diff --git a/.gitattributes b/.gitattributes index dfe0770424..ac1e451d56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,7 @@ # Auto detect text files and perform LF normalization * text=auto + +# Checkout NPM package files with forced LF lineendings +# to prevent git conflicts when running npm commands +package.json text eol=lf +package-lock.json text eol=lf diff --git a/notNeededPackages.json b/notNeededPackages.json index 8c587f7c43..5c649d2368 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -174,7 +174,7 @@ "sourceRepoURL": "https://github.com/MikeMcl/bignumber.js/", "asOfVersion": "5.0.0" }, - { + { "libraryName": "bingmaps", "typingsPackageName": "bingmaps", "sourceRepoURL": "https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions", @@ -234,6 +234,12 @@ "sourceRepoURL": "https://github.com/saltyrtc/chunked-dc-js", "asOfVersion": "0.2.2" }, + { + "libraryName": "colors.js (colors)", + "typingsPackageName": "colors", + "sourceRepoURL": "https://github.com/Marak/colors.js", + "asOfVersion": "1.2.1" + }, { "libraryName": "commander", "typingsPackageName": "commander", diff --git a/types/adone/adone.d.ts b/types/adone/adone.d.ts index 91ebc4db7c..d4e8b67b7b 100644 --- a/types/adone/adone.d.ts +++ b/types/adone/adone.d.ts @@ -1,4 +1,6 @@ /// +/// +/// declare namespace adone { const _null: symbol; @@ -104,4 +106,8 @@ declare namespace adone { export const expect: assertion.I.ExpectFunction; export const std: typeof nodestd; + + export const lodash: _.LoDashStatic; + + export const benchmark: typeof tbenchmark; } diff --git a/types/adone/benchmark.d.ts b/types/adone/benchmark.d.ts new file mode 100644 index 0000000000..042e1ae62c --- /dev/null +++ b/types/adone/benchmark.d.ts @@ -0,0 +1,5 @@ +import Benchmark = require("benchmark"); + +export { Benchmark }; + +export as namespace tbenchmark; diff --git a/types/adone/glosses/fs.d.ts b/types/adone/glosses/fs.d.ts index 7517764faf..2afc6ec8f7 100644 --- a/types/adone/glosses/fs.d.ts +++ b/types/adone/glosses/fs.d.ts @@ -1158,37 +1158,35 @@ declare namespace adone { */ function watch(paths: string | string[], options?: I.Watcher.ConstructorOptions): Watcher; - namespace is { - /** - * Returns true if the given path refers to a file - */ - function file(path: string): Promise; + /** + * Returns true if the given path refers to a file + */ + function isFile(path: string): Promise; - /** - * Returns true if the given path refers to a file - */ - function fileSync(path: string): boolean; + /** + * Returns true if the given path refers to a file + */ + function isFileSync(path: string): boolean; - /** - * Returns true if the given path refers to a direcotry - */ - function directory(path: string): Promise; + /** + * Returns true if the given path refers to a direcotry + */ + function isDirectory(path: string): Promise; - /** - * Returns true if the given path refers to a direcotry - */ - function directorySync(path: string): boolean; + /** + * Returns true if the given path refers to a direcotry + */ + function isDirectorySync(path: string): boolean; - /** - * Returns true if the given path refers to an executable file - */ - function executable(path: string): Promise; + /** + * Returns true if the given path refers to an executable file + */ + function isExecutable(path: string): Promise; - /** - * Returns true if the given path refers to an executable file - */ - function executableSync(path: string): boolean; - } + /** + * Returns true if the given path refers to an executable file + */ + function isExecutableSync(path: string): boolean; namespace I.Which { interface Options { @@ -1920,5 +1918,19 @@ declare namespace adone { * Creates a new TailWatcher instance with the given arguments */ function watchTail(filename: string, options?: I.TailWatcher.ConstructorOptions): TailWatcher; + + namespace I { + interface WriteFileAtomicOptions { + chown?: { + gid?: number; + uid?: number; + }; + encoding?: string | null; + fsync?: boolean; + mode?: number; + } + } + + function writeFileAtomic(filename: string, data: Buffer | string | Uint8Array, options?: I.WriteFileAtomicOptions): Promise; } } diff --git a/types/adone/glosses/is.d.ts b/types/adone/glosses/is.d.ts index 20d898ca7b..d112d3f109 100644 --- a/types/adone/glosses/is.d.ts +++ b/types/adone/glosses/is.d.ts @@ -676,5 +676,9 @@ declare namespace adone { export function emitter(obj: any): obj is event.Emitter; export function asyncEmitter(obj: any): obj is event.AsyncEmitter; + + export const openbsd: boolean; + + export const aix: boolean; } } diff --git a/types/adone/test/glosses/fs.ts b/types/adone/test/glosses/fs.ts index e7c5333624..86236038a0 100644 --- a/types/adone/test/glosses/fs.ts +++ b/types/adone/test/glosses/fs.ts @@ -602,13 +602,12 @@ namespace fsTests { } namespace isTests { - const { is } = fs; - is.file("hello").then((x: boolean) => {}); - { const a: boolean = is.fileSync("hello"); } - is.directory("hello").then((x: boolean) => {}); - { const a: boolean = is.directorySync("hello"); } - is.executable("hello").then((x: boolean) => {}); - { const a: boolean = is.executableSync("hello"); } + fs.isFile("hello").then((x: boolean) => {}); + { const a: boolean = fs.isFileSync("hello"); } + fs.isDirectory("hello").then((x: boolean) => {}); + { const a: boolean = fs.isDirectorySync("hello"); } + fs.isExecutable("hello").then((x: boolean) => {}); + { const a: boolean = fs.isExecutableSync("hello"); } } namespace whichTests { @@ -944,4 +943,17 @@ namespace fsTests { fs.watchTail("file", { separator: /\n/ }); fs.watchTail("file", { useWatchFile: true }); } + + namespace writeFileAtomicTests { + fs.writeFileAtomic("a", "b").then(() => {}); + fs.writeFileAtomic("a", Buffer.from("b")).then(() => {}); + fs.writeFileAtomic("a", new Uint8Array(10)).then(() => {}); + fs.writeFileAtomic("a", "a", {}).then(() => {}); + fs.writeFileAtomic("a", "a", { chown: {} }).then(() => {}); + fs.writeFileAtomic("a", "a", { chown: { gid: 0 } }).then(() => {}); + fs.writeFileAtomic("a", "a", { chown: { uid: 0 } }).then(() => {}); + fs.writeFileAtomic("a", "a", { encoding: "utf8" }).then(() => {}); + fs.writeFileAtomic("a", "a", { fsync: false }).then(() => {}); + fs.writeFileAtomic("a", "a", { mode: 0o666 }).then(() => {}); + } } diff --git a/types/adone/test/glosses/is.ts b/types/adone/test/glosses/is.ts index 045818f0ec..455dd745da 100644 --- a/types/adone/test/glosses/is.ts +++ b/types/adone/test/glosses/is.ts @@ -336,6 +336,8 @@ namespace isTests { { const a: boolean = is.freebsd; } { const a: boolean = is.darwin; } { const a: boolean = is.sunos; } + { const a: boolean = is.openbsd; } + { const a: boolean = is.aix; } { const a: boolean = is.uppercase("abc"); } { const a: boolean = is.lowercase("abc"); } { const a: boolean = is.digits("012"); } diff --git a/types/adone/test/index.ts b/types/adone/test/index.ts index ac012b9535..aec454539b 100644 --- a/types/adone/test/index.ts +++ b/types/adone/test/index.ts @@ -54,4 +54,15 @@ namespace AdoneRootTests { obj = adone.package; { const a: typeof adone.assertion.assert = adone.assert; } { const a: typeof adone.assertion.expect = adone.expect; } + + namespace lodashTests { + adone.lodash.get({}, "a"); + adone.lodash.defaults({}, {}); + adone.lodash.zip([]); + } + + namespace benchmarkTests { + const b = new adone.benchmark.Benchmark.Suite(); + b.add(() => {}).add("", () => {}).run(); + } } diff --git a/types/adone/tsconfig.json b/types/adone/tsconfig.json index 6e6b3fe1c3..6a1af264a3 100644 --- a/types/adone/tsconfig.json +++ b/types/adone/tsconfig.json @@ -22,6 +22,7 @@ "files": [ "adone-tests.ts", "adone.d.ts", + "benchmark.d.ts", "glosses/archives.d.ts", "glosses/assertion.d.ts", "glosses/collections/array_set.d.ts", diff --git a/types/archiver/archiver-tests.ts b/types/archiver/archiver-tests.ts index 752d9cc944..dbb1df1de7 100644 --- a/types/archiver/archiver-tests.ts +++ b/types/archiver/archiver-tests.ts @@ -64,6 +64,6 @@ archiver.setModule(() => {}); archiver.pointer(); archiver.use(() => {}); -archiver.finalize().then(); +archiver.finalize(); archiver.symlink('./path', './target'); diff --git a/types/archiver/index.d.ts b/types/archiver/index.d.ts index df15f9ff65..d33e8ec6dd 100644 --- a/types/archiver/index.d.ts +++ b/types/archiver/index.d.ts @@ -35,7 +35,7 @@ declare namespace archiver { directory(dirpath: string, destpath: false | string, data?: EntryData | EntryDataFunction): this; file(filename: string, data: EntryData): this; glob(pattern: string, options?: glob.IOptions, data?: EntryData): this; - finalize(): Promise; + finalize(): void; setFormat(format: string): this; setModule(module: Function): this; diff --git a/types/atmosphere.js/index.d.ts b/types/atmosphere.js/index.d.ts index 0c0bfa3c3a..48314cfdea 100644 --- a/types/atmosphere.js/index.d.ts +++ b/types/atmosphere.js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Atmosphere/atmosphere-javascript // Definitions by: Kai Toedter // Fedor Kirpichev +// Jorge Beltran // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Use this typings in future instead of deprecated 'atmosphere'. @@ -65,6 +66,7 @@ declare namespace Atmosphere { maxReconnectOnClose?: number; enableProtocol?: boolean; pollingInterval?: number; + webSocketUrl?: string; onError?: (response?:Response) => void; onClose?: (response?:Response) => void; diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts index 7dd99af9e6..dd3e6aa7ee 100644 --- a/types/auth0-lock/index.d.ts +++ b/types/auth0-lock/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for auth0-lock 10.16 +// Type definitions for auth0-lock 11.4 // Project: http://auth0.com // Definitions by: Brian Caruso // Dan Caddigan @@ -143,6 +143,7 @@ interface Auth0LockConstructorOptions { socialButtonStyle?: "big" | "small"; theme?: Auth0LockThemeOptions; usernameStyle?: string; + _enableImpersonation?: boolean; } interface Auth0LockFlashMessageOptions { diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index eccc96ba3e..5802913c37 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -90,7 +90,7 @@ export interface AttributeValue { // Context // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html export interface StreamRecord { - ApproximateCreationTime?: number; + ApproximateCreationDateTime?: number; Keys?: { [key: string]: AttributeValue }; NewImage?: { [key: string]: AttributeValue }; OldImage?: { [key: string]: AttributeValue }; diff --git a/types/azure-sb/azure-sb-tests.ts b/types/azure-sb/azure-sb-tests.ts index 411862a3b2..14d2ba9054 100644 --- a/types/azure-sb/azure-sb-tests.ts +++ b/types/azure-sb/azure-sb-tests.ts @@ -14,14 +14,14 @@ function ResponseCallback(err: Error | null, response: Azure.ServiceBus.Response const ServiceBus = AzureSB.createServiceBusService('connectionstring'); // Queues -ServiceBus.listQueues('', createResultCallback()); +ServiceBus.listQueues(createResultCallback()); ServiceBus.createQueue('test', createResultCallback()); ServiceBus.createQueueIfNotExists('test', createResultCallback()); ServiceBus.getQueue('test', createResultCallback()); ServiceBus.deleteQueue('test', ResponseCallback); // Topics -ServiceBus.listTopics('', createResultCallback()); +ServiceBus.listTopics(createResultCallback()); ServiceBus.createTopic('test', createResultCallback()); ServiceBus.createTopicIfNotExists('test', createResultCallback()); ServiceBus.getTopic('test', createResultCallback()); diff --git a/types/azure-sb/index.d.ts b/types/azure-sb/index.d.ts index ba92395c0f..9f9d07d3dc 100644 --- a/types/azure-sb/index.d.ts +++ b/types/azure-sb/index.d.ts @@ -214,15 +214,15 @@ export namespace Azure.ServiceBus { // [x: string]: string | Dictionary; // } + export const ActiveMessageCount = 'd2p1:ActiveMessageCount'; + export const DeadLetterMessageCount = 'd2p1:DeadLetterMessageCount'; + export const ScheduledMessageCount = 'd2p1:ScheduledMessageCount'; + export const TransferMessageCount = 'd2p1:TransferMessageCount'; + export const TransferDeadLetterMessageCount = 'd2p1:TransferDeadLetterMessageCount'; + export interface Topic extends ExtendedBase { AccessedAt: DateString; - CountDetails: { - 'd2p1:ActiveMessageCount': string; - 'd2p1:DeadLetterMessageCount': string; - 'd2p1:ScheduledMessageCount': string; - 'd2p1:TransferMessageCount': string; - 'd2p1:TransferDeadLetterMessageCount': string; - }; + CountDetails: { [key: string]: string }; EnableSubscriptionPartitioning: string; FilteringMessagesBeforePublishing: string; IsExpress: string; @@ -242,13 +242,7 @@ export namespace Azure.ServiceBus { } export interface Subscription extends ExtendedBase { - CountDetails: { - 'd3p1:ActiveMessageCount': string; - 'd3p1:DeadLetterMessageCount': string; - 'd3p1:ScheduledMessageCount': string; - 'd3p1:TransferMessageCount': string; - 'd3p1:TransferDeadLetterMessageCount': string; - }; + CountDetails: { [key: string]: string }; DeadLetteringOnFilterEvaluationExceptions: string; DeadLetteringOnMessageExpiration: string; LockDuration: string; @@ -315,6 +309,8 @@ export namespace Azure.ServiceBus { export type CreateSubscriptionOptions = Partial; export type ListSubscriptionsOptions = Partial; export type ListRulesOptions = Partial; + export type ListTopicsOptions = Partial; + export type ListQueuesOptions = Partial; export type CreateRuleOptions = Partial; export type CreateNotificationHubOptions = Partial; export type ListNotificationHubsOptions = Partial; diff --git a/types/azure-sb/lib/servicebusservice.d.ts b/types/azure-sb/lib/servicebusservice.d.ts index 44f2b2c522..45600a1661 100644 --- a/types/azure-sb/lib/servicebusservice.d.ts +++ b/types/azure-sb/lib/servicebusservice.d.ts @@ -11,6 +11,8 @@ import CreateTopicOptions = Azure.ServiceBus.CreateTopicOptions; import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions; import ListRulesOptions = Azure.ServiceBus.ListRulesOptions; import ListSubscriptionsOptions = Azure.ServiceBus.ListSubscriptionsOptions; +import ListTopicsOptions = Azure.ServiceBus.ListTopicsOptions; +import ListQueuesOptions = Azure.ServiceBus.ListQueuesOptions; import MessageOrName = Azure.ServiceBus.MessageOrName; import Queue = Azure.ServiceBus.Results.Models.Queue; import ReceiveQueueMessageOptions = Azure.ServiceBus.ReceiveQueueMessageOptions; @@ -88,7 +90,8 @@ declare class ServiceBusService extends ServiceBusServiceBase { public getQueue(queuePath: string, callback: TypedResultAndResponseCallback): void; - public listQueues(queuePath: string, + public listQueues(callback: TypedResultAndResponseCallback): void; + public listQueues(options: ListQueuesOptions, callback: TypedResultAndResponseCallback): void; /* @@ -115,7 +118,8 @@ declare class ServiceBusService extends ServiceBusServiceBase { public getTopic(topicPath: string, callback: TypedResultAndResponseCallback): void; - public listTopics(topicPath: string, + public listTopics(callback: TypedResultAndResponseCallback): void; + public listTopics(options: ListTopicsOptions, callback: TypedResultAndResponseCallback): void; /* diff --git a/types/azure-sb/lib/servicebusserviceclient.d.ts b/types/azure-sb/lib/servicebusserviceclient.d.ts index c97b1e3107..1730b642c3 100644 --- a/types/azure-sb/lib/servicebusserviceclient.d.ts +++ b/types/azure-sb/lib/servicebusserviceclient.d.ts @@ -1,14 +1,13 @@ -/// -import EventEmitter = NodeJS.EventEmitter; +import ServiceClient = require('azure-sb/lib/serviceclient'); -declare class ServiceBusServiceClient extends EventEmitter { +declare class ServiceBusServiceClient extends ServiceClient { constructor(accessKey?: string, issuer?: string, sharedAccessKeyName?: string, sharedAccessKeyValue?: string, host?: string, acsHost?: string, - authenticationProvider?: object); + authenticationProvider?: object); } export = ServiceBusServiceClient; diff --git a/types/azure-sb/lib/serviceclient.d.ts b/types/azure-sb/lib/serviceclient.d.ts new file mode 100644 index 0000000000..3e39052235 --- /dev/null +++ b/types/azure-sb/lib/serviceclient.d.ts @@ -0,0 +1,8 @@ +/// +import EventEmitter = NodeJS.EventEmitter; +declare class ServiceClient extends EventEmitter { + public host: string; + public port: number; + public protocol: string; +} +export = ServiceClient; diff --git a/types/azure-sb/tsconfig.json b/types/azure-sb/tsconfig.json index 6e015480dc..61e37ac754 100644 --- a/types/azure-sb/tsconfig.json +++ b/types/azure-sb/tsconfig.json @@ -30,6 +30,7 @@ "lib/models/subscriptionresult.d.ts", "lib/models/notificationhubresult.d.ts", "lib/models/resourceresult.d.ts", + "lib/serviceclient.d.ts", "lib/servicebusserviceclient.d.ts", "lib/gcmservice.d.ts", "lib/wnsservice.d.ts", @@ -38,4 +39,4 @@ "azure-sb-tests.ts", "index.d.ts" ] -} \ No newline at end of file +} diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index cd8ccd3821..7626d60d56 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Marionette 3.3 // Project: https://github.com/marionettejs/ -// Definitions by: Zeeshan Hamid , Natan Vivo , Sven Tschui +// Definitions by: Zeeshan Hamid , +// Natan Vivo , +// Sven Tschui , +// Volker Nauruhn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1394,27 +1397,27 @@ export class CollectionView, childView: TView): void; /** * This callback function allows you to know when a child / child view * instance has been added to the collection view. It provides access to * the view instance for the child that was added. */ - onAddChild(childView: TView): void; + onAddChild(collectionView: CollectionView, childView: TView): void; /** * This callback function allows you to know when a childView instance is * about to be removed from the collectionView. It provides access to the * view instance for the child that was removed. */ - onBeforeRemoveChild(childView: TView): void; + onBeforeRemoveChild(collectionView: CollectionView, childView: TView): void; /** * This callback function allows you to know when a child / childView * instance has been deleted or removed from the collection. */ - onRemoveChild(childView: TView): void; + onRemoveChild(collectionView: CollectionView, childView: TView): void; /** * Automatically destroys this Collection's children and cleans up diff --git a/types/base64-url/base64-url-tests.ts b/types/base64-url/base64-url-tests.ts new file mode 100644 index 0000000000..fd5c07cac0 --- /dev/null +++ b/types/base64-url/base64-url-tests.ts @@ -0,0 +1,9 @@ +import * as base64url from 'base64-url'; + +base64url.encode('Node.js is awesome.'); // $ExpectType string +base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg'); // $ExpectType string +base64url.escape('This+is/goingto+escape=='); // $ExpectType string +base64url.unescape('This-is_goingto-escape'); // $ExpectType string + +base64url.encode('string to encode', 'ascii'); // $ExpectType string +base64url.decode('string to decode', 'ascii'); // $ExpectType string diff --git a/types/base64-url/index.d.ts b/types/base64-url/index.d.ts new file mode 100644 index 0000000000..1065cb9115 --- /dev/null +++ b/types/base64-url/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for base64-url 2.2 +// Project: https://github.com/joaquimserafim/base64-url +// Definitions by: Uri Shaked +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function decode(value: string, encoding?: string): string; +export function encode(value: string, encoding?: string): string; +export function escape(value: string): string; +export function unescape(value: string): string; diff --git a/types/base64-url/tsconfig.json b/types/base64-url/tsconfig.json new file mode 100644 index 0000000000..26ccd93511 --- /dev/null +++ b/types/base64-url/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "base64-url-tests.ts" + ] +} diff --git a/types/colors/tslint.json b/types/base64-url/tslint.json similarity index 100% rename from types/colors/tslint.json rename to types/base64-url/tslint.json diff --git a/types/bigi/bigi-tests.ts b/types/bigi/bigi-tests.ts index ef9d7421d3..0e4822aeb6 100644 --- a/types/bigi/bigi-tests.ts +++ b/types/bigi/bigi-tests.ts @@ -7,3 +7,10 @@ const b3 = b1.multiply(b2); console.log(b3.toHex()); // => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132 + +const b4 = BigInteger.valueOf(42); +const b5 = BigInteger.valueOf(10); +const b6 = b4.multiply(b5); + +console.log(b6); +// => BigInteger { '0': 420, '1': 0, t: 1, s: 0 } diff --git a/types/bigi/index.d.ts b/types/bigi/index.d.ts index c991b13fac..7b44ff75e4 100644 --- a/types/bigi/index.d.ts +++ b/types/bigi/index.d.ts @@ -87,7 +87,7 @@ declare class bigi { static fromDERInteger(byteArray?: any): number; static fromHex(hex: string): bigi; static isBigInteger(obj: any, check_ver: any): obj is bigi; - static valueOf(i: any): number; + static valueOf(i: any): bigi; } declare namespace bigi { interface Constants { diff --git a/types/bintrees/bintrees-tests.ts b/types/bintrees/bintrees-tests.ts index fb4a22a3d8..84b75c98be 100644 --- a/types/bintrees/bintrees-tests.ts +++ b/types/bintrees/bintrees-tests.ts @@ -1,8 +1,11 @@ -/// /// import assert = require('assert'); import { BinTree, RBTree } from 'bintrees'; +// Declaring shims removes mocha dependency. These tests are never executed, only typechecked, so this is fine. +declare function describe(description: string, callback: () => void): void; +declare function it(description: string, callback: () => void): void; + describe('bintrees', () => { it('builds a simple tree', () => { let treeA = new RBTree((a: number, b: number) => a - b); diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 11d311a276..920df43d6e 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -71,6 +71,10 @@ export class ECPair { d: BigInteger; + readonly compressed: boolean; + + readonly network: Network; + getAddress(): string; getNetwork(): Network; diff --git a/types/bytebuffer/index.d.ts b/types/bytebuffer/index.d.ts index 0ed98f54c6..285948dc24 100644 --- a/types/bytebuffer/index.d.ts +++ b/types/bytebuffer/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions by: SINTEF-9012 +/// import Long = require("long"); declare namespace ByteBuffer {} @@ -70,7 +71,7 @@ declare class ByteBuffer /** * Backing buffer. */ - buffer: ArrayBuffer; + buffer: Buffer; /** * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation. @@ -135,12 +136,12 @@ declare class ByteBuffer /** * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer. */ - static calculateVariant32( value: number ): number; + static calculateVarint32( value: number ): number; /** * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer. */ - static calculateVariant64( value: number | Long ): number; + static calculateVarint64( value: number | Long ): number; /** * Concatenates multiple ByteBuffers into one. @@ -340,7 +341,7 @@ declare class ByteBuffer /** * Reads a length as uint32 prefixed UTF8 encoded string. */ - readIString( offset?: number ): string; + readIString( offset?: number ): string | { string: string; length: number }; /** * Reads a 32bit signed integer.This is an alias of ByteBuffer#readInt32. @@ -385,7 +386,7 @@ declare class ByteBuffer /** * Reads an UTF8 encoded string. */ - readUTF8String( chars: number, offset?: number ): string; + readUTF8String( chars: number, metrics?: number, offset?: number ): string | { string: string; length: number }; /** * Reads a 16bit unsigned integer. diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index 28f301237c..a1dfaaf8f0 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for C3js 0.4 +// Type definitions for C3js 0.5 // Project: http://c3js.org/ // Definitions by: Marc Climent // Gerin Jacob // Bernd Hacker // Dzmitry Shyndzin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 import * as d3 from "d3"; @@ -28,7 +28,7 @@ export interface ChartConfiguration { * Note: When chart is not binded, c3 starts observing if chart.element is binded by MutationObserver. In this case, polyfill is required in IE9 and IE10 becuase they do not support * MutationObserver. On the other hand, if chart always will be binded, polyfill will not be required because MutationObserver will never be called. */ - bindto?: string | HTMLElement | d3.Selection | null; + bindto?: string | HTMLElement | d3.Selection | null; size?: { /** * The desired width of the chart element. @@ -172,16 +172,18 @@ export interface ChartConfiguration { /** * Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio. */ - width?: number | { - /** - * Set the width of each bar by ratio - */ - ratio: number, - /** - * Set max width of each bar - */ - max?: number - }; + width?: + | number + | { + /** + * Set the width of each bar by ratio + */ + ratio: number; + /** + * Set max width of each bar + */ + max?: number; + }; /** * Set if min or max value will be 0 on bar chart. */ @@ -205,7 +207,7 @@ export interface ChartConfiguration { /** * Set threshold to show/hide labels. */ - threshold?: number + threshold?: number; }; /** * Enable or disable expanding pie pieces. @@ -226,7 +228,7 @@ export interface ChartConfiguration { /** * Set threshold to show/hide labels. */ - threshold?: number + threshold?: number; }; /** * Enable or disable expanding pie pieces. @@ -280,7 +282,17 @@ export interface ChartConfiguration { /** * Set custom spline interpolation */ - type?: 'linear' | 'linear-closed' | 'basis' | 'basis-open' | 'basis-closed' | 'bundle' | 'cardinal' | 'cardinal-open' | 'cardinal-closed' | 'monotone'; + type?: + | "linear" + | "linear-closed" + | "basis" + | "basis-open" + | "basis-closed" + | "bundle" + | "cardinal" + | "cardinal-open" + | "cardinal-closed" + | "monotone"; }; }; } @@ -309,7 +321,7 @@ export interface Data { /** * Choose which JSON object keys correspond to desired data. */ - keys?: { x?: string; value: string[]; }; + keys?: { x?: string; value: string[] }; /** * Specify the key of x values in the data. * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data @@ -365,9 +377,7 @@ export interface Data { * - j is the sub index of the data point where the label is shown. * Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (e.g. d3.format('$')) */ - labels?: boolean | - { format: FormatFunction } | - { format: { [key: string]: FormatFunction } }; + labels?: boolean | { format: FormatFunction } | { format: { [key: string]: FormatFunction } }; /** * Define the order of the data. * This option changes the order of stacking the data and pieces of pie/donut. If null specified, it will be the order the data loaded. If function specified, it will be used to sort the data @@ -387,11 +397,11 @@ export interface Data { * This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that * represents color (e.g. '#00ff00'). */ - color?(color: string, d: any): string | d3.Rgb; + color?(color: string, d: any): string | d3.RGBColor; /** * Set color for each data. */ - colors?: { [key: string]: string | d3.Rgb | ((d: any) => string | d3.Rgb) }; + colors?: { [key: string]: string | d3.RGBColor | ((d: any) => string | d3.RGBColor) }; /** * Hide each data when the chart appears. * If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden. @@ -813,7 +823,7 @@ export interface PointOptions { /** * The radius size of each point on focus. */ - r?: number + r?: number; }; }; @@ -877,7 +887,7 @@ export interface ChartAPI { load(args: { url?: string; json?: {}; - keys?: { x?: string; value: string[]; } + keys?: { x?: string; value: string[] }; rows?: PrimitiveArray[]; columns?: PrimitiveArray[]; xs?: { [key: string]: string }; @@ -885,7 +895,7 @@ export interface ChartAPI { classes?: { [key: string]: string }; categories?: string[]; axes?: { [key: string]: string }; - colors?: { [key: string]: string | d3.Rgb }; + colors?: { [key: string]: string | d3.RGBColor }; type?: string; types?: { [key: string]: string }; unload?: boolean | ArrayOrString; @@ -911,7 +921,7 @@ export interface ChartAPI { */ flow(args: { json?: {}; - keys?: { x?: string; value: string[]; } + keys?: { x?: string; value: string[] }; rows?: PrimitiveArray[]; columns?: PrimitiveArray[]; to?: any; @@ -997,7 +1007,7 @@ export interface ChartAPI { * Get and set colors of the data loaded in the chart. * @param colors If this argument is given, the colors of data will be updated. If not given, the current colors will be returned. The format of this argument is the same as data.colors. */ - colors(colors?: { [key: string]: string | d3.Rgb }): { [key: string]: string }; + colors(colors?: { [key: string]: string | d3.RGBColor }): { [key: string]: string }; /** * Get and set axes of the data loaded in the chart. * @param axes If this argument is given, the axes of data will be updated. If not given, the current axes will be returned. The format of this argument is the same as data.axes. @@ -1040,22 +1050,25 @@ export interface ChartAPI { * Get and set axis labels. * @param labels If labels is given, specified axis' label will be updated. */ - labels(labels?: { [key: string]: string }): { [key: string]: string } + labels(labels?: { [key: string]: string }): { [key: string]: string }; /** * Get and set axis min value. * @param min If min is given, specified axis' min value will be updated. If no argument is given, the current min values for each axis will be returned. */ - min(min?: number | { [key: string]: number }): number | { [key: string]: number } + min(min?: number | { [key: string]: number }): number | { [key: string]: number }; /** * Get and set axis max value. * @param max If max is given, specified axis' max value will be updated. If no argument is given, the current max values for each axis will be returned. */ - max(max?: number | { [key: string]: number }): number | { [key: string]: number } + max(max?: number | { [key: string]: number }): number | { [key: string]: number }; /** * Get and set axis min and max value. * @param range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned. */ - range(range?: { min?: number | { [key: string]: number }; max?: number | { [key: string]: number } }): { min: number | { [key: string]: number }; max: number | { [key: string]: number } } + range(range?: { + min?: number | { [key: string]: number }; + max?: number | { [key: string]: number }; + }): { min: number | { [key: string]: number }; max: number | { [key: string]: number } }; }; legend: { diff --git a/types/c3/tsconfig.json b/types/c3/tsconfig.json index fe3b00c503..aa923e91c0 100644 --- a/types/c3/tsconfig.json +++ b/types/c3/tsconfig.json @@ -1,29 +1,20 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6", - "dom" - ], + "lib": ["es6", "dom"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": false, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "paths": { - "d3": [ - "d3/v3" - ] + "d3-scale": ["d3-scale/v1"], + "d3": ["d3/v4"] }, "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "c3-tests.ts" - ] -} \ No newline at end of file + "files": ["index.d.ts", "c3-tests.ts"] +} diff --git a/types/chai-jest-snapshot/index.d.ts b/types/chai-jest-snapshot/index.d.ts index 862da8cd16..470e4fa423 100644 --- a/types/chai-jest-snapshot/index.d.ts +++ b/types/chai-jest-snapshot/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/suchipi/chai-jest-snapshot#readme // Definitions by: Matt Perry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/types/chai-spies/chai-spies-tests.ts b/types/chai-spies/chai-spies-tests.ts index 326b1e0137..1d99f0add2 100644 --- a/types/chai-spies/chai-spies-tests.ts +++ b/types/chai-spies/chai-spies-tests.ts @@ -1,6 +1,5 @@ import * as chai from 'chai'; import * as spies from 'chai-spies'; -import * as Mocha from 'mocha'; function original(): void { // do something cool diff --git a/types/chai-string/chai-string-tests.ts b/types/chai-string/chai-string-tests.ts index dc798c102a..9cd9a2e024 100644 --- a/types/chai-string/chai-string-tests.ts +++ b/types/chai-string/chai-string-tests.ts @@ -1,6 +1,4 @@ -/// - var should = chai.should(); var assert = chai.assert; var expect = chai.expect; @@ -8,6 +6,11 @@ var expect = chai.expect; import chai_string = require("chai-string"); chai.use(chai_string); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('chai-string', function() { describe('#startsWith', function() { diff --git a/types/chrome/chrome-app.d.ts b/types/chrome/chrome-app.d.ts index 4ecf1d344a..65d80f3290 100644 --- a/types/chrome/chrome-app.d.ts +++ b/types/chrome/chrome-app.d.ts @@ -1189,7 +1189,7 @@ declare namespace chrome.system.display { * @param {string} id The display's unique identifier. * @param {(success) => void} callback Optional callback to inform the caller that the touch calibration has ended. The argument of the callback informs if the calibration was a success or not. */ - export function showNativeTouchCalibration(id: string, callback: (success) => void): void; + export function showNativeTouchCalibration(id: string, callback: (success: boolean) => void): void; /** * @description Starts custom touch calibration for a display. This should be called when using a custom UX for collecting calibration data. If another touch calibration is already in progress this will throw an error. diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index d12bf94302..8c953aaca1 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -1678,6 +1678,17 @@ declare namespace chrome.devtools.inspectedWindow { * Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression. */ export function eval(expression: string, callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void): void; + /** + * Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object. + * @param expression An expression to evaluate. + * @param options The options parameter can contain one or more options. + * @param callback A function called when evaluation completes. + * If you specify the callback parameter, it should be a function that looks like this: + * function(object result, object exceptionInfo) {...}; + * Parameter result: The result of evaluation. + * Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression. + */ + export function eval(expression: string, options: EvalOptions, callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void): void; /** * Retrieves the list of resources from the inspected page. * @param callback A function that receives the list of resources when the request completes. @@ -1690,6 +1701,15 @@ declare namespace chrome.devtools.inspectedWindow { export var onResourceAdded: ResourceAddedEvent; /** Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools). */ export var onResourceContentCommitted: ResourceContentCommittedEvent; + + export interface EvalOptions { + /** If specified, the expression is evaluated on the iframe whose URL matches the one specified. By default, the expression is evaluated in the top frame of the inspected page. */ + frameURL?: string; + /** Evaluate the expression in the context of the content script of the calling extension, provided that the content script is already injected into the inspected page. If not, the expression is not evaluated and the callback is invoked with the exception parameter set to an object that has the isError field set to true and the code field set to E_NOTFOUND. */ + useContentScriptContext?: boolean; + /** Evaluate the expression in the context of a content script of an extension that matches the specified origin. If given, contextSecurityOrigin overrides the 'true' setting on userContentScriptContext. */ + contextSecurityOrigin?: string; + } } //////////////////// diff --git a/types/cleave.js/options/creditCard.d.ts b/types/cleave.js/options/creditCard.d.ts new file mode 100644 index 0000000000..b7f55ff5b0 --- /dev/null +++ b/types/cleave.js/options/creditCard.d.ts @@ -0,0 +1,19 @@ +import Cleave = require("../"); + +// Credit Card Options +export type CreditCardType = + | "amex" + | "dankort" + | "diners" + | "discover" + | "instapayment" + | "jcb" + | "maestro" + | "mastercard" + | "uatp" + | "unknown" + | "unionPay" + | "mir" + | "visa"; + +export type CreditCardTypeChangeHandler = (this: Cleave, type: CreditCardType) => void; diff --git a/types/cleave.js/options.d.ts b/types/cleave.js/options/index.d.ts similarity index 76% rename from types/cleave.js/options.d.ts rename to types/cleave.js/options/index.d.ts index 81757fe097..60e2e99e40 100644 --- a/types/cleave.js/options.d.ts +++ b/types/cleave.js/options/index.d.ts @@ -1,19 +1,4 @@ -// Credit Card Options -export type CreditCardType = - | "amex" - | "dankort" - | "diners" - | "discover" - | "instapayment" - | "jcb" - | "maestro" - | "mastercard" - | "uatp" - | "unknown" - | "unionPay" - | "mir" - | "visa"; -export type CreditCardTypeChangeHandler = (owner: HTMLInputElement, type: CreditCardType) => void; +import { CreditCardTypeChangeHandler } from "./creditCard"; export interface CleaveOptions { creditCard?: boolean; diff --git a/types/cleave.js/tsconfig.json b/types/cleave.js/tsconfig.json index c2d5447360..ec4da5d047 100644 --- a/types/cleave.js/tsconfig.json +++ b/types/cleave.js/tsconfig.json @@ -21,7 +21,8 @@ "files": [ "cleave.js-tests.tsx", "index.d.ts", - "options.d.ts", + "options/creditCard.d.ts", + "options/index.d.ts", "react/index.d.ts" ] } \ No newline at end of file diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index ef075b9d45..06c3b39f96 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -669,7 +669,7 @@ declare namespace CodeMirror { /** Returns a {from, to} object (both holding document positions), indicating the current position of the marked range, or undefined if the marker is no longer in the document. */ - find(): CodeMirror.Range; + find(): {from: CodeMirror.Position, to: CodeMirror.Position}; /** Returns an object representing the options for the marker. If copyWidget is given true, it will clone the value of the replacedWith option, if any. */ getOptions(copyWidget: boolean): CodeMirror.TextMarkerOptions; diff --git a/types/colors/colors-tests.ts b/types/colors/colors-tests.ts deleted file mode 100644 index fcac0323f6..0000000000 --- a/types/colors/colors-tests.ts +++ /dev/null @@ -1,21 +0,0 @@ -import colors = require("colors"); -import { zalgo } from "colors/safe"; - -let str: string; - -str = zalgo(""); - -colors.enabled = true; - -str = colors.black.underline('test'); -str = colors.rainbow.black.blue.gray('test'); -str = colors.random.reset.bgWhite.dim('test'); -str = colors.random.reset.bgWhite.strip('test'); -str = 'test'.black.underline; -str = 'test'.rainbow.black.blue.gray; -str = 'test'.random.reset.bgWhite.dim; -str = 'test'.random.reset.bgWhite.dim.stripColors; - -colors.enabled = false; - -str = colors.black.underline('test'); diff --git a/types/colors/index.d.ts b/types/colors/index.d.ts deleted file mode 100644 index a5494aa945..0000000000 --- a/types/colors/index.d.ts +++ /dev/null @@ -1,133 +0,0 @@ -// Type definitions for Colors.js 1.1 -// Project: https://github.com/Marak/colors.js -// Definitions by: Bart van der Schoor , Staffan Eketorp -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export interface Color { - (text: string): string; - - strip: Color; - stripColors: Color; - - black: Color; - red: Color; - green: Color; - yellow: Color; - blue: Color; - magenta: Color; - cyan: Color; - white: Color; - gray: Color; - grey: Color; - - bgBlack: Color; - bgRed: Color; - bgGreen: Color; - bgYellow: Color; - bgBlue: Color; - bgMagenta: Color; - bgCyan: Color; - bgWhite: Color; - - reset: Color; - bold: Color; - dim: Color; - italic: Color; - underline: Color; - inverse: Color; - hidden: Color; - strikethrough: Color; - - rainbow: Color; - zebra: Color; - america: Color; - trap: Color; - random: Color; - zalgo: Color; -} - -export function setTheme(theme: any): void; - -export let enabled: boolean; - -export const strip: Color; -export const stripColors: Color; - -export const black: Color; -export const red: Color; -export const green: Color; -export const yellow: Color; -export const blue: Color; -export const magenta: Color; -export const cyan: Color; -export const white: Color; -export const gray: Color; -export const grey: Color; - -export const bgBlack: Color; -export const bgRed: Color; -export const bgGreen: Color; -export const bgYellow: Color; -export const bgBlue: Color; -export const bgMagenta: Color; -export const bgCyan: Color; -export const bgWhite: Color; - -export const reset: Color; -export const bold: Color; -export const dim: Color; -export const italic: Color; -export const underline: Color; -export const inverse: Color; -export const hidden: Color; -export const strikethrough: Color; - -export const rainbow: Color; -export const zebra: Color; -export const america: Color; -export const trap: Color; -export const random: Color; -export const zalgo: Color; - -declare global { - interface String { - strip: string; - stripColors: string; - - black: string; - red: string; - green: string; - yellow: string; - blue: string; - magenta: string; - cyan: string; - white: string; - gray: string; - grey: string; - - bgBlack: string; - bgRed: string; - bgGreen: string; - bgYellow: string; - bgBlue: string; - bgMagenta: string; - bgCyan: string; - bgWhite: string; - - reset: string; - bold: string; - dim: string; - italic: string; - underline: string; - inverse: string; - hidden: string; - strikethrough: string; - - rainbow: string; - zebra: string; - america: string; - trap: string; - random: string; - zalgo: string; - } -} diff --git a/types/colors/safe.d.ts b/types/colors/safe.d.ts deleted file mode 100644 index 306b656b2b..0000000000 --- a/types/colors/safe.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export const enabled: boolean; - -export function strip(str: string): string; -export function stripColors(str: string): string; - -export function black(str: string): string; -export function red(str: string): string; -export function green(str: string): string; -export function yellow(str: string): string; -export function blue(str: string): string; -export function magenta(str: string): string; -export function cyan(str: string): string; -export function white(str: string): string; -export function gray(str: string): string; -export function grey(str: string): string; - -export function bgBlack(str: string): string; -export function bgRed(str: string): string; -export function bgGreen(str: string): string; -export function bgYellow(str: string): string; -export function bgBlue(str: string): string; -export function bgMagenta(str: string): string; -export function bgCyan(str: string): string; -export function bgWhite(str: string): string; - -export function reset(str: string): string; -export function bold(str: string): string; -export function dim(str: string): string; -export function italic(str: string): string; -export function underline(str: string): string; -export function inverse(str: string): string; -export function hidden(str: string): string; -export function strikethrough(str: string): string; - -export function rainbow(str: string): string; -export function zebra(str: string): string; -export function america(str: string): string; -export function trap(str: string): string; -export function random(str: string): string; -export function zalgo(str: string): string; diff --git a/types/cosmiconfig/cosmiconfig-tests.ts b/types/cosmiconfig/cosmiconfig-tests.ts new file mode 100644 index 0000000000..2676c58407 --- /dev/null +++ b/types/cosmiconfig/cosmiconfig-tests.ts @@ -0,0 +1,41 @@ +import cosmiconfig = require("cosmiconfig"); + +const asyncExplorer = cosmiconfig("yourModuleName", { + packageProp: "yourModuleName", + rc: ".yourModuleNamerc", + js: "yourModuleName.config.js", + rcStrictJson: false, + rcExtensions: false, + stopDir: "someDir", + cache: true, + sync: false, + transform: ({ config, filePath }) => ({ config, filePath }), + format: "js" +}); + +Promise.all([ + asyncExplorer.load(), + asyncExplorer.load("start/search/here"), + asyncExplorer.load(null, "load/this/file.json") +]).then(result => result); + +asyncExplorer.load().then(({ config, filePath }) => ({ config, filePath })); + +asyncExplorer.clearFileCache(); +asyncExplorer.clearDirectoryCache(); +asyncExplorer.clearCaches(); + +const syncExplorer = cosmiconfig("yourModuleName", { + packageProp: "yourModuleName", + rc: ".yourModuleNamerc", + js: "yourModuleName.config.js", + rcStrictJson: false, + rcExtensions: false, + stopDir: "someDir", + cache: true, + sync: true, + transform: ({ config, filePath }) => ({ config, filePath }), + format: "js" +}); + +const { config, filePath } = syncExplorer.load(); diff --git a/types/cosmiconfig/index.d.ts b/types/cosmiconfig/index.d.ts new file mode 100644 index 0000000000..032f570d6f --- /dev/null +++ b/types/cosmiconfig/index.d.ts @@ -0,0 +1,63 @@ +// Type definitions for cosmiconfig 4.0 +// Project: https://github.com/davidtheclark/cosmiconfig +// Definitions by: ozum +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +interface Result { + config: object; + filePath: string; +} + +interface Options { + packageProp?: string | false; + rc?: string | false; + js?: string | false; + rcStrictJson?: boolean; + rcExtensions?: boolean; + stopDir?: string; + cache?: boolean; + transform?: (result: Result) => Promise | Result; + configPath?: string; + format?: "json" | "yaml" | "js"; +} + +// Default is false and makes load() method async +interface AsyncOptions extends Options { + sync?: false; +} + +// Makes load() method sync +interface SyncOptions extends Options { + sync: true; +} + +interface Explorer { + clearFileCache(): void; + clearDirectoryCache(): void; + clearCaches(): void; +} + +interface AsyncExplorer extends Explorer { + // You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added. + load(searchPath?: string): Promise; + load(searchPath: null | undefined, configPath?: string): Promise; +} + +interface SyncExplorer extends Explorer { + // You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added. + load(searchPath?: string): Result; + load(searchPath: null | undefined, configPath?: string): Result; +} + +declare function cosmiconfig( + moduleName: string, + options: SyncOptions +): SyncExplorer; + +declare function cosmiconfig( + moduleName: string, + options?: AsyncOptions +): AsyncExplorer; + +export = cosmiconfig; diff --git a/types/cosmiconfig/tsconfig.json b/types/cosmiconfig/tsconfig.json new file mode 100644 index 0000000000..6f0f0ac3a2 --- /dev/null +++ b/types/cosmiconfig/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "cosmiconfig-tests.ts"] +} diff --git a/types/cosmiconfig/tslint.json b/types/cosmiconfig/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cosmiconfig/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/create-error/create-error-tests.ts b/types/create-error/create-error-tests.ts index 7a635b8dc6..ed2d9533e3 100644 --- a/types/create-error/create-error-tests.ts +++ b/types/create-error/create-error-tests.ts @@ -1,8 +1,12 @@ -/// declare function equal(a: T, b: T): void; declare function deepEqual(a: T, b: T): void; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + import * as createError from 'create-error'; // Example taken from https://github.com/tgriesser/create-error/blob/0.3.1/README.md#use diff --git a/types/d3-geo/d3-geo-tests.ts b/types/d3-geo/d3-geo-tests.ts index c4508351a0..5124694378 100644 --- a/types/d3-geo/d3-geo-tests.ts +++ b/types/d3-geo/d3-geo-tests.ts @@ -395,6 +395,9 @@ constructedProjection = constructedProjection.translate([480, 250]); const center: [number, number] = constructedProjection.center(); constructedProjection = constructedProjection.center([0, 0]); +const angle = constructedProjection.angle(); +constructedProjection = constructedProjection.angle(45); + const rotate: [number, number, number] = constructedProjection.rotate(); constructedProjection = constructedProjection.rotate([0, 0]); constructedProjection = constructedProjection.rotate([0, 0, 0]); diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 7efbb72010..d9f0931269 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -1,10 +1,10 @@ -// Type definitions for D3JS d3-geo module 1.9 +// Type definitions for D3JS d3-geo module 1.10 // Project: https://github.com/d3/d3-geo/ // Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -// Last module patch version validated against: 1.9.0 +// Last module patch version validated against: 1.10.0 import * as GeoJSON from 'geojson'; @@ -887,7 +887,15 @@ export interface GeoProjection extends GeoStreamWrapper { * @param precision A numeric value in pixels to use as the threshold for the projection’s adaptive resampling. */ precision(precision: number): this; - + /** + * Returns the projection’s current angle, which defaults to 0°. + */ + angle(): number; + /** + * Sets the projection’s post-projection planar rotation angle to the specified angle in degrees and returns the projection. + * @param angle The new rotation angle of the projection. + */ + angle(angle: number): this; /** * Returns the current rotation [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. * (These correspond to yaw, pitch and roll.) which defaults [0, 0, 0]. diff --git a/types/d3kit/v1/d3kit-tests.ts b/types/d3kit/v1/d3kit-tests.ts index 9ffb7ca2ba..18f1f144f9 100644 --- a/types/d3kit/v1/d3kit-tests.ts +++ b/types/d3kit/v1/d3kit-tests.ts @@ -1,6 +1,10 @@ -/// /// +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + var expect = chai.expect; describe('Skeleton', function(){ var element: Element, $element: d3.Selection, $svg: d3.Selection, skeleton: d3kit.Skeleton; diff --git a/types/decompress/index.d.ts b/types/decompress/index.d.ts index c2211b3434..a493f81a0d 100644 --- a/types/decompress/index.d.ts +++ b/types/decompress/index.d.ts @@ -7,33 +7,35 @@ export = decompress; -declare function decompress(input: string | Buffer, output: string, opts?: Options): Promise; +declare function decompress(input: string | Buffer, output: string, opts?: decompress.DecompressOptions): Promise; -interface File { - data: Buffer; - mode: number; - mtime: string; - path: string; - type: string; -} +declare namespace decompress { + interface File { + data: Buffer; + mode: number; + mtime: string; + path: string; + type: string; + } -interface Options { - /** - * Filter out files before extracting - */ - filter?(file: File): boolean; - /** - * Map files before extracting - */ - map?(file: File): File; - /** - * Array of plugins to use. - * Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()] - */ - plugins?: any[]; - /** - * Remove leading directory components from extracted files. - * Default: 0 - */ - strip?: number; + interface DecompressOptions { + /** + * Filter out files before extracting + */ + filter?(file: File): boolean; + /** + * Map files before extracting + */ + map?(file: File): File; + /** + * Array of plugins to use. + * Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()] + */ + plugins?: any[]; + /** + * Remove leading directory components from extracted files. + * Default: 0 + */ + strip?: number; + } } diff --git a/types/del/del-tests.ts b/types/del/del-tests.ts index fc6c63b6fa..f9d01f644f 100644 --- a/types/del/del-tests.ts +++ b/types/del/del-tests.ts @@ -1,39 +1,47 @@ -import del = require("del"); +import del = require('del'); -let paths = ["build", "dist/**/*.js"]; +let paths = ['build', 'dist/**/*.js']; -del(["tmp/*.js", "!tmp/unicorn.js"]); -del(["tmp/*.js", "!tmp/unicorn.js"], {force: true}); -del(["tmp/*.js", "!tmp/unicorn.js"], {dryRun: true}); -del(["tmp/*.js", "!tmp/unicorn.js"], {concurrency: 20}); -del(["tmp/*.js", "!tmp/unicorn.js"], {cwd: ''}); +del(['tmp/*.js', '!tmp/unicorn.js']); +del(['tmp/*.js', '!tmp/unicorn.js'], { force: true }); +del(['tmp/*.js', '!tmp/unicorn.js'], { dryRun: true }); +del(['tmp/*.js', '!tmp/unicorn.js'], { concurrency: 20 }); +del(['tmp/*.js', '!tmp/unicorn.js'], { cwd: '' }); -del(["tmp/*.js", "!tmp/unicorn.js"]).then((paths: string[]) => { +del(['tmp/*.js', '!tmp/unicorn.js']).then((paths: string[]) => { console.log('Deleted files/folders:\n', paths.join('\n')); }); -del(["tmp/*.js", "!tmp/unicorn.js"], {force: true}).then((paths: string[]) => { +del(['tmp/*.js', '!tmp/unicorn.js'], { force: true }).then( + (paths: string[]) => { + console.log('Deleted files/folders:\n', paths.join('\n')); + } +); + +del('tmp/*.js'); +del('tmp/*.js', { force: true }); +del('tmp/*.js', { dryRun: true }); +del('tmp/*.js', { concurrency: 20 }); +del('tmp/*.js', { cwd: '' }); +del('tmp/*.js').then((paths: string[]) => { console.log('Deleted files/folders:\n', paths.join('\n')); }); -del("tmp/*.js"); -del("tmp/*.js", {force: true}); -del("tmp/*.js", {dryRun: true}); -del("tmp/*.js", {concurrency: 20}); -del("tmp/*.js", {cwd: ''}); -del("tmp/*.js").then((paths: string[]) => { +del('tmp/*.js', { force: true }).then((paths: string[]) => { console.log('Deleted files/folders:\n', paths.join('\n')); }); -del("tmp/*.js", {force: true}).then((paths: string[]) => { - console.log('Deleted files/folders:\n', paths.join('\n')); -}); +paths = del.sync(['tmp/*.js', '!tmp/unicorn.js']); +paths = del.sync(['tmp/*.js', '!tmp/unicorn.js'], { force: true }); -paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"]); -paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"], {force: true}); +paths = del.sync('tmp/*.js'); +paths = del.sync('tmp/*.js', { force: true }); +paths = del.sync('tmp/*.js', { dryRun: true }); +paths = del.sync('tmp/*.js', { concurrency: 20 }); +paths = del.sync('tmp/*.js', { cwd: '' }); -paths = del.sync("tmp/*.js"); -paths = del.sync("tmp/*.js", {force: true}); -paths = del.sync("tmp/*.js", {dryRun: true}); -paths = del.sync("tmp/*.js", {concurrency: 20}); -paths = del.sync("tmp/*.js", {cwd: ''}); +const immutable: ReadonlyArray = ['tmp/*.js', '!tmp/unicorn.js']; +const mutable = del(immutable); +const mutablePaths = del.sync(immutable); +mutable.then(paths => paths.push('test')); +mutablePaths.push('test'); diff --git a/types/del/index.d.ts b/types/del/index.d.ts index e3c250e69b..ec92f96c84 100644 --- a/types/del/index.d.ts +++ b/types/del/index.d.ts @@ -3,14 +3,21 @@ // Definitions by: Asana // Aya Morisawa // BendingBender +// Jason Dreyzehner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import glob = require("glob"); +import glob = require('glob'); -declare function del(patterns: string | string[], options?: del.Options): Promise; +declare function del( + patterns: string | ReadonlyArray, + options?: del.Options +): Promise; declare namespace del { - function sync(patterns: string | string[], options?: Options): string[]; + function sync( + patterns: string | ReadonlyArray, + options?: Options + ): string[]; interface Options extends glob.IOptions { force?: boolean; diff --git a/types/download/index.d.ts b/types/download/index.d.ts index cffc282832..5d19321fb0 100644 --- a/types/download/index.d.ts +++ b/types/download/index.d.ts @@ -2,41 +2,31 @@ // Project: https://github.com/kevva/download // Definitions by: Nico Jansen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 /// +import { DecompressOptions } from 'decompress'; +import { GotBodyOptions, TimeoutOptions } from 'got'; -interface TimeoutOptions { - connect?: number; - socket?: number; - request?: number; -} -type RetryFunction = (retry: number, error: any) => number; +declare namespace download { + type RetryFunction = (retry: number, error: any) => number; -interface DownloadOptions { - body?: string | Buffer | NodeJS.ReadableStream; - encoding?: string | null; - query?: string | object; - timeout?: number | TimeoutOptions; - retries?: number | RetryFunction; - followRedirect?: boolean; - decompress?: boolean; - useElectronNet?: boolean; - /** - * If set to true, try extracting the file using decompress. - */ - extract?: boolean; - /** - * Name of the saved file. - */ - filename?: string; - /** - * Proxy endpoint - */ - proxy?: string; + interface DownloadOptions extends DecompressOptions, GotBodyOptions { + /** + * If set to true, try extracting the file using decompress. + */ + extract?: boolean; + /** + * Name of the saved file. + */ + filename?: string; + /** + * Proxy endpoint + */ + proxy?: string; + } } -declare namespace download {} -declare function download(url: string, destination?: string, options?: DownloadOptions): Promise & NodeJS.WritableStream & NodeJS.ReadableStream; +declare function download(url: string, destination?: string, options?: download.DownloadOptions): Promise & NodeJS.WritableStream & NodeJS.ReadableStream; export = download; diff --git a/types/draft-js/draft-js-tests.tsx b/types/draft-js/draft-js-tests.tsx index 63821eda98..857671d13d 100644 --- a/types/draft-js/draft-js-tests.tsx +++ b/types/draft-js/draft-js-tests.tsx @@ -22,7 +22,8 @@ import { DraftEntityMutability, DraftEntityType, convertFromHTML, - convertToRaw + convertToRaw, + CompositeDecorator, } from 'draft-js'; const SPLIT_HEADER_BLOCK = 'split-header-block'; @@ -38,6 +39,14 @@ export const KEYCODES: Record = { type SyntheticKeyboardEvent = React.KeyboardEvent<{}>; +const HANDLE_REGEX = /\@[\w]+/g; + +class HandleSpan extends React.Component { + render() { + return {this.props.children} + } +} + class RichEditorExample extends React.Component<{}, { editorState: EditorState }> { constructor() { super({}); @@ -51,8 +60,22 @@ class RichEditorExample extends React.Component<{}, { editorState: EditorState } blocksFromHTML.contentBlocks, blocksFromHTML.entityMap, ); - - this.state = { editorState: EditorState.createWithContent(state) }; + const decorator = new CompositeDecorator([{ + strategy: ( + block: ContentBlock, + callback: (start: number, end: number) => void, + contentState: ContentState + ) => { + const text = block.getText(); + let matchArr, start; + while ((matchArr = HANDLE_REGEX.exec(text)) !== null) { + start = matchArr.index; + callback(start, start + matchArr[0].length); + } + }, + component: HandleSpan, + }]); + this.state = { editorState: EditorState.createWithContent(state, decorator) }; } onChange: (editorState: EditorState) => void = (editorState: EditorState) => this.setState({ editorState }); diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index e545fa347d..e83de2b303 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Draft.js v0.10.4 +// Type definitions for Draft.js v0.10.5 // Project: https://facebook.github.io/draft-js/ // Definitions by: Dmitry Rogozhny // Eelco Lempsink @@ -7,6 +7,7 @@ // Michael Wu // Willis Plummer // Santiago Vilar +// Ulf Schwekendiek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -398,7 +399,7 @@ declare namespace Draft { /** * Given a `ContentBlock`, return an immutable List of decorator keys. */ - getDecorations(block: ContentBlock): Immutable.List; + getDecorations(block: ContentBlock, contentState: ContentState): Immutable.List; /** * Given a decorator key, return the component to use when rendering @@ -456,7 +457,7 @@ declare namespace Draft { class CompositeDraftDecorator { constructor(decorators: Array); - getDecorations(block: ContentBlock): Immutable.List; + getDecorations(block: ContentBlock, contentState: ContentState): Immutable.List; getComponentForKey(key: string): Function; getPropsForKey(key: string): Object; } @@ -957,6 +958,7 @@ import ContentBlock = Draft.Model.ImmutableData.ContentBlock; import ContentState = Draft.Model.ImmutableData.ContentState; import SelectionState = Draft.Model.ImmutableData.SelectionState; import DraftInlineStyle = Draft.Model.ImmutableData.DraftInlineStyle; +import BlockMap = Draft.Model.ImmutableData.BlockMap; import AtomicBlockUtils = Draft.Model.Modifier.AtomicBlockUtils; import KeyBindingUtil = Draft.Component.Utils.KeyBindingUtil; @@ -1005,6 +1007,7 @@ export { ContentState, SelectionState, DraftInlineStyle, + BlockMap, AtomicBlockUtils, KeyBindingUtil, diff --git a/types/dwt/addon.pdf.d.ts b/types/dwt/addon.pdf.d.ts index ef0980abfd..856291a647 100644 --- a/types/dwt/addon.pdf.d.ts +++ b/types/dwt/addon.pdf.d.ts @@ -1,5 +1,5 @@ /*! -* Dynamsoft WebTwain PDF Addon +* Based on Dynamsoft WebTwain JavaScript Intellisense * Product: Dynamsoft Web Twain * Web Site: http://www.dynamsoft.com * @@ -25,7 +25,7 @@ interface PDF { * The function to call when the download succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. * The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ Download(remoteFile: string, optionalAsyncSuccessFunc?: () => void, @@ -35,7 +35,7 @@ interface PDF { * Input the password to decrypt PDF files using PDF Rasterizer add-on. * @method Dynamsoft.WebTwain#SetPassword * @param {string} password Specifies the PDF password. - * @return {bool} + * @return {boolean} */ SetPassword(password: string): boolean; @@ -43,7 +43,7 @@ interface PDF { * Set the image convert mode for PDF Rasterizer in Dynamic Web TWAIN. * @method Dynamsoft.WebTwain#SetConvertMode * @param {EnumDWT_ConverMode} convertMode Specifies the image convert mode. - * @return {bool} + * @return {boolean} */ SetConvertMode(convertMode: EnumDWT_ConverMode): boolean; @@ -51,7 +51,7 @@ interface PDF { * Set the output resolution for the PDF Rasterizer in Dynamic Web TWAIN. * @method Dynamsoft.WebTwain#ReadRect * @param {float} fResolution Specifies the resolution for convert image from PDF file. - * @return {bool} + * @return {boolean} */ SetResolution(fResolution: number): boolean; @@ -59,7 +59,7 @@ interface PDF { * Judges whether the local PDF is text-based or not. * @method Dynamsoft.WebTwain#ReadRect * @param {string} localFile specifies the local path of the target PDF. - * @return {bool} + * @return {boolean} */ IsTextBasedPDF(localFile: string): boolean; } @@ -69,5 +69,5 @@ interface WebTwainAddon { } interface WebTwain { - Addon: WebTwainAddon; + Addon: WebTwainAddon; } diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index b940c6ae4e..69bd65bb9f 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -3,11 +3,12 @@ // Definitions by: Xiao Ling // Josh Hall // Lincoln Hu +// Tom Kent // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 /*! -* Dynamsoft WebTwain JavaScript Intellisense +* Based on Dynamsoft WebTwain JavaScript Intellisense * Product: Dynamsoft Web Twain * Web Site: http://www.dynamsoft.com * @@ -20,51 +21,87 @@ * @namespace Dynamsoft */ declare namespace Dynamsoft { + namespace Lib { + /*ignored + Addon_Events Addon_Sendback_Events AttachAndShowImage BIO DOM DynamicLoadAddonFuns DynamicWebTwain EnumMouseButton + Errors Events IntToColorStr LS OnGetImageByURL OnGetImageFromServer Path ProgressBar UI Uri + addEventListener ajax all appendMessage appendRichMessage aryControlLoadImage attachAddon attachProperty + base64 bio cancelFrome clearMessage closeAll closeProgress colorStrToInt config css currentStyle + debug detect detectButton dialog dialogShowStatus dlgProgress dlgRef drawBoxBorder drawImageWithHermite + each empty endsWith + */ + + let env: { + WSSession: number, WSVersion: string, + bChrome: boolean, bEdge: boolean, bFileSystem: boolean, bFirefox: boolean, + bIE: boolean, bLinux: boolean, bMac: boolean, bSafari: boolean, bWin: boolean, bWin64: boolean, + basePath: string, iPluginLength: number, isX64: boolean, pathType: number, + strChromeVersion: number, strFirefoxVersion: string, strIEVersion: string + }; + + /*ignored + error escapeHtml escapeRegExp extend filter fireEvent fromUnicode get getColor getCss + getElDimensions getHex getHexColor getHttpUrl getLogger getOffset getRandom getRealPath getScript + getWS getWSUrl getWheelDelta globalEval guid hide html5 imageControlCount indexOf install + io isArray isBoolean isDef isFunction isLocalIP isNaN isNull isNumber isObject + isPlainObject isString isUndef isUndefined isWindow keys log main makeArray mix + needShowTwiceShowDialog nil noop now obj one page param parse parseHTML parser + product progressMessage ready removeEventListener replaceAll replaceControl show showProgress startWS + startWSByIP startsWith stopPropagation stringify style support switchEvent tmp toggle trim + type unEscapeHtml unparam upperCaseFirst urlDecode urlEncode utf8 win + ...other internal ones + */ + } namespace WebTwainEnv { - function GetWebTwain (cid: string): WebTwain; - function RegisterEvent(event: string, fn: (...args: any[]) => void): void; + let JSVersion: string; + let PluginVersion: string; + let ActiveXVersion: string; + let ServerVersionInfo: string; + + let Trial: boolean; + let AutoLoad: boolean; + let ProductKey: string; + let ResourcesPath: string; + + let IfUpdateService: boolean; + let IfUseActiveXForIE10Plus: boolean; + let UseDefaultInstallUI: string; + let ActiveXInstallWithCAB: boolean; + let Debug: boolean; + + let ContainerMap: {}; + let Containers: Container[]; + let DynamicContainers: string[]; + let DynamicDWTMap: {}; + + function CreateDWTObject(newObjID: string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void; + function GetWebTwain(cid: string): WebTwain; + function DeleteDWTObject(objID: string): void; function Load(): void; function Unload(): void; - let AutoLoad: boolean; - let Containers: Container[]; + function RegisterEvent(event: string, fn: (...args: any[]) => void): void; + + /*ignored + initQueue inited UseDefaultInstallUI + OnWebTwainInitMessage OnWebTwainNeedUpgrade OnWebTwainNeedUpgradeWebJavascript OnWebTwainNotFound OnWebTwainOldPluginNotAllowed OnWebTwainReady + */ + function OnWebTwainPostExecute(): void; + function OnWebTwainPreExecute(): void; + + function RemoveAllAuthorizations(): void; + function ShowDialog(_dialogWidth: number, _dialogHeight: number, _strDialogMessageWithHtmlFormat: string, _bChangeImage: boolean, bHideCloseButton: boolean): void; + function CloseDialog(): void; } } -/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */ -declare enum EnumDWT_PixelType { - TWPT_BW = 0, - TWPT_GRAY = 1, - TWPT_RGB = 2, - TWPT_PALLETE = 3, - TWPT_CMY = 4, - TWPT_CMYK = 5, - TWPT_YUV = 6, - TWPT_YUVK = 7, - TWPT_CIEXYZ = 8, - TWPT_LAB = 9, - TWPT_SRGB = 10, - TWPT_SCRGB = 11, - TWPT_INFRARED = 16 -} - +/** Border Styles */ declare enum EnumDWT_BorderStyle { - /** No border. */ - TWBS_NONE = 0, - /** Flat border. */ - TWBS_SINGLEFLAT = 1, - /** 3D border. */ - TWBS_SINGLE3D = 2 -} - -/** For query the operation that are supported by the data source on a capability . - * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT - */ -declare enum EnumDWT_MessageType { - TWQC_GET = 1, - TWQC_SET = 2, - TWQC_GETDEFAULT = 4, - TWQC_GETCURRENT = 8, - TWQC_RESET = 16 + /** No border. */ + TWBS_NONE = 0, + /** Flat border. */ + TWBS_SINGLEFLAT = 1, + /** 3D border. */ + TWBS_SINGLE3D = 2 } /** Capabilities */ @@ -272,45 +309,45 @@ declare enum EnumDWT_Cap { * any frames with a left offset of zero. * TWFA_RIGHT: The alignment is to the right. */ - CAP_FEEDERALIGNMENT = 4141, + CAP_FEEDERALIGNMENT = 4141, /** TWFO_FIRSTPAGEFIRST if the feeder starts with the top of the first page. * TWFO_LASTPAGEFIRST is the feeder starts with the top of the last page. */ - CAP_FEEDERORDER = 4142, + CAP_FEEDERORDER = 4142, /** Indicates whether the physical hardware (e.g. scanner, digital camera) is capable of acquiring * multiple images of the same page without changes to the physical registration of that page. */ - CAP_REACQUIREALLOWED = 4144, + CAP_REACQUIREALLOWED = 4144, /** The minutes of battery power remaining to the device. */ - CAP_BATTERYMINUTES = 4146, + CAP_BATTERYMINUTES = 4146, /** When used with CapGet(), return the percentage of battery power level on camera. If -1 is returned, it indicates that the battery is not present. */ - CAP_BATTERYPERCENTAGE = 4147, + CAP_BATTERYPERCENTAGE = 4147, /** Added 1.91 */ - CAP_CAMERASIDE = 4148, + CAP_CAMERASIDE = 4148, /** Added 1.91 */ - CAP_SEGMENTED = 4149, + CAP_SEGMENTED = 4149, /** Added 2.0 */ - CAP_CAMERAENABLED = 4150, + CAP_CAMERAENABLED = 4150, /** Added 2.0 */ - CAP_CAMERAORDER = 4151, + CAP_CAMERAORDER = 4151, /** Added 2.0 */ - CAP_MICRENABLED = 4152, + CAP_MICRENABLED = 4152, /** Added 2.0 */ - CAP_FEEDERPREP = 4153, + CAP_FEEDERPREP = 4153, /** Added 2.0 */ - CAP_FEEDERPOCKET = 4154, + CAP_FEEDERPOCKET = 4154, /** Added 2.1 */ - CAP_AUTOMATICSENSEMEDIUM = 4155, + CAP_AUTOMATICSENSEMEDIUM = 4155, /** Added 2.1 */ - CAP_CUSTOMINTERFACEGUID = 4156, + CAP_CUSTOMINTERFACEGUID = 4156, /** TRUE enables and FALSE disables the Source's Auto-brightness function (if any). */ - ICAP_AUTOBRIGHT = 4352, + ICAP_AUTOBRIGHT = 4352, /** The brightness values available within the Source. */ - ICAP_BRIGHTNESS = 4353, + ICAP_BRIGHTNESS = 4353, /** The contrast values available within the Source. */ - ICAP_CONTRAST = 4355, + ICAP_CONTRAST = 4355, /** Specifies the square-cell halftone (dithering) matrix the Source should use to halftone the image. */ - ICAP_CUSTHALFTONE = 4356, + ICAP_CUSTHALFTONE = 4356, /** Specifies the exposure time used to capture the image, in seconds. */ ICAP_EXPOSURETIME = 4357, /** Describes the color characteristic of the subtractive filter applied to the image data. Multiple @@ -567,204 +604,85 @@ declare enum EnumDWT_Cap { ICAP_SUPPORTEDEXTIMAGEINFO = 4446 } -/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected. - * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities = - * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION. - */ -declare enum EnumDWT_CapType { - /** Nothing. */ - TWON_NONE = 0, - /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and - * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS - * capability, would use this type of container. +/** ICAP_BITORDER values. */ +declare enum EnumDWT_CapBitOrder { + TWBO_LSBFIRST = 0, + /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */ + TWBO_MSBFIRST = 1 +} + +/** ICAP_BITDEPTHREDUCTION values. */ +declare enum EnumDWT_CapBitdepthReduction { + TWBR_THRESHOLD = 0, + TWBR_HALFTONE = 1, + TWBR_CUSTHALFTONE = 2, + TWBR_DIFFUSION = 3 +} + +/** CAP_FEEDERALIGNMENT values. */ +declare enum EnumDWT_CapFeederAlignment { + /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */ + TWFA_NONE = 0, + /** The alignment is to the left. */ + TWFA_LEFT = 1, + /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the + * device. If this is set, then the Application should calculate any frames with a left offset of zero. */ - TWON_ARRAY = 3, - /** This is the most general type because it defines a list of values from which the Current Value can be chosen. - * The values do not progress uniformly through a range and there is not a consistent step size between the values. - * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600). - */ - TWON_ENUMERATION = 4, - /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value. - * For example, a capability that indicates the presence of a document feeder could be of this type. - */ - TWON_ONEVALUE = 5, - /** Many capabilities allow users to select their current value from a range of regularly spaced values. - * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values. - * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600). - */ - TWON_RANGE = 6 + TWFA_CENTER = 2, + /** The alignment is to the right. */ + TWFA_RIGHT = 3 } -/** ICAP_XFERMECH values. */ -declare enum EnumDWT_TransferMode { - /** Native transfers require the data to be transferred to a single large block of RAM. Therefore, - * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully. - */ - TWSX_NATIVE = 0, - /** Disk File Mode Transfers. */ - TWSX_FILE = 1, - /** Buffered Memory Mode Transfers. */ - TWSX_MEMORY = 2, - /** added 1.91 */ - TWSX_MEMFILE = 4 +/** CAP_FEEDERORDER values. */ +declare enum EnumDWT_CapFeederOrder { + /** The feeder starts with the top of the first page. */ + TWFO_FIRSTPAGEFIRST = 0, + /** The feeder starts with the top of the last page. */ + TWFO_LASTPAGEFIRST = 1 } -/** ICAP_IMAGEFILEFORMAT values. */ -declare enum EnumDWT_FileFormat { - /** Used for document imaging. Tagged Image File Format */ - TWFF_TIFF = 0, - /** Native Macintosh format. Macintosh PICT */ - TWFF_PICT = 1, - /** Native Microsoft format. Windows Bitmap */ - TWFF_BMP = 2, - /** Used for document imaging. X-Windows Bitmap */ - TWFF_XBM = 3, - /** Wrapper for JPEG images. JPEG File Interchange Format */ - TWFF_JFIF = 4, - /** FlashPix, used with digital cameras. Flash Pix */ - TWFF_FPX = 5, - /** Multi-page TIFF files. Multi-page tiff file */ - TWFF_TIFFMULTI = 6, - /** An image format standard intended for use on the web, replaces GIF. */ - TWFF_PNG = 7, - /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */ - TWFF_SPIFF = 8, - /** File format for use with digital cameras. */ - TWFF_EXIF = 9, - /** A file format from Adobe. 1.91 NB: this is not PDF/A */ - TWFF_PDF = 10, - /** A file format from the Joint Photographic Experts Group. 1.91 */ - TWFF_JP2 = 11, - /** 1.91 */ - TWFF_JPN = 12, - /** 1.91 */ - TWFF_JPX = 13, - /** A file format from LizardTech. 1.91 */ - TWFF_DEJAVU = 14, - /** A file format from Adobe. 2.0 */ - TWFF_PDFA = 15, - /** 2.1 Adobe PDF/A, Version 2 */ - TWFF_PDFA2 = 16 +/** ICAP_FILTER values. */ +declare enum EnumDWT_CapFilterType { + TWFT_RED = 0, + TWFT_GREEN = 1, + TWFT_BLUE = 2, + TWFT_NONE = 3, + TWFT_WHITE = 4, + TWFT_CYAN = 5, + TWFT_MAGENTA = 6, + TWFT_YELLOW = 7, + TWFT_BLACK = 8 } -/** TIFF file compression type. */ -declare enum EnumDWT_TIFFCompressionType { - /** Auto mode. */ - TIFF_AUTO = 0, - /** Dump mode. */ - TIFF_NONE = 1, - /** CCITT modified Huffman RLE. */ - TIFF_RLE = 2, - /** CCITT Group 3 fax encoding. */ - TIFF_FAX3 = 3, - /** CCITT T.4 (TIFF 6 name). */ - TIFF_T4 = 3, - /** CCITT Group 4 fax encoding */ - TIFF_FAX4 = 4, - /** CCITT T.6 (TIFF 6 name). */ - TIFF_T6 = 4, - /** Lempel Ziv and Welch */ - TIFF_LZW = 5, - TIFF_JPEG = 7, - TIFF_PACKBITS = 32773 +/** ICAP_FLASHUSED2 values. */ +declare enum EnumDWT_CapFlash { + TWFL_NONE = 0, + TWFL_OFF = 1, + TWFL_ON = 2, + TWFL_AUTO = 3, + TWFL_REDEYE = 4 } -/** The method to do interpolation. */ -declare enum EnumDWT_InterpolationMethod { - IM_NEARESTNEIGHBOUR = 1, - IM_BILINEAR = 2, - IM_BICUBIC = 3, - IM_BESTQUALITY = 5 +/** ICAP_FLIPROTATION values. */ +declare enum EnumDWT_CapFlipRotation { + /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */ + TWFR_BOOK = 0, + /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */ + TWFR_FANFOLD = 1 } -/** Image type */ -declare enum EnumDWT_ImageType { - /** Native Microsoft format. */ - IT_BMP = 0, - /** JPEG format. */ - IT_JPG = 1, - /** Tagged Image File Format. */ - IT_TIF = 2, - /** An image format standard intended for use on the web, replaces GIF. */ - IT_PNG = 3, - /** A file format from Adobe. */ - IT_PDF = 4, - IT_ALL = 5 -} - -/** PDF file compression type. */ -declare enum EnumDWT_PDFCompressionType { - /** Auto mode. */ - PDF_AUTO = 0, - /** CCITT Group 3 fax encoding. */ - PDF_FAX3 = 1, - /** CCITT Group 4 fax encoding */ - PDF_FAX4 = 2, - /** Lempel Ziv and Welch */ - PDF_LZW = 3, - /** CCITT modified Huffman RLE. */ - PDF_RLE = 4, - PDF_JPEG = 5 -} - -declare enum EnumDWT_ShowMode { - /** Activates the window and displays it in its current size and position. */ - SW_ACTIVE = 0, - /** Maximizes the window */ - SW_MAX = 1, - /** Minimize the window */ - SW_MIN = 2, - /** Close the latest opened editor window */ - SW_CLOSE = 3, - /** Check whether a window exists */ - SW_IFLIVE = 4 -} - -/** The kind of data stored in the container. */ -declare enum EnumDWT_CapValueType { - TWTY_INT8 = 0, - /** Means Item is a TW_INT16 */ - TWTY_INT16 = 1, - /** Means Item is a TW_INT32 */ - TWTY_INT32 = 2, - /** Means Item is a TW_UINT8 */ - TWTY_UINT8 = 3, - /** Means Item is a TW_UINT16 */ - TWTY_UINT16 = 4, - /** Means Item is a TW_int */ - TWTY_int = 5, - /** Means Item is a TW_BOOL */ - TWTY_BOOL = 6, - /** Means Item is a TW_FIX32 */ - TWTY_FIX32 = 7, - /** Means Item is a TW_FRAME */ - TWTY_FRAME = 8, - /** Means Item is a TW_STR32 */ - TWTY_STR32 = 9, - /** Means Item is a TW_STR64 */ - TWTY_STR64 = 10, - /** Means Item is a TW_STR128 */ - TWTY_STR128 = 11, - /** Means Item is a TW_STR255 */ - TWTY_STR255 = 12 -} - -/** ICAP_UNITS values. */ -declare enum EnumDWT_UnitType { - TWUN_INCHES = 0, - TWUN_CENTIMETERS = 1, - TWUN_PICAS = 2, - TWUN_POINTS = 3, - TWUN_TWIPS = 4, - TWUN_PIXELS = 5, - TWUN_MILLIMETERS = 6 -} - -/** ICAP_DUPLEX values. */ -declare enum EnumDWT_DUPLEX { - TWDX_NONE = 0, - TWDX_1PASSDUPLEX = 1, - TWDX_2PASSDUPLEX = 2 +/** ICAP_IMAGEFILTER values. */ +declare enum EnumDWT_CapImageFilter { + TWIF_NONE = 0, + TWIF_AUTO = 1, + /** Good for halftone images. */ + TWIF_LOWPASS = 2, + /** Good for improving text. */ + TWIF_BANDPASS = 3, + /** Good for improving fine lines. */ + TWIF_HIGHPASS = 4, + TWIF_TEXT = 3, + TWIF_FINELINE = 4 } /** CAP_LANGUAGE values. */ @@ -918,6 +836,92 @@ declare enum EnumDWT_CapLanguage { TWLG_VIETNAMESE = 113 } +/** ICAP_LIGHTPATH values. */ +declare enum EnumDWT_CapLightPath { + TWLP_REFLECTIVE = 0, + TWLP_TRANSMISSIVE = 1 +} + +/** ICAP_LIGHTSOURCE values. */ +declare enum EnumDWT_CapLightSource { + TWLS_RED = 0, + TWLS_GREEN = 1, + TWLS_BLUE = 2, + TWLS_NONE = 3, + TWLS_WHITE = 4, + TWLS_UV = 5, + TWLS_IR = 6 +} + +/** ICAP_NOISEFILTER values. */ +declare enum EnumDWT_CapNoiseFilter { + TWNF_NONE = 0, + TWNF_AUTO = 1, + TWNF_LONEPIXEL = 2, + TWNF_MAJORITYRULE = 3 +} + +/** ICAP_ORIENTATION values. */ +declare enum EnumDWT_CapORientation { + TWOR_ROT0 = 0, + TWOR_ROT90 = 1, + TWOR_ROT180 = 2, + TWOR_ROT270 = 3, + TWOR_PORTRAIT = 0, + TWOR_LANDSCAPE = 3, + /** 2.0 */ + TWOR_AUTO = 4, + /** 2.0 */ + TWOR_AUTOTEXT = 5, + /** 2.0 */ + TWOR_AUTOPICTURE = 6 +} + +/** ICAP_OVERSCAN values. */ +declare enum EnumDWT_CapOverscan { + TWOV_NONE = 0, + TWOV_AUTO = 1, + TWOV_TOPBOTTOM = 2, + TWOV_LEFTRIGHT = 3, + TWOV_ALL = 4 +} + +/** ICAP_PIXELFLAVOR values. */ +declare enum EnumDWT_CapPixelFlavor { + /** Zero pixel represents darkest shade. zero pixel represents darkest shade */ + TWPF_CHOCOLATE = 0, + /** Zero pixel represents lightest shade. zero pixel represents lightest shade */ + TWPF_VANILLA = 1 +} + +/** ICAP_PLANARCHUNKY values. */ +declare enum EnumDWT_CapPlanarChunky { + TWPC_CHUNKY = 0, + TWPC_PLANAR = 1 +} + +/** CAP_PRINTER values. */ +declare enum EnumDWT_CapPrinter { + TWPR_IMPRINTERTOPBEFORE = 0, + TWPR_IMPRINTERTOPAFTER = 1, + TWPR_IMPRINTERBOTTOMBEFORE = 2, + TWPR_IMPRINTERBOTTOMAFTER = 3, + TWPR_ENDORSERTOPBEFORE = 4, + TWPR_ENDORSERTOPAFTER = 5, + TWPR_ENDORSERBOTTOMBEFORE = 6, + TWPR_ENDORSERBOTTOMAFTER = 7 +} + +/** CAP_PRINTERMODE values. */ +declare enum EnumDWT_CapPrinterMode { + /** Specifies that the printed text will consist of a single string. */ + TWPM_SINGLESTRING = 0, + /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */ + TWPM_MULTISTRING = 1, + /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */ + TWPM_COMPOUNDSTRING = 2 +} + /** TWAIN Supported sizes. */ declare enum EnumDWT_CapSupportedSizes { /** 0 */ @@ -1046,180 +1050,68 @@ declare enum EnumDWT_CapSupportedSizes { TWSS_MAXSIZE = 54 } -/** CAP_FEEDERALIGNMENT values. */ -declare enum EnumDWT_CapFeederAlignment { - /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */ - TWFA_NONE = 0, - /** The alignment is to the left. */ - TWFA_LEFT = 1, - /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the - * device. If this is set, then the Application should calculate any frames with a left offset of zero. +/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected. + * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities = + * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION. + */ +declare enum EnumDWT_CapType { + /** Nothing. */ + TWON_NONE = 0, + /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and + * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS + * capability, would use this type of container. */ - TWFA_CENTER = 2, - /** The alignment is to the right. */ - TWFA_RIGHT = 3 -} -/** CAP_FEEDERORDER values. */ -declare enum EnumDWT_CapFeederOrder { - /** The feeder starts with the top of the first page. */ - TWFO_FIRSTPAGEFIRST = 0, - /** The feeder starts with the top of the last page. */ - TWFO_LASTPAGEFIRST = 1 + TWON_ARRAY = 3, + /** This is the most general type because it defines a list of values from which the Current Value can be chosen. + * The values do not progress uniformly through a range and there is not a consistent step size between the values. + * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600). + */ + TWON_ENUMERATION = 4, + /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value. + * For example, a capability that indicates the presence of a document feeder could be of this type. + */ + TWON_ONEVALUE = 5, + /** Many capabilities allow users to select their current value from a range of regularly spaced values. + * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values. + * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600). + */ + TWON_RANGE = 6 } -/** CAP_PRINTER values. */ -declare enum EnumDWT_CapPrinter { - TWPR_IMPRINTERTOPBEFORE = 0, - TWPR_IMPRINTERTOPAFTER = 1, - TWPR_IMPRINTERBOTTOMBEFORE = 2, - TWPR_IMPRINTERBOTTOMAFTER = 3, - TWPR_ENDORSERTOPBEFORE = 4, - TWPR_ENDORSERTOPAFTER = 5, - TWPR_ENDORSERBOTTOMBEFORE = 6, - TWPR_ENDORSERBOTTOMAFTER = 7 +/** The kind of data stored in the container. */ +declare enum EnumDWT_CapValueType { + TWTY_INT8 = 0, + /** Means Item is a TW_INT16 */ + TWTY_INT16 = 1, + /** Means Item is a TW_INT32 */ + TWTY_INT32 = 2, + /** Means Item is a TW_UINT8 */ + TWTY_UINT8 = 3, + /** Means Item is a TW_UINT16 */ + TWTY_UINT16 = 4, + /** Means Item is a TW_int */ + TWTY_int = 5, + /** Means Item is a TW_BOOL */ + TWTY_BOOL = 6, + /** Means Item is a TW_FIX32 */ + TWTY_FIX32 = 7, + /** Means Item is a TW_FRAME */ + TWTY_FRAME = 8, + /** Means Item is a TW_STR32 */ + TWTY_STR32 = 9, + /** Means Item is a TW_STR64 */ + TWTY_STR64 = 10, + /** Means Item is a TW_STR128 */ + TWTY_STR128 = 11, + /** Means Item is a TW_STR255 */ + TWTY_STR255 = 12 } -/** CAP_PRINTERMODE values. */ -declare enum EnumDWT_CapPrinterMode { - /** Specifies that the printed text will consist of a single string. */ - TWPM_SINGLESTRING = 0, - /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */ - TWPM_MULTISTRING = 1, - /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */ - TWPM_COMPOUNDSTRING = 2 -} - -/** ICAP_BITDEPTHREDUCTION values. */ -declare enum EnumDWT_CapBitdepthReduction { - TWBR_THRESHOLD = 0, - TWBR_HALFTONE = 1, - TWBR_CUSTHALFTONE = 2, - TWBR_DIFFUSION = 3 -} - -/** ICAP_BITORDER values. */ -declare enum EnumDWT_CapBitOrder { - TWBO_LSBFIRST = 0, - /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */ - TWBO_MSBFIRST = 1 -} - -/** ICAP_FILTER values. */ -declare enum EnumDWT_CapFilterType { - TWFT_RED = 0, - TWFT_GREEN = 1, - TWFT_BLUE = 2, - TWFT_NONE = 3, - TWFT_WHITE = 4, - TWFT_CYAN = 5, - TWFT_MAGENTA = 6, - TWFT_YELLOW = 7, - TWFT_BLACK = 8 -} - -/** ICAP_FLASHUSED2 values. */ -declare enum EnumDWT_CapFlash { - TWFL_NONE = 0, - TWFL_OFF = 1, - TWFL_ON = 2, - TWFL_AUTO = 3, - TWFL_REDEYE = 4 -} - -/** ICAP_FLIPROTATION values. */ -declare enum EnumDWT_CapFlipRotation { - /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */ - TWFR_BOOK = 0, - /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */ - TWFR_FANFOLD = 1 -} - -/** ICAP_IMAGEFILTER values. */ -declare enum EnumDWT_CapImageFilter { - TWIF_NONE = 0, - TWIF_AUTO = 1, - /** Good for halftone images. */ - TWIF_LOWPASS = 2, - /** Good for improving text. */ - TWIF_BANDPASS = 3, - /** Good for improving fine lines. */ - TWIF_HIGHPASS = 4, - TWIF_TEXT = 3, - TWIF_FINELINE = 4 -} - -/** ICAP_LIGHTPATH values. */ -declare enum EnumDWT_CapLightPath { - TWLP_REFLECTIVE = 0, - TWLP_TRANSMISSIVE = 1 -} - -/** ICAP_LIGHTSOURCE values. */ -declare enum EnumDWT_CapLightSource { - TWLS_RED = 0, - TWLS_GREEN = 1, - TWLS_BLUE = 2, - TWLS_NONE = 3, - TWLS_WHITE = 4, - TWLS_UV = 5, - TWLS_IR = 6 -} - -/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */ -declare enum EnumDWT_MagType { - /** Added 2.0 */ - TWMD_MICR = 0, - /** added 2.1 */ - TWMD_RAW = 1, - /** added 2.1 */ - TWMD_INVALID = 2 -} - -/** ICAP_NOISEFILTER values. */ -declare enum EnumDWT_CapNoiseFilter { - TWNF_NONE = 0, - TWNF_AUTO = 1, - TWNF_LONEPIXEL = 2, - TWNF_MAJORITYRULE = 3 -} - -/** ICAP_ORIENTATION values. */ -declare enum EnumDWT_CapORientation { - TWOR_ROT0 = 0, - TWOR_ROT90 = 1, - TWOR_ROT180 = 2, - TWOR_ROT270 = 3, - TWOR_PORTRAIT = 0, - TWOR_LANDSCAPE = 3, - /** 2.0 */ - TWOR_AUTO = 4, - /** 2.0 */ - TWOR_AUTOTEXT = 5, - /** 2.0 */ - TWOR_AUTOPICTURE = 6 -} - -/** ICAP_OVERSCAN values. */ -declare enum EnumDWT_CapOverscan { - TWOV_NONE = 0, - TWOV_AUTO = 1, - TWOV_TOPBOTTOM = 2, - TWOV_LEFTRIGHT = 3, - TWOV_ALL = 4 -} - -/** ICAP_PIXELFLAVOR values. */ -declare enum EnumDWT_CapPixelFlavor { - /** Zero pixel represents darkest shade. zero pixel represents darkest shade */ - TWPF_CHOCOLATE = 0, - /** Zero pixel represents lightest shade. zero pixel represents lightest shade */ - TWPF_VANILLA = 1 -} - -/** ICAP_PLANARCHUNKY values. */ -declare enum EnumDWT_CapPlanarChunky { - TWPC_CHUNKY = 0, - TWPC_PLANAR = 1 +/** ICAP_DUPLEX values. */ +declare enum EnumDWT_DUPLEX { + TWDX_NONE = 0, + TWDX_1PASSDUPLEX = 1, + TWDX_2PASSDUPLEX = 2 } /** Data source status. */ @@ -1234,6 +1126,48 @@ declare enum EnumDWT_DataSourceStatus { TWDSS_ACQUIRING = 3 } +declare enum EnumDWT_Error { + ModuleNotExists = -2371 +} + +/** ICAP_IMAGEFILEFORMAT values. */ +declare enum EnumDWT_FileFormat { + /** Used for document imaging. Tagged Image File Format */ + TWFF_TIFF = 0, + /** Native Macintosh format. Macintosh PICT */ + TWFF_PICT = 1, + /** Native Microsoft format. Windows Bitmap */ + TWFF_BMP = 2, + /** Used for document imaging. X-Windows Bitmap */ + TWFF_XBM = 3, + /** Wrapper for JPEG images. JPEG File Interchange Format */ + TWFF_JFIF = 4, + /** FlashPix, used with digital cameras. Flash Pix */ + TWFF_FPX = 5, + /** Multi-page TIFF files. Multi-page tiff file */ + TWFF_TIFFMULTI = 6, + /** An image format standard intended for use on the web, replaces GIF. */ + TWFF_PNG = 7, + /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */ + TWFF_SPIFF = 8, + /** File format for use with digital cameras. */ + TWFF_EXIF = 9, + /** A file format from Adobe. 1.91 NB: this is not PDF/A */ + TWFF_PDF = 10, + /** A file format from the Joint Photographic Experts Group. 1.91 */ + TWFF_JP2 = 11, + /** 1.91 */ + TWFF_JPN = 12, + /** 1.91 */ + TWFF_JPX = 13, + /** A file format from LizardTech. 1.91 */ + TWFF_DEJAVU = 14, + /** A file format from Adobe. 2.0 */ + TWFF_PDFA = 15, + /** 2.1 Adobe PDF/A, Version 2 */ + TWFF_PDFA2 = 16 +} + /** Fit window type */ declare enum EnumDWT_FitWindowType { /** Fit the image to the width and height of the window */ @@ -1244,18 +1178,186 @@ declare enum EnumDWT_FitWindowType { enumFitWindowWidth = 2 } -declare enum EnumDWT_UploadDataFormat { - Binary = 0, - Base64 = 1 +/** Image type */ +declare enum EnumDWT_ImageType { + /** Native Microsoft format. */ + IT_BMP = 0, + /** JPEG format. */ + IT_JPG = 1, + /** Tagged Image File Format. */ + IT_TIF = 2, + /** An image format standard intended for use on the web, replaces GIF. */ + IT_PNG = 3, + /** A file format from Adobe. */ + IT_PDF = 4, + /** All supported formats which are bmp, jpg, tif, png and pdf */ + IT_ALL = 5 +} + +declare enum EnumDWT_InitMsg { + Info = 1, + Error = 2, + NotInstalledError = 3, + DownloadError = 4, + DownloadNotRestartError = 5 +} + +/** The method to do interpolation. */ +declare enum EnumDWT_InterpolationMethod { + IM_NEARESTNEIGHBOUR = 1, + IM_BILINEAR = 2, + IM_BICUBIC = 3, + IM_BESTQUALITY = 5 +} + +declare enum EnumDWT_Language { + English = 0, + French = 1, + Arabic = 2, + Spanish = 3, + Portuguese = 4, + German = 5, + Italian = 6, + Russian = 7, + Chinese = 8 +} + +/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */ +declare enum EnumDWT_MagType { + /** Added 2.0 */ + TWMD_MICR = 0, + /** added 2.1 */ + TWMD_RAW = 1, + /** added 2.1 */ + TWMD_INVALID = 2 +} + +/** For query the operation that are supported by the data source on a capability . + * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT + */ +declare enum EnumDWT_MessageType { + TWQC_GET = 1, + TWQC_SET = 2, + TWQC_GETDEFAULT = 4, + TWQC_GETCURRENT = 8, + TWQC_RESET = 16 } declare enum EnumDWT_MouseShape { - Default = 0, - Hand = 1, - Crosshair = 2, - Zoom = 3 + Default = 0, + Hand = 1, + Crosshair = 2, + Zoom = 3 } +/** PDF file compression type. */ +declare enum EnumDWT_PDFCompressionType { + /** Auto mode. */ + PDF_AUTO = 0, + /** CCITT Group 3 fax encoding. */ + PDF_FAX3 = 1, + /** CCITT Group 4 fax encoding */ + PDF_FAX4 = 2, + /** Lempel Ziv and Welch */ + PDF_LZW = 3, + /** CCITT modified Huffman RLE. */ + PDF_RLE = 4, + /** JPEG compression. */ + PDF_JPEG = 5 +} + +/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */ +declare enum EnumDWT_PixelType { + TWPT_BW = 0, + TWPT_GRAY = 1, + TWPT_RGB = 2, + TWPT_PALLETE = 3, + TWPT_CMY = 4, + TWPT_CMYK = 5, + TWPT_YUV = 6, + TWPT_YUVK = 7, + TWPT_CIEXYZ = 8, + TWPT_LAB = 9, + TWPT_SRGB = 10, + TWPT_SCRGB = 11, + TWPT_INFRARED = 16 +} + +declare enum EnumDWT_PlatformType { + /// Fit the image to the width and height of the window + enumWindow = 0, + /// Fit the image to the height of the window + enumMac = 1, + /// Fit the image to the width of the window + enumLinux = 2 +} + +declare enum EnumDWT_ShowMode { + /** Activates the window and displays it in its current size and position. */ + SW_ACTIVE = 0, + /** Maximizes the window */ + SW_MAX = 1, + /** Minimize the window */ + SW_MIN = 2, + /** Close the latest opened editor window */ + SW_CLOSE = 3, + /** Check whether a window exists */ + SW_IFLIVE = 4 +} + +/** TIFF file compression type. */ +declare enum EnumDWT_TIFFCompressionType { + /** Auto mode. */ + TIFF_AUTO = 0, + /** Dump mode. */ + TIFF_NONE = 1, + /** CCITT modified Huffman RLE. */ + TIFF_RLE = 2, + /** CCITT Group 3 fax encoding. */ + TIFF_FAX3 = 3, + /** CCITT T.4 (TIFF 6 name). */ + TIFF_T4 = 3, + /** CCITT Group 4 fax encoding */ + TIFF_FAX4 = 4, + /** CCITT T.6 (TIFF 6 name). */ + TIFF_T6 = 4, + /** Lempel Ziv and Welch */ + TIFF_LZW = 5, + TIFF_JPEG = 7, + TIFF_PACKBITS = 32773 +} + +/** ICAP_XFERMECH values. */ +declare enum EnumDWT_TransferMode { + /** Native transfers require the data to be transferred to a single large block of RAM. Therefore, + * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully. + */ + TWSX_NATIVE = 0, + /** Disk File Mode Transfers. */ + TWSX_FILE = 1, + /** Buffered Memory Mode Transfers. */ + TWSX_MEMORY = 2/*,*/ + /** added 1.91 , not supported in DWT yet*/ + /** TWSX_MEMFILE = 4*/ +} + +/** ICAP_UNITS values. */ +declare enum EnumDWT_UnitType { + TWUN_INCHES = 0, + TWUN_CENTIMETERS = 1, + TWUN_PICAS = 2, + TWUN_POINTS = 3, + TWUN_TWIPS = 4, + TWUN_PIXELS = 5, + TWUN_MILLIMETERS = 6 +} + +declare enum EnumDWT_UploadDataFormat { + Binary = 0, + Base64 = 1 +} + +/** interface for a DWT container which basically defines a DIV on the page */ interface Container { ContainerId: string; Width: string | number; @@ -1268,62 +1370,85 @@ interface Container { // properties (get/set) / sync functions interface WebTwain { /** - * Returns or sets whether multi-page selection is supported. - * @type {bool} + * Returns whether the instance of a DWT is initialized + * @type {boolean} */ + bReady: boolean; + + /** + * Returns the runtime id of the dwt object + * @type {string} + */ + readonly clientId: string; + + /** + * Returns the runtime class for the dwt container DIV + * @type {string} + */ + containerClass: string; + + /*ignored + httpUrl + objectName + + ...other internal ones + */ + + /* + * Properties + */ + + /** + * Returns or sets whether multi-page selection is supported. + * @type {boolean} + */ AllowMultiSelect: boolean; /** * [Deprecated.] Returns or sets whether allowing the plugin to send authentication request. The default value of this property is TRUE. - * @type {bool} + * @type {boolean} */ AllowPluginAuthentication: boolean; /** * [Deprecated.] Returns or sets whether the async mode is activated. With this mode, Dynamic Web TWAIN is able to upload/download files via HTTP/FTP asynchronously. The default value is false. - * @type {bool} + * @type {boolean} */ AsyncMode: boolean; /** * Returns or sets the background color of the main control. It is a value specifying the 24-bit RGB value. - * @type {int} + * @type {number} */ BackgroundColor: number; /** * Returns or sets the fill color of the selected area of an image when it is cut, erased or rotated. It is a value specifying the 24-bit RGB value. - * @type {int} + * @type {number} */ BackgroundFillColor: number; - /** - * [Deprecated.] Returns the number of barcode detected in an image. - * @type {int} - */ - BarcodeCount: number; - /** * Returns or sets the pixel bit depths for the current value of PixelType property. This is a runtime property. - * @type {short} + * @type {number} */ BitDepth: number; /** * Returns the current deviation of the pixels in the image. - * @type {float} + * @type {number} */ BlankImageCurrentStdDev: number; /** * Returns or sets the standard deviation of the pixels in the image. - * @type {float} + * @type {number} */ BlankImageMaxStdDev: number; /** * Returns or sets the dividing line between black and white. The default value is 128. - * @type {int} + * @type {number} */ BlankImageThreshold: number; @@ -1335,79 +1460,73 @@ interface WebTwain { /** * Returns or sets the brightness values available within the Source. This is a runtime property. - * @type {float} + * @type {number} */ Brightness: number; /** * [Deprecated.] Sets or returns whether brokerprocess is enabled for scanning. - * @type {int} + * @type {number} */ BrokerProcessType: number; /** * Sets or returns how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk. - * @type {int} + * @type {number} */ BufferMemoryLimit: number; - /** - * Specifies the capabiltiy to be negotiated. This is a runtime property. - * @type {EnumDWT_Cap} - */ - Capability: EnumDWT_Cap; - /** * Sets or returns the index (0-based) of a list to indicate the Current Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. - * @type {int} + * @type {number} */ CapCurrentIndex: number; /** * Sets or returns the current value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {double} + * @type {number} */ CapCurrentValue: number; /** * Returns the index (0-based) of a list to indicate the Default Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime, read-only property. - * @type {int} + * @type {number} */ CapDefaultIndex: number; /** * Returns the default value in a range when the value of the CapType property is TWON_RANGE. This is a runtime, read-only property. - * @type {double} + * @type {number} */ CapDefaultValue: number; + /** + * Retruns the description for a capability + * @type {string} + */ + CapDescription: string; + /** * Sets or returns the maximum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {double} + * @type {number} */ CapMaxValue: number; /** * Sets or returns the minimum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {double} + * @type {number} */ CapMinValue: number; /** * [Deprecated.] Sets or returns how many items are in the list when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. For String data type, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. - * @type {int} + * @type {number} */ CapNumItems: number; - /** - * [Deprecated.] Replaced by GetCapItemsString method and SetCapItemsString method. - * @type {string} - */ - CapItemsString: string; - /** * Sets or returns the step size in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {double} + * @type {number} */ CapStepSize: number; @@ -1419,7 +1538,7 @@ interface WebTwain { /** * Returns or sets the value of the capability specified by Capability property when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. - * @type {double} + * @type {number} */ CapValue: number; @@ -1431,25 +1550,25 @@ interface WebTwain { /** * Sets or returns the value type for reading the value of a capability. This is a runtime property. - * @type {short} + * @type {number} */ CapValueType: number; + /** + * Specifies the capabiltiy to be negotiated. This is a runtime property. + * @type {EnumDWT_Cap} + */ + Capability: EnumDWT_Cap; + /** * Returns or sets the contrast values available within the Source. This is a runtime property. - * @type {float} + * @type {number} */ Contrast: number; - /** - * Sets or returns the product name string for the application identity. - * @type {string} - */ - ProductName: string; - /** * Returns or sets current index of image in buffer. This is a runtime property. - * @type {short} + * @type {number} */ CurrentImageIndexInBuffer: number; @@ -1461,7 +1580,7 @@ interface WebTwain { /** * Returns the value indicating the data source status. This is a runtime, read-only property. - * @type {int} + * @type {number} */ DataSourceStatus: number; @@ -1473,19 +1592,19 @@ interface WebTwain { /** * Returns whether the source supports duplex. If so, it further returns the level of duplex the Source supports (one pass or two pass duplex). This is a runtime, read-only property. - * @type {int} + * @type {number} */ Duplex: number; /** * [Deprecated.] Returns or sets whether the user can zoom image using hot key. - * @type {bool} + * @type {boolean} */ EnableInteractiveZoom: boolean; /** * Returns the error code. This is a runtime, read-only property. - * @type {int} + * @type {number} */ ErrorCode: number; @@ -1495,12 +1614,6 @@ interface WebTwain { */ ErrorString: string; - /** - * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode. - * @type {EnumDWT_FitWindowType} - */ - FitWindowType: EnumDWT_FitWindowType; - /** * Returns or sets the password used to log into the FTP server. * @type {string} @@ -1509,7 +1622,7 @@ interface WebTwain { /** * Returns or sets the port number of the FTP server. - * @type {int} + * @type {number} */ FTPPort: number; @@ -1519,12 +1632,42 @@ interface WebTwain { */ FTPUserName: string; + /** + * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode. + * @type {EnumDWT_FitWindowType} + */ + FitWindowType: EnumDWT_FitWindowType; + + /** + * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property. + * @type {string} + */ + HTTPPostResponseString: string; + + /** + * Returns whether a HTTP request has credentials + * @type {boolean} + */ + HTTPRequestswithCredentials: boolean; + + /** + * Returns or sets the height of the dwt viewer object + * @type {string|number} + */ + Height: string | number; + /** * Returns how many images are in buffer. This is a runtime, read-only property. - * @type {short} + * @type {number} */ HowManyImagesInBuffer: number; + /** + * Specifies the content type of a http upload. + * @type {string} + */ + HttpContentTypeFieldValue: string; + /** * Specifies the field name of uploaded image through POST. * @type {string} @@ -1539,15 +1682,9 @@ interface WebTwain { /** * Returns or sets the port number of the HTTP server. - * @type {int} + * @type {number|string} */ - HTTPPort: number; - - /** - * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property. - * @type {string} - */ - HTTPPostResponseString: string; + HTTPPort: number | string; /** * [Deprecated.] Returns or sets the user name used to log into the HTTP server. @@ -1557,205 +1694,211 @@ interface WebTwain { /** * Returns or sets whether the feature of disk caching is enabled. - * @type {bool} + * @type {boolean} */ IfAllowLocalCache: boolean; /** * Returns or sets whether insert or append new scanned images. - * @type {bool} + * @type {boolean} */ IfAppendImage: boolean; /** * Returns or sets whether the Source's Auto-brightness function is enabled. This is a runtime property. - * @type {bool} + * @type {boolean} */ IfAutoBright: boolean; /** * Returns or sets whether the data source (scanner) will discard blank images during scanning. The property works only if the device and its driver support discarding blank pages. You can find whether your device supports this capbility from its user manual. Or, you can use the built-in methods of Dynamic Web TWAIN to detect blank images: IsBlankImage, IsBlankImageEx. - * @type {bool} + * @type {boolean} */ IfAutoDiscardBlankpages: boolean; /** * Returns or sets whether the Source enable automatic document feeding process. This is a runtime property. - * @type {bool} + * @type {boolean} */ IfAutoFeed: boolean; + /** + * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property. + * @type {boolean} + */ + IfAutoScan: boolean; + + /** + * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images + * @type {boolean} + */ + IfAutoScroll: boolean; + /** * Turns automatic border detection on and off. The property works only if the device and its driver support detecting the border automatically. You can find whether your device supports this capbility from its user manual. - * @type {bool} + * @type {boolean} */ IfAutomaticBorderDetection: boolean; /** * Turns automatic skew correction on and off. - * @type {bool} + * @type {boolean} */ IfAutomaticDeskew: boolean; - /** - * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property. - * @type {bool} - */ - IfAutoScan: boolean; - /** * Returns or sets whether close the Data Source User Interface after acquire all images. Default value of this property is FALSE. - * @type {bool} + * @type {boolean} */ IfDisableSourceAfterAcquire: boolean; /** * Returns or sets whether the Source supports duplex. If TRUE, the scanner scans both sides of a paper; otherwise, the scanner will scan only one side of the image. This is a runtime property. - * @type {bool} + * @type {boolean} */ IfDuplexEnabled: boolean; /** * Returns or sets whether the Automatic Document Feeder (ADF) is enabled. This is a runtime property. - * @type {bool} + * @type {boolean} */ IfFeederEnabled: boolean; /** * Returns whether or not there are documents loaded in the Source's feeder when IfFeederEnabled and IfPaperDetectable are TRUE. This is a runtime, read-only property. - * @type {bool} + * @type {boolean} */ IfFeederLoaded: boolean; /** * Returns or sets whether to resize the image to fit the size of window when the view mode is set to -1 by -1. You can use SetViewMode method to set the view mode. - * @type {bool} + * @type {boolean} */ IfFitWindow: boolean; /** * [Deprecated.] Returns or sets whether the UI (User Interface) of Source runs in modal state. Default value of this property is TRUE. - * @type {bool} + * @type {boolean} */ IfModalUI: boolean; /** * Sets or returns whether Dynamic Web TWAIN uses Graphics Device Interface (GDI) when decoding images. - * @type {bool} + * @type {boolean} */ IfOpenImageWithGDIPlus: boolean; - /** - * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property. - * @type {bool} - */ - IfPaperDetectable: boolean; - /** * Returns or sets whether FTP passive mode is enabled. - * @type {bool} + * @type {boolean} */ IfPASVMode: boolean; + /** + * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property. + * @type {boolean} + */ + IfPaperDetectable: boolean; + + /** + * Returns or sets whether SSL is used when uploading or downloading images. + * @type {boolean} + */ + IfSSL: boolean; + /** * [Deprecated.] Returns or sets whether communicate with device in a separate thread. Default value of this property is FALSE. - * @type {bool} + * @type {boolean} */ IfScanInNewThread: boolean; /** * Sets or returns whether to show the cancel dialog when uploading images to server. - * @type {bool} + * @type {boolean} */ IfShowCancelDialogWhenImageTransfer: boolean; /** * Returns or sets whether to show the file dialog box when saving scanned images or loading images from local folder. - * @type {bool} + * @type {boolean} */ IfShowFileDialog: boolean; /** * Returns or sets whether the Source displays a progress indicator during acquisition and transfer, regardless of whether the Source's user interface is active. This is a runtime property. - * @type {bool} + * @type {boolean} */ IfShowIndicator: boolean; /** * [Deprecated.] Returns or sets whether the driver of the printer displays the User Interface. - * @type {bool} + * @type {boolean} */ IfShowPrintUI: boolean; /** * Returns or sets whether the progress bar will be displayed during the transaction. This is a runtime property. - * @type {bool} + * @type {boolean} */ IfShowProgressBar: boolean; /** * Returns or sets whether the Source displays the User Interface. - * @type {bool} + * @type {boolean} */ IfShowUI: boolean; /** - * Returns or sets whether SSL is used when uploading or downloading images. - * @type {bool} + * Returns or sets whether to throw exceptions + * @type {boolean} */ - IfSSL: boolean; + IfThrowException: boolean; /** * Return or sets whether the Source allows to save many images in one TIFF file. The default value is FALSE. - * @type {bool} + * @type {boolean} */ IfTiffMultiPage: boolean; /** * Returns whether the Source supports acquisition with the UI (User Interface) disabled. If FALSE, indicates that this Source can only support acquisition with the UI enabled. This is a runtime, read-only property. - * @type {bool} + * @type {boolean} */ IfUIControllable: boolean; /** * Sets or returns whether Dynamic Web TWAIN uses the new TWAIN Data Source Manager (TWAINDSM.dll) when acquiring images from TWAIN devices. - * @type {bool} + * @type {boolean} */ IfUseTwainDSM: boolean; - /** - * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images - * @type {bool} - */ - IfAutoScroll: boolean; - /** * [Deprecated.] The number of bits in each image pixel (or bit depth). This is a runtime, read-only property. - * @type {short} + * @type {number} */ ImageBitsPerPixel: number; /** * Returns or sets whether a TWAIN driver or Native Scan of Mac OS X is used for document scanning. This property works for Mac edition only. - * @type {int} + * @type {number} */ ImageCaptureDriverType: number; /** * [Deprecated.] Returns or sets whether the image enumerator is enabled in Image Editor. - * @type {bool} + * @type {boolean} */ ImageEditorIfEnableEnumerator: boolean; /** * [Deprecated.] Returns or sets whether the Image Editor is a modal window. - * @type {bool} + * @type {boolean} */ ImageEditorIfModal: boolean; /** * [Deprecated.] Returns or sets whether the Image Editor is read-only. - * @type {bool} + * @type {boolean} */ ImageEditorIfReadonly: boolean; @@ -1767,37 +1910,37 @@ interface WebTwain { /** * Returns the document number of the current image. This is a runtime, read-only property. - * @type {int} + * @type {number} */ ImageLayoutDocumentNumber: number; /** * Returns the value of the bottom-most edge of the current image frame (in Unit). This is a read-only runtime property. - * @type {float} + * @type {number} */ ImageLayoutFrameBottom: number; /** * Returns the value of the left-most edge of the current image frame (in Unit). This is a runtime, read-only property. - * @type {float} + * @type {number} */ ImageLayoutFrameLeft: number; /** * Returns the frame number of the current image. This is a runtime, read-only property. - * @type {int} + * @type {number} */ ImageLayoutFrameNumber: number; /** * Returns the value of the right-most edge of the current image frame (in Unit). This is a runtime, read-only property. - * @type {float} + * @type {number} */ ImageLayoutFrameRight: number; /** * Returns the value of the top-most edge of the current image frame (in Unit). This is a runtime, read-only property. - * @type {float} + * @type {number} */ ImageLayoutFrameTop: number; @@ -1809,13 +1952,13 @@ interface WebTwain { /** * [Deprecated.] Returns how tall/long, in pixels, the image is. This is a runtime, read-only property. - * @type {int} + * @type {number} */ ImageLength: number; /** * Returns or sets the margin between images when multiple images are displayed in Dynamic Web TWAIN. - * @type {short} + * @type {number} */ ImageMargin: number; @@ -1827,31 +1970,31 @@ interface WebTwain { /** * [Deprecated.] Returns how width, in pixels, the image is. This is a runtime, read-only property. - * @type {int} + * @type {number} */ ImageWidth: number; /** * [Deprecated.] Returns the X resolution of the current image. X resolution is the number of pixels per Unit in the horizontal direction. This is a runtime, read-only property. - * @type {float} + * @type {number} */ ImageXResolution: number; /** * [Deprecated.] Returns the Y resolution of the current image. Y resolution is the number of pixels per Unit in the vertical direction. This is a runtime, read-only property. - * @type {float} + * @type {number} */ ImageYResolution: number; /** * Returns or sets the quality of JPEG files and PDF files using JPEG compression. - * @type {short} + * @type {number} */ JPEGQuality: number; /** * Returns or sets the log level for debugging. - * @type {short} + * @type {number} */ LogLevel: number; @@ -1863,7 +2006,7 @@ interface WebTwain { /** * Return the magnetic type if the scanner support magnetic data recognition. - * @type {short} + * @type {number} */ MagType: number; @@ -1875,46 +2018,40 @@ interface WebTwain { /** * Returns or sets the maximum number of images can be held in buffer. - * @type {short} + * @type {number} */ MaxImagesInBuffer: number; /** * [Deprecated.] Returns or sets how many threads can be used when you upload files through POST. - * @type {int} + * @type {number} */ MaxInternetTransferThreads: number; /** * Sets or returns the maximum allowed size when Dynamic Web TWAIN uploads a document. - * @type {int} + * @type {number} */ MaxUploadImageSize: number; /** * Returns or sets the shape of the mouse. - * @type {bool} + * @type {boolean} */ MouseShape: boolean; /** * Returns the X co-ordinate of the mouse. This is a runtime property. - * @type {int} + * @type {number} */ MouseX: number; /** * Returns the Y co-ordinate of the mouse. This is a runtime property. - * @type {int} + * @type {number} */ MouseY: number; - /** - * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property. - * @type {short} - */ - PageSize: number; - /** * Returns or sets the name of the person who creates the PDF document. * @type {string} @@ -1975,15 +2112,21 @@ interface WebTwain { */ PDFVersion: string; + /** + * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property. + * @type {number} + */ + PageSize: number; + /** * Returns the number of transfers the Source is ready to supply, upon demand. This is a runtime, read-only property. - * @type {short} + * @type {number} */ PendingXfers: number; /** * Returns or sets the pixel flavor for acquired images. This is a runtime property. - * @type {short} + * @type {number} */ PixelFlavor: number; @@ -2005,6 +2148,12 @@ interface WebTwain { */ ProductKey: string; + /** + * Sets or returns the product name string for the application identity. + * @type {string} + */ + ProductName: string; + /** * [Deprecated.] Returns or sets the name of the proxy server. * @type {string} @@ -2013,46 +2162,40 @@ interface WebTwain { /** * Returns or sets the current resolution for acquired images. This is a runtime property. - * @type {float} + * @type {number} */ Resolution: number; /** * Returns or sets how many scanned images are selected. - * @type {short} + * @type {number} */ SelectedImagesCount: number; /** * Returns or sets the border color of the selected image. It is a value specifying the 24-bit RGB value. - * @type {int} + * @type {number} */ SelectionImageBorderColor: number; /** * Specifies a fixed aspect ratio to be used for selecting an area. - * @type {float} + * @type {number} */ SelectionRectAspectRatio: number; + /** + * Specifies whether to show the page number + * @type {boolean} + */ + ShowPageNumber: boolean; + /** * Returns how many sources are installed in the system. This is a runtime, read-only property. - * @type {int} + * @type {number} */ SourceCount: number; - /** - * [Deprecated.] Replaced by GetSourceNameItems method. - * @type {string} - */ - SourceNameItems: string; - - /** - * [Deprecated.] - * @type {string} - */ - GetSourceNames: string; - /** * Returns or sets the compression type of TIFF files. This is a runtime property. * @type {EnumDWT_TIFFCompressionType} @@ -2067,160 +2210,194 @@ interface WebTwain { /** * Returns or sets the unit of measure. This is a runtime property. - * @type {short} + * @type {number} */ Unit: number; + /** + * Specifies whether to show the vertical scroll bar + * @type {boolean} + */ + VScrollBar: boolean; + /** * Sets or returns the version info string for the application identity. * @type {string} */ VersionInfo: string; + /** + * Returns or sets the width of the dwt object viewer + * @type {string|number} + */ + Width: string | number; + /** * Returns and sets the number of images you are willing to transfer per session. This is a runtime property. - * @type {short} + * @type {number} */ XferCount: number; /** * Returns or sets zoom factor for the image, only valid When the view mode is set to -1 by -1. - * @type {float} + * @type {number} */ Zoom: number; + /** ignored + style + _AutoCropMethod + */ /** - * Binds a specified function to an event, so that the function gets called whenever the event fires. - * @method WebTwain#RegisterEvent - * @param {string} name the name of the event that the function is bound to. - * @param {object} evt specifies the function to call when event fires. - * @return {bool} + * Displays the source's built-in interface to acquire image. + * @method WebTwain#AcquireImage + * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} */ - RegisterEvent(name: string, evt: object): boolean; + AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - // --- SCAN start -- + /** + * Add text on an image. + * @method WebTwain#AddText + * @param {number} sImageIndex the index of the image that you want to add text to. + * @param {number} x the x coordinate for the text. + * @param {number} y the y coordinate for the text. + * @param {string} text the content of the text that you want to add. + * @param {number} txtColor the color for the text. + * @param {number} backgroundColor the background color. + * @param {number} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter. + * @param {number} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1 + * @return {boolean} + */ + AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean; /** * Cancels all pending transfers. * @method WebTwain#CancelAllPendingTransfers - * @return {bool} + * @return {boolean} */ CancelAllPendingTransfers(): boolean; /** - * Closes Data Source. - * @method WebTwain#CloseSource - * @return {bool} + * Gets information of the capability specified by the Capability property. + * @method WebTwain#CapGet + * @return {boolean} */ - CloseSource(): boolean; + CapGet(): boolean; /** - * Closes and unloads Data Source Manager. - * @method WebTwain#CloseSourceManager - * @return {bool} + * Returns the Source's current Value for the specified capability. + * @method WebTwain#CapGetCurrent + * @return {boolean} */ - CloseSourceManager(): boolean; + CapGetCurrent(): boolean; /** - * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed. - * @method WebTwain#DisableSource - * @return {bool} + * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value. + * @method WebTwain#CapGetDefault + * @return {boolean} */ - DisableSource(): boolean; + CapGetDefault(): boolean; /** - * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE. - * @method WebTwain#FeedPage - * @return {bool} + * Returns the value of the bottom-most edge of the specified frame. + * @method WebTwain#CapGetFrameBottom + * @param {number} index specifies the value of which frame to get. The index is 0-based. + * @return {number} */ - FeedPage(): boolean; + CapGetFrameBottom(index: number): number; /** - * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc. - * @method WebTwain#GetDeviceType - * @return {int} + * Returns the value (in Unit) of the left-most edge of the specified frame. + * @method WebTwain#CapGetFrameLeft + * @param {number} index specifies the value of which frame to get. The index is 0-based. + * @return {number} */ - GetDeviceType(): number; + CapGetFrameLeft(index: number): number; /** - * Get the source name according to the source index. - * @method WebTwain#GetSourceNameItems - * @param {short} index int index. Index is 0-based and can not be greater than SourceCount property. - * @return {string} + * Returns the value (in Unit) of the left-most edge of the specified frame. + * @method WebTwain#CapGetFrameRight + * @param {number} index specifies the value of which frame to get. The index is 0-based. + * @return {number} */ - GetSourceNameItems(index: number): string; + CapGetFrameRight(index: number): number; /** - * Loads the specified Source into main memory and causes its initialization, - * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is - * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source. - * @method WebTwain#OpenSource - * @return {bool} + * Returns the value (in Unit) of the top-most edge of the specified frame. + * @method WebTwain#CapGetFrameTop + * @param {number} index specifies the value of which frame to get. The index is 0-based. + * @return {number} */ - OpenSource(): boolean; + CapGetFrameTop(index: number): number; + + /* ignored + * CapGetHelp + * CapGetLabel + * CapGetLabels + */ /** - * Loads and opens Data Source Manager. - * @method WebTwain#OpenSourceManager - * @return {bool} + * Queries whether the Source supports a particular operation on the capability. + * @method WebTwain#CapIfSupported + * @param {EnumDWT_MessageType} messageType specifies the type of capability operation. + * @return {boolean} */ - OpenSourceManager(): boolean; + CapIfSupported(messageType: EnumDWT_MessageType): boolean; /** - * Reverts the current image layout to the Data Source's default. - * @method WebTwain#ResetImageLayout - * @return {bool} + * Changes the Current Value of the capability specified by Capability property back to its power-on value. + * @method WebTwain#CapReset + * @return {boolean} */ - ResetImageLayout(): boolean; + CapReset(): boolean; /** - * Sets the Source to return the current page to the input side of the document feeder and - * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE. - * @method WebTwain#RewindPage - * @return {bool} + * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property. + * @method WebTwain#CapSet + * @return {boolean} */ - RewindPage(): boolean; + CapSet(): boolean; /** - * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI) - * so that user can choose which Data Source to be the current Source. - * @method WebTwain#SelectSource - * @return {bool} + * Sets the values of the specified frame. + * @method WebTwain#CapSetFrame + * @param {number} index specifies the values of which frame to set. The index is 0-based. + * @param {number} left the value (in Unit) of the left-most edge of the specified frame. + * @param {number} top the value (in Unit) of the top-most edge of the specified frame. + * @param {number} right the value (in Unit) of the right-most edge of the specified frame. + * @param {number} bottom the value (in Unit) of the bottom-most edge of the specified frame. + * @return {boolean} */ - SelectSource(): boolean; + CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean; /** - * Selects the index-the source in SourceNameItems property as the current source. - * @method WebTwain#SelectSourceByIndex - * @param {short} index It is the index of SourceNameItems property. - * @return {bool} + * Changes the bitdepth of a specified image. + * @method WebTwain#ChangeBitDepth + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} sBitDepth specifies the target bit depth. + * @param {boolean} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time. + * @return {boolean} */ - SelectSourceByIndex(index: number): boolean; + ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean; /** - * Sets file name and file format information used in File Transfer Mode. - * @method WebTwain#SetFileXferInfo - * @param {string} fileName the name of the file to be used in transfer. - * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image. - * @return {bool} + * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately. + * @method WebTwain#ChangeImageSize + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} iNewWidth specifies the pixel width of the new image. + * @param {number} iNewHeight specifies the pixel height of the new image. + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {boolean} */ - SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean; - - /** - * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source. - * @method WebTwain#SetImageLayout - * @param {float} left specifies the floating point number for the left side of the image layout rectangle. - * @param {float} top specifies the floating point number for the top side of the image layout rectangle. - * @param {float} right specifies the floating point number for the right side of the image layout rectangle. - * @param {float} bottom specifies the floating point number for the bottom side of the image layout rectangle. - * @return {bool} - */ - SetImageLayout(left: number, top: number, right: number, bottom: number): boolean; + ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean; /** * Clears all the web forms which are used for image uploading. * @method WebTwain#ClearAllHTTPFormField - * @return {bool} + * @return {boolean} */ ClearAllHTTPFormField(): boolean; @@ -2232,12 +2409,154 @@ interface WebTwain { ClearTiffCustomTag(): void; /** - * Check whether a certain file exists on the local disk. - * @method WebTwain#FileExists - * @param {string} localFile specifies the absolute path of the local file. - * @return {bool} + * Closes Data Source. + * @method WebTwain#CloseSource + * @return {boolean} */ - FileExists(localFile: string): boolean; + CloseSource(): boolean; + + /** + * Closes and unloads Data Source Manager. + * @method WebTwain#CloseSourceManager + * @return {boolean} + */ + CloseSourceManager(): boolean; + + /** + * Closes the current process used to scan + * @method WebTwain#CloseWorkingProcess + * @return {boolean} + */ + CloseWorkingProcess(): boolean; + + /** + * Converts the images specified by the indices to base64. + * @method WebTwain#ConvertToBase64 + * @param {Array} indices indices specifies which images are to be converted to base64. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: (result: any) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Converts the images specified by the indices to base64. + * @method WebTwain#ConvertToBase64 + * @param {Array} indices indices specifies which images are to be converted to base64. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + ConvertToBlob(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: (result: any) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Changes a specified image to gray scale. + * @method WebTwain#ConvertToGrayScale + * @param {number} sIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + ConvertToGrayScale(sIndex: number): boolean; + + /** + * Copies the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CopyToClipboard + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + CopyToClipboard(sImageIndex: number): boolean; + + /** + * Create the font for adding text using the method AddText. + * @method WebTwain#CreateTextFont + * @param {number} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size. + * @param {number} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference. + * @param {number} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis. + * @param {number} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up. + * @param {number} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used. + * @param {number} italic Specifies an italic font if set to TRUE. + * @param {number} underline Specifies an underlined font if set to TRUE. + * @param {number} strikeOut A strikeout font if set to TRUE. + * @param {number} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font. + * @param {number} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch. + * @param {number} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region. + * @param {number} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font. + * @param {number} pitchAndFamily The pitch and family of the font. + * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character. + * @return {boolean} + */ + CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean; + + /** + * Crops the image of a specified index in buffer. + * @method WebTwain#Crop + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {boolean} + */ + Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Crops the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CropToClipboard + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {boolean} + */ + CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Cuts the image data in the specified area to the system clipboard in DIB format. + * @method WebTwain#CutFrameToClipboard + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {boolean} + */ + CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Cuts the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CutToClipboard + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + CutToClipboard(sImageIndex: number): boolean; + + /** + * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed. + * @method WebTwain#DisableSource + * @return {boolean} + */ + DisableSource(): boolean; + + /** + * Enables the source to accept image. + * @method WebTwain#EnableSource + * @return {boolean} + */ + EnableSource(): boolean; + + /** + * Clears the specified area of a specified image, and fill the area with the fill color. + * @method WebTwain#Erase + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {boolean} + */ + Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; /** * Downloads an image from the FTP server. @@ -2246,7 +2565,7 @@ interface WebTwain { * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPDownload(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; @@ -2258,7 +2577,7 @@ interface WebTwain { * @param {string} localFile specify a full path to store the file. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPDownloadDirectly(FTPServer: string, FTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; @@ -2270,7 +2589,7 @@ interface WebTwain { * @param {EnumDWT_ImageType} lImageType simage format of the file to be downloaded. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPDownloadEx(FTPServer: string, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; @@ -2278,11 +2597,11 @@ interface WebTwain { * Uploads the image of a specified index in the buffer to the FTP server. * @method WebTwain#FTPUpload * @param {string} FTPServer the name of the FTP server. - * @param {short} sImageIndex specifies the index of the image in the buffer. The index is 0-based. + * @param {number} sImageIndex specifies the index of the image in the buffer. The index is 0-based. * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPUpload(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; @@ -2294,7 +2613,7 @@ interface WebTwain { * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPUploadDirectly(FTPServer: string, localFile: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; @@ -2302,12 +2621,12 @@ interface WebTwain { * Uploads the image of a specified index in the buffer to the FTP server as a specified image format. * @method WebTwain#FTPUploadEx * @param {string} FTPServer the name of the FTP server. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the FTP server. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPUploadEx(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; @@ -2318,7 +2637,7 @@ interface WebTwain { * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPUploadAllAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; @@ -2329,7 +2648,7 @@ interface WebTwain { * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPUploadAllAsPDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; @@ -2340,7 +2659,7 @@ interface WebTwain { * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPUploadAsMultiPagePDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; @@ -2351,994 +2670,49 @@ interface WebTwain { * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} + * @return {boolean} */ FTPUploadAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; /** - * Downloads an image from the HTTP server. - * @method WebTwain#HTTPDownload - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {bool} + * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE. + * @method WebTwain#FeedPage + * @return {boolean} */ - HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + FeedPage(): boolean; /** - * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN. - * @method WebTwain#HTTPDownloadDirectly - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server. - * @param {string} localFile specify the location to store the downloaded file. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {bool} + * Check whether a certain file exists on the local disk. + * @method WebTwain#FileExists + * @param {string} localFile specifies the absolute path of the local file. + * @return {boolean} */ - HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + FileExists(localFile: string): boolean; /** - * Downloads an image from the HTTP server. - * @method WebTwain#HTTPDownloadEx - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) - * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {bool} + * Flips the image of a specified index in buffer. + * @method WebTwain#Flip + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} */ - HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Download an image from the server using a HTTP Post call. - * @method WebTwain#HTTPDownloadThroughPost - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) - * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method. - * @method WebTwain#HTTPUploadThroughPost - * @param {string} HTTPServer the name of the HTTP server. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {bool} - */ - HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN. - * @method WebTwain#HTTPUploadThroughPostDirectly - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} localFile specifies the path of a local file . - * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the file to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {bool} - */ - HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method. - * @method WebTwain#HTTPUploadThroughPostEx - * @param {string} HTTPServer the name of the HTTP server. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure. - * @return {bool} - */ - HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {bool} - */ - HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {bool} - */ - HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadAllThroughPostAsPDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {bool} - */ - HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {bool} - */ - HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN. - * @method WebTwain#HTTPUploadThroughPutDirectly - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} localFile specifies the path of a local file. - * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method. - * @method WebTwain#HTTPUploadThroughPut - * @param {string} HTTPServer the name of the HTTP server. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method. - * @method WebTwain#HTTPUploadThroughPutEx - * @param {string} HTTPServer the name of the HTTP server. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadAllThroughPutAsPDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Configures how segmented upload is done. - * @method WebTwain#SetUploadSegment - * @param {int} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked. - * @param {int} moduleSize specifies the size of each segment (in KB). - * @return {bool} - */ - SetUploadSegment (segmentUploadThreshold: number, moduleSize: number): boolean; - - /** - * Uploads the images specified by the indices to the HTTP server. - * @method WebTwain#HTTPUpload - * @param {string} url the url where the images are sent in a POST request. - * @param {Array} indices indices specifies which images are to be uploaded. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded. - * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - HTTPUpload (url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN. - * @method WebTwain#LoadDibFromClipboard - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads an image into the Dynamic Web TWAIN. - * @method WebTwain#LoadImage - * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads an image into the Dynamic Web TWAIN. - * @method WebTwain#LoadImageEx - * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads image from a base64 byte array with the specified file format. - * @method WebTwain#LoadImageFromBase64Binary - * @param {string} bry specifies the base64 string data. - * @param {EnumDWT_ImageType} lImageType specifies the file format. - * @return {bool} - */ - LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType): boolean; - - /** - * [Deprecated.] Loads image from a byte array with the specified file format. - * @method WebTwain#LoadImageFromBytes - * @param {int} lBufferSize Specifies the buffer size. - * @param {Array} buffer A byte array of the image data. - * @param {EnumDWT_ImageType} lImageType Specifies the file format. - * @return {bool} - */ - LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean; - - /** - * Saves all images in buffer as a MultiPage TIFF file. - * @method WebTwain#SaveAllAsMultiPageTIFF - * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves all images in buffer as a Multi-Page PDF file. - * @method WebTwain#SaveAllAsPDF - * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the image of a specified index in buffer as a BMP file. - * @method WebTwain#SaveAsBMP - * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - SaveAsBMP(localFile: string, sImageIndex: number): boolean; - - /** - * Saves the image of a specified index in buffer as a JPEG file. - * @method WebTwain#SaveAsJPEG - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - SaveAsJPEG(localFile: string, sImageIndex: number): boolean; - - /** - * Saves the image of a specified index in buffer as a PDF file. - * @method WebTwain#SaveAsPDF - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - SaveAsPDF(localFile: string, sImageIndex: number): boolean; - - /** - * Saves the image of a specified index in buffer as a PNG file. - * @method WebTwain#SaveAsPNG - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - SaveAsPNG(localFile: string, sImageIndex: number): boolean; - - /** - * Saves the image of a specified index in buffer as a TIFF file. - * @method WebTwain#SaveAsTIFF - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - SaveAsTIFF(localFile: string, sImageIndex: number): boolean; - - /** - * Saves the selected images in buffer as a Multipage PDF file. - * @method WebTwain#SaveSelectedImagesAsMultiPagePDF - * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the selected images in buffer as a Multipage TIFF file. - * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF - * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the selected images in buffer to base64 string. - * @method WebTwain#SaveSelectedImagesToBase64Binary - * @return {string} - */ - SaveSelectedImagesToBase64Binary(): string; - - /** - * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format. - * @method WebTwain#SaveSelectedImagesToBytes - * @param {int} bufferSize specified the buffer size. - * @param {Array} buffer A byte array of the image data. - * @return {int} - */ - SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number; - - /** - * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST. - * @method WebTwain#SetCookie - * @param {string} cookie the cookie on current page. - * @return {void} - */ - SetCookie(cookie: string): void; - - /** - * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. - * @method WebTwain#SetHTTPFormField - * @param {string} FieldName specifies the name of a text field in web form. - * @param {string} FieldValue specifies the value of a text field in web form. - * @return {bool} - */ - SetHTTPFormField(FieldName: string, FieldValue: string): boolean; - - /** - * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64. - * @method WebTwain#SetTiffCustomTag - * @param {int} tag specifies the tag identifier. The value should be between 600 and 700. - * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it. - * @param {bool} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text. - * @return {bool} - */ - SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean; - - /** - * Show save file dialog or show open file dialog. - * @method WebTwain#ShowFileDialog - * @param {bool} SaveDialog True -- show save file dialog, False -- show open file dialog. - * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically. - * @param {int} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based. - * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended. - * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms. - * @param {bool} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file. - * @param {bool} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file. - * @param {int} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless. - * @return {bool} - */ - ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean; - - /** - * Gets information of the capability specified by the Capability property. - * @method WebTwain#CapGet - * @return {bool} - */ - CapGet(): boolean; - - /** - * Returns the Source's current Value for the specified capability. - * @method WebTwain#CapGetCurrent - * @return {bool} - */ - CapGetCurrent(): boolean; - - /** - * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value. - * @method WebTwain#CapGetDefault - * @return {bool} - */ - CapGetDefault(): boolean; - - /** - * Returns the value of the bottom-most edge of the specified frame. - * @method WebTwain#CapGetFrameBottom - * @param {short} index specifies the value of which frame to get. The index is 0-based. - * @return {float} - */ - CapGetFrameBottom(index: number): number; - - /** - * Returns the value (in Unit) of the left-most edge of the specified frame. - * @method WebTwain#CapGetFrameLeft - * @param {short} index specifies the value of which frame to get. The index is 0-based. - * @return {float} - */ - CapGetFrameLeft(index: number): number; - - /** - * Returns the value (in Unit) of the left-most edge of the specified frame. - * @method WebTwain#CapGetFrameRight - * @param {short} index specifies the value of which frame to get. The index is 0-based. - * @return {float} - */ - CapGetFrameRight(index: number): number; - - /** - * Returns the value (in Unit) of the top-most edge of the specified frame. - * @method WebTwain#CapGetFrameTop - * @param {short} index specifies the value of which frame to get. The index is 0-based. - * @return {float} - */ - CapGetFrameTop(index: number): number; - - /** - * Queries whether the Source supports a particular operation on the capability. - * @method WebTwain#CapIfSupported - * @param {EnumDWT_MessageType} messageType specifies the type of capability operation. - * @return {bool} - */ - CapIfSupported(messageType: EnumDWT_MessageType): boolean; - - /** - * Changes the Current Value of the capability specified by Capability property back to its power-on value. - * @method WebTwain#CapReset - * @return {bool} - */ - CapReset(): boolean; - - /** - * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property. - * @method WebTwain#CapSet - * @return {bool} - */ - CapSet(): boolean; - - /** - * Sets the values of the specified frame. - * @method WebTwain#CapSetFrame - * @param {short} index specifies the values of which frame to set. The index is 0-based. - * @param {float} left the value (in Unit) of the left-most edge of the specified frame. - * @param {float} top the value (in Unit) of the top-most edge of the specified frame. - * @param {float} right the value (in Unit) of the right-most edge of the specified frame. - * @param {float} bottom the value (in Unit) of the bottom-most edge of the specified frame. - * @return {bool} - */ - CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean; + Flip(sImageIndex: number): boolean; /** * Get the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. * @method WebTwain#GetCapItems - * @param {int} index Index is 0-based. It is the index of the cap item. - * @return {double} + * @param {number} index Index is 0-based. It is the index of the cap item. + * @return {number} */ GetCapItems(index: number): number; /** * Returns the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. * @method WebTwain#GetCapItemsString - * @param {int} index Index is 0-based. It is the index of the cap item. + * @param {number} index Index is 0-based. It is the index of the cap item. * @return {string} */ GetCapItemsString(index: number): string; - /** - * Set the value of the specified cap item. - * @method WebTwain#SetCapItems - * @param {int} index Index is 0-based. It is the index of the cap item. - * @param {double} newVal The Double type of CapItems property is used to present Double, Single(float), Long, int and even boolean types. For string type, please use CapItemsstring property. - * @return {void} - */ - SetCapItems(index: number, newVal: number): void; - - /** - * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. - * @method WebTwain#SetCapItemsString - * @param {int} index Index is 0-based. It is the index of the cap item. - * @param {string} newVal The new value to be set. - * @return {void} - */ - SetCapItemsString(index: number, newVal: string): void; - // --- SCAN end -- - - // --- View & Edit start -- - - /** - * Add text on an image. - * @method WebTwain#AddText - * @param {short} sImageIndex the index of the image that you want to add text to. - * @param {int} x the x coordinate for the text. - * @param {int} y the y coordinate for the text. - * @param {string} text the content of the text that you want to add. - * @param {int} txtColor the color for the text. - * @param {int} backgroundColor the background color. - * @param {float} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter. - * @param {float} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1 - * @return {bool} - */ - AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean; - - /** - * Create the font for adding text using the method AddText. - * @method WebTwain#CreateTextFont - * @param {int} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size. - * @param {int} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference. - * @param {int} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis. - * @param {int} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up. - * @param {int} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used. - * @param {short} italic Specifies an italic font if set to TRUE. - * @param {short} underline Specifies an underlined font if set to TRUE. - * @param {short} strikeOut A strikeout font if set to TRUE. - * @param {short} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font. - * @param {short} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch. - * @param {short} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region. - * @param {short} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font. - * @param {short} pitchAndFamily The pitch and family of the font. - * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character. - * @return {bool} - */ - CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean; - - /** - * Copies the image of a specified index in buffer to clipboard in DIB format. - * @method WebTwain#CopyToClipboard - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - CopyToClipboard(sImageIndex: number): boolean; - - /** - * Clears the specified area of a specified image, and fill the area with the fill color. - * @method WebTwain#Erase - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {bool} - */ - Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Returns the pixel bit depth of the selected image. - * @method WebTwain#GetImageBitDepth - * @param {short} sImageIndex specifies the index of image. The index is 0-based. - * @return {short} - */ - GetImageBitDepth(sImageIndex: number): number; - - /** - * Returns the width (pixels) of the selected image. This is a read-only property. - * @method WebTwain#GetImageWidth - * @param {short} sImageIndex specifies the index of image. The index is 0-based. - * @return {int} - */ - GetImageWidth(sImageIndex: number): number; - - /** - * Returns the height (pixels) of the selected image. This is a read-only property. - * @method WebTwain#GetImageHeight - * @param {short} sImageIndex specifies the index of image. The index is 0-based. - * @return {int} - */ - GetImageHeight(sImageIndex: number): number; - - /** - * Returns the file size of the new image resized from the image of a specified index in buffer. - * @method WebTwain#GetImageSize - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} iWidth specifies the pixel width of the new image. - * @param {int} iHeight specifies the pixel height of the new image. - * @return {double} - */ - GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number; - - /** - * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer. - * @method WebTwain#GetImageSizeWithSpecifiedType - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {short} sImageType specifies the type of an image file.. - * @return {int} - */ - GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: number): number; - - /** - * Return the horizontal resolution of the specified image. - * @method WebTwain#GetImageXResolution - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {int} - */ - GetImageXResolution(sImageIndex: number): number; - - /** - * Return the vertical resolution of the specified image. - * @method WebTwain#GetImageYResolution - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {int} - */ - GetImageYResolution(sImageIndex: number): number; - - /** - * Returns the index of the selected image. - * @method WebTwain#GetSelectedImageIndex - * @param {short} sSelectedIndex specifies the index of the selected image. - * @return {short} - */ - GetSelectedImageIndex(sSelectedIndex: number): number; - - /** - * You can use the method to select images programatically which is ususally done by mouse clicking. - * @method WebTwain#SetSelectedImageIndex - * @param {short} sSelectedIndex this is the index of an array that holds the indices of selected images. - * @param {short} newVal specifies the index of an image that you want to select. - * @return {void} - */ - SetSelectedImageIndex(selectedIndex: number, newVal: number): void; - - /** - * Pre-calculate the file size of the local image file that is saved from the selected images in buffer. - * @method WebTwain#GetSelectedImagesSize - * @param {int} iImageType specifies the type of an image file. - * @return {int} - */ - GetSelectedImagesSize(iImageType: number): number; - - /** - * Check the skew angle of an image by its index in buffer. - * @method WebTwain#GetSkewAngle - * @param {short} sImageIndex the index of the image in the buffer. - * @return {double} - */ - GetSkewAngle(sImageIndex: number): number; - - /** - * Check the skew angle of a rectangular part of an image by its index in buffer. - * @method WebTwain#GetSkewAngleEx - * @param {short} sImageIndex the index of the image in the buffer. - * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {double} - */ - GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number; - - /** - * [Deprecated.] Detects whether a certain area on an image is blank. - * @method WebTwain#IsBlankImageEx - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @param {bool} bFuzzyMatch specifies whether use fuzzy matching when detecting. - * @return {bool} - */ - IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean; - - /** - * Mirrors the image of a specified index in buffer. - * @method WebTwain#Mirror - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - Mirror(sImageIndex: number): boolean; - - /** - * Decorates image of a specified index in buffer with rectangles of transparent color. - * @method WebTwain#OverlayRectangle - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @param {int} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red. - * @param {float} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent. - * @return {bool} - */ - OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean; - - /** - * Removes all images in buffer. - * @method WebTwain#RemoveAllImages - * @return {void} - */ - RemoveAllImages(): void; - - /** - * Removes selected images in buffer. - * @method WebTwain#RemoveAllSelectedImages - * @return {bool} - */ - RemoveAllSelectedImages(): boolean; - - /** - * Removes the image of a specified index in buffer. - * @method WebTwain#RemoveImage - * @param {short} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based. - * @return {bool} - */ - RemoveImage(sImageIndexToBeDeleted: number): boolean; - - // Image Operate - /** - * Rotates the image of a specified index in buffer by specified angle. - * @method WebTwain#Rotate - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {float} fAngle Specifies the rotation angle. - * @param {bool} bKeepSize Keep size or not. - * @return {bool} - */ - Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean; - - /** - * Rotates the image of a specified index in buffer by specified angle. - * @method WebTwain#RotateEx - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {float} fAngle Specifies the rotation angle. - * @param {bool} bKeepSize Keep size or not. - * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. - * @return {bool} - */ - RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean; - - /** - * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise. - * @method WebTwain#RotateLeft - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - RotateLeft(sImageIndex: number): boolean; - - /** - * Rotates the image of a specified index in buffer by 90 degrees clockwise. - * @method WebTwain#RotateRight - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - RotateRight(sImageIndex: number): boolean; - - /** - * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately. - * @method WebTwain#ChangeImageSize - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} iNewWidth specifies the pixel width of the new image. - * @param {int} iNewHeight specifies the pixel height of the new image. - * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. - * @return {bool} - */ - ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean; - - /** - * Flips the image of a specified index in buffer. - * @method WebTwain#Flip - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - Flip(sImageIndex: number): boolean; - - /** - * Crops the image of a specified index in buffer. - * @method WebTwain#Crop - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {bool} - */ - Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Crops the image of a specified index in buffer to clipboard in DIB format. - * @method WebTwain#CropToClipboard - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {bool} - */ - CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Cuts the image data in the specified area to the system clipboard in DIB format. - * @method WebTwain#CutFrameToClipboard - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. - * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. - * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. - * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. - * @return {bool} - */ - CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Cuts the image of a specified index in buffer to clipboard in DIB format. - * @method WebTwain#CutToClipboard - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - CutToClipboard(sImageIndex: number): boolean; - - /** - * Change the DPI (dots per inch) for the specified image. - * @method WebTwain#SetDPI - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} xResolution The horizontal resolution. - * @param {int} yResolution The vertical resolution. - * @param {bool} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true). - * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. - * @return {bool} - */ - SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean; - - /** - * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN. - * @method WebTwain#SetViewMode - * @param {short} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN. - * @param {short} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN.. - * @return {void} - */ - SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void; - - /** - * Moves a specified image. - * @method WebTwain#MoveImage - * @param {short} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based. - * @param {short} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based. - * @return {bool} - */ - MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean; - - /** - * Switchs two images of specified indices in buffer. - * @method WebTwain#SwitchImage - * @param {short} sImageIndex1 specifies the index of image in buffer. The index is 0-based. - * @param {short} sImageIndex2 specifies the index of image in buffer. The index is 0-based. - * @return {bool} - */ - SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean; - - /** - * Shows the GUI of Image Printer. - * @method WebTwain#Print - * @return {bool} - */ - Print(): boolean; - // --- View & Edit end -- - - // --- Upload & Save end -- - - // --- Others --- - /** - * Shows the GUI of Image Editor. - * @method WebTwain#ShowImageEditor - * @return {bool} - */ - ShowImageEditor(): boolean; - - /** - * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires. - * @method WebTwain#UnregisterEvent - * @param {string} name the name of the event. - * @param {object} evt specified the function to be unbound. - * @return {bool} - */ - UnregisterEvent(name: string, evt: object): boolean; - // --- Others end --- - - /** - * Enables the source to accept image. - * @method WebTwain#EnableSource - * @return {bool} - */ - EnableSource(): boolean; - - /** - * Displays the source's built-in interface to acquire image. - * @method WebTwain#AcquireImage - * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - // start from 10.0 - /** - * Change the width of an image in buffer. - * @method WebTwain#SetImageWidth - * @param {short} sImageIndex specifies which image you'd like to change. - * @param {int} iNewWidth specifies how wide you'd like to change the image. - * @return {bool} - */ - SetImageWidth(sImageIndex: number, iNewWidth: number): boolean; - - // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64 - /** - * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile. - * @method WebTwain#SetCustomDSDataEx - * @param {string} value the input string which is encoded with base64. - * @return {bool} - */ - SetCustomDSDataEx(value: string): boolean; - - // Set custom DS data, load data from the specified file - /** - * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile. - * @method WebTwain#SetCustomDSData - * @param {string} fileName the absolute path of the file where the custom data source data is stored. - * @return {bool} - */ - SetCustomDSData(fileName: string): boolean; - // Get custom DS data, and returned string is encoded with base64 /** * Gets custom DS data, the returned string is base64 encoded. @@ -3352,120 +2726,962 @@ interface WebTwain { * Gets custom DS data and save the data in a specified file. * @method WebTwain#GetCustomDSData * @param {string} fileName the path of the file used for storing custom DS data. - * @return {bool} + * @return {boolean} */ GetCustomDSData(fileName: string): boolean; /** - * Changes the bitdepth of a specified image. - * @method WebTwain#ChangeBitDepth - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {short} sBitDepth specifies the target bit depth. - * @param {bool} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time. - * @return {bool} + * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc. + * @method WebTwain#GetDeviceType + * @return {number} */ - ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean; + GetDeviceType(): number; /** - * Changes a specified image to gray scale. - * @method WebTwain#ConvertToGrayScale - * @param {short} sIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} + * Returns the pixel bit depth of the selected image. + * @method WebTwain#GetImageBitDepth + * @param {number} sImageIndex specifies the index of image. The index is 0-based. + * @return {number} */ - ConvertToGrayScale(sIndex: number): boolean; + GetImageBitDepth(sImageIndex: number): number; /** - * [Deprecated.] Shows the GUI of Image Editor with custom settings. - * @method WebTwain#ShowImageEditorEx - * @param {int} x specifies the new position of the left top corner of the window. - * @param {int} y specifies the new position of the left top corner of the window. - * @param {int} cx specifies the width of the window. - * @param {int} cy specifies the height of the window. - * @param {int} nCmdShow specifices how the window should be shown. - * @return {bool} + * Returns the height (pixels) of the selected image. This is a read-only property. + * @method WebTwain#GetImageHeight + * @param {number} sImageIndex specifies the index of image. The index is 0-based. + * @return {number} */ - ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean; + GetImageHeight(sImageIndex: number): number; + + /*work on + GetImagePartURL + */ /** - * [Deprecated.] Detects whether an image is blank. - * @method WebTwain#IsBlankImage - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} + * Returns the file size of the new image resized from the image of a specified index in buffer. + * @method WebTwain#GetImageSize + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} iWidth specifies the pixel width of the new image. + * @param {number} iHeight specifies the pixel height of the new image. + * @return {number} */ - IsBlankImage(sImageIndex: number): boolean; + GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number; /** - * Detects whether a specific image is blank. - * @method WebTwain#IsBlankImageExpress - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {bool} + * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer. + * @method WebTwain#GetImageSizeWithSpecifiedType + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} sImageType specifies the type of an image file.. + * @return {number} */ - IsBlankImageExpress(sImageIndex: number): boolean; - - /** - * [Deprecated.] Detects whether a specific image is blank. - * @method WebTwain#GetBarcodeInfo - * @param {int} barcodeInfoType Defined in TWAIN Specification. - * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based. - * @return {object} - */ - GetBarcodeInfo(barcodeInfoType: number, barcodeIndex: number): object; - - /** - * [Deprecated.] Gets the content from a specified barcode. - * @method WebTwain#GetBarcodeText - * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based. - * @return {bool} - */ - GetBarcodeText(barcodeIndex: number): boolean; - - /** - * Sets the default source to use. It's only valid when IfUseTWAINDSM is set to true. - * @method WebTwain#SetDefaultSource - * @param {short} sImageIndex specifies the index of the default source. The index is 0-based. - * @return {bool} - */ - SetDefaultSource(sImageIndex: number): boolean; - - /** - * Draws a rectangle on the viewer which represents the selected area. - * @method WebTwain#SetSelectedImageArea - * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {int} left The X axis of the left border. - * @param {int} top The Y axis of the top border. - * @param {int} right The X axis of the right border. - * @param {int} bottom The Y axis of the bottom border. - * @return {bool} - */ - SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Converts the images specified by the indices to base64. - * @method WebTwain#ConvertToBase64 - * @param {Array} indices indices specifies which images are to be converted to base64. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: number): number; /** * Returns the direct URL of an image specified by index, if iWidth or iHeight is set to -1, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio. * @method WebTwain#GetImageURL - * @param {short} index the index of the image. - * @param {int} iWidth the width of the image. - * @param {int} iHeight the height of the image. + * @param {number} index the index of the image. + * @param {number} iWidth the width of the image. + * @param {number} iHeight the height of the image. * @return {string} */ GetImageURL(index: number, iWidth: number, iHeight: number): string; + /** + * Returns the width (pixels) of the selected image. This is a read-only property. + * @method WebTwain#GetImageWidth + * @param {number} sImageIndex specifies the index of image. The index is 0-based. + * @return {number} + */ + GetImageWidth(sImageIndex: number): number; + + /** + * Return the horizontal resolution of the specified image. + * @method WebTwain#GetImageXResolution + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {number} + */ + GetImageXResolution(sImageIndex: number): number; + + /** + * Return the vertical resolution of the specified image. + * @method WebTwain#GetImageYResolution + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {number} + */ + GetImageYResolution(sImageIndex: number): number; + + /** + * Return the runtime license info. + * @method WebTwain#GetLicenseInfo + */ + GetLicenseInfo(): { Domain: string, Detail: any[] }; + + /** + * Returns the index of the selected image. + * @method WebTwain#GetSelectedImageIndex + * @param {number} sSelectedIndex specifies the index of the selected image. + * @return {number} + */ + GetSelectedImageIndex(sSelectedIndex: number): number; + + /** + * Pre-calculate the file size of the local image file that is saved from the selected images in buffer. + * @method WebTwain#GetSelectedImagesSize + * @param {number} iImageType specifies the type of an image file. + * @return {number} + */ + GetSelectedImagesSize(iImageType: number): number; + + /** + * Check the skew angle of an image by its index in buffer. + * @method WebTwain#GetSkewAngle + * @param {number} sImageIndex the index of the image in the buffer. + * @return {number} + */ + GetSkewAngle(sImageIndex: number): number; + + /** + * Check the skew angle of a rectangular part of an image by its index in buffer. + * @method WebTwain#GetSkewAngleEx + * @param {number} sImageIndex the index of the image in the buffer. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {number} + */ + GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number; + + /** + * Get the source name according to the source index. + * @method WebTwain#GetSourceNameItems + * @param {number} index number index. Index is 0-based and can not be greater than SourceCount property. + * @return {string} + */ + GetSourceNameItems(index: number): string; + + /*ignored + GetSourceNames + GetSourceType + GetVersionInfoAsync + */ + + /** + * Downloads an image from the HTTP server. + * @method WebTwain#HTTPDownload + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPDownloadDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server. + * @param {string} localFile specify the location to store the downloaded file. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Downloads an image from the HTTP server. + * @method WebTwain#HTTPDownloadEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) + * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /*ignored + HTTPDownloadStreamThroughPost + HTTPDownloadThroughGet + */ + + /** + * Download an image from the server using a HTTP Post call. + * @method WebTwain#HTTPDownloadThroughPost + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) + * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the images specified by the indices to the HTTP server. + * @method WebTwain#HTTPUpload + * @param {string} url the url where the images are sent in a POST request. + * @param {Array} indices indices specifies which images are to be uploaded. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded. + * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadAllThroughPostAsPDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadAllThroughPutAsPDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /*ignored + HTTPUploadStreamThroughPost + */ + + /** + * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method. + * @method WebTwain#HTTPUploadThroughPost + * @param {string} HTTPServer the name of the HTTP server. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPUploadThroughPostDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} localFile specifies the path of a local file . + * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the file to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method. + * @method WebTwain#HTTPUploadThroughPostEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure. + * @return {boolean} + */ + HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method. + * @method WebTwain#HTTPUploadThroughPut + * @param {string} HTTPServer the name of the HTTP server. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPUploadThroughPutDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} localFile specifies the path of a local file. + * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method. + * @method WebTwain#HTTPUploadThroughPutEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Detects whether an image is blank. + * @method WebTwain#IsBlankImage + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + IsBlankImage(sImageIndex: number): boolean; + + /** + * [Deprecated.] Detects whether a certain area on an image is blank. + * @method WebTwain#IsBlankImageEx + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @param {boolean} bFuzzyMatch specifies whether use fuzzy matching when detecting. + * @return {boolean} + */ + IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean; + + /** + * Detects whether a specific image is blank. + * @method WebTwain#IsBlankImageExpress + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + IsBlankImageExpress(sImageIndex: number): boolean; + + /** + * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN. + * @method WebTwain#LoadDibFromClipboard + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads an image into the Dynamic Web TWAIN. + * @method WebTwain#LoadImage + * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads an image into the Dynamic Web TWAIN. + * @method WebTwain#LoadImageEx + * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads image from a base64 byte array with the specified file format. + * @method WebTwain#LoadImageFromBase64Binary + * @param {string} bry specifies the base64 string data. + * @param {EnumDWT_ImageType} lImageType specifies the file format. + * @return {boolean} + */ + LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Loads image from a byte array with the specified file format. + * @method WebTwain#LoadImageFromBytes + * @param {number} lBufferSize Specifies the buffer size. + * @param {Array} buffer A byte array of the image data. + * @param {EnumDWT_ImageType} lImageType Specifies the file format. + * @return {boolean} + */ + LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean; + + /** + * Mirrors the image of a specified index in buffer. + * @method WebTwain#Mirror + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + Mirror(sImageIndex: number): boolean; + + /** + * Moves a specified image. + * @method WebTwain#MoveImage + * @param {number} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based. + * @param {number} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based. + * @return {boolean} + */ + MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean; + + /*ignored + OnRefreshUI + */ + + /** + * Loads the specified Source into main memory and causes its initialization, + * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is + * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source. + * @method WebTwain#OpenSource + * @return {boolean} + */ + OpenSource(): boolean; + + /** + * Loads and opens Data Source Manager. + * @method WebTwain#OpenSourceManager + * @return {boolean} + */ + OpenSourceManager(): boolean; + + /** + * Decorates image of a specified index in buffer with rectangles of transparent color. + * @method WebTwain#OverlayRectangle + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @param {number} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red. + * @param {number} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent. + * @return {boolean} + */ + OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean; + + /** + * Shows the GUI of Image Printer. + * @method WebTwain#Print + * @return {boolean} + */ + Print(): boolean; + + /** + * Binds a specified function to an event, so that the function gets called whenever the event fires. + * @method WebTwain#RegisterEvent + * @param {string} name the name of the event that the function is bound to. + * @param {object} evt specifies the function to call when event fires. + * @return {boolean} + */ + RegisterEvent(name: string, evt: object): boolean; + + /** + * Removes all images in buffer. + * @method WebTwain#RemoveAllImages + * @return {void} + */ + RemoveAllImages(): void; + + /** + * Removes selected images in buffer. + * @method WebTwain#RemoveAllSelectedImages + * @return {boolean} + */ + RemoveAllSelectedImages(): boolean; + + /** + * Removes the image of a specified index in buffer. + * @method WebTwain#RemoveImage + * @param {number} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based. + * @return {boolean} + */ + RemoveImage(sImageIndexToBeDeleted: number): boolean; + + /** + * Reverts the current image layout to the Data Source's default. + * @method WebTwain#ResetImageLayout + * @return {boolean} + */ + ResetImageLayout(): boolean; + + /** + * Sets the Source to return the current page to the input side of the document feeder and + * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE. + * @method WebTwain#RewindPage + * @return {boolean} + */ + RewindPage(): boolean; + + /** + * Rotates the image of a specified index in buffer by specified angle. + * @method WebTwain#Rotate + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} fAngle Specifies the rotation angle. + * @param {boolean} bKeepSize Keep size or not. + * @return {boolean} + */ + Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean; + + /** + * Rotates the image of a specified index in buffer by specified angle. + * @method WebTwain#RotateEx + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} fAngle Specifies the rotation angle. + * @param {boolean} bKeepSize Keep size or not. + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {boolean} + */ + RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise. + * @method WebTwain#RotateLeft + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + RotateLeft(sImageIndex: number): boolean; + + /** + * Rotates the image of a specified index in buffer by 90 degrees clockwise. + * @method WebTwain#RotateRight + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + RotateRight(sImageIndex: number): boolean; + + /** + * Saves all images in buffer as a MultiPage TIFF file. + * @method WebTwain#SaveAllAsMultiPageTIFF + * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves all images in buffer as a Multi-Page PDF file. + * @method WebTwain#SaveAllAsPDF + * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a BMP file. + * @method WebTwain#SaveAsBMP + * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsBMP(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /*ignored + SaveAsGIF + */ + + /** + * Saves the image of a specified index in buffer as a JPEG file. + * @method WebTwain#SaveAsJPEG + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsJPEG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a PDF file. + * @method WebTwain#SaveAsPDF + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsPDF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a PNG file. + * @method WebTwain#SaveAsPNG + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsPNG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a TIFF file. + * @method WebTwain#SaveAsTIFF + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SaveAsTIFF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer as a Multipage PDF file. + * @method WebTwain#SaveSelectedImagesAsMultiPagePDF + * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer as a Multipage TIFF file. + * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF + * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {boolean} + */ + SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer to base64 string. + * @method WebTwain#SaveSelectedImagesToBase64Binary + * @return {string|bool} + */ + SaveSelectedImagesToBase64Binary(optionalAsyncSuccessFunc?: (result: string[]) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): string | boolean; + + /** + * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format. + * @method WebTwain#SaveSelectedImagesToBytes + * @param {number} bufferSize specified the buffer size. + * @param {Array} buffer A byte array of the image data. + * @return {number} + */ + SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number; + + /** + * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI) + * so that user can choose which Data Source to be the current Source. + * @method WebTwain#SelectSource + * @return {boolean} + */ + SelectSource(): boolean; + + /** + * Selects the index-the source in SourceNameItems property as the current source. + * @method WebTwain#SelectSourceByIndex + * @param {number} index It is the index of SourceNameItems property. + * @return {boolean} + */ + SelectSourceByIndex(index: number): boolean; + + /*ignored + SetCancel + */ + + /** + * Set the value of the specified cap item. + * @method WebTwain#SetCapItems + * @param {number} index Index is 0-based. It is the index of the cap item. + * @param {number} newVal For string type, please use CapItemsstring property. + * @return {void} + */ + SetCapItems(index: number, newVal: number): void; + + /** + * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#SetCapItemsString + * @param {number} index Index is 0-based. It is the index of the cap item. + * @param {string} newVal The new value to be set. + * @return {void} + */ + SetCapItemsString(index: number, newVal: string): void; + + /** + * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST. + * @method WebTwain#SetCookie + * @param {string} cookie the cookie on current page. + * @return {void} + */ + SetCookie(cookie: string): void; + + // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64 + /** + * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile. + * @method WebTwain#SetCustomDSDataEx + * @param {string} value the input string which is encoded with base64. + * @return {boolean} + */ + SetCustomDSDataEx(value: string): boolean; + + // Set custom DS data, load data from the specified file + /** + * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile. + * @method WebTwain#SetCustomDSData + * @param {string} fileName the absolute path of the file where the custom data source data is stored. + * @return {boolean} + */ + SetCustomDSData(fileName: string): boolean; + + /** + * Change the DPI (dots per inch) for the specified image. + * @method WebTwain#SetDPI + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} xResolution The horizontal resolution. + * @param {number} yResolution The vertical resolution. + * @param {boolean} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true). + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {boolean} + */ + SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Sets file name and file format information used in File Transfer Mode. + * @method WebTwain#SetFileXferInfo + * @param {string} fileName the name of the file to be used in transfer. + * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image. + * @return {boolean} + */ + SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean; + + /** + * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. + * @method WebTwain#SetHTTPFormField + * @param {string} FieldName specifies the name of a text field in web form. + * @param {string} FieldValue specifies the value of a text field in web form. + * @return {boolean} + */ + SetHTTPFormField(FieldName: string, FieldValue: string): boolean; + /** * Sets a header for the current HTTP Post request. * @method WebTwain#SetHTTPHeader * @param {string} key the key of the header. * @param {string} value the value of the header. - * @return {bool} + * @return {boolean} */ SetHTTPHeader(key: string, value: string): boolean; + + /** + * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source. + * @method WebTwain#SetImageLayout + * @param {number} left specifies the floating point number for the left side of the image layout rectangle. + * @param {number} top specifies the floating point number for the top side of the image layout rectangle. + * @param {number} right specifies the floating point number for the right side of the image layout rectangle. + * @param {number} bottom specifies the floating point number for the bottom side of the image layout rectangle. + * @return {boolean} + */ + SetImageLayout(left: number, top: number, right: number, bottom: number): boolean; + + /** + * Change the width of an image in buffer. + * @method WebTwain#SetImageWidth + * @param {number} sImageIndex specifies which image you'd like to change. + * @param {number} iNewWidth specifies how wide you'd like to change the image. + * @return {boolean} + */ + SetImageWidth(sImageIndex: number, iNewWidth: number): boolean; + + /** + * Set the language for the authorization dialogs. + * @method WebTwain#SetLanguage + * @param {EnumDWT_Language} language specify the language + * @return {boolean} + */ + SetLanguage(language: EnumDWT_Language): boolean; + + /** + * Sets the time-out used to open a specified Data Source. + * @method WebTwain#SetOpenSourceTimeout + * @param {number} iMilliseconds specifies the number of milliseconds. + * @return {boolean} + */ + SetOpenSourceTimeout(iMilliseconds: number): boolean; + + /** + * Draws a rectangle on the viewer which represents the selected area. + * @method WebTwain#SetSelectedImageArea + * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {number} left The X axis of the left border. + * @param {number} top The Y axis of the top border. + * @param {number} right The X axis of the right border. + * @param {number} bottom The Y axis of the bottom border. + * @return {boolean} + */ + SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * You can use the method to select images programatically which is ususally done by mouse clicking. + * @method WebTwain#SetSelectedImageIndex + * @param {number} sSelectedIndex this is the index of an array that holds the indices of selected images. + * @param {number} newVal specifies the index of an image that you want to select. + * @return {void} + */ + SetSelectedImageIndex(selectedIndex: number, newVal: number): void; + + /** + * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64. + * @method WebTwain#SetTiffCustomTag + * @param {number} tag specifies the tag identifier. The value should be between 600 and 700. + * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it. + * @param {boolean} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text. + * @return {boolean} + */ + SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean; + + /** + * Configures how segmented upload is done. + * @method WebTwain#SetUploadSegment + * @param {number} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked. + * @param {number} moduleSize specifies the size of each segment (in KB). + * @return {boolean} + */ + SetUploadSegment(segmentUploadThreshold: number, moduleSize: number): boolean; + + /** + * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN. + * @method WebTwain#SetViewMode + * @param {number} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN. + * @param {number} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN.. + * @return {void} + */ + SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void; + + /** + * Show save file dialog or show open file dialog. + * @method WebTwain#ShowFileDialog + * @param {boolean} SaveDialog True -- show save file dialog, False -- show open file dialog. + * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically. + * @param {number} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based. + * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended. + * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms. + * @param {boolean} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file. + * @param {boolean} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file. + * @param {number} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless. + * @return {boolean} + */ + ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean; + + /** + * Shows the GUI of Image Editor. + * @method WebTwain#ShowImageEditor + * @return {boolean} + */ + ShowImageEditor(): boolean; + + /** + * [Deprecated.] Shows the GUI of Image Editor with custom settings. + * @method WebTwain#ShowImageEditorEx + * @param {number} x specifies the new position of the left top corner of the window. + * @param {number} y specifies the new position of the left top corner of the window. + * @param {number} cx specifies the width of the window. + * @param {number} cy specifies the height of the window. + * @param {number} nCmdShow specifices how the window should be shown. + * @return {boolean} + */ + ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean; + + /*ingored + SourceNameItems + */ + + /** + * Switchs two images of specified indices in buffer. + * @method WebTwain#SwitchImage + * @param {number} sImageIndex1 specifies the index of image in buffer. The index is 0-based. + * @param {number} sImageIndex2 specifies the index of image in buffer. The index is 0-based. + * @return {boolean} + */ + SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean; + + /** + * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires. + * @method WebTwain#UnregisterEvent + * @param {string} name the name of the event. + * @param {object} evt specified the function to be unbound. + * @return {boolean} + */ + UnregisterEvent(name: string, evt: object): boolean; + + /*ignored + checkErrorString + first + getInstance + last + next + on + onEvent + previous + + ...other internal ones + */ } diff --git a/types/dynogels/dynogels-tests.ts b/types/dynogels/dynogels-tests.ts index ca16707256..a7634548e7 100644 --- a/types/dynogels/dynogels-tests.ts +++ b/types/dynogels/dynogels-tests.ts @@ -148,12 +148,14 @@ dynogels.dynamoDriver(dynamodb); // Saving Models To DynamoDB Account.create({ email: 'foo@example.com', name: 'Foo Bar', age: 21 }, (err, acc) => { - acc.get('email'); + const email = acc.get('email') as string; + console.log(`Created account ${email}`); }); const acc = new Account({ email: 'test@example.com', name: 'Test Example' }); acc.save((err) => { - acc.get('email'); + const email = acc.get('email') as string; + console.log(`Created account ${email}`); }); BlogPost.create({ diff --git a/types/dynogels/index.d.ts b/types/dynogels/index.d.ts index 4742af5a04..dd6aedf907 100644 --- a/types/dynogels/index.d.ts +++ b/types/dynogels/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for dynogels 8.0 +// Type definitions for dynogels 9.0 // Project: https://github.com/clarkie/dynogels#readme // Definitions by: Spartan Labs // Ramon de Klein +// Stephen Tuso // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -153,7 +154,8 @@ export interface ModelConfig { // Dynogels Item export interface Item { - get(key?: string): { [key: string]: any }; + get(): { [key: string]: any }; + get(key: string): any; set(params: {}): Item; save(callback?: DynogelsItemCallback): void; update(options: UpdateItemOptions, callback?: DynogelsItemCallback): void; diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index 9eec5ed467..ea3de94436 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -71,7 +71,7 @@ declare module 'ember-data' { inverse?: string | null; polymorphic?: boolean; } - ): Ember.ComputedProperty>; + ): Ember.ComputedProperty, ModelRegistry[K]>; /** * `DS.hasMany` is used to define One-To-Many and Many-To-Many * relationships on a [DS.Model](/api/data/classes/DS.Model.html). @@ -91,7 +91,7 @@ declare module 'ember-data' { inverse?: string | null; polymorphic?: boolean; } - ): Ember.ComputedProperty>; + ): Ember.ComputedProperty, Ember.Array>; /** * This method normalizes a modelName into the format Ember Data uses * internally. diff --git a/types/ember-data/test/belongs-to.ts b/types/ember-data/test/belongs-to.ts index bd1037a65e..31977c148c 100644 --- a/types/ember-data/test/belongs-to.ts +++ b/types/ember-data/test/belongs-to.ts @@ -1,6 +1,8 @@ import DS from 'ember-data'; import { assertType } from './lib/assert'; +declare const store: DS.Store; + class Folder extends DS.Model { name = DS.attr('string'); children = DS.hasMany('folder', { inverse: 'parent' }); @@ -19,4 +21,9 @@ assertType(folder.get('parent').get('name')); folder.get('parent').then(parent => { assertType(parent); assertType(parent.get('name')); + folder.set('parent', parent); }); + +folder.set('parent', folder); +folder.set('parent', folder.get('parent')); +folder.set('parent', store.findRecord('folder', 3)); diff --git a/types/ember-data/test/has-many.ts b/types/ember-data/test/has-many.ts index e24fb1b814..480a6bd56d 100644 --- a/types/ember-data/test/has-many.ts +++ b/types/ember-data/test/has-many.ts @@ -1,3 +1,4 @@ +import Ember from 'ember'; import DS from 'ember-data'; import { assertType } from './lib/assert'; @@ -44,6 +45,10 @@ blogPost.get('commentsAsync').then(comments => { assertType(comments.get('firstObject')!.get('text')); }); +blogPost.set('commentsAsync', blogPost.get('commentsAsync')); +blogPost.set('commentsAsync', Ember.A()); +blogPost.set('commentsAsync', Ember.A([ comment! ])); + class PaymentMethod extends DS.Model {} declare module 'ember-data' { interface ModelRegistry { diff --git a/types/ember-mocha/index.d.ts b/types/ember-mocha/index.d.ts index f43982fda8..1d24564e31 100644 --- a/types/ember-mocha/index.d.ts +++ b/types/ember-mocha/index.d.ts @@ -62,17 +62,4 @@ declare module 'mocha' { // augment test callback context interface ITestCallbackContext extends TestContext {} interface IHookCallbackContext extends TestContext {} - - // re-export mocha globals as named exports - export const describe: Mocha.IContextDefinition; - export const context: Mocha.IContextDefinition; - export const it: Mocha.ITestDefinition; - export const setup: mochaSetup; - export const teardown: mochaTeardown; - export const suiteSetup: mochaSuiteSetup; - export const suiteTeardown: mochaSuiteTeardown; - export const before: mochaBefore; - export const after: mochaAfter; - export const beforeEach: mochaBeforeEach; - export const afterEach: mochaAfterEach; } diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index dd3ed1ec64..6d8adebae2 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -28,7 +28,8 @@ declare module 'ember' { /** * Deconstructs computed properties into the types which would be returned by `.get()`. */ - type ComputedProperties = { [K in keyof T]: Ember.ComputedProperty | ModuleComputed | T[K] }; + type ComputedPropertyGetters = { [K in keyof T]: Ember.ComputedProperty | ModuleComputed | T[K] }; + type ComputedPropertySetters = { [K in keyof T]: Ember.ComputedProperty | ModuleComputed | T[K] }; /** * Check that any arguments to `create()` match the type's properties. @@ -683,7 +684,7 @@ declare module 'ember' { will be cached. You can specify various properties that your computed property is dependent on. This will force the cached result to be recomputed if the dependencies are modified. **/ - class ComputedProperty { + class ComputedProperty { /** * Call on a computed property to set it into non-cached mode. When in this * mode the computed property will not automatically cache the return value. @@ -812,7 +813,7 @@ declare module 'ember' { static create(this: EmberClassConstructor): Fix; static create>( - this: EmberClassConstructor>, + this: EmberClassConstructor>, arg1: T1 & ThisType> ): Fix; @@ -822,7 +823,7 @@ declare module 'ember' { T1 extends EmberInstanceArguments, T2 extends EmberInstanceArguments >( - this: EmberClassConstructor>, + this: EmberClassConstructor>, arg1: T1 & ThisType>, arg2: T2 & ThisType> ): Fix; @@ -834,7 +835,7 @@ declare module 'ember' { T2 extends EmberInstanceArguments, T3 extends EmberInstanceArguments >( - this: EmberClassConstructor>, + this: EmberClassConstructor>, arg1: T1 & ThisType>, arg2: T2 & ThisType>, arg3: T3 & ThisType> @@ -1641,27 +1642,27 @@ declare module 'ember' { /** * Retrieves the value of a property from the object. */ - get(this: ComputedProperties, key: K): T[K]; + get(this: ComputedPropertyGetters, key: K): T[K]; /** * To get the values of multiple properties at once, call `getProperties` * with a list of strings or an array: */ - getProperties(this: ComputedProperties, list: K[]): Pick; + getProperties(this: ComputedPropertyGetters, list: K[]): Pick; getProperties( - this: ComputedProperties, + this: ComputedPropertyGetters, ...list: K[] ): Pick; /** * Sets the provided key or path to the value. */ - set(this: ComputedProperties, key: K, value: T[K]): T[K]; + set(this: ComputedPropertySetters, key: K, value: T[K]): T[K]; /** * Sets a list of properties at once. These properties are set inside * a single `beginPropertyChanges` and `endPropertyChanges` batch, so * observers will be buffered. */ setProperties( - this: ComputedProperties, + this: ComputedPropertySetters, hash: Pick ): Pick; /** @@ -1692,7 +1693,7 @@ declare module 'ember' { * property returns `undefined`. */ getWithDefault( - this: ComputedProperties, + this: ComputedPropertyGetters, key: K, defaultValue: T[K] ): T[K]; @@ -1715,7 +1716,7 @@ declare module 'ember' { * without accidentally invoking it if it is intended to be * generated lazily. */ - cacheFor(this: ComputedProperties, key: K): T[K] | undefined; + cacheFor(this: ComputedPropertyGetters, key: K): T[K] | undefined; } const Observable: Mixin; /** @@ -2989,7 +2990,7 @@ declare module 'ember' { * it to be created. */ function cacheFor( - obj: ComputedProperties, + obj: ComputedPropertyGetters, key: K ): T[K] | undefined; /** @@ -3028,12 +3029,12 @@ declare module 'ember' { * with an object followed by a list of strings or an array: */ function getProperties( - obj: ComputedProperties, + obj: ComputedPropertyGetters, list: K[] ): Pick; function getProperties(obj: T, list: K[]): Pick; // for dynamic K function getProperties( - obj: ComputedProperties, + obj: ComputedPropertyGetters, ...list: K[] ): Pick; function getProperties(obj: T, ...list: K[]): Pick; // for dynamic K @@ -3120,14 +3121,14 @@ declare module 'ember' { * the function will be invoked. If the property is not defined but the * object implements the `unknownProperty` method then that will be invoked. */ - function get(obj: ComputedProperties, key: K): T[K]; + function get(obj: ComputedPropertyGetters, key: K): T[K]; function get(obj: T, key: K): T[K]; // for dynamic K /** * Retrieves the value of a property from an Object, or a default value in the * case that the property returns `undefined`. */ function getWithDefault( - obj: ComputedProperties, + obj: ComputedPropertyGetters, key: K, defaultValue: T[K] ): T[K]; @@ -3139,7 +3140,7 @@ declare module 'ember' { * method then that will be invoked as well. */ function set( - obj: ComputedProperties, + obj: ComputedPropertySetters, key: K, value: V ): V; @@ -3155,7 +3156,7 @@ declare module 'ember' { * observers will be buffered. */ function setProperties( - obj: ComputedProperties, + obj: ComputedPropertySetters, hash: Pick ): Pick; function setProperties(obj: T, hash: Pick): Pick; // for dynamic K @@ -3499,6 +3500,12 @@ declare module '@ember/enumerable' { export default Enumerable; } +declare module '@ember/error' { + import Ember from 'ember'; + const Error: typeof Ember.Error; + export default Error; +} + declare module '@ember/instrumentation' { import Ember from 'ember'; export const instrument: typeof Ember.instrument; @@ -3534,7 +3541,7 @@ declare module '@ember/object' { declare module '@ember/object/computed' { import Ember from 'ember'; - export default class ComputedProperty extends Ember.ComputedProperty { } + export default class ComputedProperty extends Ember.ComputedProperty { } export const alias: typeof Ember.computed.alias; export const and: typeof Ember.computed.and; export const bool: typeof Ember.computed.bool; diff --git a/types/ember/test/error.ts b/types/ember/test/error.ts new file mode 100644 index 0000000000..ad3c2ee8c3 --- /dev/null +++ b/types/ember/test/error.ts @@ -0,0 +1,6 @@ +import { assertType } from "./lib/assert"; + +import Ember from "ember"; +import EmberError from "@ember/error"; + +assertType(EmberError); diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index 19c8cf4b50..cbdb6b6afc 100755 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -23,6 +23,7 @@ "test/lib/assert.ts", "test/application.ts", "test/ember-tests.ts", + "test/error.ts", "test/event.ts", "test/extend.ts", "test/create.ts", @@ -49,4 +50,4 @@ "test/route.ts", "test/view-utils.ts" ] -} \ No newline at end of file +} diff --git a/types/ethereumjs-util/ethereumjs-util-tests.ts b/types/ethereumjs-util/ethereumjs-util-tests.ts new file mode 100644 index 0000000000..5159dcf758 --- /dev/null +++ b/types/ethereumjs-util/ethereumjs-util-tests.ts @@ -0,0 +1,4 @@ +import * as assert from "assert"; +import * as etherUtil from "ethereumjs-util"; + +assert.ok(etherUtil.isValidAddress("0x0bfe6d9a4d4a73857db6fac276669ba45ee69b48")); diff --git a/types/ethereumjs-util/index.d.ts b/types/ethereumjs-util/index.d.ts new file mode 100644 index 0000000000..7a29b38ff5 --- /dev/null +++ b/types/ethereumjs-util/index.d.ts @@ -0,0 +1,83 @@ +// Type definitions for ethereumjs-util 5.1 +// Project: https://github.com/ethereumjs/ethereumjs-util#readme +// Definitions by: Juan J. Jimenez-Anca +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +// TODO: import types for [`BN`](https://github.com/indutny/bn.js) +// TODO: MAX_INTEGER as type of BN +// TODO: import types for [`rlp`](https://github.com/ethereumjs/rlp) +// TODO: import types for [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/) + +export const SHA3_NULL_S: string; + +export const SHA3_RLP_ARRAY_S: string; + +export const SHA3_RLP_S: string; + +export function addHexPrefix(str: string): string; + +export function arrayContainsArray(superset: any, subset: any, some: any): any; + +export function baToJSON(ba: Buffer | string[]): Buffer | string[]; + +export function bufferToHex(buf: Buffer): string; + +export function bufferToInt(buf: Buffer): string; + +export function defineProperties(self: {[k: string]: any}, fields: string[], data: {[k: string]: any}): {[k: string]: any}; + +export function ecrecover(msgHash: Buffer, v: number, r: Buffer, s: Buffer): Buffer; + +export function ecsign(msgHash: Buffer, privateKey: Buffer): {[k: string]: any}; + +export function fromRpcSig(sig: string): {[k: string]: any}; + +export function fromSigned(num: Buffer): any; + +export function generateAddress(from: Buffer, nonce: Buffer): Buffer; + +export function hashPersonalMessage(message: string): Buffer; + +export function importPublic(publicKey: Buffer): Buffer; + +export function isValidAddress(address: string): boolean; + +export function isValidChecksumAddress(address: Buffer): boolean; + +export function isValidPrivate(privateKey: Buffer): boolean; + +export function isValidPublic(publicKey: Buffer, sanitize?: boolean): any; + +export function isValidSignature(v: Buffer, r: Buffer, s: Buffer, homestead?: boolean): boolean; + +export function privateToAddress(privateKey: Buffer): Buffer; + +export function privateToPublic(privateKey: Buffer): Buffer; + +export function pubToAddress(pubKey: Buffer, sanitize: boolean): Buffer; + +export function ripemd160(a: Buffer | any[] | string | number, padded: boolean): Buffer; + +export function rlphash(a: Buffer | any[] | string | number): Buffer; + +export function setLengthLeft(msg: Buffer | any[], length: number, right?: boolean): Buffer | any[]; + +export function setLengthRight(msg: Buffer | any[], length: number): Buffer | any[]; + +export function sha256(a: Buffer | any[] | string | number): Buffer; + +export function sha3(a: Buffer | any[] | string | number, bits?: number): Buffer; + +export function toBuffer(v: any): Buffer; + +export function toChecksumAddress(address: string): string; + +export function toRpcSig(v: number, r: Buffer, s: Buffer): string; + +export function toUnsigned(num: any): Buffer; + +export function unpad(a: T): T; + +export function zeros(bytes: number): Buffer; diff --git a/types/ethereumjs-util/tsconfig.json b/types/ethereumjs-util/tsconfig.json new file mode 100644 index 0000000000..53f8c15b5b --- /dev/null +++ b/types/ethereumjs-util/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ethereumjs-util-tests.ts" + ] +} \ No newline at end of file diff --git a/types/ethereumjs-util/tslint.json b/types/ethereumjs-util/tslint.json new file mode 100644 index 0000000000..a0051c9352 --- /dev/null +++ b/types/ethereumjs-util/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/exenv/exenv-tests.ts b/types/exenv/exenv-tests.ts new file mode 100644 index 0000000000..d13633b4a6 --- /dev/null +++ b/types/exenv/exenv-tests.ts @@ -0,0 +1,6 @@ +import * as ExecutionEnvironment from 'exenv'; + +JSON.stringify(ExecutionEnvironment.canUseDOM); +JSON.stringify(ExecutionEnvironment.canUseEventListeners); +JSON.stringify(ExecutionEnvironment.canUseViewport); +JSON.stringify(ExecutionEnvironment.canUseWorkers); diff --git a/types/exenv/index.d.ts b/types/exenv/index.d.ts new file mode 100644 index 0000000000..701494f6d8 --- /dev/null +++ b/types/exenv/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for exenv 1.2 +// Project: https://github.com/JedWatson/exenv +// Definitions by: Christian Chown +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +export const canUseDOM: boolean; +export const canUseEventListeners: boolean; +export const canUseViewport: boolean; +export const canUseWorkers: boolean; diff --git a/types/colors/tsconfig.json b/types/exenv/tsconfig.json similarity index 87% rename from types/colors/tsconfig.json rename to types/exenv/tsconfig.json index 99d78ad72d..d8825637a1 100644 --- a/types/colors/tsconfig.json +++ b/types/exenv/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, @@ -18,7 +18,6 @@ }, "files": [ "index.d.ts", - "colors-tests.ts", - "safe.d.ts" + "exenv-tests.ts" ] } \ No newline at end of file diff --git a/types/exenv/tslint.json b/types/exenv/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/exenv/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/expect/expect-tests.ts b/types/expect/expect-tests.ts index fea4a3d4d9..5df83340cb 100644 --- a/types/expect/expect-tests.ts +++ b/types/expect/expect-tests.ts @@ -1,8 +1,11 @@ -/// - import { Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies } from 'expect'; import * as expect from 'expect'; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('chaining assertions', () => { it('should allow chaining for array-like applications', () => { expect([ 1, 2, 'foo', 3 ]) diff --git a/types/expectations/expectations-tests.ts b/types/expectations/expectations-tests.ts index b0cef0aa0f..4e994e7546 100644 --- a/types/expectations/expectations-tests.ts +++ b/types/expectations/expectations-tests.ts @@ -1,9 +1,12 @@ -/// - // transplant from https://github.com/spmason/expectations/blob/695c25bd35bb1751533a8082a5aa378e3e1b381f/test/expect.tests.js var root = this; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('expect', ()=> { describe('toEqual', ()=> { it('can expect true to be true', ()=> { diff --git a/types/express-graphql/express-graphql-tests.ts b/types/express-graphql/express-graphql-tests.ts index 6fdfc0d945..1557c4c0ac 100644 --- a/types/express-graphql/express-graphql-tests.ts +++ b/types/express-graphql/express-graphql-tests.ts @@ -1,31 +1,45 @@ import express = require('express'); import 'express-session'; import graphqlHTTP = require('express-graphql'); +import { GraphQLSchema } from 'graphql/type/schema'; const app = express(); -const schema = {}; +const schema: GraphQLSchema = { + getQueryType: null, + getMutationType: null, + getSubscriptionType: null, + getTypeMap: null, + getType: null, + getPossibleTypes: null, + isPossibleType: null, + getDirective: null, + getDirectives: null, +}; -const graphqlOption: graphqlHTTP.OptionsObj = { +const graphqlOption: graphqlHTTP.OptionsData = { graphiql: true, - schema: schema, + schema, formatError: (error: Error) => ({ message: error.message }), - extensions: (args) => { } + validationRules: [() => false, () => true], + extensions: ({ document, variables, operationName, result }) => ({ key: "value", key2: "value"}), }; -const graphqlOptionRequest = (request: express.Request, response: express.Response): graphqlHTTP.OptionsObj => ({ +const graphqlOptionRequest = (request: express.Request): graphqlHTTP.OptionsData => ({ graphiql: true, - schema: schema, - context: request.session + schema, + context: request.session, + validationRules: [() => false, () => true], }); -const graphqlOptionRequestAsync = async (request: express.Request, response: express.Response): Promise => { +const graphqlOptionRequestAsync = async (request: express.Request): Promise => { return { graphiql: true, schema: await Promise.resolve(schema), context: request.session, - extensions: async (args) => { } + extensions: async (args) => { }, + validationRules: [() => false, () => true], }; }; diff --git a/types/express-graphql/index.d.ts b/types/express-graphql/index.d.ts index ade08f1729..4b2d10c99b 100644 --- a/types/express-graphql/index.d.ts +++ b/types/express-graphql/index.d.ts @@ -1,14 +1,15 @@ -// Type definitions for express-graphql -// Project: https://www.npmjs.org/package/express-graphql +// Type definitions for express-graphql 0.6 +// Project: https://github.com/graphql/express-graphql // Definitions by: Isman Usoh // Nitin Tutlani // Daniel Fader // Ehsan Ziya +// Margus Lamp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import { Request, Response } from "express"; - +import { DocumentNode, GraphQLSchema, GraphQLError } from 'graphql'; export = graphqlHTTP; declare namespace graphqlHTTP { @@ -16,60 +17,99 @@ declare namespace graphqlHTTP { * Used to configure the graphQLHTTP middleware by providing a schema * and other configuration options. */ - export type Options = ((req: Request, res: Response) => OptionsObj) | ((req: Request, res: Response) => Promise) | OptionsObj - export type OptionsObj = { + export type Options = ((request: Request, + response: Response, + params?: GraphQLParams) => OptionsResult) | OptionsResult; + export type OptionsResult = OptionsData | Promise; + export interface OptionsData { /** * A GraphQL schema from graphql-js. */ - schema: Object, + schema: GraphQLSchema; /** * A value to pass as the context to the graphql() function. */ - context?: Object, + context?: any; /** * An object to pass as the rootValue to the graphql() function. */ - rootValue?: Object, + rootValue?: any; /** * A boolean to configure whether the output should be pretty-printed. */ - pretty?: boolean, + pretty?: boolean; /** * An optional function which will be used to format any errors produced by * fulfilling a GraphQL operation. If no function is provided, GraphQL's * default spec-compliant `formatError` function will be used. */ - formatError?: Function, + formatError?: (error: GraphQLError) => any; + + /** + * An optional array of validation rules that will be applied on the document + * in additional to those defined by the GraphQL spec. + */ + validationRules?: any[]; + + /** + * An optional function for adding additional metadata to the GraphQL response + * as a key-value object. The result will be added to "extensions" field in + * the resulting JSON. This is often a useful place to add development time + * info such as the runtime of a query or the amount of resources consumed. + * + * Information about the request is provided to be used. + * + * This function may be async. + */ + extensions?: (info: RequestInfo) => { [key: string]: any }; /** * A boolean to optionally enable GraphiQL mode. */ - graphiql?: boolean, + graphiql?: boolean; + } + + /** + * All information about a GraphQL request. + */ + export interface RequestInfo { + /** + * The parsed GraphQL document. + */ + document?: DocumentNode; /** - * An optional function for adding additional metadata to the GraphQL response as a key-value object. - * The result will be added to "extensions" field in the resulting JSON. + * The variable values used at runtime. */ - extensions?: ((args: ExtenstionsArgs) => any) | ((args: ExtenstionsArgs) => Promise); + variables?: { [name: string]: any }; - }; + /** + * The (optional) operation name requested. + */ + operationName?: string; - interface ExtenstionsArgs { - document: object, - variables: object, - operationName: any, - result: object + /** + * The result of executing the operation. + */ + result?: any; + } + + export interface GraphQLParams { + query?: string; + variables?: { [name: string]: any }; + operationName?: string; + raw?: boolean; } type Middleware = (request: Request, response: Response) => void; } /** -* Middleware for express; takes an options object or function as input to -* configure behavior, and returns an express middleware. -*/ + * Middleware for express; takes an options object or function as input to + * configure behavior, and returns an express middleware. + */ declare function graphqlHTTP(options: graphqlHTTP.Options): graphqlHTTP.Middleware; diff --git a/types/express-graphql/tslint.json b/types/express-graphql/tslint.json index a41bf5d19a..4c4fc86ace 100644 --- a/types/express-graphql/tslint.json +++ b/types/express-graphql/tslint.json @@ -1,79 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "strict-export-declare-modifiers": false } } diff --git a/types/express-jwt/express-jwt-tests.ts b/types/express-jwt/express-jwt-tests.ts index 798818b728..9de759adb2 100644 --- a/types/express-jwt/express-jwt-tests.ts +++ b/types/express-jwt/express-jwt-tests.ts @@ -13,6 +13,25 @@ app.use(jwt({ userProperty: 'auth' })); +app.use(jwt({ + secret: (req: express.Request, + payload: any, + done: (err: any, secret: string) => void) => { + done(null, 'shhhhhhared-secret'); + }, + userProperty: 'auth' +})); + +app.use(jwt({ + secret: (req: express.Request, + header: any, + payload: any, + done: (err: any, secret: string) => void) => { + done(null, 'shhhhhhared-secret'); + }, + userProperty: 'auth' +})); + var jwtCheck = jwt({ secret: 'shhhhhhared-secret' }); @@ -28,4 +47,4 @@ app.use(function (err: any, req: express.Request, res: express.Response, next: e } else { next(err); } -}); \ No newline at end of file +}); diff --git a/types/express-jwt/index.d.ts b/types/express-jwt/index.d.ts index de0a2dd337..33c1206254 100644 --- a/types/express-jwt/index.d.ts +++ b/types/express-jwt/index.d.ts @@ -12,8 +12,10 @@ export = jwt; declare function jwt(options: jwt.Options): jwt.RequestHandler; declare namespace jwt { export type secretType = string | Buffer + export interface SecretCallbackLong { + (req: express.Request, header: any, payload: any, done: (err: any, secret?: secretType) => void): void; + } export interface SecretCallback { - (req: express.Request, header: any, payload: any, done: (err: any, secret?: boolean) => void): void; (req: express.Request, payload: any, done: (err: any, secret?: secretType) => void): void; } @@ -25,7 +27,7 @@ declare namespace jwt { (req: express.Request): any; } export interface Options { - secret: secretType | SecretCallback; + secret: secretType | SecretCallback | SecretCallbackLong; userProperty?: string; skip?: string[]; credentialsRequired?: boolean; diff --git a/types/express-minify/tsconfig.json b/types/express-minify/tsconfig.json index 65c999883e..20480fc428 100644 --- a/types/express-minify/tsconfig.json +++ b/types/express-minify/tsconfig.json @@ -14,10 +14,15 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "paths": { + "uglify-js": [ + "uglify-js/v2" + ] + } }, "files": [ "index.d.ts", "express-minify-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/facebook-instant-games/facebook-instant-games-tests.ts b/types/facebook-instant-games/facebook-instant-games-tests.ts new file mode 100644 index 0000000000..8d33e2c970 --- /dev/null +++ b/types/facebook-instant-games/facebook-instant-games-tests.ts @@ -0,0 +1,58 @@ +class FBInstantTest { + winStreak: number; + + init() { + FBInstant.initializeAsync().then(() => { + FBInstant.setLoadingProgress(100); + FBInstant.startGameAsync().then(() => { + this.startGame(); + }); + }); + } + + startGame() { + const contextId = FBInstant.context.getID(); + const contextType = FBInstant.context.getType(); + + const playerName = FBInstant.player.getName(); + const playerPic = FBInstant.player.getPhoto(); + const playerId = FBInstant.player.getID(); + } + + saveState() { + FBInstant.player.setDataAsync({ + score: this.winStreak + }); + } + + getState() { + FBInstant.player.getDataAsync(['score']) + .then((data) => { + if (typeof data['score'] !== 'undefined') { + this.winStreak = +data['score']; + } + }); + } + + update() { + FBInstant.updateAsync({ + action: 'CUSTOM', + cta: 'Play', + image: '', + text: { + default: 'Edgar played their move', + localizations: { + en_US: 'Edgar played their move', + es_LA: '\u00A1Edgar jug\u00F3 su jugada!' + } + }, + template: 'play_turn', + data: { myReplayData: '...' }, + strategy: 'IMMEDIATE', + notification: 'NO_PUSH' + }).then(() => { + // closes the game after the update is posted. + FBInstant.quit(); + }); + } +} diff --git a/types/facebook-instant-games/index.d.ts b/types/facebook-instant-games/index.d.ts new file mode 100644 index 0000000000..1e8a8d76fd --- /dev/null +++ b/types/facebook-instant-games/index.d.ts @@ -0,0 +1,221 @@ +// Type definitions for facebook-instant-games 6.1 +// Project: https://developers.facebook.com/docs/games/instant-games +// Definitions by: Menushka Weeratunga +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace FBInstant { + let player: Player; + let context: Context; + let payments: Payments; + + function getLocale(): string; + function getPlatform(): string; + function getSDKVersion(): string; + function initializeAsync(): Promise; + function setLoadingProgress(progress: number): void; + function getSupportedAPIs(): string[]; + function getEntryPointData(): any; + function getEntryPointAsync(): Promise; + function setSessionData(sessionData: any): void; + function startGameAsync(): Promise; + function shareAsync(payload: SharePayload): Promise; + function updateAsync(payload: UpdatePayload | LeaderboardUpdatePayload): Promise; + function switchGameAsync(appID: string, data?: string): Promise; + function canCreateShortcutAsync(): Promise; + function createShortcutAsync(): Promise; + function quit(): void; + function logEvent(eventName: string, valueToSum?: number, parameter?: any): APIError; + function onPause(func: () => void): void; + function getInterstitialAdAsync(placementID: string): Promise; + function getRewardedVideoAsync(placementID: string): Promise; + function matchPlayerAsync(matchTag?: string, switchContextWhenMatched?: boolean): Promise; + function checkCanPlayerMatchAsync(): Promise; + function getLeaderboardAsync(name: string): Promise; + + interface Player { + getID(): string; + getSignedPlayerInfoAsync(requestPayload: string): Promise; + canSubscribeBotAsync(): Promise; + subscribeBotAsync(): Promise; + getName(): string; + getPhoto(): string; + getDataAsync(keys?: string[]): Promise; + setDataAsync(data: DataObject): Promise; + flushDataAsync(): Promise; + getStatsAsync(keys?: string[]): Promise; + setStatsAsync(stats: StatsObject): Promise; + incrementStatsAsync(increments: IncrementObject): Promise; + getConnectedPlayersAsync(): Promise; + } + + interface Context { + getID(): string; + getType(): Type; + isSizeBetween(minSize: number, maxSize: number): ContextSizeResponse; + switchAsync(id: string): Promise; + chooseAsync(options: ContextOptions): Promise; + createAsync(playerID: string): Promise; + getPlayersAsync(): Promise; + } + + interface Leaderboard { + getName(): string; + getContextID(): string; + getEntryCountAsync(): Promise; + setScoreAsync(score: number, extraData: string): Promise; + getPlayerEntryAsync(): Promise; + getEntriesAsync(count: number, offset: number): Promise; + } + + interface LeaderboardEntry { + getScore(): number; + getFormattedScore(): string; + getTimestamp(): number; + getRank(): number; + getExtraData(): string; + getPlayer(): LeaderboardPlayer; + } + + interface LeaderboardPlayer { + getName(): string; + getPhoto(): string; + getID(): string; + } + + interface ConnectedPlayer { + getID(): string; + getName(): string; + getPhoto(): string; + } + + interface SignedPlayerInfo { + getPlayerID(): string; + getSignature(): string; + } + + interface ContextPlayer { + getID(): string; + getName(): string; + getPhoto(): string; + } + + interface AdInstance { + getPlacementID(): string; + loadAsync(): Promise; + showAsync(): Promise; + } + + interface Payments { + purchaseAsync(purchaseConfig: PurchaseConfig): Promise; + getPurchasesAsync(): Promise; + consumePurchaseAsync(purchaseToken: string): Promise; + onReady(callback: () => void): void; + } + + interface Product { + title: string; + productID: string; + description?: string; + imageURI?: string; + price: string; + priceCurrencyCode: string; + } + + interface ContextSizeResponse { + answer: boolean; + minSize?: number; + maxSize?: number; + } + + interface Purchase { + developerPayload?: string; + paymentID: string; + productID: string; + purchaseTime: string; + purchaseToken: string; + signedRequest: SignedPurchaseRequest; + } + + interface ContextOptions { + filters?: ContextFilter[]; + maxSize?: number; + minSize?: number; + } + + interface SharePayload { + intent?: Intent; + image?: string; + text?: string; + data?: any; + } + + interface APIError { + code: ErrorCodeType; + message: string; + } + + interface PurchaseConfig { + productID: string; + developerPayload?: string; + } + + interface UpdatePayload { + action?: UpdateAction; + template?: string; + cta?: (string | LocalizableContent); + image?: string; + text?: (string | LocalizableContent); + data?: any; + strategy?: string; + notification?: string; + } + + interface LeaderboardUpdatePayload { + action: UpdateAction; + name: string; + text?: string; + } + + interface LocalizableContent { + default: string; + localizations: LocalizationsDict; + } + + interface DataObject { [ key: string ]: string | number; } + + interface StatsObject { [ key: string ]: number; } + + interface IncrementObject { [ key: string ]: number; } + + type LocalizationsDict = any; + + type SignedPurchaseRequest = string; + + type ContextFilter = "NEW_CONTEXT_ONLY" | "INCLUDE_EXISTING_CHALLENGES" | "NEW_PLAYERS_ONLY"; + + type UpdateAction = "CUSTOM" | "LEADERBOARD"; + + type Platform = "IOS" | "ANDROID" | "WEB" | "MOBILE_WEB"; + + type Type = "POST" | "THREAD" | "GROUP" | "SOLO"; + + type Intent = "INVITE" | "REQUEST" | "CHALLENGE" | "SHARE"; + + type ErrorCodeType = "ADS_FREQUENT_LOAD" | + "ADS_NO_FILL" | + "ADS_NOT_LOADED" | + "ADS_TOO_MANY_INSTANCES" | + "ANALYTICS_POST_EXCEPTION" | + "CLIENT_REQUIRES_UPDATE" | + "CLIENT_UNSUPPORTED_OPERATION" | + "INVALID_OPERATION" | + "INVALID_PARAM" | + "LEADERBOARD_NOT_FOUND" | + "LEADERBOARD_WRONG_CONTEXT" | + "NETWORK_FAILURE" | + "PENDING_REQUEST" | + "RATE_LIMITED" | + "SAME_CONTEXT" | + "UNKNOWN" | + "USER_INPUT"; +} diff --git a/types/facebook-instant-games/tsconfig.json b/types/facebook-instant-games/tsconfig.json new file mode 100644 index 0000000000..5f1b7e6ccd --- /dev/null +++ b/types/facebook-instant-games/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "facebook-instant-games-tests.ts" + ] +} diff --git a/types/facebook-instant-games/tslint.json b/types/facebook-instant-games/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/facebook-instant-games/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/facebook-js-sdk/facebook-js-sdk-tests.ts b/types/facebook-js-sdk/facebook-js-sdk-tests.ts index f919e3290f..9652dbb86f 100644 --- a/types/facebook-js-sdk/facebook-js-sdk-tests.ts +++ b/types/facebook-js-sdk/facebook-js-sdk-tests.ts @@ -72,6 +72,15 @@ FB.ui({ console.log(data.payment_id); }); +FB.ui({ + method: 'pay', + action: 'purchaseiap', + product_id: 'com.fb.friendsmash.coins.10', + developer_payload: 'this_is_a_test_payload' +}, response => { + console.log(response); +}); + FB.ui({ method: 'pagetab', redirect_uri: 'YOUR_URL' diff --git a/types/facebook-js-sdk/index.d.ts b/types/facebook-js-sdk/index.d.ts index c380ee004d..be9f71f6c9 100644 --- a/types/facebook-js-sdk/index.d.ts +++ b/types/facebook-js-sdk/index.d.ts @@ -66,6 +66,11 @@ declare namespace facebook { */ ui(params: PayDialogParams, callback: (response: PayDialogResponse) => void): void; + /** + * @see https://developers.facebook.com/docs/games_payments/payments_lite + */ + ui(params: PaymentsLiteDialogParams, callback: (response: PaymentsLiteDialogResponse) => void): void; + /** * @see https://developers.facebook.com/docs/videos/live-video/exploring-live */ @@ -154,6 +159,14 @@ declare namespace facebook { request_id?: string; test_currency?: string; } + + interface PaymentsLiteDialogParams extends DialogParams { + method: 'pay'; + action: 'purchaseiap'; + product_id: string; + developer_payload?: string; + quantity?: number; + } interface LiveDialogParams extends DialogParams { method: 'live_broadcast'; @@ -173,7 +186,7 @@ declare namespace facebook { authResponse: { accessToken: string; expiresIn: number; - grantedScopes: string; + grantedScopes: string; signedRequest: string; userID: string; }; @@ -199,6 +212,17 @@ declare namespace facebook { signed_request: string; } + interface PaymentsLiteDialogResponse { + developer_payload?: string; + payment_id: number; + product_id?: string; + purchase_time?: number; + purchase_token?: string; + signed_request?: string; + error_code?: number; + error_message?: string; + } + interface LiveDialogResponse { id: string; stream_url: string; diff --git a/types/fbemitter/fbemitter-tests.ts b/types/fbemitter/fbemitter-tests.ts index 1a4983242f..22424fc442 100644 --- a/types/fbemitter/fbemitter-tests.ts +++ b/types/fbemitter/fbemitter-tests.ts @@ -1,5 +1,4 @@ /// -/// 'use strict'; @@ -11,6 +10,11 @@ import { EventEmitter, EventSubscription } from 'fbemitter'; import * as util from 'util'; import * as assert from 'assert'; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('EventEmitter', function tests() { 'use strict'; diff --git a/types/feathersjs__authentication-client/index.d.ts b/types/feathersjs__authentication-client/index.d.ts index 04275eb93c..9d1972bebc 100644 --- a/types/feathersjs__authentication-client/index.d.ts +++ b/types/feathersjs__authentication-client/index.d.ts @@ -3,8 +3,10 @@ // Definitions by: Abraao Alves , Jan Lohage // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript // TypeScript Version: 2.3 +import * as self from '@feathersjs/authentication-client'; -export default function feathersAuthClient(config?: FeathersAuthClientConfig): () => void; +declare const feathersAuthClient: ((config?: FeathersAuthClientConfig) => () => void) & typeof self; +export default feathersAuthClient; export interface FeathersAuthClientConfig { storage?: Storage; diff --git a/types/feathersjs__authentication-jwt/index.d.ts b/types/feathersjs__authentication-jwt/index.d.ts index b55adeed46..ab6a7f6dbe 100644 --- a/types/feathersjs__authentication-jwt/index.d.ts +++ b/types/feathersjs__authentication-jwt/index.d.ts @@ -6,8 +6,10 @@ import { Application } from '@feathersjs/feathers'; import { Request } from 'express'; +import * as self from '@feathersjs/authentication-jwt'; -export default function feathersAuthenticationJwt(options?: FeathersAuthenticationJWTOptions): () => void; +declare const feathersAuthenticationJwt: ((options?: FeathersAuthenticationJWTOptions) => () => void) & typeof self; +export default feathersAuthenticationJwt; export interface FeathersAuthenticationJWTOptions { /** diff --git a/types/feathersjs__authentication-local/index.d.ts b/types/feathersjs__authentication-local/index.d.ts index e935419263..e15b101258 100644 --- a/types/feathersjs__authentication-local/index.d.ts +++ b/types/feathersjs__authentication-local/index.d.ts @@ -10,8 +10,10 @@ import { Paginated } from '@feathersjs/feathers'; import { Request } from 'express'; +import * as self from '@feathersjs/authentication-local'; -export default function feathersAuthenticationLocal(options?: FeathersAuthenticationLocalOptions): () => void; +declare const feathersAuthenticationLocal: ((options?: FeathersAuthenticationLocalOptions) => () => void) & typeof self; +export default feathersAuthenticationLocal; export interface FeathersAuthenticationLocalOptions { /** diff --git a/types/feathersjs__authentication-oauth1/index.d.ts b/types/feathersjs__authentication-oauth1/index.d.ts index eee59fd64a..fa993c1cd0 100644 --- a/types/feathersjs__authentication-oauth1/index.d.ts +++ b/types/feathersjs__authentication-oauth1/index.d.ts @@ -9,8 +9,10 @@ import { Paginated } from '@feathersjs/feathers'; import { Request } from 'express'; +import * as self from '@feathersjs/authentication-oauth1'; -export default function feathersAuthenticationOAuth1(options?: FeathersAuthenticationOAuth1Options): () => void; +declare const feathersAuthenticationOAuth1: ((options?: FeathersAuthenticationOAuth1Options) => () => void) & typeof self; +export default feathersAuthenticationOAuth1; export interface FeathersAuthenticationOAuth1Options { /** diff --git a/types/feathersjs__authentication-oauth2/index.d.ts b/types/feathersjs__authentication-oauth2/index.d.ts index fbce7514cd..3037c1c47a 100644 --- a/types/feathersjs__authentication-oauth2/index.d.ts +++ b/types/feathersjs__authentication-oauth2/index.d.ts @@ -9,8 +9,10 @@ import { Paginated } from '@feathersjs/feathers'; import { Request } from 'express'; +import * as self from '@feathersjs/authentication-oauth2'; -export default function feathersAuthenticationOAuth2(options?: FeathersAuthenticationOAuth2Options): () => void; +declare const feathersAuthenticationOAuth2: ((options?: FeathersAuthenticationOAuth2Options) => () => void) & typeof self; +export default feathersAuthenticationOAuth2; export interface FeathersAuthenticationOAuth2Options { /** diff --git a/types/feathersjs__authentication/index.d.ts b/types/feathersjs__authentication/index.d.ts index 3a4722f12e..f451b0deda 100644 --- a/types/feathersjs__authentication/index.d.ts +++ b/types/feathersjs__authentication/index.d.ts @@ -4,8 +4,10 @@ // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript import { Hook } from '@feathersjs/feathers'; +import * as self from '@feathersjs/authentication'; -export default function feathersAuthentication(config?: FeathersAuthenticationOptions): () => void; +declare const feathersAuthentication: ((config?: FeathersAuthenticationOptions) => () => void) & typeof self; +export default feathersAuthentication; export const hooks: AuthHooks.Hooks; diff --git a/types/feathersjs__express/feathersjs__express-tests.ts b/types/feathersjs__express/feathersjs__express-tests.ts index 687191d0c6..1bd1f5221a 100644 --- a/types/feathersjs__express/feathersjs__express-tests.ts +++ b/types/feathersjs__express/feathersjs__express-tests.ts @@ -1,8 +1,11 @@ import feathers, { Application } from '@feathersjs/feathers'; -import feathersExpress, { original, rest, notFound, errorHandler } from '@feathersjs/express'; +import feathersExpress, * as express from '@feathersjs/express'; const app = feathersExpress(feathers()); -app.configure(rest()); -app.use(notFound()); -app.use(errorHandler()); +app.use(express.json()); +app.use(express.urlencoded({ extended: true })); +app.use('/', express.static('./public')); +app.configure(express.rest()); +app.use(express.notFound()); +app.use(express.errorHandler({ logger: console })); diff --git a/types/feathersjs__express/index.d.ts b/types/feathersjs__express/index.d.ts index f50203432f..4dfaa0f8ee 100644 --- a/types/feathersjs__express/index.d.ts +++ b/types/feathersjs__express/index.d.ts @@ -1,19 +1,28 @@ // Type definitions for @feathersjs/express 1.1 // Project: http://feathersjs.com/ // Definitions by: Jan Lohage +// Aleksey Klimenko // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript // TypeScript Version: 2.3 import { Application as FeathersApplication } from '@feathersjs/feathers'; import * as express from 'express'; +import * as self from '@feathersjs/express'; -export default function feathersExpress(app: FeathersApplication): Application; +declare const feathersExpress: ((app: FeathersApplication) => Application) & typeof self; +export default feathersExpress; export type Application = express.Application & FeathersApplication; -export function errorHandler(options?: any): express.ErrorRequestHandler; +export function errorHandler(options?: { + public?: string, + logger?: { error?: (msg: string) => void }, + html?: any, + json?: any, +}): express.ErrorRequestHandler; export function notFound(): express.RequestHandler; + export const rest: { - (): () => void; + (handler?: express.RequestHandler): () => void; formatter: express.RequestHandler; }; diff --git a/types/feathersjs__feathers/index.d.ts b/types/feathersjs__feathers/index.d.ts index 6ae7b22238..c0fa3d9946 100644 --- a/types/feathersjs__feathers/index.d.ts +++ b/types/feathersjs__feathers/index.d.ts @@ -8,8 +8,10 @@ /// import { EventEmitter } from 'events'; +import * as self from '@feathersjs/feathers'; -export default function feathers(): Application; +declare const feathers: (() => Application) & typeof self; +export default feathers; export const version: string; diff --git a/types/find-root/index.d.ts b/types/find-root/index.d.ts index b2fe6f572a..050781eacf 100644 --- a/types/find-root/index.d.ts +++ b/types/find-root/index.d.ts @@ -10,7 +10,7 @@ type FindRootCheckFn = (dir: string) => boolean; /** * Returns the path for the nearest directory to startingPath containing a package.json file. If a check function is * provided, then this will return the nearest directory for which the function returns true. - * @param startingPath The path to start searching form, e.g. __dirname + * @param startingPath The path to start searching from, e.g. __dirname * @param check The check predicate * @throws {Error} if package.json cannot be found or if the function never returns true */ diff --git a/types/fnv-lite/fnv-lite-tests.ts b/types/fnv-lite/fnv-lite-tests.ts new file mode 100644 index 0000000000..33d9133a27 --- /dev/null +++ b/types/fnv-lite/fnv-lite-tests.ts @@ -0,0 +1,20 @@ +import FNV = require('fnv-lite'); + +let result: string; +result = FNV.hex(''); +result = FNV.base64(''); +result = FNV.base64Url(''); +result = FNV.base36(''); + +result = FNV.hex([1, 2, 3]); +result = FNV.base64([1, 2, 3]); +result = FNV.base64Url([1, 2, 3]); +result = FNV.base36([1, 2, 3]); + +const fnv = new FNV(); +fnv.update([1, 2, 3]).update("abc"); +result = fnv.digest('hex'); +result = fnv.digest('base36'); +result = fnv.digest('base64'); +result = fnv.digest('base64Url'); +const resultArray: number[] = fnv.digest(); diff --git a/types/fnv-lite/index.d.ts b/types/fnv-lite/index.d.ts new file mode 100644 index 0000000000..0cbd3553d6 --- /dev/null +++ b/types/fnv-lite/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for fnv-lite 1.2 +// Project: https://github.com/casetext/fnv-lite +// Definitions by: MarcinD +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type Input = string | ArrayLike; + +declare class FNV { + static hex(input: Input): string; + static base64(input: Input): string; + static base64Url(input: Input): string; + static base36(input: Input): string; + + update(input: Input): this; + digest(): number[]; + digest(type: "hex" | "base36" | "base64" | "base64Url"): string; +} + +export = FNV; diff --git a/types/fnv-lite/tsconfig.json b/types/fnv-lite/tsconfig.json new file mode 100644 index 0000000000..d04f5527ef --- /dev/null +++ b/types/fnv-lite/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "fnv-lite-tests.ts" + ] +} diff --git a/types/fnv-lite/tslint.json b/types/fnv-lite/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/fnv-lite/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/gapi.client.drive/gapi.client.drive-tests.ts b/types/gapi.client.drive/gapi.client.drive-tests.ts index f9fa0ce332..002b5e7eb6 100644 --- a/types/gapi.client.drive/gapi.client.drive-tests.ts +++ b/types/gapi.client.drive/gapi.client.drive-tests.ts @@ -43,15 +43,15 @@ gapi.load('client', () => { async function run() { /** Gets information about the user, the user's Drive, and system capabilities. */ - await gapi.client.about.get({ + await gapi.client.drive.about.get({ }); /** Gets the starting pageToken for listing future changes. */ - await gapi.client.changes.getStartPageToken({ + await gapi.client.drive.changes.getStartPageToken({ supportsTeamDrives: true, teamDriveId: "teamDriveId", }); /** Lists the changes for a user or Team Drive. */ - await gapi.client.changes.list({ + await gapi.client.drive.changes.list({ includeCorpusRemovals: true, includeRemoved: true, includeTeamDriveItems: true, @@ -63,7 +63,7 @@ gapi.load('client', () => { teamDriveId: "teamDriveId", }); /** Subscribes to changes for a user. */ - await gapi.client.changes.watch({ + await gapi.client.drive.changes.watch({ includeCorpusRemovals: true, includeRemoved: true, includeTeamDriveItems: true, @@ -75,25 +75,25 @@ gapi.load('client', () => { teamDriveId: "teamDriveId", }); /** Stop watching resources through this channel */ - await gapi.client.channels.stop({ + await gapi.client.drive.channels.stop({ }); /** Creates a new comment on a file. */ - await gapi.client.comments.create({ + await gapi.client.drive.comments.create({ fileId: "fileId", }); /** Deletes a comment. */ - await gapi.client.comments.delete({ + await gapi.client.drive.comments.delete({ commentId: "commentId", fileId: "fileId", }); /** Gets a comment by ID. */ - await gapi.client.comments.get({ + await gapi.client.drive.comments.get({ commentId: "commentId", fileId: "fileId", includeDeleted: true, }); /** Lists a file's comments. */ - await gapi.client.comments.list({ + await gapi.client.drive.comments.list({ fileId: "fileId", includeDeleted: true, pageSize: 3, @@ -101,12 +101,12 @@ gapi.load('client', () => { startModifiedTime: "startModifiedTime", }); /** Updates a comment with patch semantics. */ - await gapi.client.comments.update({ + await gapi.client.drive.comments.update({ commentId: "commentId", fileId: "fileId", }); /** Creates a copy of a file and applies any requested updates with patch semantics. */ - await gapi.client.files.copy({ + await gapi.client.drive.files.copy({ fileId: "fileId", ignoreDefaultVisibility: true, keepRevisionForever: true, @@ -114,7 +114,7 @@ gapi.load('client', () => { supportsTeamDrives: true, }); /** Creates a new file. */ - await gapi.client.files.create({ + await gapi.client.drive.files.create({ ignoreDefaultVisibility: true, keepRevisionForever: true, ocrLanguage: "ocrLanguage", @@ -125,31 +125,31 @@ gapi.load('client', () => { * Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a Team Drive the user must be an organizer on the * parent. If the target is a folder, all descendants owned by the user are also deleted. */ - await gapi.client.files.delete({ + await gapi.client.drive.files.delete({ fileId: "fileId", supportsTeamDrives: true, }); /** Permanently deletes all of the user's trashed files. */ - await gapi.client.files.emptyTrash({ + await gapi.client.drive.files.emptyTrash({ }); /** Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB. */ - await gapi.client.files.export({ + await gapi.client.drive.files.export({ fileId: "fileId", mimeType: "mimeType", }); /** Generates a set of file IDs which can be provided in create requests. */ - await gapi.client.files.generateIds({ + await gapi.client.drive.files.generateIds({ count: 1, space: "space", }); /** Gets a file's metadata or content by ID. */ - await gapi.client.files.get({ + await gapi.client.drive.files.get({ acknowledgeAbuse: true, fileId: "fileId", supportsTeamDrives: true, }); /** Lists or searches files. */ - await gapi.client.files.list({ + await gapi.client.drive.files.list({ corpora: "corpora", corpus: "corpus", includeTeamDriveItems: true, @@ -162,7 +162,7 @@ gapi.load('client', () => { teamDriveId: "teamDriveId", }); /** Updates a file's metadata and/or content with patch semantics. */ - await gapi.client.files.update({ + await gapi.client.drive.files.update({ addParents: "addParents", fileId: "fileId", keepRevisionForever: true, @@ -172,66 +172,71 @@ gapi.load('client', () => { useContentAsIndexableText: true, }); /** Subscribes to changes to a file */ - await gapi.client.files.watch({ + await gapi.client.drive.files.watch({ acknowledgeAbuse: true, fileId: "fileId", supportsTeamDrives: true, }); /** Creates a permission for a file or Team Drive. */ - await gapi.client.permissions.create({ + await gapi.client.drive.permissions.create({ emailMessage: "emailMessage", fileId: "fileId", sendNotificationEmail: true, supportsTeamDrives: true, transferOwnership: true, + useDomainAdminAccess: true, }); /** Deletes a permission. */ - await gapi.client.permissions.delete({ + await gapi.client.drive.permissions.delete({ fileId: "fileId", permissionId: "permissionId", supportsTeamDrives: true, + useDomainAdminAccess: true, }); /** Gets a permission by ID. */ - await gapi.client.permissions.get({ + await gapi.client.drive.permissions.get({ fileId: "fileId", permissionId: "permissionId", supportsTeamDrives: true, + useDomainAdminAccess: true, }); /** Lists a file's or Team Drive's permissions. */ - await gapi.client.permissions.list({ + await gapi.client.drive.permissions.list({ fileId: "fileId", pageSize: 2, pageToken: "pageToken", supportsTeamDrives: true, + useDomainAdminAccess: true, }); /** Updates a permission with patch semantics. */ - await gapi.client.permissions.update({ + await gapi.client.drive.permissions.update({ fileId: "fileId", permissionId: "permissionId", removeExpiration: true, supportsTeamDrives: true, transferOwnership: true, + useDomainAdminAccess: true, }); /** Creates a new reply to a comment. */ - await gapi.client.replies.create({ + await gapi.client.drive.replies.create({ commentId: "commentId", fileId: "fileId", }); /** Deletes a reply. */ - await gapi.client.replies.delete({ + await gapi.client.drive.replies.delete({ commentId: "commentId", fileId: "fileId", replyId: "replyId", }); /** Gets a reply by ID. */ - await gapi.client.replies.get({ + await gapi.client.drive.replies.get({ commentId: "commentId", fileId: "fileId", includeDeleted: true, replyId: "replyId", }); /** Lists a comment's replies. */ - await gapi.client.replies.list({ + await gapi.client.drive.replies.list({ commentId: "commentId", fileId: "fileId", includeDeleted: true, @@ -239,52 +244,55 @@ gapi.load('client', () => { pageToken: "pageToken", }); /** Updates a reply with patch semantics. */ - await gapi.client.replies.update({ + await gapi.client.drive.replies.update({ commentId: "commentId", fileId: "fileId", replyId: "replyId", }); /** Permanently deletes a revision. This method is only applicable to files with binary content in Drive. */ - await gapi.client.revisions.delete({ + await gapi.client.drive.revisions.delete({ fileId: "fileId", revisionId: "revisionId", }); /** Gets a revision's metadata or content by ID. */ - await gapi.client.revisions.get({ + await gapi.client.drive.revisions.get({ acknowledgeAbuse: true, fileId: "fileId", revisionId: "revisionId", }); /** Lists a file's revisions. */ - await gapi.client.revisions.list({ + await gapi.client.drive.revisions.list({ fileId: "fileId", pageSize: 2, pageToken: "pageToken", }); /** Updates a revision with patch semantics. */ - await gapi.client.revisions.update({ + await gapi.client.drive.revisions.update({ fileId: "fileId", revisionId: "revisionId", }); /** Creates a new Team Drive. */ - await gapi.client.teamdrives.create({ + await gapi.client.drive.teamdrives.create({ requestId: "requestId", }); /** Permanently deletes a Team Drive for which the user is an organizer. The Team Drive cannot contain any untrashed items. */ - await gapi.client.teamdrives.delete({ + await gapi.client.drive.teamdrives.delete({ teamDriveId: "teamDriveId", }); /** Gets a Team Drive's metadata by ID. */ - await gapi.client.teamdrives.get({ + await gapi.client.drive.teamdrives.get({ teamDriveId: "teamDriveId", + useDomainAdminAccess: true, }); /** Lists the user's Team Drives. */ - await gapi.client.teamdrives.list({ + await gapi.client.drive.teamdrives.list({ pageSize: 1, pageToken: "pageToken", + q: "q", + useDomainAdminAccess: true, }); /** Updates a Team Drive's metadata */ - await gapi.client.teamdrives.update({ + await gapi.client.drive.teamdrives.update({ teamDriveId: "teamDriveId", }); } diff --git a/types/gapi.client.drive/index.d.ts b/types/gapi.client.drive/index.d.ts index 7004e2c0bb..1b2a939a7d 100644 --- a/types/gapi.client.drive/index.d.ts +++ b/types/gapi.client.drive/index.d.ts @@ -16,28 +16,12 @@ declare namespace gapi.client { function load(name: "drive", version: "v3"): PromiseLike; function load(name: "drive", version: "v3", callback: () => any): void; - const about: drive.AboutResource; - - const changes: drive.ChangesResource; - - const channels: drive.ChannelsResource; - - const comments: drive.CommentsResource; - - const files: drive.FilesResource; - - const permissions: drive.PermissionsResource; - - const replies: drive.RepliesResource; - - const revisions: drive.RevisionsResource; - - const teamdrives: drive.TeamdrivesResource; - namespace drive { interface About { /** Whether the user has installed the requesting app. */ appInstalled?: boolean; + /** Whether the user can create Team Drives. */ + canCreateTeamDrives?: boolean; /** A map of source MIME type to possible targets for all supported exports. */ exportFormats?: Record; /** The currently supported folder colors as RGB hex strings. */ @@ -363,8 +347,9 @@ declare namespace gapi.client { owners?: User[]; /** * The IDs of the parent folders which contain the file. - * If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and - * removeParents parameters to modify the values. + * If not specified as part of a create request, the file will be placed directly in the user's My Drive folder. If not specified as part of a copy + * request, the file will inherit any discoverable parents of the source file. Update requests must use the addParents and removeParents parameters to + * modify the parents list. */ parents?: string[]; /** List of permission IDs for users with access to this file. */ @@ -683,6 +668,8 @@ declare namespace gapi.client { }; /** The color of this Team Drive as an RGB hex string. It can only be set on a drive.teamdrives.update request that does not set themeId. */ colorRgb?: string; + /** The time at which the Team Drive was created (RFC 3339 date-time). */ + createdTime?: string; /** The ID of this Team Drive which is also the ID of the top level folder for this Team Drive. */ id?: string; /** Identifies what kind of resource this is. Value: the fixed string "drive#teamDrive". */ @@ -1322,7 +1309,7 @@ declare namespace gapi.client { create(request: { /** Data format for the response. */ alt?: string; - /** A custom message to include in the notification email. */ + /** A plain text custom message to include in the notification email. */ emailMessage?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; @@ -1351,6 +1338,11 @@ declare namespace gapi.client { * the side effect. */ transferOwnership?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1377,6 +1369,11 @@ declare namespace gapi.client { quotaUser?: string; /** Whether the requesting application supports Team Drives. */ supportsTeamDrives?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1403,6 +1400,11 @@ declare namespace gapi.client { quotaUser?: string; /** Whether the requesting application supports Team Drives. */ supportsTeamDrives?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1434,6 +1436,11 @@ declare namespace gapi.client { quotaUser?: string; /** Whether the requesting application supports Team Drives. */ supportsTeamDrives?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1467,6 +1474,11 @@ declare namespace gapi.client { * the side effect. */ transferOwnership?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1777,6 +1789,11 @@ declare namespace gapi.client { quotaUser?: string; /** The ID of the Team Drive */ teamDriveId: string; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the Team Drive belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1796,11 +1813,18 @@ declare namespace gapi.client { pageToken?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; + /** Query string for searching Team Drives. */ + q?: string; /** * Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. * Overrides userIp if both are provided. */ quotaUser?: string; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then all Team Drives of the domain in which the + * requester is an administrator are returned. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1827,5 +1851,23 @@ declare namespace gapi.client { userIp?: string; }): Request; } + + const about: AboutResource; + + const changes: ChangesResource; + + const channels: ChannelsResource; + + const comments: CommentsResource; + + const files: FilesResource; + + const permissions: PermissionsResource; + + const replies: RepliesResource; + + const revisions: RevisionsResource; + + const teamdrives: TeamdrivesResource; } } diff --git a/types/gapi.client.drive/tsconfig.json b/types/gapi.client.drive/tsconfig.json index 0cdc6f7fab..6d5901b410 100644 --- a/types/gapi.client.drive/tsconfig.json +++ b/types/gapi.client.drive/tsconfig.json @@ -14,7 +14,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, + "forceConsistentCasingInFileNames": true, "strictFunctionTypes": true }, "files": [ diff --git a/types/glue/glue-tests.ts b/types/glue/glue-tests.ts new file mode 100644 index 0000000000..7ac309352c --- /dev/null +++ b/types/glue/glue-tests.ts @@ -0,0 +1,20 @@ +import * as Glue from "glue"; +import * as Hapi from "hapi"; + +const manifest: Glue.Manifest = { + server: { + port: 3000 + }, + register: { + plugins: [ + { + plugin: "./test", + routes: { + prefix: "test" + } + } + ] + } +}; + +Glue.compose(manifest); diff --git a/types/glue/index.d.ts b/types/glue/index.d.ts new file mode 100644 index 0000000000..8e710d233a --- /dev/null +++ b/types/glue/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for glue 5.0 +// Project: https://github.com/hapijs/glue +// Definitions by: Gareth Parker +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import { Server, ServerOptions } from "hapi"; + +export interface Options { + relativeTo: string; + preConnections?: (Server: Server, next: (err: any) => void) => void; + preRegister?: (Server: Server, next: (err: any) => void) => void; +} + +export interface Plugin { + plugin: string | { + register: string; + options?: any; + }; + options?: any; + routes?: any; +} + +export interface Manifest { + server: ServerOptions; + register?: { + plugins: Plugin[] + }; +} + +export function compose(manifest: Manifest, options?: Options): Server; diff --git a/types/glue/tsconfig.json b/types/glue/tsconfig.json new file mode 100644 index 0000000000..2d9b76b8f7 --- /dev/null +++ b/types/glue/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es2017", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "experimentalDecorators": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "glue-tests.ts" + ] +} \ No newline at end of file diff --git a/types/glue/tslint.json b/types/glue/tslint.json new file mode 100644 index 0000000000..30a1bdde2e --- /dev/null +++ b/types/glue/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/google.analytics/index.d.ts b/types/google.analytics/index.d.ts index b71fdef286..9f522b3b9b 100644 --- a/types/google.analytics/index.d.ts +++ b/types/google.analytics/index.d.ts @@ -525,6 +525,8 @@ declare namespace UniversalAnalytics { socialTarget?: string; some?: string; step?: boolean | number; + storage?: string; + storeGac?: boolean; tax?: string; timingCategory?: string; timingLabel?: string; diff --git a/types/graphql-list-fields/graphql-list-fields-tests.ts b/types/graphql-list-fields/graphql-list-fields-tests.ts index 7624a3cbd8..ee9bcc6851 100644 --- a/types/graphql-list-fields/graphql-list-fields-tests.ts +++ b/types/graphql-list-fields/graphql-list-fields-tests.ts @@ -2,7 +2,6 @@ import getFieldNames = require("graphql-list-fields"); import { GraphQLID, - GraphQLInterfaceType, GraphQLObjectType, GraphQLResolveInfo, GraphQLSchema, @@ -13,7 +12,7 @@ const sampleGraphQLResolveInfo: GraphQLResolveInfo = { fieldName: "", fieldNodes: [], returnType: GraphQLString, - parentType: new GraphQLInterfaceType({ + parentType: new GraphQLObjectType({ name: "Sample", fields: { name: { type: GraphQLString } diff --git a/types/graphql/error/GraphQLError.d.ts b/types/graphql/error/GraphQLError.d.ts index 116f17c3fa..a4aa3f17c6 100644 --- a/types/graphql/error/GraphQLError.d.ts +++ b/types/graphql/error/GraphQLError.d.ts @@ -1,6 +1,6 @@ -import { getLocation } from '../language'; -import { ASTNode } from '../language/ast'; -import { Source } from '../language/source'; +import { getLocation } from "../language"; +import { ASTNode } from "../language/ast"; +import { Source } from "../language/source"; /** * A GraphQLError describes an Error found during the parse, validate, or @@ -9,60 +9,66 @@ import { Source } from '../language/source'; * GraphQL document and/or execution result that correspond to the Error. */ export class GraphQLError extends Error { - /** - * A message describing the Error for debugging purposes. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - message: string; + /** + * A message describing the Error for debugging purposes. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + message: string; - /** - * An array of { line, column } locations within the source GraphQL document - * which correspond to this error. - * - * Errors during validation often contain multiple locations, for example to - * point out two things with the same name. Errors during execution include a - * single location, the field which produced the error. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - locations?: Array<{ line: number; column: number }> | undefined; + /** + * An array of { line, column } locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + locations?: Array<{ line: number; column: number }> | undefined; - /** - * An array describing the JSON-path into the execution response which - * corresponds to this error. Only included for errors during execution. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - path?: Array | undefined; + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + path?: Array | undefined; - /** - * An array of GraphQL AST Nodes corresponding to this error. - */ - nodes?: ASTNode[] | undefined; + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + nodes?: ASTNode[] | undefined; - /** - * The source GraphQL document corresponding to this error. - */ - source?: Source | undefined; + /** + * The source GraphQL document corresponding to this error. + */ + source?: Source | undefined; - /** - * An array of character offsets within the source GraphQL document - * which correspond to this error. - */ - positions?: number[] | undefined; + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + positions?: number[] | undefined; - /** - * The original error thrown from a field resolver during execution. - */ - originalError?: Error; + /** + * The original error thrown from a field resolver during execution. + */ + originalError?: Error; - constructor( - message: string, - nodes?: any[], - source?: Source, - positions?: number[], - path?: Array, - originalError?: Error, - ); + /** + * Extension fields to add to the formatted error. + */ + extensions?: { [key: string]: any } | undefined; + + constructor( + message: string, + nodes?: any[], + source?: Source, + positions?: number[], + path?: Array, + originalError?: Error, + extensions?: { [key: string]: any } + ); } diff --git a/types/graphql/error/formatError.d.ts b/types/graphql/error/formatError.d.ts index 26dbe0f743..a683da0375 100644 --- a/types/graphql/error/formatError.d.ts +++ b/types/graphql/error/formatError.d.ts @@ -1,4 +1,4 @@ -import { GraphQLError } from './GraphQLError'; +import { GraphQLError } from "./GraphQLError"; /** * Given a GraphQLError, format it according to the rules described by the @@ -7,12 +7,12 @@ import { GraphQLError } from './GraphQLError'; export function formatError(error: GraphQLError): GraphQLFormattedError; export interface GraphQLFormattedError { - message: string; - locations?: GraphQLErrorLocation[]; - path?: Array; + message: string; + locations?: GraphQLErrorLocation[]; + path?: Array; } export interface GraphQLErrorLocation { - line: number; - column: number; + line: number; + column: number; } diff --git a/types/graphql/error/index.d.ts b/types/graphql/error/index.d.ts index 0e9a557794..8d81175bcc 100644 --- a/types/graphql/error/index.d.ts +++ b/types/graphql/error/index.d.ts @@ -1,8 +1,4 @@ -export { GraphQLError } from './GraphQLError'; -export { syntaxError } from './syntaxError'; -export { locatedError } from './locatedError'; -export { - formatError, - GraphQLFormattedError, - GraphQLErrorLocation, -} from './formatError'; +export { GraphQLError } from "./GraphQLError"; +export { syntaxError } from "./syntaxError"; +export { locatedError } from "./locatedError"; +export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from "./formatError"; diff --git a/types/graphql/error/locatedError.d.ts b/types/graphql/error/locatedError.d.ts index 64fadf49f4..c41fd0df50 100644 --- a/types/graphql/error/locatedError.d.ts +++ b/types/graphql/error/locatedError.d.ts @@ -1,12 +1,8 @@ -import { GraphQLError } from './GraphQLError'; +import { GraphQLError } from "./GraphQLError"; /** * Given an arbitrary Error, presumably thrown while attempting to execute a * GraphQL operation, produce a new GraphQLError aware of the location in the * document responsible for the original Error. */ -export function locatedError( - originalError: Error, - nodes: T[], - path: Array, -): GraphQLError; +export function locatedError(originalError: Error, nodes: T[], path: Array): GraphQLError; diff --git a/types/graphql/error/syntaxError.d.ts b/types/graphql/error/syntaxError.d.ts index ccf84044ca..bc33cd8107 100644 --- a/types/graphql/error/syntaxError.d.ts +++ b/types/graphql/error/syntaxError.d.ts @@ -1,12 +1,8 @@ -import { Source } from '../language/source'; -import { GraphQLError } from './GraphQLError'; +import { Source } from "../language/source"; +import { GraphQLError } from "./GraphQLError"; /** * Produces a GraphQLError representing a syntax error, containing useful * descriptive information about the syntax error's position in the source. */ -export function syntaxError( - source: Source, - position: number, - description: string, -): GraphQLError; +export function syntaxError(source: Source, position: number, description: string): GraphQLError; diff --git a/types/graphql/execution/execute.d.ts b/types/graphql/execution/execute.d.ts index ea6ab8ed39..387a3d4d73 100644 --- a/types/graphql/execution/execute.d.ts +++ b/types/graphql/execution/execute.d.ts @@ -1,19 +1,15 @@ -import { GraphQLError, locatedError } from '../error'; -import { GraphQLSchema } from '../type/schema'; +import { GraphQLError, locatedError } from "../error"; +import { GraphQLSchema } from "../type/schema"; +import { GraphQLField, GraphQLFieldResolver, ResponsePath } from "../type/definition"; import { - GraphQLField, - GraphQLFieldResolver, - ResponsePath, -} from '../type/definition'; -import { - DirectiveNode, - DocumentNode, - OperationDefinitionNode, - SelectionSetNode, - FieldNode, - InlineFragmentNode, - FragmentDefinitionNode, -} from '../language/ast'; + DirectiveNode, + DocumentNode, + OperationDefinitionNode, + SelectionSetNode, + FieldNode, + InlineFragmentNode, + FragmentDefinitionNode, +} from "../language/ast"; /** * Data that must be available at all points during query execution. * @@ -21,13 +17,13 @@ import { * and the fragments defined in the query document */ export interface ExecutionContext { - schema: GraphQLSchema; - fragments: { [key: string]: FragmentDefinitionNode }; - rootValue: any; - operation: OperationDefinitionNode; - variableValues: { [key: string]: any }; - fieldResolver: GraphQLFieldResolver; - errors: GraphQLError[]; + schema: GraphQLSchema; + fragments: { [key: string]: FragmentDefinitionNode }; + rootValue: any; + operation: OperationDefinitionNode; + variableValues: { [key: string]: any }; + fieldResolver: GraphQLFieldResolver; + errors: GraphQLError[]; } /** @@ -37,19 +33,19 @@ export interface ExecutionContext { * non-empty array if an error occurred. */ export interface ExecutionResult { - data?: { [key: string]: any }; - extensions?: { [key: string]: any }; - errors?: GraphQLError[]; + data?: { [key: string]: any }; + extensions?: { [key: string]: any }; + errors?: GraphQLError[]; } export type ExecutionArgs = { - schema: GraphQLSchema; - document: DocumentNode; - rootValue?: any; - contextValue?: any; - variableValues?: { [key: string]: any }; - operationName?: string; - fieldResolver?: GraphQLFieldResolver; + schema: GraphQLSchema; + document: DocumentNode; + rootValue?: any; + contextValue?: any; + variableValues?: { [key: string]: any }; + operationName?: string; + fieldResolver?: GraphQLFieldResolver; }; /** @@ -64,15 +60,15 @@ export type ExecutionArgs = { */ export function execute(args: ExecutionArgs): Promise; export function execute( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { - [key: string]: any; - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver, + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: any, + contextValue?: any, + variableValues?: { + [key: string]: any; + }, + operationName?: string, + fieldResolver?: GraphQLFieldResolver ): Promise; /** diff --git a/types/graphql/execution/index.d.ts b/types/graphql/execution/index.d.ts index a5c4980c0a..74aef224ce 100644 --- a/types/graphql/execution/index.d.ts +++ b/types/graphql/execution/index.d.ts @@ -1,9 +1,3 @@ -export { - execute, - defaultFieldResolver, - responsePathAsArray, - ExecutionArgs, - ExecutionResult, -} from './execute'; +export { execute, defaultFieldResolver, responsePathAsArray, ExecutionArgs, ExecutionResult } from "./execute"; -export { getDirectiveValues } from './values'; +export { getDirectiveValues } from "./values"; diff --git a/types/graphql/execution/values.d.ts b/types/graphql/execution/values.d.ts index 08e6041aa2..d8e1ec2e7e 100644 --- a/types/graphql/execution/values.d.ts +++ b/types/graphql/execution/values.d.ts @@ -1,15 +1,7 @@ -import { - GraphQLInputType, - GraphQLField, - GraphQLArgument, -} from '../type/definition'; -import { GraphQLDirective } from '../type/directives'; -import { GraphQLSchema } from '../type/schema'; -import { - FieldNode, - DirectiveNode, - VariableDefinitionNode, -} from '../language/ast'; +import { GraphQLInputType, GraphQLField, GraphQLArgument } from "../type/definition"; +import { GraphQLDirective } from "../type/directives"; +import { GraphQLSchema } from "../type/schema"; +import { FieldNode, DirectiveNode, VariableDefinitionNode } from "../language/ast"; /** * Prepares an object map of variableValues of the correct type based on the @@ -17,9 +9,9 @@ import { * parsed to match the variable definitions, a GraphQLError will be thrown. */ export function getVariableValues( - schema: GraphQLSchema, - varDefNodes: VariableDefinitionNode[], - inputs: { [key: string]: any }, + schema: GraphQLSchema, + varDefNodes: VariableDefinitionNode[], + inputs: { [key: string]: any } ): { [key: string]: any }; /** @@ -27,9 +19,9 @@ export function getVariableValues( * definitions and list of argument AST nodes. */ export function getArgumentValues( - def: GraphQLField | GraphQLDirective, - node: FieldNode | DirectiveNode, - variableValues?: { [key: string]: any }, + def: GraphQLField | GraphQLDirective, + node: FieldNode | DirectiveNode, + variableValues?: { [key: string]: any } ): { [key: string]: any }; /** @@ -40,7 +32,7 @@ export function getArgumentValues( * If the directive does not exist on the node, returns undefined. */ export function getDirectiveValues( - directiveDef: GraphQLDirective, - node: { directives?: Array }, - variableValues?: { [key: string]: any }, + directiveDef: GraphQLDirective, + node: { directives?: Array }, + variableValues?: { [key: string]: any } ): void | { [key: string]: any }; diff --git a/types/graphql/graphql.d.ts b/types/graphql/graphql.d.ts index f5469d7d8c..386cdd9e1b 100644 --- a/types/graphql/graphql.d.ts +++ b/types/graphql/graphql.d.ts @@ -1,7 +1,7 @@ -import { Source } from './language/source'; -import { GraphQLFieldResolver } from './type/definition'; -import { GraphQLSchema } from './type/schema'; -import { ExecutionResult } from './execution/execute'; +import { Source } from "./language/source"; +import { GraphQLFieldResolver } from "./type/definition"; +import { GraphQLSchema } from "./type/schema"; +import { ExecutionResult } from "./execution/execute"; /** * This is the primary entry point function for fulfilling GraphQL operations @@ -34,15 +34,15 @@ import { ExecutionResult } from './execution/execute'; * value or method on the source value with the field's name). */ export function graphql(args: { - schema: GraphQLSchema, - source: string | Source, - rootValue?: any, - contextValue?: any, + schema: GraphQLSchema; + source: string | Source; + rootValue?: any; + contextValue?: any; variableValues?: { - [key: string]: any - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver + [key: string]: any; + }; + operationName?: string; + fieldResolver?: GraphQLFieldResolver; }): Promise; export function graphql( schema: GraphQLSchema, @@ -50,7 +50,7 @@ export function graphql( rootValue?: any, contextValue?: any, variableValues?: { - [key: string]: any + [key: string]: any; }, operationName?: string, fieldResolver?: GraphQLFieldResolver diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index 49185e11a1..017f006787 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -17,17 +17,15 @@ // TypeScript Version: 2.3 // The primary entry point into fulfilling a GraphQL request. -export { - graphql -} from './graphql'; +export { graphql } from "./graphql"; // Create and operate on GraphQL type definitions and schema. -export * from './type'; +export * from "./type"; // Parse and operate on GraphQL language source files. -export * from './language'; +export * from "./language"; -export * from './subscription'; +export * from "./subscription"; // Execute GraphQL queries. export { @@ -37,16 +35,14 @@ export { getDirectiveValues, ExecutionArgs, ExecutionResult, -} from './execution'; +} from "./execution"; // Validate GraphQL queries. export { validate, ValidationContext, - // All validation rules in the GraphQL Specification. specifiedRules, - // Individual validation rules. ArgumentsOfCorrectTypeRule, DefaultValuesOfCorrectTypeRule, @@ -74,87 +70,60 @@ export { UniqueVariableNamesRule, VariablesAreInputTypesRule, VariablesInAllowedPositionRule, -} from './validation'; +} from "./validation"; // Create and format GraphQL errors. -export { - GraphQLError, - formatError, - GraphQLFormattedError, - GraphQLErrorLocation, -} from './error'; +export { GraphQLError, formatError, GraphQLFormattedError, GraphQLErrorLocation } from "./error"; // Utilities for operating on GraphQL type schema and parsed sources. export { // The GraphQL query recommended for a full schema introspection. introspectionQuery, - // Gets the target Operation from a Document getOperationAST, - // Build a GraphQLSchema from an introspection result. buildClientSchema, - // Build a GraphQLSchema from a parsed GraphQL Schema language AST. buildASTSchema, - // Build a GraphQLSchema from a GraphQL schema language document. buildSchema, - // Get the description of an AST node getDescription, - // Extends an existing GraphQLSchema from a parsed GraphQL Schema // language AST. extendSchema, - // Print a GraphQLSchema to GraphQL Schema language. printSchema, - // Print a GraphQLType to GraphQL Schema language. printType, - // Create a GraphQLType from a GraphQL language AST. typeFromAST, - // Create a JavaScript value from a GraphQL language AST. valueFromAST, - // Create a GraphQL language AST from a JavaScript value. astFromValue, - // A helper to use within recursive-descent visitors which need to be aware of // the GraphQL type system. TypeInfo, - // Determine if JavaScript values adhere to a GraphQL type. isValidJSValue, - // Determine if AST values adhere to a GraphQL type. isValidLiteralValue, - // Concatenates multiple AST together. concatAST, - // Separates an AST into an AST per Operation. separateOperations, - // Comparators for types isEqualType, isTypeSubTypeOf, doTypesOverlap, - // Asserts a string is a valid GraphQL name. assertValidName, - // Compares two GraphQLSchemas and detects breaking changes. findBreakingChanges, - // Report all deprecated usage within a GraphQL document. findDeprecatedUsages, - BreakingChange, - IntrospectionDirective, IntrospectionEnumType, IntrospectionEnumValue, @@ -172,4 +141,4 @@ export { IntrospectionType, IntrospectionTypeRef, IntrospectionUnionType, -} from './utilities'; +} from "./utilities"; diff --git a/types/graphql/language/ast.d.ts b/types/graphql/language/ast.d.ts index 1873caeb1f..21dbe83361 100644 --- a/types/graphql/language/ast.d.ts +++ b/types/graphql/language/ast.d.ts @@ -1,34 +1,34 @@ -import { Source } from './source'; +import { Source } from "./source"; /** * Contains a range of UTF-8 character offsets and token references that * identify the region of the source from which the AST derived. */ export interface Location { - /** - * The character offset at which this Node begins. - */ - start: number; + /** + * The character offset at which this Node begins. + */ + start: number; - /** - * The character offset at which this Node ends. - */ - end: number; + /** + * The character offset at which this Node ends. + */ + end: number; - /** - * The Token at which this Node begins. - */ - startToken: Token; + /** + * The Token at which this Node begins. + */ + startToken: Token; - /** - * The Token at which this Node ends. - */ - endToken: Token; + /** + * The Token at which this Node ends. + */ + endToken: Token; - /** - * The Source document the AST represents. - */ - source: Source; + /** + * The Source document the AST represents. + */ + source: Source; } /** @@ -37,346 +37,342 @@ export interface Location { * *only*. */ type TokenKind = - | '' - | '' - | '!' - | '$' - | '(' - | ')' - | '...' - | ':' - | '=' - | '@' - | '[' - | ']' - | '{' - | '|' - | '}' - | 'Name' - | 'Int' - | 'Float' - | 'String' - | 'BlockString' - | 'Comment'; + | "" + | "" + | "!" + | "$" + | "(" + | ")" + | "..." + | ":" + | "=" + | "@" + | "[" + | "]" + | "{" + | "|" + | "}" + | "Name" + | "Int" + | "Float" + | "String" + | "BlockString" + | "Comment"; /** * Represents a range of characters represented by a lexical token * within a Source. */ export interface Token { - /** - * The kind of Token. - */ - kind: TokenKind; + /** + * The kind of Token. + */ + kind: TokenKind; - /** - * The character offset at which this Node begins. - */ - start: number; + /** + * The character offset at which this Node begins. + */ + start: number; - /** - * The character offset at which this Node ends. - */ - end: number; + /** + * The character offset at which this Node ends. + */ + end: number; - /** - * The 1-indexed line number on which this Token appears. - */ - line: number; + /** + * The 1-indexed line number on which this Token appears. + */ + line: number; - /** - * The 1-indexed column number at which this Token begins. - */ - column: number; + /** + * The 1-indexed column number at which this Token begins. + */ + column: number; - /** - * For non-punctuation tokens, represents the interpreted value of the token. - */ - value: string | undefined; + /** + * For non-punctuation tokens, represents the interpreted value of the token. + */ + value: string | undefined; - /** - * Tokens exist as nodes in a double-linked-list amongst all tokens - * including ignored tokens. is always the first node and - * the last. - */ - prev?: Token; - next?: Token; + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + prev?: Token; + next?: Token; } /** * The list of all possible AST node types. */ export type ASTNode = - | NameNode - | DocumentNode - | OperationDefinitionNode - | VariableDefinitionNode - | VariableNode - | SelectionSetNode - | FieldNode - | ArgumentNode - | FragmentSpreadNode - | InlineFragmentNode - | FragmentDefinitionNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode - | ObjectFieldNode - | DirectiveNode - | NamedTypeNode - | ListTypeNode - | NonNullTypeNode - | SchemaDefinitionNode - | OperationTypeDefinitionNode - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | FieldDefinitionNode - | InputValueDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | EnumValueDefinitionNode - | InputObjectTypeDefinitionNode - | ScalarTypeExtensionNode - | ObjectTypeExtensionNode - | InterfaceTypeExtensionNode - | UnionTypeExtensionNode - | EnumTypeExtensionNode - | InputObjectTypeExtensionNode - | DirectiveDefinitionNode; + | NameNode + | DocumentNode + | OperationDefinitionNode + | VariableDefinitionNode + | VariableNode + | SelectionSetNode + | FieldNode + | ArgumentNode + | FragmentSpreadNode + | InlineFragmentNode + | FragmentDefinitionNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode + | ObjectFieldNode + | DirectiveNode + | NamedTypeNode + | ListTypeNode + | NonNullTypeNode + | SchemaDefinitionNode + | OperationTypeDefinitionNode + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | FieldDefinitionNode + | InputValueDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | EnumValueDefinitionNode + | InputObjectTypeDefinitionNode + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode + | DirectiveDefinitionNode; /** * Utility type listing all nodes indexed by their kind. */ export interface ASTKindToNode { - Name: NameNode; - Document: DocumentNode; - OperationDefinition: OperationDefinitionNode; - VariableDefinition: VariableDefinitionNode; - Variable: VariableNode; - SelectionSet: SelectionSetNode; - Field: FieldNode; - Argument: ArgumentNode; - FragmentSpread: FragmentSpreadNode; - InlineFragment: InlineFragmentNode; - FragmentDefinition: FragmentDefinitionNode; - IntValue: IntValueNode; - FloatValue: FloatValueNode; - StringValue: StringValueNode; - BooleanValue: BooleanValueNode; - NullValue: NullValueNode; - EnumValue: EnumValueNode; - ListValue: ListValueNode; - ObjectValue: ObjectValueNode; - ObjectField: ObjectFieldNode; - Directive: DirectiveNode; - NamedType: NamedTypeNode; - ListType: ListTypeNode; - NonNullType: NonNullTypeNode; - SchemaDefinition: SchemaDefinitionNode; - OperationTypeDefinition: OperationTypeDefinitionNode; - ScalarTypeDefinition: ScalarTypeDefinitionNode; - ObjectTypeDefinition: ObjectTypeDefinitionNode; - FieldDefinition: FieldDefinitionNode; - InputValueDefinition: InputValueDefinitionNode; - InterfaceTypeDefinition: InterfaceTypeDefinitionNode; - UnionTypeDefinition: UnionTypeDefinitionNode; - EnumTypeDefinition: EnumTypeDefinitionNode; - EnumValueDefinition: EnumValueDefinitionNode; - InputObjectTypeDefinition: InputObjectTypeDefinitionNode; - ScalarTypeExtension: ScalarTypeExtensionNode; - ObjectTypeExtension: ObjectTypeExtensionNode; - InterfaceTypeExtension: InterfaceTypeExtensionNode; - UnionTypeExtension: UnionTypeExtensionNode; - EnumTypeExtension: EnumTypeExtensionNode; - InputObjectTypeExtension: InputObjectTypeExtensionNode; - DirectiveDefinition: DirectiveDefinitionNode; + Name: NameNode; + Document: DocumentNode; + OperationDefinition: OperationDefinitionNode; + VariableDefinition: VariableDefinitionNode; + Variable: VariableNode; + SelectionSet: SelectionSetNode; + Field: FieldNode; + Argument: ArgumentNode; + FragmentSpread: FragmentSpreadNode; + InlineFragment: InlineFragmentNode; + FragmentDefinition: FragmentDefinitionNode; + IntValue: IntValueNode; + FloatValue: FloatValueNode; + StringValue: StringValueNode; + BooleanValue: BooleanValueNode; + NullValue: NullValueNode; + EnumValue: EnumValueNode; + ListValue: ListValueNode; + ObjectValue: ObjectValueNode; + ObjectField: ObjectFieldNode; + Directive: DirectiveNode; + NamedType: NamedTypeNode; + ListType: ListTypeNode; + NonNullType: NonNullTypeNode; + SchemaDefinition: SchemaDefinitionNode; + OperationTypeDefinition: OperationTypeDefinitionNode; + ScalarTypeDefinition: ScalarTypeDefinitionNode; + ObjectTypeDefinition: ObjectTypeDefinitionNode; + FieldDefinition: FieldDefinitionNode; + InputValueDefinition: InputValueDefinitionNode; + InterfaceTypeDefinition: InterfaceTypeDefinitionNode; + UnionTypeDefinition: UnionTypeDefinitionNode; + EnumTypeDefinition: EnumTypeDefinitionNode; + EnumValueDefinition: EnumValueDefinitionNode; + InputObjectTypeDefinition: InputObjectTypeDefinitionNode; + ScalarTypeExtension: ScalarTypeExtensionNode; + ObjectTypeExtension: ObjectTypeExtensionNode; + InterfaceTypeExtension: InterfaceTypeExtensionNode; + UnionTypeExtension: UnionTypeExtensionNode; + EnumTypeExtension: EnumTypeExtensionNode; + InputObjectTypeExtension: InputObjectTypeExtensionNode; + DirectiveDefinition: DirectiveDefinitionNode; } // Name export interface NameNode { - kind: 'Name'; - loc?: Location; - value: string; + kind: "Name"; + loc?: Location; + value: string; } // Document export interface DocumentNode { - kind: 'Document'; - loc?: Location; - definitions: DefinitionNode[]; + kind: "Document"; + loc?: Location; + definitions: DefinitionNode[]; } -export type DefinitionNode = - | ExecutableDefinitionNode - | TypeSystemDefinitionNode; // experimental non-spec addition. +export type DefinitionNode = ExecutableDefinitionNode | TypeSystemDefinitionNode; // experimental non-spec addition. -export type ExecutableDefinitionNode = - | OperationDefinitionNode - | FragmentDefinitionNode; +export type ExecutableDefinitionNode = OperationDefinitionNode | FragmentDefinitionNode; export interface OperationDefinitionNode { - kind: 'OperationDefinition'; - loc?: Location; - operation: OperationTypeNode; - name?: NameNode; - variableDefinitions?: VariableDefinitionNode[]; - directives?: DirectiveNode[]; - selectionSet: SelectionSetNode; + kind: "OperationDefinition"; + loc?: Location; + operation: OperationTypeNode; + name?: NameNode; + variableDefinitions?: VariableDefinitionNode[]; + directives?: DirectiveNode[]; + selectionSet: SelectionSetNode; } // Note: subscription is an experimental non-spec addition. -export type OperationTypeNode = 'query' | 'mutation' | 'subscription'; +export type OperationTypeNode = "query" | "mutation" | "subscription"; export interface VariableDefinitionNode { - kind: 'VariableDefinition'; - loc?: Location; - variable: VariableNode; - type: TypeNode; - defaultValue?: ValueNode; + kind: "VariableDefinition"; + loc?: Location; + variable: VariableNode; + type: TypeNode; + defaultValue?: ValueNode; } export interface VariableNode { - kind: 'Variable'; - loc?: Location; - name: NameNode; + kind: "Variable"; + loc?: Location; + name: NameNode; } export interface SelectionSetNode { - kind: 'SelectionSet'; - loc?: Location; - selections: SelectionNode[]; + kind: "SelectionSet"; + loc?: Location; + selections: SelectionNode[]; } export type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode; export interface FieldNode { - kind: 'Field'; - loc?: Location; - alias?: NameNode; - name: NameNode; - arguments?: ArgumentNode[]; - directives?: DirectiveNode[]; - selectionSet?: SelectionSetNode; + kind: "Field"; + loc?: Location; + alias?: NameNode; + name: NameNode; + arguments?: ArgumentNode[]; + directives?: DirectiveNode[]; + selectionSet?: SelectionSetNode; } export interface ArgumentNode { - kind: 'Argument'; - loc?: Location; - name: NameNode; - value: ValueNode; + kind: "Argument"; + loc?: Location; + name: NameNode; + value: ValueNode; } // Fragments export interface FragmentSpreadNode { - kind: 'FragmentSpread'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; + kind: "FragmentSpread"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; } export interface InlineFragmentNode { - kind: 'InlineFragment'; - loc?: Location; - typeCondition?: NamedTypeNode; - directives?: DirectiveNode[]; - selectionSet: SelectionSetNode; + kind: "InlineFragment"; + loc?: Location; + typeCondition?: NamedTypeNode; + directives?: DirectiveNode[]; + selectionSet: SelectionSetNode; } export interface FragmentDefinitionNode { - kind: 'FragmentDefinition'; - loc?: Location; - name: NameNode; - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - variableDefinitions?: VariableDefinitionNode[]; - typeCondition: NamedTypeNode; - directives?: DirectiveNode[]; - selectionSet: SelectionSetNode; + kind: "FragmentDefinition"; + loc?: Location; + name: NameNode; + // Note: fragment variable definitions are experimental and may be changed + // or removed in the future. + variableDefinitions?: VariableDefinitionNode[]; + typeCondition: NamedTypeNode; + directives?: DirectiveNode[]; + selectionSet: SelectionSetNode; } // Values export type ValueNode = - | VariableNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode; + | VariableNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode; export interface IntValueNode { - kind: 'IntValue'; - loc?: Location; - value: string; + kind: "IntValue"; + loc?: Location; + value: string; } export interface FloatValueNode { - kind: 'FloatValue'; - loc?: Location; - value: string; + kind: "FloatValue"; + loc?: Location; + value: string; } export interface StringValueNode { - kind: 'StringValue'; - loc?: Location; - value: string; + kind: "StringValue"; + loc?: Location; + value: string; } export interface BooleanValueNode { - kind: 'BooleanValue'; - loc?: Location; - value: boolean; + kind: "BooleanValue"; + loc?: Location; + value: boolean; } export interface NullValueNode { - kind: 'NullValue'; - loc?: Location; + kind: "NullValue"; + loc?: Location; } export interface EnumValueNode { - kind: 'EnumValue'; - loc?: Location; - value: string; + kind: "EnumValue"; + loc?: Location; + value: string; } export interface ListValueNode { - kind: 'ListValue'; - loc?: Location; - values: ValueNode[]; + kind: "ListValue"; + loc?: Location; + values: ValueNode[]; } export interface ObjectValueNode { - kind: 'ObjectValue'; - loc?: Location; - fields: ObjectFieldNode[]; + kind: "ObjectValue"; + loc?: Location; + fields: ObjectFieldNode[]; } export interface ObjectFieldNode { - kind: 'ObjectField'; - loc?: Location; - name: NameNode; - value: ValueNode; + kind: "ObjectField"; + loc?: Location; + name: NameNode; + value: ValueNode; } // Directives export interface DirectiveNode { - kind: 'Directive'; - loc?: Location; - name: NameNode; - arguments?: ArgumentNode[]; + kind: "Directive"; + loc?: Location; + name: NameNode; + arguments?: ArgumentNode[]; } // Type Reference @@ -384,198 +380,198 @@ export interface DirectiveNode { export type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode; export interface NamedTypeNode { - kind: 'NamedType'; - loc?: Location; - name: NameNode; + kind: "NamedType"; + loc?: Location; + name: NameNode; } export interface ListTypeNode { - kind: 'ListType'; - loc?: Location; - type: TypeNode; + kind: "ListType"; + loc?: Location; + type: TypeNode; } export interface NonNullTypeNode { - kind: 'NonNullType'; - loc?: Location; - type: NamedTypeNode | ListTypeNode; + kind: "NonNullType"; + loc?: Location; + type: NamedTypeNode | ListTypeNode; } // Type System Definition export type TypeSystemDefinitionNode = - | SchemaDefinitionNode - | TypeDefinitionNode - | TypeExtensionNode - | DirectiveDefinitionNode; + | SchemaDefinitionNode + | TypeDefinitionNode + | TypeExtensionNode + | DirectiveDefinitionNode; export interface SchemaDefinitionNode { - kind: 'SchemaDefinition'; - loc?: Location; - directives: DirectiveNode[]; - operationTypes: OperationTypeDefinitionNode[]; + kind: "SchemaDefinition"; + loc?: Location; + directives: DirectiveNode[]; + operationTypes: OperationTypeDefinitionNode[]; } export interface OperationTypeDefinitionNode { - kind: 'OperationTypeDefinition'; - loc?: Location; - operation: OperationTypeNode; - type: NamedTypeNode; + kind: "OperationTypeDefinition"; + loc?: Location; + operation: OperationTypeNode; + type: NamedTypeNode; } export type TypeDefinitionNode = - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | InputObjectTypeDefinitionNode; + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | InputObjectTypeDefinitionNode; export interface ScalarTypeDefinitionNode { - kind: 'ScalarTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; + kind: "ScalarTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; } export interface ObjectTypeDefinitionNode { - kind: 'ObjectTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - interfaces?: NamedTypeNode[]; - directives?: DirectiveNode[]; - fields: FieldDefinitionNode[]; + kind: "ObjectTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + interfaces?: NamedTypeNode[]; + directives?: DirectiveNode[]; + fields: FieldDefinitionNode[]; } export interface FieldDefinitionNode { - kind: 'FieldDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - arguments: InputValueDefinitionNode[]; - type: TypeNode; - directives?: DirectiveNode[]; + kind: "FieldDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + arguments: InputValueDefinitionNode[]; + type: TypeNode; + directives?: DirectiveNode[]; } export interface InputValueDefinitionNode { - kind: 'InputValueDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - type: TypeNode; - defaultValue?: ValueNode; - directives?: DirectiveNode[]; + kind: "InputValueDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + type: TypeNode; + defaultValue?: ValueNode; + directives?: DirectiveNode[]; } export interface InterfaceTypeDefinitionNode { - kind: 'InterfaceTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - fields: FieldDefinitionNode[]; + kind: "InterfaceTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + fields: FieldDefinitionNode[]; } export interface UnionTypeDefinitionNode { - kind: 'UnionTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - types: NamedTypeNode[]; + kind: "UnionTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + types: NamedTypeNode[]; } export interface EnumTypeDefinitionNode { - kind: 'EnumTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - values: EnumValueDefinitionNode[]; + kind: "EnumTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + values: EnumValueDefinitionNode[]; } export interface EnumValueDefinitionNode { - kind: 'EnumValueDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; + kind: "EnumValueDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; } export interface InputObjectTypeDefinitionNode { - kind: 'InputObjectTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - fields: InputValueDefinitionNode[]; + kind: "InputObjectTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + fields: InputValueDefinitionNode[]; } export type TypeExtensionNode = - | ScalarTypeExtensionNode - | ObjectTypeExtensionNode - | InterfaceTypeExtensionNode - | UnionTypeExtensionNode - | EnumTypeExtensionNode - | InputObjectTypeExtensionNode; + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode; export type ScalarTypeExtensionNode = { - kind: 'ScalarTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; + kind: "ScalarTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; }; export type ObjectTypeExtensionNode = { - kind: 'ObjectTypeExtension'; - loc?: Location; - name: NameNode; - interfaces?: NamedTypeNode[]; - directives?: DirectiveNode[]; - fields?: FieldDefinitionNode[]; + kind: "ObjectTypeExtension"; + loc?: Location; + name: NameNode; + interfaces?: NamedTypeNode[]; + directives?: DirectiveNode[]; + fields?: FieldDefinitionNode[]; }; export type InterfaceTypeExtensionNode = { - kind: 'InterfaceTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; - fields?: FieldDefinitionNode[]; + kind: "InterfaceTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + fields?: FieldDefinitionNode[]; }; export type UnionTypeExtensionNode = { - kind: 'UnionTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; - types?: NamedTypeNode[]; + kind: "UnionTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + types?: NamedTypeNode[]; }; export type EnumTypeExtensionNode = { - kind: 'EnumTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; - values?: EnumValueDefinitionNode[]; + kind: "EnumTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + values?: EnumValueDefinitionNode[]; }; export type InputObjectTypeExtensionNode = { - kind: 'InputObjectTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; - fields?: InputValueDefinitionNode[]; + kind: "InputObjectTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + fields?: InputValueDefinitionNode[]; }; // Directive Definitions export interface DirectiveDefinitionNode { - kind: 'DirectiveDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - arguments?: InputValueDefinitionNode[]; - locations: NameNode[]; + kind: "DirectiveDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + arguments?: InputValueDefinitionNode[]; + locations: NameNode[]; } diff --git a/types/graphql/language/index.d.ts b/types/graphql/language/index.d.ts index c8fe4b13ec..db088e6925 100644 --- a/types/graphql/language/index.d.ts +++ b/types/graphql/language/index.d.ts @@ -1,15 +1,9 @@ -export * from './ast'; -export { getLocation } from './location'; -import * as Kind from './kinds'; +export * from "./ast"; +export { getLocation } from "./location"; +import * as Kind from "./kinds"; export { Kind }; -export { createLexer, TokenKind, Lexer } from './lexer'; -export { parse, parseValue, parseType, ParseOptions } from './parser'; -export { print } from './printer'; -export { Source } from './source'; -export { - visit, - visitInParallel, - visitWithTypeInfo, - getVisitFn, - BREAK, -} from './visitor'; +export { createLexer, TokenKind, Lexer } from "./lexer"; +export { parse, parseValue, parseType, ParseOptions } from "./parser"; +export { print } from "./printer"; +export { Source } from "./source"; +export { visit, visitInParallel, visitWithTypeInfo, getVisitFn, BREAK } from "./visitor"; diff --git a/types/graphql/language/kinds.d.ts b/types/graphql/language/kinds.d.ts index f92826f891..2e7db3ad87 100644 --- a/types/graphql/language/kinds.d.ts +++ b/types/graphql/language/kinds.d.ts @@ -1,72 +1,72 @@ // Name -export const NAME: 'Name'; +export const NAME: "Name"; // Document -export const DOCUMENT: 'Document'; -export const OPERATION_DEFINITION: 'OperationDefinition'; -export const VARIABLE_DEFINITION: 'VariableDefinition'; -export const VARIABLE: 'Variable'; -export const SELECTION_SET: 'SelectionSet'; -export const FIELD: 'Field'; -export const ARGUMENT: 'Argument'; +export const DOCUMENT: "Document"; +export const OPERATION_DEFINITION: "OperationDefinition"; +export const VARIABLE_DEFINITION: "VariableDefinition"; +export const VARIABLE: "Variable"; +export const SELECTION_SET: "SelectionSet"; +export const FIELD: "Field"; +export const ARGUMENT: "Argument"; // Fragments -export const FRAGMENT_SPREAD: 'FragmentSpread'; -export const INLINE_FRAGMENT: 'InlineFragment'; -export const FRAGMENT_DEFINITION: 'FragmentDefinition'; +export const FRAGMENT_SPREAD: "FragmentSpread"; +export const INLINE_FRAGMENT: "InlineFragment"; +export const FRAGMENT_DEFINITION: "FragmentDefinition"; // Values -export const INT: 'IntValue'; -export const FLOAT: 'FloatValue'; -export const STRING: 'StringValue'; -export const BOOLEAN: 'BooleanValue'; -export const NULL: 'NullValue'; -export const ENUM: 'EnumValue'; -export const LIST: 'ListValue'; -export const OBJECT: 'ObjectValue'; -export const OBJECT_FIELD: 'ObjectField'; +export const INT: "IntValue"; +export const FLOAT: "FloatValue"; +export const STRING: "StringValue"; +export const BOOLEAN: "BooleanValue"; +export const NULL: "NullValue"; +export const ENUM: "EnumValue"; +export const LIST: "ListValue"; +export const OBJECT: "ObjectValue"; +export const OBJECT_FIELD: "ObjectField"; // Directives -export const DIRECTIVE: 'Directive'; +export const DIRECTIVE: "Directive"; // Types -export const NAMED_TYPE: 'NamedType'; -export const LIST_TYPE: 'ListType'; -export const NON_NULL_TYPE: 'NonNullType'; +export const NAMED_TYPE: "NamedType"; +export const LIST_TYPE: "ListType"; +export const NON_NULL_TYPE: "NonNullType"; // Type System Definitions -export const SCHEMA_DEFINITION: 'SchemaDefinition'; -export const OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition'; +export const SCHEMA_DEFINITION: "SchemaDefinition"; +export const OPERATION_TYPE_DEFINITION: "OperationTypeDefinition"; // Type Definitions -export const SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition'; -export const OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition'; -export const FIELD_DEFINITION: 'FieldDefinition'; -export const INPUT_VALUE_DEFINITION: 'InputValueDefinition'; -export const INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition'; -export const UNION_TYPE_DEFINITION: 'UnionTypeDefinition'; -export const ENUM_TYPE_DEFINITION: 'EnumTypeDefinition'; -export const ENUM_VALUE_DEFINITION: 'EnumValueDefinition'; -export const INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition'; +export const SCALAR_TYPE_DEFINITION: "ScalarTypeDefinition"; +export const OBJECT_TYPE_DEFINITION: "ObjectTypeDefinition"; +export const FIELD_DEFINITION: "FieldDefinition"; +export const INPUT_VALUE_DEFINITION: "InputValueDefinition"; +export const INTERFACE_TYPE_DEFINITION: "InterfaceTypeDefinition"; +export const UNION_TYPE_DEFINITION: "UnionTypeDefinition"; +export const ENUM_TYPE_DEFINITION: "EnumTypeDefinition"; +export const ENUM_VALUE_DEFINITION: "EnumValueDefinition"; +export const INPUT_OBJECT_TYPE_DEFINITION: "InputObjectTypeDefinition"; // Type Extensions -export const TYPE_EXTENSION_DEFINITION: 'TypeExtensionDefinition'; -export const SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension'; -export const OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension'; -export const INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension'; -export const UNION_TYPE_EXTENSION: 'UnionTypeExtension'; -export const ENUM_TYPE_EXTENSION: 'EnumTypeExtension'; -export const INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension'; +export const TYPE_EXTENSION_DEFINITION: "TypeExtensionDefinition"; +export const SCALAR_TYPE_EXTENSION: "ScalarTypeExtension"; +export const OBJECT_TYPE_EXTENSION: "ObjectTypeExtension"; +export const INTERFACE_TYPE_EXTENSION: "InterfaceTypeExtension"; +export const UNION_TYPE_EXTENSION: "UnionTypeExtension"; +export const ENUM_TYPE_EXTENSION: "EnumTypeExtension"; +export const INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"; // Directive Definitions -export const DIRECTIVE_DEFINITION: 'DirectiveDefinition'; +export const DIRECTIVE_DEFINITION: "DirectiveDefinition"; diff --git a/types/graphql/language/lexer.d.ts b/types/graphql/language/lexer.d.ts index 0db85434e2..27db5b04cc 100644 --- a/types/graphql/language/lexer.d.ts +++ b/types/graphql/language/lexer.d.ts @@ -1,6 +1,6 @@ -import { Token } from './ast'; -import { Source } from './source'; -import { syntaxError } from '../error'; +import { Token } from "./ast"; +import { Source } from "./source"; +import { syntaxError } from "../error"; /** * Given a Source object, this returns a Lexer for that source. @@ -10,42 +10,39 @@ import { syntaxError } from '../error'; * EOF, after which the lexer will repeatedly return the same EOF token * whenever called. */ -export function createLexer( - source: Source, - options: TOptions, -): Lexer; +export function createLexer(source: Source, options: TOptions): Lexer; /** * The return type of createLexer. */ export interface Lexer { - source: Source; - options: TOptions; + source: Source; + options: TOptions; - /** - * The previously focused non-ignored token. - */ - lastToken: Token; + /** + * The previously focused non-ignored token. + */ + lastToken: Token; - /** - * The currently focused non-ignored token. - */ - token: Token; + /** + * The currently focused non-ignored token. + */ + token: Token; - /** - * The (1-indexed) line containing the current token. - */ - line: number; + /** + * The (1-indexed) line containing the current token. + */ + line: number; - /** - * The character offset at which the current line begins. - */ - lineStart: number; + /** + * The character offset at which the current line begins. + */ + lineStart: number; - /** - * Advances the token stream to the next non-ignored token. - */ - advance(): Token; + /** + * Advances the token stream to the next non-ignored token. + */ + advance(): Token; } /** @@ -53,26 +50,26 @@ export interface Lexer { * lexer emits. */ export const TokenKind: { - SOF: ''; - EOF: ''; - BANG: '!'; - DOLLAR: '$'; - PAREN_L: '('; - PAREN_R: ')'; - SPREAD: '...'; - COLON: ':'; - EQUALS: '='; - AT: '@'; - BRACKET_L: '['; - BRACKET_R: ']'; - BRACE_L: '{'; - PIPE: '|'; - BRACE_R: '}'; - NAME: 'Name'; - INT: 'Int'; - FLOAT: 'Float'; - STRING: 'String'; - COMMENT: 'Comment'; + SOF: ""; + EOF: ""; + BANG: "!"; + DOLLAR: "$"; + PAREN_L: "("; + PAREN_R: ")"; + SPREAD: "..."; + COLON: ":"; + EQUALS: "="; + AT: "@"; + BRACKET_L: "["; + BRACKET_R: "]"; + BRACE_L: "{"; + PIPE: "|"; + BRACE_R: "}"; + NAME: "Name"; + INT: "Int"; + FLOAT: "Float"; + STRING: "String"; + COMMENT: "Comment"; }; /** diff --git a/types/graphql/language/location.d.ts b/types/graphql/language/location.d.ts index cb9744e0d5..4d7a13e314 100644 --- a/types/graphql/language/location.d.ts +++ b/types/graphql/language/location.d.ts @@ -1,8 +1,8 @@ -import { Source } from './source'; +import { Source } from "./source"; export interface SourceLocation { - line: number; - column: number; + line: number; + column: number; } export function getLocation(source: Source, position: number): SourceLocation; diff --git a/types/graphql/language/parser.d.ts b/types/graphql/language/parser.d.ts index ffafaae7fb..3cdb3462ae 100644 --- a/types/graphql/language/parser.d.ts +++ b/types/graphql/language/parser.d.ts @@ -1,66 +1,62 @@ -import { NamedTypeNode, TypeNode, ValueNode, DocumentNode } from './ast'; -import { Source } from './source'; -import { Lexer } from './lexer'; +import { NamedTypeNode, TypeNode, ValueNode, DocumentNode } from "./ast"; +import { Source } from "./source"; +import { Lexer } from "./lexer"; /** * Configuration options to control parser behavior */ export interface ParseOptions { + /** + * By default, the parser creates AST nodes that know the location + * in the source that they correspond to. This configuration flag + * disables that behavior for performance or testing. + */ + noLocation?: boolean; - /** - * By default, the parser creates AST nodes that know the location - * in the source that they correspond to. This configuration flag - * disables that behavior for performance or testing. - */ - noLocation?: boolean, + /** + * If enabled, the parser will parse empty fields sets in the Schema + * Definition Language. Otherwise, the parser will follow the current + * specification. + * + * This option is provided to ease adoption of the final SDL specification + * and will be removed in a future major release. + */ + allowLegacySDLEmptyFields?: boolean; - /** - * If enabled, the parser will parse empty fields sets in the Schema - * Definition Language. Otherwise, the parser will follow the current - * specification. - * - * This option is provided to ease adoption of the final SDL specification - * and will be removed in a future major release. - */ - allowLegacySDLEmptyFields?: boolean, + /** + * If enabled, the parser will parse implemented interfaces with no `&` + * character between each interface. Otherwise, the parser will follow the + * current specification. + * + * This option is provided to ease adoption of the final SDL specification + * and will be removed in a future major release. + */ + allowLegacySDLImplementsInterfaces?: boolean; - /** - * If enabled, the parser will parse implemented interfaces with no `&` - * character between each interface. Otherwise, the parser will follow the - * current specification. - * - * This option is provided to ease adoption of the final SDL specification - * and will be removed in a future major release. - */ - allowLegacySDLImplementsInterfaces?: boolean, - - /** - * EXPERIMENTAL: - * - * If enabled, the parser will understand and parse variable definitions - * contained in a fragment definition. They'll be represented in the - * `variableDefinitions` field of the FragmentDefinitionNode. - * - * The syntax is identical to normal, query-defined variables. For example: - * - * fragment A($var: Boolean = false) on T { - * ... - * } - * - * Note: this feature is experimental and may change or be removed in the - * future. - */ - experimentalFragmentVariables?: boolean, + /** + * EXPERIMENTAL: + * + * If enabled, the parser will understand and parse variable definitions + * contained in a fragment definition. They'll be represented in the + * `variableDefinitions` field of the FragmentDefinitionNode. + * + * The syntax is identical to normal, query-defined variables. For example: + * + * fragment A($var: Boolean = false) on T { + * ... + * } + * + * Note: this feature is experimental and may change or be removed in the + * future. + */ + experimentalFragmentVariables?: boolean; } /** * Given a GraphQL source, parses it into a Document. * Throws GraphQLError if a syntax error is encountered. */ -export function parse( - source: string | Source, - options?: ParseOptions, -): DocumentNode; +export function parse(source: string | Source, options?: ParseOptions): DocumentNode; /** * Given a string containing a GraphQL value, parse the AST for that value. @@ -69,10 +65,7 @@ export function parse( * This is useful within tools that operate upon GraphQL Values directly and * in isolation of complete GraphQL documents. */ -export function parseValue( - source: Source | string, - options?: ParseOptions, -): ValueNode; +export function parseValue(source: Source | string, options?: ParseOptions): ValueNode; /** * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for @@ -84,10 +77,7 @@ export function parseValue( * * Consider providing the results to the utility function: typeFromAST(). */ -export function parseType( - source: Source | string, - options?: ParseOptions, -): TypeNode; +export function parseType(source: Source | string, options?: ParseOptions): TypeNode; export function parseConstValue(lexer: Lexer): ValueNode; diff --git a/types/graphql/language/source.d.ts b/types/graphql/language/source.d.ts index 236028b7df..80e68f5557 100644 --- a/types/graphql/language/source.d.ts +++ b/types/graphql/language/source.d.ts @@ -1,5 +1,5 @@ export class Source { - body: string; - name: string; - constructor(body: string, name?: string); + body: string; + name: string; + constructor(body: string, name?: string); } diff --git a/types/graphql/language/visitor.d.ts b/types/graphql/language/visitor.d.ts index e7e9d67da0..320d181e4a 100644 --- a/types/graphql/language/visitor.d.ts +++ b/types/graphql/language/visitor.d.ts @@ -1,43 +1,43 @@ export const QueryDocumentKeys: { - Name: any[]; - Document: string[]; - OperationDefinition: string[]; - VariableDefinition: string[]; - Variable: string[]; - SelectionSet: string[]; - Field: string[]; - Argument: string[]; + Name: any[]; + Document: string[]; + OperationDefinition: string[]; + VariableDefinition: string[]; + Variable: string[]; + SelectionSet: string[]; + Field: string[]; + Argument: string[]; - FragmentSpread: string[]; - InlineFragment: string[]; - FragmentDefinition: string[]; + FragmentSpread: string[]; + InlineFragment: string[]; + FragmentDefinition: string[]; - IntValue: number[]; - FloatValue: number[]; - StringValue: string[]; - BooleanValue: boolean[]; - NullValue: null[]; - EnumValue: any[]; - ListValue: string[]; - ObjectValue: string[]; - ObjectField: string[]; + IntValue: number[]; + FloatValue: number[]; + StringValue: string[]; + BooleanValue: boolean[]; + NullValue: null[]; + EnumValue: any[]; + ListValue: string[]; + ObjectValue: string[]; + ObjectField: string[]; - Directive: string[]; + Directive: string[]; - NamedType: string[]; - ListType: string[]; - NonNullType: string[]; + NamedType: string[]; + ListType: string[]; + NonNullType: string[]; - ObjectTypeDefinition: string[]; - FieldDefinition: string[]; - InputValueDefinition: string[]; - InterfaceTypeDefinition: string[]; - UnionTypeDefinition: string[]; - ScalarTypeDefinition: string[]; - EnumTypeDefinition: string[]; - EnumValueDefinition: string[]; - InputObjectTypeDefinition: string[]; - TypeExtensionDefinition: string[]; + ObjectTypeDefinition: string[]; + FieldDefinition: string[]; + InputValueDefinition: string[]; + InterfaceTypeDefinition: string[]; + UnionTypeDefinition: string[]; + ScalarTypeDefinition: string[]; + EnumTypeDefinition: string[]; + EnumValueDefinition: string[]; + InputObjectTypeDefinition: string[]; + TypeExtensionDefinition: string[]; }; export const BREAK: any; diff --git a/types/graphql/subscription/index.d.ts b/types/graphql/subscription/index.d.ts index 11b0a7f26d..71583e7ff3 100644 --- a/types/graphql/subscription/index.d.ts +++ b/types/graphql/subscription/index.d.ts @@ -1 +1 @@ -export { subscribe, createSourceEventStream } from './subscribe'; +export { subscribe, createSourceEventStream } from "./subscribe"; diff --git a/types/graphql/subscription/subscribe.d.ts b/types/graphql/subscription/subscribe.d.ts index dc2c096b86..c4eec87ac9 100644 --- a/types/graphql/subscription/subscribe.d.ts +++ b/types/graphql/subscription/subscribe.d.ts @@ -1,29 +1,29 @@ -import { GraphQLSchema } from '../type/schema'; -import { DocumentNode } from '../language/ast'; -import { GraphQLFieldResolver } from '../type/definition'; -import { ExecutionResult } from '../execution/execute'; +import { GraphQLSchema } from "../type/schema"; +import { DocumentNode } from "../language/ast"; +import { GraphQLFieldResolver } from "../type/definition"; +import { ExecutionResult } from "../execution/execute"; export function subscribe( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { - [key: string]: any; - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver, - subscribeFieldResolver?: GraphQLFieldResolver, + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: any, + contextValue?: any, + variableValues?: { + [key: string]: any; + }, + operationName?: string, + fieldResolver?: GraphQLFieldResolver, + subscribeFieldResolver?: GraphQLFieldResolver ): Promise | ExecutionResult>; export function createSourceEventStream( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { - [key: string]: any; - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver, + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: any, + contextValue?: any, + variableValues?: { + [key: string]: any; + }, + operationName?: string, + fieldResolver?: GraphQLFieldResolver ): Promise>; diff --git a/types/graphql/type/definition.d.ts b/types/graphql/type/definition.d.ts index 098f7376ef..b31ac6bbed 100644 --- a/types/graphql/type/definition.d.ts +++ b/types/graphql/type/definition.d.ts @@ -1,33 +1,33 @@ import { - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - TypeExtensionNode, - OperationDefinitionNode, - FieldNode, - FragmentDefinitionNode, - ValueNode, -} from '../language/ast'; -import { GraphQLSchema } from './schema'; + ScalarTypeDefinitionNode, + ObjectTypeDefinitionNode, + FieldDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + UnionTypeDefinitionNode, + EnumTypeDefinitionNode, + EnumValueDefinitionNode, + InputObjectTypeDefinitionNode, + TypeExtensionNode, + OperationDefinitionNode, + FieldNode, + FragmentDefinitionNode, + ValueNode, +} from "../language/ast"; +import { GraphQLSchema } from "./schema"; /** * These are all of the possible kinds of types. */ export type GraphQLType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull; export function isType(type: any): type is GraphQLType; @@ -37,16 +37,11 @@ export function assertType(type: any): GraphQLType; * These types may be used as input types for arguments and directives. */ export type GraphQLInputType = - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - >; + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull>; export function isInputType(type: GraphQLType): type is GraphQLInputType; @@ -56,20 +51,20 @@ export function assertInputType(type: GraphQLType): GraphQLInputType; * These types may be used as output types as the result of fields. */ export type GraphQLOutputType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList - >; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + >; export function isOutputType(type: GraphQLType): type is GraphQLOutputType; @@ -87,14 +82,9 @@ export function assertLeafType(type: GraphQLType): GraphQLLeafType; /** * These types may describe the parent context of a selection set. */ -export type GraphQLCompositeType = - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType; +export type GraphQLCompositeType = GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType; -export function isCompositeType( - type: GraphQLType, -): type is GraphQLCompositeType; +export function isCompositeType(type: GraphQLType): type is GraphQLCompositeType; export function assertCompositeType(type: GraphQLType): GraphQLCompositeType; @@ -111,28 +101,26 @@ export function assertAbstractType(type: GraphQLType): GraphQLAbstractType; * These types can all accept null as a value. */ export type GraphQLNullableType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList; -export function getNullableType( - type: T, -): T & GraphQLNullableType; +export function getNullableType(type: T): T & GraphQLNullableType; /** * These named types do not include modifiers like List or NonNull. */ export type GraphQLNamedType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType; export function isNamedType(type: GraphQLType): boolean; @@ -164,30 +152,30 @@ export type Thunk = (() => T) | T; * */ export class GraphQLScalarType { - name: string; - description: string; - astNode?: ScalarTypeDefinitionNode; - constructor(config: GraphQLScalarTypeConfig); + name: string; + description: string; + astNode?: ScalarTypeDefinitionNode; + constructor(config: GraphQLScalarTypeConfig); - // Serializes an internal value to include in a response. - serialize(value: any): any; + // Serializes an internal value to include in a response. + serialize(value: any): any; - // Parses an externally provided value to use as an input. - parseValue(value: any): any; + // Parses an externally provided value to use as an input. + parseValue(value: any): any; - // Parses an externally provided literal value to use as an input. - parseLiteral(valueNode: ValueNode): any; + // Parses an externally provided literal value to use as an input. + parseLiteral(valueNode: ValueNode): any; - toString(): string; + toString(): string; } export interface GraphQLScalarTypeConfig { - name: string; - description?: string; - astNode?: ScalarTypeDefinitionNode; - serialize(value: any): TExternal | null | undefined; - parseValue?(value: any): TInternal | null | undefined; - parseLiteral?(valueNode: ValueNode): TInternal | null | undefined; + name: string; + description?: string; + astNode?: ScalarTypeDefinitionNode; + serialize(value: any): TExternal | null | undefined; + parseValue?(value: any): TInternal | null | undefined; + parseLiteral?(valueNode: ValueNode): TInternal | null | undefined; } /** @@ -228,123 +216,109 @@ export interface GraphQLScalarTypeConfig { * */ export class GraphQLObjectType { - name: string; - description: string; - astNode?: ObjectTypeDefinitionNode; - extensionASTNodes: Array; - isTypeOf: GraphQLIsTypeOfFn; + name: string; + description: string; + astNode?: ObjectTypeDefinitionNode; + extensionASTNodes: Array; + isTypeOf: GraphQLIsTypeOfFn; - constructor(config: GraphQLObjectTypeConfig); - getFields(): GraphQLFieldMap; - getInterfaces(): GraphQLInterfaceType[]; - toString(): string; + constructor(config: GraphQLObjectTypeConfig); + getFields(): GraphQLFieldMap; + getInterfaces(): GraphQLInterfaceType[]; + toString(): string; } export interface GraphQLObjectTypeConfig { - name: string; - interfaces?: Thunk; - fields: Thunk>; - isTypeOf?: GraphQLIsTypeOfFn; - description?: string; - astNode?: ObjectTypeDefinitionNode; - extensionASTNodes?: Array; + name: string; + interfaces?: Thunk; + fields: Thunk>; + isTypeOf?: GraphQLIsTypeOfFn; + description?: string; + astNode?: ObjectTypeDefinitionNode; + extensionASTNodes?: Array; } export type GraphQLTypeResolver = ( - value: TSource, - context: TContext, - info: GraphQLResolveInfo, + value: TSource, + context: TContext, + info: GraphQLResolveInfo ) => GraphQLObjectType | string | Promise; export type GraphQLIsTypeOfFn = ( - source: TSource, - context: TContext, - info: GraphQLResolveInfo, + source: TSource, + context: TContext, + info: GraphQLResolveInfo ) => boolean | Promise; -export type GraphQLFieldResolver< - TSource, - TContext, - TArgs = { [argName: string]: any } -> = ( - source: TSource, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, +export type GraphQLFieldResolver = ( + source: TSource, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo ) => any; export interface GraphQLResolveInfo { - fieldName: string; - fieldNodes: FieldNode[]; - returnType: GraphQLOutputType; - parentType: GraphQLCompositeType; - path: ResponsePath; - schema: GraphQLSchema; - fragments: { [fragmentName: string]: FragmentDefinitionNode }; - rootValue: any; - operation: OperationDefinitionNode; - variableValues: { [variableName: string]: any }; + fieldName: string; + fieldNodes: FieldNode[]; + returnType: GraphQLOutputType; + parentType: GraphQLCompositeType; + path: ResponsePath; + schema: GraphQLSchema; + fragments: { [fragmentName: string]: FragmentDefinitionNode }; + rootValue: any; + operation: OperationDefinitionNode; + variableValues: { [variableName: string]: any }; } -export type ResponsePath = - | { prev: ResponsePath; key: string | number } - | undefined; +export type ResponsePath = { prev: ResponsePath; key: string | number } | undefined; -export interface GraphQLFieldConfig< - TSource, - TContext, - TArgs = { [argName: string]: any } -> { - type: GraphQLOutputType; - args?: GraphQLFieldConfigArgumentMap; - resolve?: GraphQLFieldResolver; - subscribe?: GraphQLFieldResolver; - deprecationReason?: string; - description?: string; - astNode?: FieldDefinitionNode; +export interface GraphQLFieldConfig { + type: GraphQLOutputType; + args?: GraphQLFieldConfigArgumentMap; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + deprecationReason?: string; + description?: string; + astNode?: FieldDefinitionNode; } export interface GraphQLFieldConfigArgumentMap { - [argName: string]: GraphQLArgumentConfig; + [argName: string]: GraphQLArgumentConfig; } export interface GraphQLArgumentConfig { - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLFieldConfigMap { - [fieldName: string]: GraphQLFieldConfig; + [fieldName: string]: GraphQLFieldConfig; } -export interface GraphQLField< - TSource, - TContext, - TArgs = { [argName: string]: any } -> { - name: string; - description: string; - type: GraphQLOutputType; - args: GraphQLArgument[]; - resolve?: GraphQLFieldResolver; - subscribe?: GraphQLFieldResolver; - isDeprecated?: boolean; - deprecationReason?: string; - astNode?: FieldDefinitionNode; +export interface GraphQLField { + name: string; + description: string; + type: GraphQLOutputType; + args: GraphQLArgument[]; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + isDeprecated?: boolean; + deprecationReason?: string; + astNode?: FieldDefinitionNode; } export interface GraphQLArgument { - name: string; - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + name: string; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLFieldMap { - [fieldName: string]: GraphQLField; + [fieldName: string]: GraphQLField; } /** @@ -366,29 +340,29 @@ export interface GraphQLFieldMap { * */ export class GraphQLInterfaceType { - name: string; - description: string; - astNode?: InterfaceTypeDefinitionNode; - resolveType: GraphQLTypeResolver; + name: string; + description: string; + astNode?: InterfaceTypeDefinitionNode; + resolveType: GraphQLTypeResolver; - constructor(config: GraphQLInterfaceTypeConfig); + constructor(config: GraphQLInterfaceTypeConfig); - getFields(): GraphQLFieldMap; + getFields(): GraphQLFieldMap; - toString(): string; + toString(): string; } export interface GraphQLInterfaceTypeConfig { - name: string; - fields: Thunk>; - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: GraphQLTypeResolver; - description?: string; - astNode?: InterfaceTypeDefinitionNode; + name: string; + fields: Thunk>; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: GraphQLTypeResolver; + description?: string; + astNode?: InterfaceTypeDefinitionNode; } /** @@ -415,29 +389,29 @@ export interface GraphQLInterfaceTypeConfig { * */ export class GraphQLUnionType { - name: string; - description: string; - astNode?: UnionTypeDefinitionNode; - resolveType: GraphQLTypeResolver; + name: string; + description: string; + astNode?: UnionTypeDefinitionNode; + resolveType: GraphQLTypeResolver; - constructor(config: GraphQLUnionTypeConfig); + constructor(config: GraphQLUnionTypeConfig); - getTypes(): GraphQLObjectType[]; + getTypes(): GraphQLObjectType[]; - toString(): string; + toString(): string; } export interface GraphQLUnionTypeConfig { - name: string; - types: Thunk; - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: GraphQLTypeResolver; - description?: string; - astNode?: UnionTypeDefinitionNode; + name: string; + types: Thunk; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: GraphQLTypeResolver; + description?: string; + astNode?: UnionTypeDefinitionNode; } /** @@ -462,45 +436,45 @@ export interface GraphQLUnionTypeConfig { * will be used as its internal value. */ export class GraphQLEnumType { - name: string; - description: string; - astNode?: EnumTypeDefinitionNode; + name: string; + description: string; + astNode?: EnumTypeDefinitionNode; - constructor(config: GraphQLEnumTypeConfig); - getValues(): GraphQLEnumValue[]; - getValue(name: string): GraphQLEnumValue; - isValidValue(value: any): boolean; - serialize(value: any): string; - parseValue(value: any): any; - parseLiteral(valueNode: ValueNode): any; - toString(): string; + constructor(config: GraphQLEnumTypeConfig); + getValues(): GraphQLEnumValue[]; + getValue(name: string): GraphQLEnumValue; + isValidValue(value: any): boolean; + serialize(value: any): string; + parseValue(value: any): any; + parseLiteral(valueNode: ValueNode): any; + toString(): string; } export interface GraphQLEnumTypeConfig { - name: string; - values: GraphQLEnumValueConfigMap; - description?: string; - astNode?: EnumTypeDefinitionNode; + name: string; + values: GraphQLEnumValueConfigMap; + description?: string; + astNode?: EnumTypeDefinitionNode; } export interface GraphQLEnumValueConfigMap { - [valueName: string]: GraphQLEnumValueConfig; + [valueName: string]: GraphQLEnumValueConfig; } export interface GraphQLEnumValueConfig { - value?: any; - deprecationReason?: string; - description?: string; - astNode?: EnumValueDefinitionNode; + value?: any; + deprecationReason?: string; + description?: string; + astNode?: EnumValueDefinitionNode; } export interface GraphQLEnumValue { - name: string; - description: string; - isDeprecated?: boolean; - deprecationReason: string; - astNode?: EnumValueDefinitionNode; - value: any; + name: string; + description: string; + isDeprecated?: boolean; + deprecationReason: string; + astNode?: EnumValueDefinitionNode; + value: any; } /** @@ -524,42 +498,42 @@ export interface GraphQLEnumValue { * */ export class GraphQLInputObjectType { - name: string; - description: string; - astNode?: InputObjectTypeDefinitionNode; - constructor(config: GraphQLInputObjectTypeConfig); - getFields(): GraphQLInputFieldMap; - toString(): string; + name: string; + description: string; + astNode?: InputObjectTypeDefinitionNode; + constructor(config: GraphQLInputObjectTypeConfig); + getFields(): GraphQLInputFieldMap; + toString(): string; } export interface GraphQLInputObjectTypeConfig { - name: string; - fields: Thunk; - description?: string; - astNode?: InputObjectTypeDefinitionNode; + name: string; + fields: Thunk; + description?: string; + astNode?: InputObjectTypeDefinitionNode; } export interface GraphQLInputFieldConfig { - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLInputFieldConfigMap { - [fieldName: string]: GraphQLInputFieldConfig; + [fieldName: string]: GraphQLInputFieldConfig; } export interface GraphQLInputField { - name: string; - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + name: string; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLInputFieldMap { - [fieldName: string]: GraphQLInputField; + [fieldName: string]: GraphQLInputField; } /** @@ -581,9 +555,9 @@ export interface GraphQLInputFieldMap { * */ export class GraphQLList { - ofType: T; - constructor(type: T); - toString(): string; + ofType: T; + constructor(type: T); + toString(): string; } /** @@ -607,9 +581,9 @@ export class GraphQLList { * Note: the enforcement of non-nullability occurs within the executor. */ export class GraphQLNonNull { - ofType: T; + ofType: T; - constructor(type: T); + constructor(type: T); - toString(): string; + toString(): string; } diff --git a/types/graphql/type/directives.d.ts b/types/graphql/type/directives.d.ts index b6962bc4ae..bf1fc8df16 100644 --- a/types/graphql/type/directives.d.ts +++ b/types/graphql/type/directives.d.ts @@ -1,27 +1,27 @@ -import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from './definition'; -import { DirectiveDefinitionNode } from '../language/ast'; +import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from "./definition"; +import { DirectiveDefinitionNode } from "../language/ast"; export const DirectiveLocation: { - // Operations - QUERY: 'QUERY'; - MUTATION: 'MUTATION'; - SUBSCRIPTION: 'SUBSCRIPTION'; - FIELD: 'FIELD'; - FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION'; - FRAGMENT_SPREAD: 'FRAGMENT_SPREAD'; - INLINE_FRAGMENT: 'INLINE_FRAGMENT'; - // Schema Definitions - SCHEMA: 'SCHEMA'; - SCALAR: 'SCALAR'; - OBJECT: 'OBJECT'; - FIELD_DEFINITION: 'FIELD_DEFINITION'; - ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION'; - INTERFACE: 'INTERFACE'; - UNION: 'UNION'; - ENUM: 'ENUM'; - ENUM_VALUE: 'ENUM_VALUE'; - INPUT_OBJECT: 'INPUT_OBJECT'; - INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION'; + // Operations + QUERY: "QUERY"; + MUTATION: "MUTATION"; + SUBSCRIPTION: "SUBSCRIPTION"; + FIELD: "FIELD"; + FRAGMENT_DEFINITION: "FRAGMENT_DEFINITION"; + FRAGMENT_SPREAD: "FRAGMENT_SPREAD"; + INLINE_FRAGMENT: "INLINE_FRAGMENT"; + // Schema Definitions + SCHEMA: "SCHEMA"; + SCALAR: "SCALAR"; + OBJECT: "OBJECT"; + FIELD_DEFINITION: "FIELD_DEFINITION"; + ARGUMENT_DEFINITION: "ARGUMENT_DEFINITION"; + INTERFACE: "INTERFACE"; + UNION: "UNION"; + ENUM: "ENUM"; + ENUM_VALUE: "ENUM_VALUE"; + INPUT_OBJECT: "INPUT_OBJECT"; + INPUT_FIELD_DEFINITION: "INPUT_FIELD_DEFINITION"; }; export type DirectiveLocationEnum = keyof typeof DirectiveLocation; @@ -31,21 +31,21 @@ export type DirectiveLocationEnum = keyof typeof DirectiveLocation; * behavior. Type system creators will usually not create these directly. */ export class GraphQLDirective { - name: string; - description?: string; - locations: DirectiveLocationEnum[]; - args: GraphQLArgument[]; - astNode?: DirectiveDefinitionNode; + name: string; + description?: string; + locations: DirectiveLocationEnum[]; + args: GraphQLArgument[]; + astNode?: DirectiveDefinitionNode; - constructor(config: GraphQLDirectiveConfig); + constructor(config: GraphQLDirectiveConfig); } export interface GraphQLDirectiveConfig { - name: string; - description?: string; - locations: DirectiveLocationEnum[]; - args?: GraphQLFieldConfigArgumentMap; - astNode?: DirectiveDefinitionNode; + name: string; + description?: string; + locations: DirectiveLocationEnum[]; + args?: GraphQLFieldConfigArgumentMap; + astNode?: DirectiveDefinitionNode; } /** @@ -61,7 +61,7 @@ export const GraphQLSkipDirective: GraphQLDirective; /** * Constant string used for default reason for a deprecation. */ -export const DEFAULT_DEPRECATION_REASON: 'No longer supported'; +export const DEFAULT_DEPRECATION_REASON: "No longer supported"; /** * Used to declare element of a GraphQL schema as deprecated. diff --git a/types/graphql/type/index.d.ts b/types/graphql/type/index.d.ts index 5fdfb1190a..551ade35e7 100644 --- a/types/graphql/type/index.d.ts +++ b/types/graphql/type/index.d.ts @@ -1,47 +1,41 @@ // GraphQL Schema definition -export { GraphQLSchema } from './schema'; +export { GraphQLSchema } from "./schema"; -export * from './definition'; +export * from "./definition"; export { - // "Enum" of Directive Locations - DirectiveLocation, - // Directives Definition - GraphQLDirective, - // Built-in Directives defined by the Spec - specifiedDirectives, - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - // Constant Deprecation Reason - DEFAULT_DEPRECATION_REASON, -} from './directives'; + // "Enum" of Directive Locations + DirectiveLocation, + // Directives Definition + GraphQLDirective, + // Built-in Directives defined by the Spec + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + // Constant Deprecation Reason + DEFAULT_DEPRECATION_REASON, +} from "./directives"; // Common built-in scalar instances. -export { - GraphQLInt, - GraphQLFloat, - GraphQLString, - GraphQLBoolean, - GraphQLID, -} from './scalars'; +export { GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID } from "./scalars"; export { - // "Enum" of Type Kinds - TypeKind, - // GraphQL Types for introspection. - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, - // Meta-field definitions. - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, -} from './introspection'; + // "Enum" of Type Kinds + TypeKind, + // GraphQL Types for introspection. + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + // Meta-field definitions. + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from "./introspection"; -export { DirectiveLocationEnum } from './directives'; +export { DirectiveLocationEnum } from "./directives"; diff --git a/types/graphql/type/introspection.d.ts b/types/graphql/type/introspection.d.ts index 48ac468ed0..042c3e2b6b 100644 --- a/types/graphql/type/introspection.d.ts +++ b/types/graphql/type/introspection.d.ts @@ -1,14 +1,14 @@ import { - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLList, - GraphQLNonNull, -} from './definition'; -import { GraphQLField } from './definition'; + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, +} from "./definition"; +import { GraphQLField } from "./definition"; export const __Schema: GraphQLObjectType; export const __Directive: GraphQLObjectType; @@ -19,14 +19,14 @@ export const __InputValue: GraphQLObjectType; export const __EnumValue: GraphQLObjectType; export const TypeKind: { - SCALAR: 'SCALAR'; - OBJECT: 'OBJECT'; - INTERFACE: 'INTERFACE'; - UNION: 'UNION'; - ENUM: 'ENUM'; - INPUT_OBJECT: 'INPUT_OBJECT'; - LIST: 'LIST'; - NON_NULL: 'NON_NULL'; + SCALAR: "SCALAR"; + OBJECT: "OBJECT"; + INTERFACE: "INTERFACE"; + UNION: "UNION"; + ENUM: "ENUM"; + INPUT_OBJECT: "INPUT_OBJECT"; + LIST: "LIST"; + NON_NULL: "NON_NULL"; }; export const __TypeKind: GraphQLEnumType; diff --git a/types/graphql/type/scalars.d.ts b/types/graphql/type/scalars.d.ts index 31a33aafad..287d99602a 100644 --- a/types/graphql/type/scalars.d.ts +++ b/types/graphql/type/scalars.d.ts @@ -1,4 +1,4 @@ -import { GraphQLScalarType } from './definition'; +import { GraphQLScalarType } from "./definition"; export const GraphQLInt: GraphQLScalarType; export const GraphQLFloat: GraphQLScalarType; diff --git a/types/graphql/type/schema.d.ts b/types/graphql/type/schema.d.ts index 26500c6ed3..bdd1089756 100644 --- a/types/graphql/type/schema.d.ts +++ b/types/graphql/type/schema.d.ts @@ -1,11 +1,7 @@ -import { GraphQLObjectType } from './definition'; -import { - GraphQLType, - GraphQLNamedType, - GraphQLAbstractType, -} from './definition'; -import { SchemaDefinitionNode } from '../language/ast'; -import { GraphQLDirective } from './directives'; +import { GraphQLObjectType } from "./definition"; +import { GraphQLType, GraphQLNamedType, GraphQLAbstractType } from "./definition"; +import { SchemaDefinitionNode } from "../language/ast"; +import { GraphQLDirective } from "./directives"; /** * Schema Definition @@ -34,59 +30,56 @@ import { GraphQLDirective } from './directives'; * */ export class GraphQLSchema { - astNode?: SchemaDefinitionNode; - // private _queryType: GraphQLObjectType; - // private _mutationType: GraphQLObjectType; - // private _subscriptionType: GraphQLObjectType; - // private _directives: Array; - // private _typeMap: TypeMap; - // private _implementations: { [interfaceName: string]: Array }; - // private _possibleTypeMap: { [abstractName: string]: { [possibleName: string]: boolean } }; + astNode?: SchemaDefinitionNode; + // private _queryType: GraphQLObjectType; + // private _mutationType: GraphQLObjectType; + // private _subscriptionType: GraphQLObjectType; + // private _directives: Array; + // private _typeMap: TypeMap; + // private _implementations: { [interfaceName: string]: Array }; + // private _possibleTypeMap: { [abstractName: string]: { [possibleName: string]: boolean } }; - constructor(config: GraphQLSchemaConfig); + constructor(config: GraphQLSchemaConfig); - getQueryType(): GraphQLObjectType; - getMutationType(): GraphQLObjectType | null | undefined; - getSubscriptionType(): GraphQLObjectType | null | undefined; - getTypeMap(): { [typeName: string]: GraphQLNamedType }; - getType(name: string): GraphQLNamedType; - getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[]; + getQueryType(): GraphQLObjectType; + getMutationType(): GraphQLObjectType | null | undefined; + getSubscriptionType(): GraphQLObjectType | null | undefined; + getTypeMap(): { [typeName: string]: GraphQLNamedType }; + getType(name: string): GraphQLNamedType; + getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[]; - isPossibleType( - abstractType: GraphQLAbstractType, - possibleType: GraphQLObjectType, - ): boolean; + isPossibleType(abstractType: GraphQLAbstractType, possibleType: GraphQLObjectType): boolean; - getDirectives(): GraphQLDirective[]; - getDirective(name: string): GraphQLDirective; + getDirectives(): GraphQLDirective[]; + getDirective(name: string): GraphQLDirective; } export type GraphQLSchemaValidationOptions = { - /** - * When building a schema from a GraphQL service's introspection result, it - * might be safe to assume the schema is valid. Set to true to assume the - * produced schema is valid. - * - * Default: false - */ - assumeValid?: boolean; + /** + * When building a schema from a GraphQL service's introspection result, it + * might be safe to assume the schema is valid. Set to true to assume the + * produced schema is valid. + * + * Default: false + */ + assumeValid?: boolean; - /** - * If provided, the schema will consider fields or types with names included - * in this list valid, even if they do not adhere to the specification's - * schema validation rules. - * - * This option is provided to ease adoption and may be removed in a future - * major release. - */ - allowedLegacyNames?: ReadonlyArray; + /** + * If provided, the schema will consider fields or types with names included + * in this list valid, even if they do not adhere to the specification's + * schema validation rules. + * + * This option is provided to ease adoption and may be removed in a future + * major release. + */ + allowedLegacyNames?: ReadonlyArray; }; export interface GraphQLSchemaConfig { - query: GraphQLObjectType; - mutation?: GraphQLObjectType; - subscription?: GraphQLObjectType; - types?: GraphQLNamedType[]; - directives?: GraphQLDirective[]; - astNode?: SchemaDefinitionNode; + query: GraphQLObjectType; + mutation?: GraphQLObjectType; + subscription?: GraphQLObjectType; + types?: GraphQLNamedType[]; + directives?: GraphQLDirective[]; + astNode?: SchemaDefinitionNode; } diff --git a/types/graphql/utilities/TypeInfo.d.ts b/types/graphql/utilities/TypeInfo.d.ts index a04a24a1a7..8b1ddc6206 100644 --- a/types/graphql/utilities/TypeInfo.d.ts +++ b/types/graphql/utilities/TypeInfo.d.ts @@ -1,15 +1,15 @@ -import { GraphQLSchema } from '../type/schema'; +import { GraphQLSchema } from "../type/schema"; import { - GraphQLOutputType, - GraphQLCompositeType, - GraphQLInputType, - GraphQLField, - GraphQLArgument, - GraphQLEnumValue, - GraphQLType, -} from '../type/definition'; -import { GraphQLDirective } from '../type/directives'; -import { ASTNode, FieldNode } from '../language/ast'; + GraphQLOutputType, + GraphQLCompositeType, + GraphQLInputType, + GraphQLField, + GraphQLArgument, + GraphQLEnumValue, + GraphQLType, +} from "../type/definition"; +import { GraphQLDirective } from "../type/directives"; +import { ASTNode, FieldNode } from "../language/ast"; /** * TypeInfo is a utility class which, given a GraphQL schema, can keep track @@ -17,27 +17,27 @@ import { ASTNode, FieldNode } from '../language/ast'; * AST during a recursive descent by calling `enter(node)` and `leave(node)`. */ export class TypeInfo { - constructor( - schema: GraphQLSchema, - // NOTE: this experimental optional second parameter is only needed in order - // to support non-spec-compliant codebases. You should never need to use it. - // It may disappear in the future. - getFieldDefFn?: getFieldDef, - ); + constructor( + schema: GraphQLSchema, + // NOTE: this experimental optional second parameter is only needed in order + // to support non-spec-compliant codebases. You should never need to use it. + // It may disappear in the future. + getFieldDefFn?: getFieldDef + ); - getType(): GraphQLOutputType; - getParentType(): GraphQLCompositeType; - getInputType(): GraphQLInputType; - getFieldDef(): GraphQLField; - getDirective(): GraphQLDirective; - getArgument(): GraphQLArgument; - getEnumValue(): GraphQLEnumValue; - enter(node: ASTNode): any; - leave(node: ASTNode): any; + getType(): GraphQLOutputType; + getParentType(): GraphQLCompositeType; + getInputType(): GraphQLInputType; + getFieldDef(): GraphQLField; + getDirective(): GraphQLDirective; + getArgument(): GraphQLArgument; + getEnumValue(): GraphQLEnumValue; + enter(node: ASTNode): any; + leave(node: ASTNode): any; } export type getFieldDef = ( - schema: GraphQLSchema, - parentType: GraphQLType, - fieldNode: FieldNode, + schema: GraphQLSchema, + parentType: GraphQLType, + fieldNode: FieldNode ) => GraphQLField; diff --git a/types/graphql/utilities/astFromValue.d.ts b/types/graphql/utilities/astFromValue.d.ts index 557a07dd9d..57f7f977ad 100644 --- a/types/graphql/utilities/astFromValue.d.ts +++ b/types/graphql/utilities/astFromValue.d.ts @@ -1,6 +1,6 @@ import { - ValueNode, - /* + ValueNode, + /* TODO: IntValueNode, FloatValueNode, @@ -10,8 +10,8 @@ import { ListValueNode, ObjectValueNode, */ -} from '../language/ast'; -import { GraphQLInputType } from '../type/definition'; +} from "../language/ast"; +import { GraphQLInputType } from "../type/definition"; /** * Produces a GraphQL Value AST given a JavaScript value. diff --git a/types/graphql/utilities/buildASTSchema.d.ts b/types/graphql/utilities/buildASTSchema.d.ts index 6b8aa56327..4d256fe180 100644 --- a/types/graphql/utilities/buildASTSchema.d.ts +++ b/types/graphql/utilities/buildASTSchema.d.ts @@ -1,16 +1,16 @@ -import { DocumentNode, Location, StringValueNode } from '../language/ast'; -import { Source } from '../language/source'; -import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema'; +import { DocumentNode, Location, StringValueNode } from "../language/ast"; +import { Source } from "../language/source"; +import { GraphQLSchema, GraphQLSchemaValidationOptions } from "../type/schema"; interface BuildSchemaOptions extends GraphQLSchemaValidationOptions { - /** - * Descriptions are defined as preceding string literals, however an older - * experimental version of the SDL supported preceding comments as - * descriptions. Set to true to enable this deprecated behavior. - * - * Default: false - */ - commentDescriptions?: boolean; + /** + * Descriptions are defined as preceding string literals, however an older + * experimental version of the SDL supported preceding comments as + * descriptions. Set to true to enable this deprecated behavior. + * + * Default: false + */ + commentDescriptions?: boolean; } /** @@ -35,8 +35,8 @@ export function buildASTSchema(ast: DocumentNode): GraphQLSchema; * */ export function getDescription( - node: { description?: StringValueNode; loc?: Location }, - options: BuildSchemaOptions + node: { description?: StringValueNode; loc?: Location }, + options: BuildSchemaOptions ): string; /** diff --git a/types/graphql/utilities/buildClientSchema.d.ts b/types/graphql/utilities/buildClientSchema.d.ts index bdf898bc2b..80516c2111 100644 --- a/types/graphql/utilities/buildClientSchema.d.ts +++ b/types/graphql/utilities/buildClientSchema.d.ts @@ -1,5 +1,7 @@ -import { IntrospectionQuery } from './introspectionQuery'; -import { GraphQLSchema } from '../type/schema'; +import { IntrospectionQuery } from "./introspectionQuery"; +import { GraphQLSchema, GraphQLSchemaValidationOptions } from "../type/schema"; + +interface Options extends GraphQLSchemaValidationOptions {} /** * Build a GraphQLSchema for use by client tools. @@ -10,6 +12,4 @@ import { GraphQLSchema } from '../type/schema'; * represent the "resolver", "parse" or "serialize" functions or any other * server-internal mechanisms. */ -export function buildClientSchema( - introspection: IntrospectionQuery, -): GraphQLSchema; +export function buildClientSchema(introspection: IntrospectionQuery, options?: Options): GraphQLSchema; diff --git a/types/graphql/utilities/concatAST.d.ts b/types/graphql/utilities/concatAST.d.ts index 405ac69936..6e4c33aed5 100644 --- a/types/graphql/utilities/concatAST.d.ts +++ b/types/graphql/utilities/concatAST.d.ts @@ -1,4 +1,4 @@ -import { DocumentNode } from '../language/ast'; +import { DocumentNode } from "../language/ast"; /** * Provided a collection of ASTs, presumably each from different files, diff --git a/types/graphql/utilities/extendSchema.d.ts b/types/graphql/utilities/extendSchema.d.ts index 389bd02d8b..027c4d5745 100644 --- a/types/graphql/utilities/extendSchema.d.ts +++ b/types/graphql/utilities/extendSchema.d.ts @@ -1,5 +1,5 @@ -import { DocumentNode } from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; +import { DocumentNode } from "../language/ast"; +import { GraphQLSchema } from "../type/schema"; /** * Produces a new schema given an existing schema and a document which may @@ -13,7 +13,4 @@ import { GraphQLSchema } from '../type/schema'; * This algorithm copies the provided schema, applying extensions while * producing the copy. The original schema remains unaltered. */ -export function extendSchema( - schema: GraphQLSchema, - documentAST: DocumentNode, -): GraphQLSchema; +export function extendSchema(schema: GraphQLSchema, documentAST: DocumentNode): GraphQLSchema; diff --git a/types/graphql/utilities/findBreakingChanges.d.ts b/types/graphql/utilities/findBreakingChanges.d.ts index 0d5fc0041a..37b98dae34 100644 --- a/types/graphql/utilities/findBreakingChanges.d.ts +++ b/types/graphql/utilities/findBreakingChanges.d.ts @@ -1,88 +1,70 @@ import { - getNamedType, - GraphQLScalarType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLInterfaceType, - GraphQLObjectType, - GraphQLUnionType, - GraphQLNamedType, -} from '../type/definition'; -import { GraphQLSchema } from '../type/schema'; + getNamedType, + GraphQLScalarType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLObjectType, + GraphQLUnionType, + GraphQLNamedType, +} from "../type/definition"; +import { GraphQLSchema } from "../type/schema"; export const BreakingChangeType: { - FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND'; - FIELD_REMOVED: 'FIELD_REMOVED'; - TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND'; - TYPE_REMOVED: 'TYPE_REMOVED'; - TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION'; - VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM'; + FIELD_CHANGED_KIND: "FIELD_CHANGED_KIND"; + FIELD_REMOVED: "FIELD_REMOVED"; + TYPE_CHANGED_KIND: "TYPE_CHANGED_KIND"; + TYPE_REMOVED: "TYPE_REMOVED"; + TYPE_REMOVED_FROM_UNION: "TYPE_REMOVED_FROM_UNION"; + VALUE_REMOVED_FROM_ENUM: "VALUE_REMOVED_FROM_ENUM"; }; export type BreakingChangeKey = - | 'FIELD_CHANGED_KIND' - | 'FIELD_REMOVED' - | 'TYPE_CHANGED_KIND' - | 'TYPE_REMOVED' - | 'TYPE_REMOVED_FROM_UNION' - | 'VALUE_REMOVED_FROM_ENUM'; + | "FIELD_CHANGED_KIND" + | "FIELD_REMOVED" + | "TYPE_CHANGED_KIND" + | "TYPE_REMOVED" + | "TYPE_REMOVED_FROM_UNION" + | "VALUE_REMOVED_FROM_ENUM"; export interface BreakingChange { - type: BreakingChangeKey; - description: string; + type: BreakingChangeKey; + description: string; } /** * Given two schemas, returns an Array containing descriptions of all the types * of breaking changes covered by the other functions down below. */ -export function findBreakingChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findBreakingChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to removing an entire type. */ -export function findRemovedTypes( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findRemovedTypes(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to changing the type of a type. */ -export function findTypesThatChangedKind( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findTypesThatChangedKind(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to the fields on a type. This includes if * a field has been removed from a type or if a field has changed type. */ -export function findFieldsThatChangedType( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findFieldsThatChangedType(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to removing types from a union type. */ -export function findTypesRemovedFromUnions( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findTypesRemovedFromUnions(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to removing values from an enum type. */ -export function findValuesRemovedFromEnums( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findValuesRemovedFromEnums(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; diff --git a/types/graphql/utilities/findDeprecatedUsages.d.ts b/types/graphql/utilities/findDeprecatedUsages.d.ts index 8cd844e15f..da99c98269 100644 --- a/types/graphql/utilities/findDeprecatedUsages.d.ts +++ b/types/graphql/utilities/findDeprecatedUsages.d.ts @@ -1,13 +1,10 @@ -import { GraphQLSchema } from '../type/schema'; -import { DocumentNode } from '../language/ast'; -import { GraphQLError } from '../error/GraphQLError'; +import { GraphQLSchema } from "../type/schema"; +import { DocumentNode } from "../language/ast"; +import { GraphQLError } from "../error/GraphQLError"; /** * A validation rule which reports deprecated usages. * * Returns a list of GraphQLError instances describing each deprecated use. */ -export function findDeprecatedUsages( - schema: GraphQLSchema, - ast: DocumentNode, -): GraphQLError[]; +export function findDeprecatedUsages(schema: GraphQLSchema, ast: DocumentNode): GraphQLError[]; diff --git a/types/graphql/utilities/getOperationAST.d.ts b/types/graphql/utilities/getOperationAST.d.ts index 0d5064d48d..5a1e0dc7a7 100644 --- a/types/graphql/utilities/getOperationAST.d.ts +++ b/types/graphql/utilities/getOperationAST.d.ts @@ -1,11 +1,8 @@ -import { DocumentNode, OperationDefinitionNode } from '../language/ast'; +import { DocumentNode, OperationDefinitionNode } from "../language/ast"; /** * Returns an operation AST given a document AST and optionally an operation * name. If a name is not provided, an operation is only returned if only one is * provided in the document. */ -export function getOperationAST( - documentAST: DocumentNode, - operationName?: string, -): OperationDefinitionNode; +export function getOperationAST(documentAST: DocumentNode, operationName?: string): OperationDefinitionNode; diff --git a/types/graphql/utilities/index.d.ts b/types/graphql/utilities/index.d.ts index c2b2c182ff..91777235d1 100644 --- a/types/graphql/utilities/index.d.ts +++ b/types/graphql/utilities/index.d.ts @@ -1,82 +1,74 @@ // The GraphQL query recommended for a full schema introspection. -export { introspectionQuery } from './introspectionQuery'; +export { introspectionQuery } from "./introspectionQuery"; export { - IntrospectionQuery, - IntrospectionSchema, - IntrospectionType, - IntrospectionScalarType, - IntrospectionObjectType, - IntrospectionInterfaceType, - IntrospectionUnionType, - IntrospectionEnumType, - IntrospectionInputObjectType, - IntrospectionTypeRef, - IntrospectionNamedTypeRef, - IntrospectionListTypeRef, - IntrospectionNonNullTypeRef, - IntrospectionField, - IntrospectionInputValue, - IntrospectionEnumValue, - IntrospectionDirective, -} from './introspectionQuery'; + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, +} from "./introspectionQuery"; // Gets the target Operation from a Document -export { getOperationAST } from './getOperationAST'; +export { getOperationAST } from "./getOperationAST"; // Build a GraphQLSchema from an introspection result. -export { buildClientSchema } from './buildClientSchema'; +export { buildClientSchema } from "./buildClientSchema"; // Build a GraphQLSchema from GraphQL Schema language. -export { buildASTSchema, buildSchema, getDescription } from './buildASTSchema'; +export { buildASTSchema, buildSchema, getDescription } from "./buildASTSchema"; // Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. -export { extendSchema } from './extendSchema'; +export { extendSchema } from "./extendSchema"; // Print a GraphQLSchema to GraphQL Schema language. -export { - printSchema, - printType, - printIntrospectionSchema, -} from './schemaPrinter'; +export { printSchema, printType, printIntrospectionSchema } from "./schemaPrinter"; // Create a GraphQLType from a GraphQL language AST. -export { typeFromAST } from './typeFromAST'; +export { typeFromAST } from "./typeFromAST"; // Create a JavaScript value from a GraphQL language AST. -export { valueFromAST } from './valueFromAST'; +export { valueFromAST } from "./valueFromAST"; // Create a GraphQL language AST from a JavaScript value. -export { astFromValue } from './astFromValue'; +export { astFromValue } from "./astFromValue"; // A helper to use within recursive-descent visitors which need to be aware of // the GraphQL type system. -export { TypeInfo } from './TypeInfo'; +export { TypeInfo } from "./TypeInfo"; // Determine if JavaScript values adhere to a GraphQL type. -export { isValidJSValue } from './isValidJSValue'; +export { isValidJSValue } from "./isValidJSValue"; // Determine if AST values adhere to a GraphQL type. -export { isValidLiteralValue } from './isValidLiteralValue'; +export { isValidLiteralValue } from "./isValidLiteralValue"; // Concatenates multiple AST together. -export { concatAST } from './concatAST'; +export { concatAST } from "./concatAST"; // Separates an AST into an AST per Operation. -export { separateOperations } from './separateOperations'; +export { separateOperations } from "./separateOperations"; // Comparators for types -export { - isEqualType, - isTypeSubTypeOf, - doTypesOverlap, -} from './typeComparators'; +export { isEqualType, isTypeSubTypeOf, doTypesOverlap } from "./typeComparators"; // Asserts that a string is a valid GraphQL name -export { assertValidName } from './assertValidName'; +export { assertValidName } from "./assertValidName"; // Compares two GraphQLSchemas and detects breaking changes. -export { findBreakingChanges } from './findBreakingChanges'; -export { BreakingChange } from './findBreakingChanges'; +export { findBreakingChanges } from "./findBreakingChanges"; +export { BreakingChange } from "./findBreakingChanges"; // Report all deprecated usage within a GraphQL document. -export { findDeprecatedUsages } from './findDeprecatedUsages'; +export { findDeprecatedUsages } from "./findDeprecatedUsages"; diff --git a/types/graphql/utilities/introspectionQuery.d.ts b/types/graphql/utilities/introspectionQuery.d.ts index f16b873a3a..10c3b0a200 100644 --- a/types/graphql/utilities/introspectionQuery.d.ts +++ b/types/graphql/utilities/introspectionQuery.d.ts @@ -1,4 +1,4 @@ -import { DirectiveLocationEnum } from '../type/directives'; +import { DirectiveLocationEnum } from "../type/directives"; /* query IntrospectionQuery { @@ -96,114 +96,111 @@ fragment TypeRef on __Type { export const introspectionQuery: string; export interface IntrospectionQuery { - __schema: IntrospectionSchema; + __schema: IntrospectionSchema; } export interface IntrospectionSchema { - queryType: IntrospectionNamedTypeRef; - mutationType?: IntrospectionNamedTypeRef; - subscriptionType?: IntrospectionNamedTypeRef; - types: IntrospectionType[]; - directives: IntrospectionDirective[]; + queryType: IntrospectionNamedTypeRef; + mutationType?: IntrospectionNamedTypeRef; + subscriptionType?: IntrospectionNamedTypeRef; + types: IntrospectionType[]; + directives: IntrospectionDirective[]; } export type IntrospectionType = - | IntrospectionScalarType - | IntrospectionObjectType - | IntrospectionInterfaceType - | IntrospectionUnionType - | IntrospectionEnumType - | IntrospectionInputObjectType; + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType + | IntrospectionInputObjectType; export interface IntrospectionScalarType { - kind: 'SCALAR'; - name: string; - description?: string; + kind: "SCALAR"; + name: string; + description?: string; } export interface IntrospectionObjectType { - kind: 'OBJECT'; - name: string; - description?: string; - fields: IntrospectionField[]; - interfaces: IntrospectionNamedTypeRef[]; + kind: "OBJECT"; + name: string; + description?: string; + fields: IntrospectionField[]; + interfaces: IntrospectionNamedTypeRef[]; } export interface IntrospectionInterfaceType { - kind: 'INTERFACE'; - name: string; - description?: string; - fields: IntrospectionField[]; - possibleTypes: IntrospectionNamedTypeRef[]; + kind: "INTERFACE"; + name: string; + description?: string; + fields: IntrospectionField[]; + possibleTypes: IntrospectionNamedTypeRef[]; } export interface IntrospectionUnionType { - kind: 'UNION'; - name: string; - description?: string; - possibleTypes: IntrospectionNamedTypeRef[]; + kind: "UNION"; + name: string; + description?: string; + possibleTypes: IntrospectionNamedTypeRef[]; } export interface IntrospectionEnumType { - kind: 'ENUM'; - name: string; - description?: string; - enumValues: IntrospectionEnumValue[]; + kind: "ENUM"; + name: string; + description?: string; + enumValues: IntrospectionEnumValue[]; } export interface IntrospectionInputObjectType { - kind: 'INPUT_OBJECT'; - name: string; - description?: string; - inputFields: IntrospectionInputValue[]; + kind: "INPUT_OBJECT"; + name: string; + description?: string; + inputFields: IntrospectionInputValue[]; } -export type IntrospectionTypeRef = - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - | IntrospectionNonNullTypeRef; +export type IntrospectionTypeRef = IntrospectionNamedTypeRef | IntrospectionListTypeRef | IntrospectionNonNullTypeRef; export interface IntrospectionNamedTypeRef { - kind: string; - name: string; + kind: string; + name: string; } export interface IntrospectionListTypeRef { - kind: 'LIST'; - ofType?: IntrospectionTypeRef; + kind: "LIST"; + ofType?: IntrospectionTypeRef; } export interface IntrospectionNonNullTypeRef { - kind: 'NON_NULL'; - ofType?: IntrospectionTypeRef; + kind: "NON_NULL"; + ofType?: IntrospectionTypeRef; } export interface IntrospectionField { - name: string; - description?: string; - args: IntrospectionInputValue[]; - type: IntrospectionTypeRef; - isDeprecated: boolean; - deprecationReason?: string; + name: string; + description?: string; + args: IntrospectionInputValue[]; + type: IntrospectionTypeRef; + isDeprecated: boolean; + deprecationReason?: string; } export interface IntrospectionInputValue { - name: string; - description?: string; - type: IntrospectionTypeRef; - defaultValue?: string; + name: string; + description?: string; + type: IntrospectionTypeRef; + defaultValue?: string; } export interface IntrospectionEnumValue { - name: string; - description?: string; - isDeprecated: boolean; - deprecationReason?: string; + name: string; + description?: string; + isDeprecated: boolean; + deprecationReason?: string; } export interface IntrospectionDirective { - name: string; - description?: string; - locations: DirectiveLocationEnum[]; - args: IntrospectionInputValue[]; + name: string; + description?: string; + locations: DirectiveLocationEnum[]; + args: IntrospectionInputValue[]; } diff --git a/types/graphql/utilities/isValidJSValue.d.ts b/types/graphql/utilities/isValidJSValue.d.ts index 911d8fea67..557429c7f4 100644 --- a/types/graphql/utilities/isValidJSValue.d.ts +++ b/types/graphql/utilities/isValidJSValue.d.ts @@ -1,4 +1,4 @@ -import { GraphQLInputType } from '../type/definition'; +import { GraphQLInputType } from "../type/definition"; /** * Given a JavaScript value and a GraphQL type, determine if the value will be diff --git a/types/graphql/utilities/isValidLiteralValue.d.ts b/types/graphql/utilities/isValidLiteralValue.d.ts index 4ad03d1013..bf54f6bb22 100644 --- a/types/graphql/utilities/isValidLiteralValue.d.ts +++ b/types/graphql/utilities/isValidLiteralValue.d.ts @@ -1,5 +1,5 @@ -import { ValueNode } from '../language/ast'; -import { GraphQLInputType } from '../type/definition'; +import { ValueNode } from "../language/ast"; +import { GraphQLInputType } from "../type/definition"; /** * Utility for validators which determines if a value literal AST is valid given @@ -8,7 +8,4 @@ import { GraphQLInputType } from '../type/definition'; * Note that this only validates literal values, variables are assumed to * provide values of the correct type. */ -export function isValidLiteralValue( - type: GraphQLInputType, - valueNode: ValueNode, -): string[]; +export function isValidLiteralValue(type: GraphQLInputType, valueNode: ValueNode): string[]; diff --git a/types/graphql/utilities/schemaPrinter.d.ts b/types/graphql/utilities/schemaPrinter.d.ts index f9cf9ad209..d49e6aee58 100644 --- a/types/graphql/utilities/schemaPrinter.d.ts +++ b/types/graphql/utilities/schemaPrinter.d.ts @@ -1,8 +1,8 @@ -import { GraphQLSchema } from '../type/schema'; -import { GraphQLType } from '../type/definition'; +import { GraphQLSchema } from "../type/schema"; +import { GraphQLType } from "../type/definition"; export interface PrinterOptions { - commentDescriptions?: boolean; + commentDescriptions?: boolean; } export function printSchema(schema: GraphQLSchema, options?: PrinterOptions): string; diff --git a/types/graphql/utilities/separateOperations.d.ts b/types/graphql/utilities/separateOperations.d.ts index a10ad0a29e..8269b22d75 100644 --- a/types/graphql/utilities/separateOperations.d.ts +++ b/types/graphql/utilities/separateOperations.d.ts @@ -1,5 +1,3 @@ -import { DocumentNode, OperationDefinitionNode } from '../language/ast'; +import { DocumentNode, OperationDefinitionNode } from "../language/ast"; -export function separateOperations( - documentAST: DocumentNode, -): { [operationName: string]: DocumentNode }; +export function separateOperations(documentAST: DocumentNode): { [operationName: string]: DocumentNode }; diff --git a/types/graphql/utilities/typeComparators.d.ts b/types/graphql/utilities/typeComparators.d.ts index ca0cdaf6c2..7bf0b9ebdf 100644 --- a/types/graphql/utilities/typeComparators.d.ts +++ b/types/graphql/utilities/typeComparators.d.ts @@ -1,9 +1,5 @@ -import { - GraphQLType, - GraphQLCompositeType, - GraphQLAbstractType, -} from '../type/definition'; -import { GraphQLSchema } from '../type/schema'; +import { GraphQLType, GraphQLCompositeType, GraphQLAbstractType } from "../type/definition"; +import { GraphQLSchema } from "../type/schema"; /** * Provided two types, return true if the types are equal (invariant). @@ -14,11 +10,7 @@ export function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean; * Provided a type and a super type, return true if the first type is either * equal or a subset of the second super type (covariant). */ -export function isTypeSubTypeOf( - schema: GraphQLSchema, - maybeSubType: GraphQLType, - superType: GraphQLType, -): boolean; +export function isTypeSubTypeOf(schema: GraphQLSchema, maybeSubType: GraphQLType, superType: GraphQLType): boolean; /** * Provided two composite types, determine if they "overlap". Two composite @@ -30,7 +22,7 @@ export function isTypeSubTypeOf( * This function is commutative. */ export function doTypesOverlap( - schema: GraphQLSchema, - typeA: GraphQLCompositeType, - typeB: GraphQLCompositeType, + schema: GraphQLSchema, + typeA: GraphQLCompositeType, + typeB: GraphQLCompositeType ): boolean; diff --git a/types/graphql/utilities/typeFromAST.d.ts b/types/graphql/utilities/typeFromAST.d.ts index 415cbd2636..79b7b24a38 100644 --- a/types/graphql/utilities/typeFromAST.d.ts +++ b/types/graphql/utilities/typeFromAST.d.ts @@ -1,8 +1,5 @@ -import { TypeNode } from '../language/ast'; -import { GraphQLType, GraphQLNullableType } from '../type/definition'; -import { GraphQLSchema } from '../type/schema'; +import { TypeNode } from "../language/ast"; +import { GraphQLType, GraphQLNullableType } from "../type/definition"; +import { GraphQLSchema } from "../type/schema"; -export function typeFromAST( - schema: GraphQLSchema, - typeNode: TypeNode, -): GraphQLType; +export function typeFromAST(schema: GraphQLSchema, typeNode: TypeNode): GraphQLType; diff --git a/types/graphql/utilities/valueFromAST.d.ts b/types/graphql/utilities/valueFromAST.d.ts index 0bfbf04981..e0b06b0506 100644 --- a/types/graphql/utilities/valueFromAST.d.ts +++ b/types/graphql/utilities/valueFromAST.d.ts @@ -1,15 +1,10 @@ -import { GraphQLInputType } from '../type/definition'; -import { - ValueNode, - VariableNode, - ListValueNode, - ObjectValueNode, -} from '../language/ast'; +import { GraphQLInputType } from "../type/definition"; +import { ValueNode, VariableNode, ListValueNode, ObjectValueNode } from "../language/ast"; export function valueFromAST( - valueNode: ValueNode, - type: GraphQLInputType, - variables?: { - [key: string]: any; - }, + valueNode: ValueNode, + type: GraphQLInputType, + variables?: { + [key: string]: any; + } ): any; diff --git a/types/graphql/validation/index.d.ts b/types/graphql/validation/index.d.ts index b8cb9ddd00..4353da53fa 100644 --- a/types/graphql/validation/index.d.ts +++ b/types/graphql/validation/index.d.ts @@ -1,128 +1,80 @@ -export { validate, ValidationContext } from './validate'; -export { specifiedRules } from './specifiedRules'; +export { validate, ValidationContext } from "./validate"; +export { specifiedRules } from "./specifiedRules"; // Spec Section: "Argument Values Type Correctness" -export { - ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule, -} from './rules/ArgumentsOfCorrectType'; +export { ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule } from "./rules/ArgumentsOfCorrectType"; // Spec Section: "Variable Default Values Are Correctly Typed" -export { - DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule, -} from './rules/DefaultValuesOfCorrectType'; +export { DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule } from "./rules/DefaultValuesOfCorrectType"; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" -export { - FieldsOnCorrectType as FieldsOnCorrectTypeRule, -} from './rules/FieldsOnCorrectType'; +export { FieldsOnCorrectType as FieldsOnCorrectTypeRule } from "./rules/FieldsOnCorrectType"; // Spec Section: "Fragments on Composite Types" -export { - FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule, -} from './rules/FragmentsOnCompositeTypes'; +export { FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule } from "./rules/FragmentsOnCompositeTypes"; // Spec Section: "Argument Names" -export { - KnownArgumentNames as KnownArgumentNamesRule, -} from './rules/KnownArgumentNames'; +export { KnownArgumentNames as KnownArgumentNamesRule } from "./rules/KnownArgumentNames"; // Spec Section: "Directives Are Defined" -export { - KnownDirectives as KnownDirectivesRule, -} from './rules/KnownDirectives'; +export { KnownDirectives as KnownDirectivesRule } from "./rules/KnownDirectives"; // Spec Section: "Fragment spread target defined" -export { - KnownFragmentNames as KnownFragmentNamesRule, -} from './rules/KnownFragmentNames'; +export { KnownFragmentNames as KnownFragmentNamesRule } from "./rules/KnownFragmentNames"; // Spec Section: "Fragment Spread Type Existence" -export { KnownTypeNames as KnownTypeNamesRule } from './rules/KnownTypeNames'; +export { KnownTypeNames as KnownTypeNamesRule } from "./rules/KnownTypeNames"; // Spec Section: "Lone Anonymous Operation" -export { - LoneAnonymousOperation as LoneAnonymousOperationRule, -} from './rules/LoneAnonymousOperation'; +export { LoneAnonymousOperation as LoneAnonymousOperationRule } from "./rules/LoneAnonymousOperation"; // Spec Section: "Fragments must not form cycles" -export { - NoFragmentCycles as NoFragmentCyclesRule, -} from './rules/NoFragmentCycles'; +export { NoFragmentCycles as NoFragmentCyclesRule } from "./rules/NoFragmentCycles"; // Spec Section: "All Variable Used Defined" -export { - NoUndefinedVariables as NoUndefinedVariablesRule, -} from './rules/NoUndefinedVariables'; +export { NoUndefinedVariables as NoUndefinedVariablesRule } from "./rules/NoUndefinedVariables"; // Spec Section: "Fragments must be used" -export { - NoUnusedFragments as NoUnusedFragmentsRule, -} from './rules/NoUnusedFragments'; +export { NoUnusedFragments as NoUnusedFragmentsRule } from "./rules/NoUnusedFragments"; // Spec Section: "All Variables Used" -export { - NoUnusedVariables as NoUnusedVariablesRule, -} from './rules/NoUnusedVariables'; +export { NoUnusedVariables as NoUnusedVariablesRule } from "./rules/NoUnusedVariables"; // Spec Section: "Field Selection Merging" -export { - OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule, -} from './rules/OverlappingFieldsCanBeMerged'; +export { OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule } from "./rules/OverlappingFieldsCanBeMerged"; // Spec Section: "Fragment spread is possible" -export { - PossibleFragmentSpreads as PossibleFragmentSpreadsRule, -} from './rules/PossibleFragmentSpreads'; +export { PossibleFragmentSpreads as PossibleFragmentSpreadsRule } from "./rules/PossibleFragmentSpreads"; // Spec Section: "Argument Optionality" -export { - ProvidedNonNullArguments as ProvidedNonNullArgumentsRule, -} from './rules/ProvidedNonNullArguments'; +export { ProvidedNonNullArguments as ProvidedNonNullArgumentsRule } from "./rules/ProvidedNonNullArguments"; // Spec Section: "Leaf Field Selections" -export { ScalarLeafs as ScalarLeafsRule } from './rules/ScalarLeafs'; +export { ScalarLeafs as ScalarLeafsRule } from "./rules/ScalarLeafs"; // Spec Section: "Subscriptions with Single Root Field" -export { - SingleFieldSubscriptions as SingleFieldSubscriptionsRule, -} from './rules/SingleFieldSubscriptions'; +export { SingleFieldSubscriptions as SingleFieldSubscriptionsRule } from "./rules/SingleFieldSubscriptions"; // Spec Section: "Argument Uniqueness" -export { - UniqueArgumentNames as UniqueArgumentNamesRule, -} from './rules/UniqueArgumentNames'; +export { UniqueArgumentNames as UniqueArgumentNamesRule } from "./rules/UniqueArgumentNames"; // Spec Section: "Directives Are Unique Per Location" -export { - UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule, -} from './rules/UniqueDirectivesPerLocation'; +export { UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule } from "./rules/UniqueDirectivesPerLocation"; // Spec Section: "Fragment Name Uniqueness" -export { - UniqueFragmentNames as UniqueFragmentNamesRule, -} from './rules/UniqueFragmentNames'; +export { UniqueFragmentNames as UniqueFragmentNamesRule } from "./rules/UniqueFragmentNames"; // Spec Section: "Input Object Field Uniqueness" -export { - UniqueInputFieldNames as UniqueInputFieldNamesRule, -} from './rules/UniqueInputFieldNames'; +export { UniqueInputFieldNames as UniqueInputFieldNamesRule } from "./rules/UniqueInputFieldNames"; // Spec Section: "Operation Name Uniqueness" -export { - UniqueOperationNames as UniqueOperationNamesRule, -} from './rules/UniqueOperationNames'; +export { UniqueOperationNames as UniqueOperationNamesRule } from "./rules/UniqueOperationNames"; // Spec Section: "Variable Uniqueness" -export { - UniqueVariableNames as UniqueVariableNamesRule, -} from './rules/UniqueVariableNames'; +export { UniqueVariableNames as UniqueVariableNamesRule } from "./rules/UniqueVariableNames"; // Spec Section: "Variables are Input Types" -export { - VariablesAreInputTypes as VariablesAreInputTypesRule, -} from './rules/VariablesAreInputTypes'; +export { VariablesAreInputTypes as VariablesAreInputTypesRule } from "./rules/VariablesAreInputTypes"; // Spec Section: "All Variable Usages Are Allowed" -export { - VariablesInAllowedPosition as VariablesInAllowedPositionRule, -} from './rules/VariablesInAllowedPosition'; +export { VariablesInAllowedPosition as VariablesInAllowedPositionRule } from "./rules/VariablesInAllowedPosition"; diff --git a/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts b/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts index f7247d0a9c..235db84162 100644 --- a/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts +++ b/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Argument values of correct type diff --git a/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts b/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts index 88b3a824f2..b617538a74 100644 --- a/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts +++ b/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Variable default values of correct type diff --git a/types/graphql/validation/rules/FieldsOnCorrectType.d.ts b/types/graphql/validation/rules/FieldsOnCorrectType.d.ts index 19609b2b65..247de1298c 100644 --- a/types/graphql/validation/rules/FieldsOnCorrectType.d.ts +++ b/types/graphql/validation/rules/FieldsOnCorrectType.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Fields on correct type diff --git a/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts b/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts index d6fffd4337..384f43beb3 100644 --- a/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts +++ b/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Fragments on composite type diff --git a/types/graphql/validation/rules/KnownArgumentNames.d.ts b/types/graphql/validation/rules/KnownArgumentNames.d.ts index 4477b62a75..bd56137311 100644 --- a/types/graphql/validation/rules/KnownArgumentNames.d.ts +++ b/types/graphql/validation/rules/KnownArgumentNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Known argument names diff --git a/types/graphql/validation/rules/KnownDirectives.d.ts b/types/graphql/validation/rules/KnownDirectives.d.ts index 68c6acf549..40e58ce0c3 100644 --- a/types/graphql/validation/rules/KnownDirectives.d.ts +++ b/types/graphql/validation/rules/KnownDirectives.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Known directives diff --git a/types/graphql/validation/rules/KnownFragmentNames.d.ts b/types/graphql/validation/rules/KnownFragmentNames.d.ts index b904f22d89..c5fa899995 100644 --- a/types/graphql/validation/rules/KnownFragmentNames.d.ts +++ b/types/graphql/validation/rules/KnownFragmentNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Known fragment names diff --git a/types/graphql/validation/rules/KnownTypeNames.d.ts b/types/graphql/validation/rules/KnownTypeNames.d.ts index 48b15318da..ab8abce9d5 100644 --- a/types/graphql/validation/rules/KnownTypeNames.d.ts +++ b/types/graphql/validation/rules/KnownTypeNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Known type names diff --git a/types/graphql/validation/rules/LoneAnonymousOperation.d.ts b/types/graphql/validation/rules/LoneAnonymousOperation.d.ts index 4ce6abcba9..f281df2bce 100644 --- a/types/graphql/validation/rules/LoneAnonymousOperation.d.ts +++ b/types/graphql/validation/rules/LoneAnonymousOperation.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Lone anonymous operation diff --git a/types/graphql/validation/rules/NoFragmentCycles.d.ts b/types/graphql/validation/rules/NoFragmentCycles.d.ts index fed5982fc8..4cce233cd5 100644 --- a/types/graphql/validation/rules/NoFragmentCycles.d.ts +++ b/types/graphql/validation/rules/NoFragmentCycles.d.ts @@ -1,3 +1,3 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; export function NoFragmentCycles(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoUndefinedVariables.d.ts b/types/graphql/validation/rules/NoUndefinedVariables.d.ts index 51d30b8fd1..418e3cf2b5 100644 --- a/types/graphql/validation/rules/NoUndefinedVariables.d.ts +++ b/types/graphql/validation/rules/NoUndefinedVariables.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * No undefined variables diff --git a/types/graphql/validation/rules/NoUnusedFragments.d.ts b/types/graphql/validation/rules/NoUnusedFragments.d.ts index 7f4d431299..7a099e66be 100644 --- a/types/graphql/validation/rules/NoUnusedFragments.d.ts +++ b/types/graphql/validation/rules/NoUnusedFragments.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * No unused fragments diff --git a/types/graphql/validation/rules/NoUnusedVariables.d.ts b/types/graphql/validation/rules/NoUnusedVariables.d.ts index 6eb2d984aa..53692ed494 100644 --- a/types/graphql/validation/rules/NoUnusedVariables.d.ts +++ b/types/graphql/validation/rules/NoUnusedVariables.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * No unused variables diff --git a/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts b/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts index f21edbd2cb..302617386b 100644 --- a/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts +++ b/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Overlapping fields can be merged diff --git a/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts b/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts index 8defb47721..e9e10aca14 100644 --- a/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts +++ b/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Possible fragment spread diff --git a/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts b/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts index 4d5334b9fb..291a3ab5bc 100644 --- a/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts +++ b/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Provided required arguments diff --git a/types/graphql/validation/rules/ScalarLeafs.d.ts b/types/graphql/validation/rules/ScalarLeafs.d.ts index afdc575671..8505cc2512 100644 --- a/types/graphql/validation/rules/ScalarLeafs.d.ts +++ b/types/graphql/validation/rules/ScalarLeafs.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Scalar leafs diff --git a/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts b/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts index 01a2654a16..d6f8fa2c6b 100644 --- a/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts +++ b/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Subscriptions must only include one field. diff --git a/types/graphql/validation/rules/UniqueArgumentNames.d.ts b/types/graphql/validation/rules/UniqueArgumentNames.d.ts index 8cc166d07a..f4cc750b86 100644 --- a/types/graphql/validation/rules/UniqueArgumentNames.d.ts +++ b/types/graphql/validation/rules/UniqueArgumentNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique argument names diff --git a/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts b/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts index 70ea02cd9c..80d4a252c6 100644 --- a/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts +++ b/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique directive names per location diff --git a/types/graphql/validation/rules/UniqueFragmentNames.d.ts b/types/graphql/validation/rules/UniqueFragmentNames.d.ts index c505968f6a..525befc0a9 100644 --- a/types/graphql/validation/rules/UniqueFragmentNames.d.ts +++ b/types/graphql/validation/rules/UniqueFragmentNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique fragment names diff --git a/types/graphql/validation/rules/UniqueInputFieldNames.d.ts b/types/graphql/validation/rules/UniqueInputFieldNames.d.ts index cebd71b79b..f81fb25e5c 100644 --- a/types/graphql/validation/rules/UniqueInputFieldNames.d.ts +++ b/types/graphql/validation/rules/UniqueInputFieldNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique input field names diff --git a/types/graphql/validation/rules/UniqueOperationNames.d.ts b/types/graphql/validation/rules/UniqueOperationNames.d.ts index 5b12cc0eed..5080307d4b 100644 --- a/types/graphql/validation/rules/UniqueOperationNames.d.ts +++ b/types/graphql/validation/rules/UniqueOperationNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique operation names diff --git a/types/graphql/validation/rules/UniqueVariableNames.d.ts b/types/graphql/validation/rules/UniqueVariableNames.d.ts index ef8712fbc1..a0a029d165 100644 --- a/types/graphql/validation/rules/UniqueVariableNames.d.ts +++ b/types/graphql/validation/rules/UniqueVariableNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique variable names diff --git a/types/graphql/validation/rules/VariablesAreInputTypes.d.ts b/types/graphql/validation/rules/VariablesAreInputTypes.d.ts index df079e52f9..79846a3073 100644 --- a/types/graphql/validation/rules/VariablesAreInputTypes.d.ts +++ b/types/graphql/validation/rules/VariablesAreInputTypes.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Variables are input types diff --git a/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts b/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts index 6d3e513876..bd302a73b4 100644 --- a/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts +++ b/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Variables passed to field arguments conform to type diff --git a/types/graphql/validation/specifiedRules.d.ts b/types/graphql/validation/specifiedRules.d.ts index c09c358cb1..5afc1a09e5 100644 --- a/types/graphql/validation/specifiedRules.d.ts +++ b/types/graphql/validation/specifiedRules.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from './validate'; // It needs to check. +import { ValidationContext } from "./validate"; // It needs to check. /** * This set includes all validation rules defined by the GraphQL spec. diff --git a/types/graphql/validation/validate.d.ts b/types/graphql/validation/validate.d.ts index 9e2fd479f1..c60c3bf072 100644 --- a/types/graphql/validation/validate.d.ts +++ b/types/graphql/validation/validate.d.ts @@ -1,23 +1,23 @@ -import { GraphQLError } from '../error'; +import { GraphQLError } from "../error"; import { - DocumentNode, - OperationDefinitionNode, - VariableNode, - SelectionSetNode, - FragmentSpreadNode, - FragmentDefinitionNode, -} from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; + DocumentNode, + OperationDefinitionNode, + VariableNode, + SelectionSetNode, + FragmentSpreadNode, + FragmentDefinitionNode, +} from "../language/ast"; +import { GraphQLSchema } from "../type/schema"; import { - GraphQLInputType, - GraphQLOutputType, - GraphQLCompositeType, - GraphQLField, - GraphQLArgument, -} from '../type/definition'; -import { GraphQLDirective } from '../type/directives'; -import { TypeInfo } from '../utilities/TypeInfo'; -import { specifiedRules } from './specifiedRules'; + GraphQLInputType, + GraphQLOutputType, + GraphQLCompositeType, + GraphQLField, + GraphQLArgument, +} from "../type/definition"; +import { GraphQLDirective } from "../type/directives"; +import { TypeInfo } from "../utilities/TypeInfo"; +import { specifiedRules } from "./specifiedRules"; /** * Implements the "Validation" section of the spec. @@ -32,11 +32,7 @@ import { specifiedRules } from './specifiedRules'; * (see the language/visitor API). Visitor methods are expected to return * GraphQLErrors, or Arrays of GraphQLErrors when invalid. */ -export function validate( - schema: GraphQLSchema, - ast: DocumentNode, - rules?: any[], -): GraphQLError[]; +export function validate(schema: GraphQLSchema, ast: DocumentNode, rules?: any[]): GraphQLError[]; /** * This uses a specialized visitor which runs multiple visitors in parallel, @@ -45,18 +41,16 @@ export function validate( * @internal */ export function visitUsingRules( - schema: GraphQLSchema, - typeInfo: TypeInfo, - documentAST: DocumentNode, - rules: any[], + schema: GraphQLSchema, + typeInfo: TypeInfo, + documentAST: DocumentNode, + rules: any[] ): GraphQLError[]; -export type NodeWithSelectionSet = - | OperationDefinitionNode - | FragmentDefinitionNode; +export type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; export interface VariableUsage { - node: VariableNode; - type: GraphQLInputType; + node: VariableNode; + type: GraphQLInputType; } /** @@ -65,38 +59,34 @@ export interface VariableUsage { * validation rule. */ export class ValidationContext { - constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo); - reportError(error: GraphQLError): void; + constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo); + reportError(error: GraphQLError): void; - getErrors(): GraphQLError[]; + getErrors(): GraphQLError[]; - getSchema(): GraphQLSchema; + getSchema(): GraphQLSchema; - getDocument(): DocumentNode; + getDocument(): DocumentNode; - getFragment(name: string): FragmentDefinitionNode; + getFragment(name: string): FragmentDefinitionNode; - getFragmentSpreads(node: SelectionSetNode): FragmentSpreadNode[]; + getFragmentSpreads(node: SelectionSetNode): FragmentSpreadNode[]; - getRecursivelyReferencedFragments( - operation: OperationDefinitionNode, - ): FragmentDefinitionNode[]; + getRecursivelyReferencedFragments(operation: OperationDefinitionNode): FragmentDefinitionNode[]; - getVariableUsages(node: NodeWithSelectionSet): VariableUsage[]; + getVariableUsages(node: NodeWithSelectionSet): VariableUsage[]; - getRecursiveVariableUsages( - operation: OperationDefinitionNode, - ): VariableUsage[]; + getRecursiveVariableUsages(operation: OperationDefinitionNode): VariableUsage[]; - getType(): GraphQLOutputType; + getType(): GraphQLOutputType; - getParentType(): GraphQLCompositeType; + getParentType(): GraphQLCompositeType; - getInputType(): GraphQLInputType; + getInputType(): GraphQLInputType; - getFieldDef(): GraphQLField; + getFieldDef(): GraphQLField; - getDirective(): GraphQLDirective; + getDirective(): GraphQLDirective; - getArgument(): GraphQLArgument; + getArgument(): GraphQLArgument; } diff --git a/types/gulp-filter/tsconfig.json b/types/gulp-filter/tsconfig.json index f4f7d56d52..43ae1fe5c5 100644 --- a/types/gulp-filter/tsconfig.json +++ b/types/gulp-filter/tsconfig.json @@ -14,10 +14,13 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "paths": { + "uglify-js": ["uglify-js/v2"] + } }, "files": [ "index.d.ts", "gulp-filter-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/gulp-html-replace/index.d.ts b/types/gulp-html-replace/index.d.ts index e0610326c8..f2612b3688 100644 --- a/types/gulp-html-replace/index.d.ts +++ b/types/gulp-html-replace/index.d.ts @@ -2,6 +2,8 @@ // Project: https://www.npmjs.com/package/gulp-html-replace // Definitions by: Peter Juras // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + /// diff --git a/types/gulp-htmlmin/index.d.ts b/types/gulp-htmlmin/index.d.ts index ec97434de2..1f5f3e4a26 100644 --- a/types/gulp-htmlmin/index.d.ts +++ b/types/gulp-htmlmin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jonschlinkert/gulp-htmlmin // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/gulp-mocha/index.d.ts b/types/gulp-mocha/index.d.ts index ae56e9a9ac..ba1a6d4fca 100644 --- a/types/gulp-mocha/index.d.ts +++ b/types/gulp-mocha/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/sindresorhus/gulp-mocha // Definitions by: Asana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/types/gulp-rev-replace/tsconfig.json b/types/gulp-rev-replace/tsconfig.json index c9a020605c..dfef77b20b 100644 --- a/types/gulp-rev-replace/tsconfig.json +++ b/types/gulp-rev-replace/tsconfig.json @@ -14,10 +14,15 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "paths": { + "uglify-js": [ + "uglify-js/v2" + ] + } }, "files": [ "index.d.ts", "gulp-rev-replace-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/gulp-uglify/tsconfig.json b/types/gulp-uglify/tsconfig.json index 72fd35c65e..70663fcc71 100644 --- a/types/gulp-uglify/tsconfig.json +++ b/types/gulp-uglify/tsconfig.json @@ -14,11 +14,16 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "paths": { + "uglify-js": [ + "uglify-js/v2" + ] + } }, "files": [ "index.d.ts", "composer.d.ts", "gulp-uglify-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/gulp-useref/tsconfig.json b/types/gulp-useref/tsconfig.json index cdb7922c57..f3867032fa 100644 --- a/types/gulp-useref/tsconfig.json +++ b/types/gulp-useref/tsconfig.json @@ -14,10 +14,13 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "paths": { + "uglify-js": ["uglify-js/v2"] + } }, "files": [ "index.d.ts", "gulp-useref-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/gulp-util/gulp-util-tests.ts b/types/gulp-util/gulp-util-tests.ts index 47e705bf00..1781ce7664 100644 --- a/types/gulp-util/gulp-util-tests.ts +++ b/types/gulp-util/gulp-util-tests.ts @@ -1,5 +1,3 @@ -/// - import gulp = require('gulp'); import util = require('gulp-util'); import path = require('path'); @@ -7,6 +5,11 @@ import Stream = require('stream'); import through = require('through2'); const es = require('event-stream'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + // TODO: These aren't useful as types tests since they take `any`. declare const should: ShouldStatic; interface ShouldStatic { diff --git a/types/hexo-fs/hexo-fs-tests.ts b/types/hexo-fs/hexo-fs-tests.ts index 5f73cd91fc..7bd5dc13b8 100644 --- a/types/hexo-fs/hexo-fs-tests.ts +++ b/types/hexo-fs/hexo-fs-tests.ts @@ -1,9 +1,13 @@ import fs = require('hexo-fs'); import { join, dirname } from 'path'; -import 'mocha'; import chai = require('chai'); import Promise = require('bluebird'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + const should = chai.should(); function createDummyFolder(path: string) { @@ -198,7 +202,8 @@ it('copyFile() - callback', callback => { if (err) return callback(err); fs.readFile(dest, (err, content) => { - if (err) return callback(err); + if (err) + return callback(err); content!.should.eql(body); Promise.all([ diff --git a/types/html-minifier/index.d.ts b/types/html-minifier/index.d.ts index c190fc4a74..2f1281c442 100644 --- a/types/html-minifier/index.d.ts +++ b/types/html-minifier/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Tanguy Krotoff // Riku // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as UglifyJS from 'uglify-js'; import * as CleanCSS from 'clean-css'; diff --git a/types/html-minifier/v1/tsconfig.json b/types/html-minifier/v1/tsconfig.json index dd9586e561..846fa3a1f6 100644 --- a/types/html-minifier/v1/tsconfig.json +++ b/types/html-minifier/v1/tsconfig.json @@ -16,6 +16,9 @@ "html-minifier": [ "html-minifier/v1" ], + "uglify-js": [ + "uglify-js/v2" + ], "html-minifier/*": [ "html-minifier/v1/*" ] @@ -28,4 +31,4 @@ "index.d.ts", "html-minifier-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/i18next-express-middleware/index.d.ts b/types/i18next-express-middleware/index.d.ts index f9877b2659..d28a334429 100644 --- a/types/i18next-express-middleware/index.d.ts +++ b/types/i18next-express-middleware/index.d.ts @@ -5,104 +5,130 @@ // TypeScript Version: 2.3 declare namespace I18next { - interface I18nextOptions extends i18nextExpressMiddleware.I18nextOptions { } + interface I18nextOptions extends i18nextExpressMiddleware.I18nextOptions {} } declare namespace i18nextExpressMiddleware { - /** - * @summary Interface for Language detector options. - * @interface - */ - interface LanguageDetectorOptions { - caches?: Array|boolean; - cookieDomain?: string; - cookieExpirationDate?: Date; - lookupCookie?: string; - lookupFromPathIndex?: number; - lookupQuerystring?: string; - lookupSession?: string; - order?: Array; - } + /** + * @summary Interface for Language detector options. + * @interface + */ + interface LanguageDetectorOptions { + caches?: Array | boolean + cookieDomain?: string + cookieExpirationDate?: Date + lookupCookie?: string + lookupFromPathIndex?: number + lookupQuerystring?: string + lookupSession?: string + order?: Array + } - /** - * @summary i18next options. - * @interface - */ - interface I18nextOptions { - detection?: LanguageDetectorOptions; - } + /** + * @summary i18next options. + * @interface + */ + interface I18nextOptions { + detection?: LanguageDetectorOptions + } } -declare module "i18next-express-middleware" { - import express = require("express"); - import i18next = require("i18next"); +declare module 'i18next-express-middleware' { + import express = require('express') + import i18next = require('i18next') + + /** + * @summary Interface for middleware to use i18next in express.js. + * @interface + */ + export interface i18nextExpressMiddleware { + LanguageDetector(): express.Handler + missingKeyHandler(): express.Handler + } + + /** + * @summary Interface for own detection functionality. + */ + export interface i18nextCustomDetection { + name: string + lookup: ( + req: express.Request, + res: express.Response, + options?: Object + ) => void + cacheUserLanguage: ( + req: express.Request, + res: express.Response, + lng?: any, + options?: Object + ) => void + } + + /** + * @summary Detects user language from current request. + * @class + */ + export class LanguageDetector { + /** + * @summary Constructor. + * @constructor + * @param {any} services The services. + * @param {Object} options The options. + * @param {Object} allOptions The all options. + */ + constructor(services?: any, options?: Object, allOptions?: Object) /** - * @summary Interface for middleware to use i18next in express.js. - * @interface + * @summary Adds detector. + * @param {i18nextCustomDetection} detector The detector to add. */ - export interface i18nextExpressMiddleware { - LanguageDetector(): express.Handler; - missingKeyHandler(): express.Handler; - } + addDetector(detector: i18nextCustomDetection): void + + // NOTE: add documentation + cacheUserLanguage( + req: express.Request, + res: express.Response, + detectionOrder: any + ): void /** - * @summary Interface for own detection functionality. + * @summary Detects the language. + * @param {Request} req The HTTP request. + * @param {Response} res The HTTP response. + * @param {detectionOrder} detectionOrder The detection order. */ - export interface i18nextCustomDetection { - name: string; - lookup: (req: express.Request, res: express.Response, options?: Object) => void; - cacheUserLanguage: (req: express.Request, res: express.Response, lng?: any, options?: Object) => void; - } + detect( + req: express.Request, + res: express.Response, + detectionOrder: any + ): void /** - * @summary Detects user language from current request. - * @class + * @summary Initializes class. + * @param {any} services The services. + * @param {Object} options The options. + * @param {Object} allOptions The all options. */ - export class LanguageDetector { - /** - * @summary Constructor. - * @constructor - * @param {any} services The services. - * @param {Object} options The options. - * @param {Object} allOptions The all options. - */ - constructor(services?: any, options?: Object, allOptions?: Object); + init(services: any, options?: Object, allOptions?: Object): void + } - /** - * @summary Adds detector. - * @param {i18nextCustomDetection} detector The detector to add. - */ - addDetector(detector: i18nextCustomDetection): void; + export function getResourcesHandler( + i18next: i18next.i18n, + options: Object + ): express.Handler + export function handle( + i18next: i18next.i18n, + options?: Object + ): express.Handler - // NOTE: add documentation - cacheUserLanguage(req: express.Request, res: express.Response, detectionOrder: any): void; - - /** - * @summary Detects the language. - * @param {Request} req The HTTP request. - * @param {Response} res The HTTP response. - * @param {detectionOrder} detectionOrder The detection order. - */ - detect(req: express.Request, res: express.Response, detectionOrder: any): void; - - /** - * @summary Initializes class. - * @param {any} services The services. - * @param {Object} options The options. - * @param {Object} allOptions The all options. - */ - init(services: any, options?: Object, allOptions?: Object): void; - } - - export function getResourcesHandler(i18next: i18next.i18n, options: Object): express.Handler; - export function handle(i18next: i18next.i18n, options?: Object): express.Handler; - - /** - * @summary Gets handler for missing key. - * @param {I18nextStatic} i18next The i18next. - * @param {Object} options The options. - * @return {express.Handler} The express handler. - */ - export function missingKeyHandler(i18next: i18next.i18n, options: Object): express.Handler; + /** + * @summary Gets handler for missing key. + * @param {I18nextStatic} i18next The i18next. + * @param {Object} options The options. + * @return {express.Handler} The express handler. + */ + export function missingKeyHandler( + i18next: i18next.i18n, + options?: Object + ): express.Handler } diff --git a/types/incremental-dom/incremental-dom-tests.ts b/types/incremental-dom/incremental-dom-tests.ts index 2e30297e57..f593299575 100644 --- a/types/incremental-dom/incremental-dom-tests.ts +++ b/types/incremental-dom/incremental-dom-tests.ts @@ -1,6 +1,10 @@ -/// declare var expect: any; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + import id = require('incremental-dom'); var patch = id.patch; var elementVoid = id.elementVoid; diff --git a/types/inquirer/index.d.ts b/types/inquirer/index.d.ts index 804f96411f..b793673215 100644 --- a/types/inquirer/index.d.ts +++ b/types/inquirer/index.d.ts @@ -5,6 +5,7 @@ // Jouderian // Qibang // Jason Dreyzehner +// Synarque // Justin Rockwood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index d072e003a8..bc3d656985 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -48,6 +48,7 @@ declare namespace IORedis { } interface Redis extends NodeJS.EventEmitter, Commander { + Promise: typeof Promise; status: string; connect(callback?: () => void): Promise; disconnect(): void; diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index d8106ecdea..e8e32062dc 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -105,7 +105,10 @@ redis.multi([ // results = [[null, 'OK'], [null, 'bar']] }); -const keys = [ 'foo', 'bar' ]; +redis.Promise.onPossiblyUnhandledRejection((error) => { +}); + +const keys = ['foo', 'bar']; redis.mget(...keys); new Redis.Cluster([ diff --git a/types/is-color/index.d.ts b/types/is-color/index.d.ts new file mode 100644 index 0000000000..f6c545246f --- /dev/null +++ b/types/is-color/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for is-color 1.0 +// Project: https://github.com/morishitter/is-color +// Definitions by: Vitor Luiz Cavalcanti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function isColor(str: string): boolean; + +declare namespace isColor { + function isRgb(str: string): boolean; + function isRgba(str: string): boolean; + function isHsl(str: string): boolean; + function isHsla(str: string): boolean; + function isHex(str: string): boolean; + function isKeyword(str: string): boolean; + function isInherit(str: string): str is 'inherit'; + function isCurrentColor(str: string): str is ('currentColor' | 'currentcolor'); + function isTransparent(str: string): str is 'transparent'; +} + +export = isColor; diff --git a/types/is-color/is-color-tests.ts b/types/is-color/is-color-tests.ts new file mode 100644 index 0000000000..a17ffc7b08 --- /dev/null +++ b/types/is-color/is-color-tests.ts @@ -0,0 +1,23 @@ +import isColor = require('is-color'); + +isColor('#000'); +// => boolean + +isColor.isHex('#000'); +// => boolean +isColor.isHsl('#000'); +// => boolean +isColor.isHsla('#000'); +// => boolean +isColor.isRgb('rgb(0, 0, 0)'); +// => boolean +isColor.isRgba('rgba(0,0,0, 0)'); +// => boolean +isColor.isKeyword('red'); +// => boolean +isColor.isInherit('inherit'); +// => is 'inherit' +isColor.isTransparent('transparent'); +// => is 'transparent' +isColor.isCurrentColor('currentColor'); +// => is 'currentColor'|'currentcolor' diff --git a/types/is-color/tsconfig.json b/types/is-color/tsconfig.json new file mode 100644 index 0000000000..41488170d8 --- /dev/null +++ b/types/is-color/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "is-color-tests.ts" + ] +} diff --git a/types/is-color/tslint.json b/types/is-color/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/is-color/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/is-empty/index.d.ts b/types/is-empty/index.d.ts new file mode 100644 index 0000000000..ca712b74cb --- /dev/null +++ b/types/is-empty/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for is-empty 1.2 +// Project: https://github.com/ianstormtaylor/is-empty +// Definitions by: Stanislav Termosa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Test if a value is empty + */ +declare function isEmpty(value: any): boolean; + +export = isEmpty; diff --git a/types/is-empty/is-empty-tests.ts b/types/is-empty/is-empty-tests.ts new file mode 100644 index 0000000000..3c49359089 --- /dev/null +++ b/types/is-empty/is-empty-tests.ts @@ -0,0 +1,10 @@ +import isEmpty = require('is-empty'); + +isEmpty({}); +isEmpty(null); +isEmpty(undefined); +isEmpty(9); +isEmpty(new Object()); +isEmpty(Array); +isEmpty(''); +isEmpty(() => {}); diff --git a/types/is-empty/tsconfig.json b/types/is-empty/tsconfig.json new file mode 100644 index 0000000000..c9e999956e --- /dev/null +++ b/types/is-empty/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "is-empty-tests.ts" + ] +} diff --git a/types/is-empty/tslint.json b/types/is-empty/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/is-empty/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/is/index.d.ts b/types/is/index.d.ts index b61bd6deee..3b70472d65 100644 --- a/types/is/index.d.ts +++ b/types/is/index.d.ts @@ -32,6 +32,11 @@ interface IsStatic { */ error(value: any): boolean; + /** + * Checks if the given value type is function. + */ + fn(value: any): boolean; + /** * Checks if the given value type is function. */ @@ -587,7 +592,7 @@ interface IsStaticApi { * Checks if the given value type is arguments. */ arguments(...value: any[]): boolean; - + /** * Checks if the given value type is arguments. */ @@ -633,6 +638,16 @@ interface IsStaticApi { */ error(value: any[]): boolean; + /** + * Checks if the given value type is function. + */ + fn(...value: any[]): boolean; + + /** + * Checks if the given value type is function. + */ + fn(value: any[]): boolean; + /** * Checks if the given value type is function. */ @@ -1234,12 +1249,12 @@ interface Is extends IsStatic { * Override RegExps if you think they suck. */ setRegexp(value: RegExp, regexp: 'url'): boolean; - + /** * Override RegExps if you think they suck. */ setRegexp(value: RegExp, regexp: 'email'): boolean; - + /** * Override RegExps if you think they suck. */ diff --git a/types/is/is-tests.ts b/types/is/is-tests.ts index 674d5ff761..0084de8990 100644 --- a/types/is/is-tests.ts +++ b/types/is/is-tests.ts @@ -36,6 +36,12 @@ is.all.error(new Error(), 'bar'); is.any.error(new Error(), 'bar'); is.all.error([new Error(), 'foo', 'bar']); +is.fn(toString); +is.not.fn({ foo: 'bar' }); +is.all.fn(toString, 'bar'); +is.any.fn(toString, 'bar'); +is.all.fn([toString, 'foo', 'bar']); + is.function(toString); is.not.function({ foo: 'bar' }); is.all.function(toString, 'bar'); diff --git a/types/istanbul/index.d.ts b/types/istanbul/index.d.ts index ee23e27782..fe45802865 100644 --- a/types/istanbul/index.d.ts +++ b/types/istanbul/index.d.ts @@ -24,6 +24,7 @@ declare namespace istanbul { interface Collector { new (options?: any): Collector; add(coverage: any, testName?: string): void; + getFinalCoverage(): any; } interface Config { diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 80957f32ad..3dc26955e6 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -11,6 +11,8 @@ // Jamie Mason // Douglas Duteil // Ahn +// Josh Goldberg +// Bradley Ayers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -201,6 +203,10 @@ declare namespace jest { type Lifecycle = (fn: ProvidesCallback, timeout?: number) => any; + interface FunctionLike { + readonly name: string; + } + /** * Creates a test closure */ @@ -222,7 +228,8 @@ declare namespace jest { } interface Describe { - (name: string, fn: EmptyFunction): void; + // tslint:disable-next-line ban-types + (name: number | string | Function | FunctionLike, fn: EmptyFunction): void; only: Describe; skip: Describe; } @@ -230,8 +237,8 @@ declare namespace jest { interface MatcherUtils { readonly isNot: boolean; utils: { - readonly EXPECTED_COLOR: string; - readonly RECEIVED_COLOR: string; + readonly EXPECTED_COLOR: (text: string) => string; + readonly RECEIVED_COLOR: (text: string) => string; ensureActualIsNumber(actual: any, matcherName?: string): void; ensureExpectedIsNumber(actual: any, matcherName?: string): void; ensureNoExpected(actual: any, matcherName?: string): void; diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index cc73b0b054..786dccb641 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -10,6 +10,10 @@ declare const $: any; // Tests based on the Jest website jest.unmock('../sum'); +class TestClass { } + +describe(TestClass, () => { }); + describe('sum', () => { it('adds 1 + 2 to equal 3', () => { const sum: (a: number, b: number) => number = require('../sum'); diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 6e2b7be6c7..2b6d264b3e 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -165,6 +165,11 @@ export interface IPOptions { cidr?: string } +export interface StringRegexOptions { + name?: string; + invert?: boolean; +} + export interface JoiObject { isJoi: boolean; } @@ -552,9 +557,13 @@ export interface StringSchema extends AnySchema { /** * Defines a regular expression rule. * @param pattern - a regular expression object the string value must match against. - * @param name - optional name for patterns (useful with multiple patterns). Defaults to 'required'. + * @param options - optional, can be: + * Name for patterns (useful with multiple patterns). Defaults to 'required'. + * An optional configuration object with the following supported properties: + * name - optional pattern name. + * invert - optional boolean flag. Defaults to false behavior. If specified as true, the provided pattern will be disallowed instead of required. */ - regex(pattern: RegExp, name?: string): this; + regex(pattern: RegExp, options?: string | StringRegexOptions): this; /** * Replace characters matching the given pattern with the specified replacement string where: diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 3ee7c45b66..1ab3316eb8 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -135,6 +135,13 @@ refOpts = { contextPrefix: str }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- +let stringRegexOpts: Joi.StringRegexOptions = null; + +stringRegexOpts = { name: str }; +stringRegexOpts = { invert: bool }; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + let validErr: Joi.ValidationError = null; let validErrItem: Joi.ValidationErrorItem; let validErrFunc: Joi.ValidationErrorFunction; @@ -764,6 +771,7 @@ strSchema = strSchema.length(ref); strSchema = strSchema.length(ref, str); strSchema = strSchema.regex(exp); strSchema = strSchema.regex(exp, str); +strSchema = strSchema.regex(exp, stringRegexOpts); strSchema = strSchema.replace(exp, str); strSchema = strSchema.replace(str, str); strSchema = strSchema.alphanum(); diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index 9c793a2c19..c13cd7f26f 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -236,7 +236,7 @@ declare namespace Fancytree { /** Outer element of single nodes */ span: HTMLElement; /** Outer element of single nodes for table extension */ - tr: HTMLElement; + tr: HTMLTableRowElement; //#endregion //#region Methods diff --git a/types/jquery.pin/index.d.ts b/types/jquery.pin/index.d.ts new file mode 100644 index 0000000000..df132c6571 --- /dev/null +++ b/types/jquery.pin/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for JQuery Pin 1.0 +// Project: https://github.com/webpop/jquery.pin +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +export interface Options { + minWidth?: number; + activeClass?: string; + containerSelector?: string; + padding?: { + top?: number; + bottom?: number; + }; +} +declare global { + interface JQuery { + pin(options?: Options): JQuery; + } +} diff --git a/types/jquery.pin/jquery.pin-tests.ts b/types/jquery.pin/jquery.pin-tests.ts new file mode 100644 index 0000000000..b43c6e7881 --- /dev/null +++ b/types/jquery.pin/jquery.pin-tests.ts @@ -0,0 +1,17 @@ +import { Options } from "jquery.pin"; + +// basic usage +$(".pinned").pin(); + +// with options +const options: Options = { + activeClass: 'active', + minWidth: 940, + containerSelector: '.container', + padding: { + top: 10, + bottom: 10 + } +}; + +$(".pinned").pin(options); diff --git a/types/jquery.pin/tsconfig.json b/types/jquery.pin/tsconfig.json new file mode 100644 index 0000000000..4e880d5205 --- /dev/null +++ b/types/jquery.pin/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "jquery.pin-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jquery.pin/tslint.json b/types/jquery.pin/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/jquery.pin/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file diff --git a/types/js-yaml/index.d.ts b/types/js-yaml/index.d.ts index 2fa264cbd9..5cd852ab3f 100644 --- a/types/js-yaml/index.d.ts +++ b/types/js-yaml/index.d.ts @@ -1,11 +1,13 @@ -// Type definitions for js-yaml 3.10 +// Type definitions for js-yaml 3.11 // Project: https://github.com/nodeca/js-yaml // Definitions by: Bart van der Schoor , Sebastian Clausen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export function safeLoad(str: string, opts?: LoadOptions): any; -export function load(str: string, opts?: LoadOptions): any; +export type DocumentLoadResult = object | undefined; + +export function safeLoad(str: string, opts?: LoadOptions): DocumentLoadResult; +export function load(str: string, opts?: LoadOptions): DocumentLoadResult; export class Type { constructor(tag: string, opts?: TypeConstructorOptions); @@ -26,8 +28,12 @@ export class Schema implements SchemaDefinition { static create(schemas: Schema[] | Schema, types: Type[] | Type): Schema; } -export function safeLoadAll(str: string, iterator?: (doc: any) => void, opts?: LoadOptions): any; -export function loadAll(str: string, iterator?: (doc: any) => void, opts?: LoadOptions): any; +export function safeLoadAll(str: string, iterator?: undefined, opts?: LoadOptions): DocumentLoadResult[]; +export function safeLoadAll(str: string, iterator: (doc: any) => void, opts?: LoadOptions): undefined; + +export function loadAll(str: string, iterator?: undefined, opts?: LoadOptions): DocumentLoadResult[]; + +export function loadAll(str: string, iterator: (doc: any) => void, opts?: LoadOptions): undefined; export function safeDump(obj: any, opts?: DumpOptions): string; export function dump(obj: any, opts?: DumpOptions): string; diff --git a/types/js-yaml/js-yaml-tests.ts b/types/js-yaml/js-yaml-tests.ts index 3d5ecc17bf..9a61da204f 100644 --- a/types/js-yaml/js-yaml-tests.ts +++ b/types/js-yaml/js-yaml-tests.ts @@ -109,40 +109,44 @@ type.styleAliases; // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -// $ExpectType any +// $ExpectType DocumentLoadResult yaml.safeLoad(str); -// $ExpectType any +// $ExpectType DocumentLoadResult yaml.safeLoad(str, loadOpts); -// $ExpectType any +// $ExpectType DocumentLoadResult yaml.load(str); -// $ExpectType any +// $ExpectType DocumentLoadResult yaml.load(str, loadOpts); // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -// $ExpectType any +// $ExpectType DocumentLoadResult[] yaml.safeLoadAll(str); -// $ExpectType any + +// $ExpectType undefined yaml.safeLoadAll(str, (doc) => { value = doc; }); -// $ExpectType any +// $ExpectType undefined yaml.safeLoadAll(str, (doc) => { value = doc; }, loadOpts); +// $ExpectType DocumentLoadResult[] value = yaml.safeLoadAll(str, undefined, loadOpts); -// $ExpectType any +// $ExpectType DocumentLoadResult[] value = yaml.loadAll(str); -// $ExpectType any + +// $ExpectType undefined yaml.loadAll(str, (doc) => { value = doc; }); -// $ExpectType any +// $ExpectType undefined yaml.loadAll(str, (doc) => { value = doc; }, loadOpts); +// $ExpectType DocumentLoadResult[] value = yaml.loadAll(str, undefined, loadOpts); // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/types/jsforce/query.d.ts b/types/jsforce/query.d.ts index 242d89b358..0e7d413cf8 100644 --- a/types/jsforce/query.d.ts +++ b/types/jsforce/query.d.ts @@ -49,6 +49,7 @@ export class Query extends Readable implements Promise { // Implementing promise methods then(onfulfilled?: any): Promise; catch(onrejected?: any): Promise; + finally(): Promise; [Symbol.toStringTag]: "Promise"; } diff --git a/types/jss/index.d.ts b/types/jss/index.d.ts index 0f77605b2c..37d2443e4a 100644 --- a/types/jss/index.d.ts +++ b/types/jss/index.d.ts @@ -125,7 +125,7 @@ declare class JSS { ): StyleSheet; removeStyleSheet(sheet: StyleSheet): this; setup(options?: Partial): this; - use(plugin: JSSPlugin): this; + use(...plugins: JSSPlugin[]): this; createRule(style: Style, options?: Partial): Rule; createRule(name: string, style: Style, options?: Partial): Rule; } diff --git a/types/jss/jss-tests.ts b/types/jss/jss-tests.ts index a5c6f34126..0211df99a8 100644 --- a/types/jss/jss-tests.ts +++ b/types/jss/jss-tests.ts @@ -7,6 +7,7 @@ import { } from 'jss'; const jss = createJSS().setup({}); +jss.use({}, {}); // $ExpectType JSS const styleSheet = jss.createStyleSheet( { diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index cb40e26da7..58c656956c 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for JW Player V8.0 -// Project: http://developer.longtailvideo.com/trac/ +// Project: https://github.com/jwplayer/jwplayer/ // Definitions by: Martin Duparc // Tomer Kruvi // Philipp Gürtler @@ -255,8 +255,8 @@ interface JWPlayer { getSafeRegion(): Region; getState(): string; getVolume(): number; - getContainer(): HTMLElement; - getEnvironment(): Environment; + getContainer(): HTMLElement; + getEnvironment(): Environment; getWidth(): number; load(playlist: any[]): void; load(playlist: string): void; diff --git a/types/karma-viewport/index.d.ts b/types/karma-viewport/index.d.ts new file mode 100644 index 0000000000..10196485ca --- /dev/null +++ b/types/karma-viewport/index.d.ts @@ -0,0 +1,124 @@ +// Type definitions for karma-viewport 0.4 +// Project: https://github.com/squidfunk/karma-viewport +// Definitions by: Karak +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Type definition file for 'karma-viewport' +// https://www.npmjs.com/package/karma-viewport + +declare namespace KarmaViewport { + interface Breakpoint { + name: string; + size: { + width: number, + height: number, + }; + } + + interface Config { + /** Context selector */ + context: string; + /** Breakpoints */ + breakpoints: Breakpoint[]; + } + + class Viewport { + /** + * Create viewport resizer + * + * @param config - Configuration + * @param context - Initialization context + */ + constructor(config: Config, context: Window); + + /** + * Load and embed document into viewport + * + * @param url - URL of document to load + * @param cb - Callback to execute after document was loaded + */ + load(url: string, cb: () => void): void; + + /** + * Set viewport to number or array + */ + set(width: number, height?: number): void; + + /** + * Set viewport to breakpoint identifier + */ + set(name: string): void; + + /** + * Reset viewport + */ + reset(): void; + + /** + * Execute a callback for all breakpoints between the first and last given + * + * @example + * viewport.between("mobile", "tablet", name => { + * ... + * }) + * + * @param first - First breakpoint name + * @param last - Last breakpoint name + * @param cb - Callback to execute after resizing + */ + between(first: string, last: string, cb: (name: string) => void): void; + + /** + * Execute a callback for all breakpoints + * + * @example + * viewport.each(name => { + * ... + * }) + * + * @param cb - Callback to execute after resizing + */ + each(cb: (name: string) => void): void; + + /** + * Execute a callback starting at the given breakpoint + * + * @example + * viewport.from("tablet", name => { + * ... + * }) + * + * @param first - First breakpoint name + * @param cb - Callback to execute after resizing + */ + from(first: string, cb: (name: string) => void): void; + + /** + * Execute a callback ending at the given breakpoint + * + * @example + * viewport.to("tablet", name => { + * ... + * }) + * + * @param last - Last breakpoint name + * @param cb - Callback to execute after resizing + */ + to(last: string, cb: (name: string) => void): void; + + /** + * Retrieve configuration + * + * @return Configuration + */ + readonly config: Config; // get config() + + /** + * Retrieve context element + * + * @return context element + */ + readonly element: HTMLIFrameElement; // get element() + } +} + +declare const viewport: KarmaViewport.Viewport; diff --git a/types/karma-viewport/karma-viewport-tests.ts b/types/karma-viewport/karma-viewport-tests.ts new file mode 100644 index 0000000000..f220f35d98 --- /dev/null +++ b/types/karma-viewport/karma-viewport-tests.ts @@ -0,0 +1,46 @@ +// Set to 320px x 100% +viewport.set(320); + +// Set to 320px x 480px +viewport.set(320, 480); + +// Set to 320px x 480px by breakpoints +viewport.set("mobile"); + +// Reset to 100% x 100% +viewport.reset(); + +// Load entire webpages for testing: +viewport.load("/path/to/fixture.html", () => console.log('done')); + +// Run tests for mobile, tablet and screen +viewport.each(name => { + // ... +}); + +// Run tests for tablet and screen +viewport.from("tablet", name => { + // ... +}); + +// Run tests for mobile and tablet +viewport.to("tablet", name => { + // ... +}); + +// Run tests for tablet and screen +viewport.between("tablet", "screen", name => { + // ... +}); + +// get config +viewport.config.breakpoints.forEach(breakpoint => { + const name: string = breakpoint.name; + const width: number = breakpoint.size.width; + const height: number = breakpoint.size.height; +}); + +const contextSelector: string = viewport.config.context; + +// get element +const iframe: HTMLIFrameElement = viewport.element; diff --git a/types/karma-viewport/tsconfig.json b/types/karma-viewport/tsconfig.json new file mode 100644 index 0000000000..def40ab217 --- /dev/null +++ b/types/karma-viewport/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "karma-viewport-tests.ts" + ] +} diff --git a/types/karma-viewport/tslint.json b/types/karma-viewport/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/karma-viewport/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/keyv/index.d.ts b/types/keyv/index.d.ts new file mode 100644 index 0000000000..9d0e2c6404 --- /dev/null +++ b/types/keyv/index.d.ts @@ -0,0 +1,56 @@ +// Type definitions for keyv 3.0 +// Project: https://github.com/lukechilds/keyv +// Definitions by: AryloYeung +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +interface KeyvOptions { + /** Namespace for the current instance. */ + namespace?: string; + /** A custom serialization function. */ + serialize?: (data: any) => string; + /** A custom deserialization function. */ + deserialize?: (data: string) => any; + /** The connection string URI. */ + uri?: string; + /** The storage adapter instance to be used by Keyv. */ + store?: any; + /** Default TTL. Can be overridden by specififying a TTL on `.set()`. */ + ttl?: number; + /** Specify an adapter to use. e.g `'redis'` or `'mongodb'`. */ + adapter?: string; +} + +declare class Keyv extends NodeJS.EventEmitter { + /** + * @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options. + */ + constructor(opts?: KeyvOptions); + /** + * @param uri The connection string URI. + * + * Merged into the options object as options.uri. + * @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options. + */ + constructor(uri?: string, opts?: KeyvOptions); + /** Returns the value. */ + get(key: string): Promise; + /** + * Set a value. + * + * By default keys are persistent. You can set an expiry TTL in milliseconds. + */ + set(key: string, value: any, ttl?: number): Promise; + /** + * Deletes an entry. + * + * Returns `true` if the key existed, `false` if not. + */ + delete(key: string): Promise; + /** Delete all entries in the current namespace. */ + clear(): Promise; +} + +export = Keyv; diff --git a/types/keyv/keyv-tests.ts b/types/keyv/keyv-tests.ts new file mode 100644 index 0000000000..7ee4cac90e --- /dev/null +++ b/types/keyv/keyv-tests.ts @@ -0,0 +1,25 @@ +import Keyv = require("keyv"); + +new Keyv({ + uri: 'redis://user:pass@localhost:6379', + namespace: "redis" +}); + +new Keyv('mongodb://user:pass@localhost:27017/dbname'); +new Keyv('redis://user:pass@localhost:6379'); +new Keyv('sqlite://path/to/database.sqlite'); +new Keyv('postgresql://user:pass@localhost:5432/dbname'); +new Keyv('mysql://user:pass@localhost:3306/dbname'); +new Keyv(); + +(async () => { + const keyv = new Keyv(); + + keyv.on('error', err => console.log('Connection Error', err)); + + await keyv.set('foo', 'expires in 1 second', 1000); // true + await keyv.set('foo', 'never expires'); // true + await keyv.get('foo'); // 'never expires' + await keyv.delete('foo'); // true + await keyv.clear(); // undefined +})(); diff --git a/types/keyv/tsconfig.json b/types/keyv/tsconfig.json new file mode 100644 index 0000000000..47eab45180 --- /dev/null +++ b/types/keyv/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "keyv-tests.ts" + ] +} diff --git a/types/keyv/tslint.json b/types/keyv/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/keyv/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/knockout/index.d.ts b/types/knockout/index.d.ts index 0964d24284..d4031b2337 100644 --- a/types/knockout/index.d.ts +++ b/types/knockout/index.d.ts @@ -444,10 +444,10 @@ interface KnockoutStatic { toJS(viewModel: any): any; isObservable(instance: any): instance is KnockoutObservable; - isObservable(instance: KnockoutObservable): instance is KnockoutObservable; + isObservable(instance: KnockoutObservable | T): instance is KnockoutObservable; isWriteableObservable(instance: any): instance is KnockoutObservable; - isWriteableObservable(instance: KnockoutObservable): instance is KnockoutObservable; + isWriteableObservable(instance: KnockoutObservable | T): instance is KnockoutObservable; isComputed(instance: any): instance is KnockoutComputed; isComputed(instance: KnockoutObservable | T): instance is KnockoutComputed; diff --git a/types/koa-webpack/index.d.ts b/types/koa-webpack/index.d.ts index b425956f03..4f86fcd11f 100644 --- a/types/koa-webpack/index.d.ts +++ b/types/koa-webpack/index.d.ts @@ -19,7 +19,7 @@ declare namespace koaWebpack { compiler?: webpack.Compiler; config?: webpack.Configuration; dev?: webpackDevMiddleware.Options; - hot?: webpackHotMiddleware.Options; + hot?: webpackHotMiddleware.Options | boolean; } interface CombinedWebpackMiddleware { diff --git a/types/libpq/libpq-tests.ts b/types/libpq/libpq-tests.ts index f1ae6cc1e3..7d19e910cd 100644 --- a/types/libpq/libpq-tests.ts +++ b/types/libpq/libpq-tests.ts @@ -1,10 +1,13 @@ -/// - import { Buffer } from 'buffer'; import assert = require('assert'); import * as async from 'async'; import PQ = require('libpq'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + declare const _: { times(n: number, f: () => T): T[] }; declare const ok: Function; diff --git a/types/lodash/common/array.d.ts b/types/lodash/common/array.d.ts index f70fbbf135..49f93aa313 100644 --- a/types/lodash/common/array.d.ts +++ b/types/lodash/common/array.d.ts @@ -916,27 +916,15 @@ declare module "../index" { interface LoDashStatic { /** - * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only - * flattened a single level. + * Flattens `array` a single level deep. * * @param array The array to flatten. - * @param isDeep Specify a deep flatten. * @return Returns the new flattened array. */ - flatten(array: ListOfRecursiveArraysOrValues | null | undefined, isDeep: boolean): T[]; - - /** - * @see _.flatten - */ flatten(array: List> | null | undefined): T[]; } interface LoDashImplicitWrapper { - /** - * @see _.flatten - */ - flatten(this: LoDashImplicitWrapper | null | undefined>, isDeep: boolean): LoDashImplicitWrapper; - /** * @see _.flatten */ @@ -944,11 +932,6 @@ declare module "../index" { } interface LoDashExplicitWrapper { - /** - * @see _.flatten - */ - flatten(this: LoDashExplicitWrapper | null | undefined>, isDeep: boolean): LoDashExplicitWrapper; - /** * @see _.flatten */ @@ -1102,8 +1085,7 @@ declare module "../index" { * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. If `fromIndex` is negative, it's used as the offset - * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` - * performs a faster binary search. + * from the end of `array`. * * @category Array * @param array The array to search. @@ -1122,7 +1104,7 @@ declare module "../index" { indexOf( array: List | null | undefined, value: T, - fromIndex?: boolean|number + fromIndex?: number ): number; } @@ -1133,7 +1115,7 @@ declare module "../index" { indexOf( this: LoDashImplicitWrapper | null | undefined>, value: T, - fromIndex?: boolean|number + fromIndex?: number ): number; } @@ -1144,7 +1126,7 @@ declare module "../index" { indexOf( this: LoDashExplicitWrapper | null | undefined>, value: T, - fromIndex?: boolean|number + fromIndex?: number ): LoDashExplicitWrapper; } @@ -3463,7 +3445,7 @@ declare module "../index" { /** * @see _.zip */ - zip(...arrays: Array | null | undefined>): (T | undefined)[][]; + zip(...arrays: Array | null | undefined>): Array>; } interface LoDashImplicitWrapper { @@ -3842,4 +3824,4 @@ declare module "../index" { ...iteratee: Array<((...group: T[]) => TResult) | List | null | undefined> ): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/common/collection.d.ts b/types/lodash/common/collection.d.ts index c8b2770610..3c7e65d38f 100644 --- a/types/lodash/common/collection.d.ts +++ b/types/lodash/common/collection.d.ts @@ -516,13 +516,13 @@ declare module "../index" { interface LoDashStatic { /** - * This method is like _.find except that it iterates over elements of a collection from - * right to left. - * @param collection Searches for a value in this list. - * @param predicate The function called per iteration. - * @param fromIndex The index to search from. - * @return The found element, else undefined. - **/ + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ findLast( collection: List | null | undefined, predicate: ListIteratorTypeGuard, @@ -2720,4 +2720,4 @@ declare module "../index" { ...iteratees: Array>> ): LoDashExplicitWrapper>; } -} \ No newline at end of file +} diff --git a/types/lodash/common/common.d.ts b/types/lodash/common/common.d.ts index 468019ea53..17d5e04b36 100644 --- a/types/lodash/common/common.d.ts +++ b/types/lodash/common/common.d.ts @@ -1,4 +1,5 @@ import _ = require("../index"); +// tslint:disable-next-line:strict-export-declare-modifiers type GlobalPartial = Partial; declare module "../index" { type PartialObject = GlobalPartial; @@ -86,7 +87,6 @@ declare module "../index" { templateSettings: TemplateSettings; } - /** * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. @@ -193,17 +193,23 @@ declare module "../index" { type StringIterator = (char: string, index: number, string: string) => TResult; + /** @deprecated Use MemoVoidArrayIterator or MemoVoidDictionaryIterator instead. */ type MemoVoidIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => void; - /** @deprecated Use MemoListIterator or MemoObjectIterator instead. */ + /** @deprecated Use MemoListIterator or MemoObjectIterator instead. */ type MemoIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => TResult; type MemoListIterator = (prev: TResult, curr: T, index: number, list: TList) => TResult; type MemoObjectIterator = (prev: TResult, curr: T, key: string, list: TList) => TResult; + type MemoIteratorCapped = (prev: TResult, curr: T) => TResult; + type MemoIteratorCappedRight = (curr: T, prev: TResult) => TResult; type MemoVoidArrayIterator = (acc: TResult, curr: T, index: number, arr: T[]) => void; type MemoVoidDictionaryIterator = (acc: TResult, curr: T, key: string, dict: Dictionary) => void; + type MemoVoidIteratorCapped = (acc: TResult, curr: T) => void; type ValueIteratee = ((value: T) => NotVoid) | string | [string, any] | PartialDeep; + type ValueIterateeCustom = ((value: T) => TResult) | string | [string, any] | PartialDeep; + type ValueIteratorTypeGuard = (value: T) => value is S; type ValueKeyIteratee = ((value: T, key: string) => NotVoid) | string | [string, any] | PartialDeep; type Comparator = (a: T, b: T) => boolean; type Comparator2 = (a: T1, b: T2) => boolean; diff --git a/types/lodash/common/date.d.ts b/types/lodash/common/date.d.ts index e460de4e1a..79131e4560 100644 --- a/types/lodash/common/date.d.ts +++ b/types/lodash/common/date.d.ts @@ -24,4 +24,4 @@ declare module "../index" { */ now(): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/common/function.d.ts b/types/lodash/common/function.d.ts index b51fa6c625..31055a2781 100644 --- a/types/lodash/common/function.d.ts +++ b/types/lodash/common/function.d.ts @@ -667,30 +667,30 @@ declare module "../index" { // flip interface LoDashStatic { - /** - * Creates a function that invokes `func` with arguments reversed. - * - * @category Function - * @param func The function to flip arguments for. - * @returns Returns the new function. - * @example - * - * var flipped = _.flip(function() { - * return _.toArray(arguments); - * }); - * - * flipped('a', 'b', 'c', 'd'); - * // => ['d', 'c', 'b', 'a'] - */ - flip any>(func: T): T; - } + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @category Function + * @param func The function to flip arguments for. + * @returns Returns the new function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + flip any>(func: T): T; + } - interface LoDashWrapper { - /** - * @see _.flip - */ - flip(): this; - } + interface LoDashWrapper { + /** + * @see _.flip + */ + flip(): this; + } // memoize @@ -771,34 +771,34 @@ declare module "../index" { // overArgs - interface LoDashStatic { - /** - * Creates a function that runs each argument through a corresponding transform function. - * - * @param func The function to wrap. - * @param transforms The functions to transform arguments, specified as individual functions or arrays - * of functions. - * @return Returns the new function. - */ - overArgs( - func: (...args: any[]) => any, - ...transforms: Array any>> - ): (...args: any[]) => any; - } + interface LoDashStatic { + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + overArgs( + func: (...args: any[]) => any, + ...transforms: Array any>> + ): (...args: any[]) => any; + } - interface LoDashImplicitWrapper { - /** - * @see _.overArgs - */ - overArgs(...transforms: Array any>>): LoDashImplicitWrapper<(...args: any[]) => any>; - } + interface LoDashImplicitWrapper { + /** + * @see _.overArgs + */ + overArgs(...transforms: Array any>>): LoDashImplicitWrapper<(...args: any[]) => any>; + } - interface LoDashExplicitWrapper { - /** - * @see _.overArgs - */ - overArgs(...transforms: Array any>>): LoDashExplicitWrapper<(...args: any[]) => any>; - } + interface LoDashExplicitWrapper { + /** + * @see _.overArgs + */ + overArgs(...transforms: Array any>>): LoDashExplicitWrapper<(...args: any[]) => any>; + } // partial @@ -1364,4 +1364,4 @@ declare module "../index" { wrapper: (value: TValue, ...args: any[]) => TResult ): LoDashExplicitWrapper<(...args: any[]) => TResult>; } -} \ No newline at end of file +} diff --git a/types/lodash/common/lang.d.ts b/types/lodash/common/lang.d.ts index 43393ab4b6..9afe554b28 100644 --- a/types/lodash/common/lang.d.ts +++ b/types/lodash/common/lang.d.ts @@ -210,7 +210,6 @@ declare module "../index" { // conformsTo - interface LoDashStatic { /** * Checks if object conforms to source by invoking the predicate properties of source with the @@ -233,11 +232,11 @@ declare module "../index" { /** * @see _.conformsTo */ - conformsTo(this: LoDashImplicitWrapper, source: ConformsPredicateObject): LoDashExplicitWrapper; + conformsTo(this: LoDashExplicitWrapper, source: ConformsPredicateObject): LoDashExplicitWrapper; // Note: we can't use TValue here, because it generates a typescript error when strictFunctionTypes is enabled. } - type CondPair = [(val: T) => boolean, (val: T) => R] + type CondPair = [(val: T) => boolean, (val: T) => R]; // eq @@ -1934,4 +1933,4 @@ declare module "../index" { */ toString(value: any): string; } -} \ No newline at end of file +} diff --git a/types/lodash/common/math.d.ts b/types/lodash/common/math.d.ts index a0af6114b5..b38a7df970 100644 --- a/types/lodash/common/math.d.ts +++ b/types/lodash/common/math.d.ts @@ -529,8 +529,4 @@ declare module "../index" { iteratee?: ((value: T) => number) | string ): LoDashExplicitWrapper; } - - /********** - * Number * - **********/ -} \ No newline at end of file +} diff --git a/types/lodash/common/number.d.ts b/types/lodash/common/number.d.ts index 3e6a945855..7da1cab03a 100644 --- a/types/lodash/common/number.d.ts +++ b/types/lodash/common/number.d.ts @@ -175,8 +175,4 @@ declare module "../index" { floating?: boolean ): LoDashExplicitWrapper; } - - /********** - * Object * - **********/ -} \ No newline at end of file +} diff --git a/types/lodash/common/object.d.ts b/types/lodash/common/object.d.ts index 3063072b17..4bedba42ae 100644 --- a/types/lodash/common/object.d.ts +++ b/types/lodash/common/object.d.ts @@ -2281,7 +2281,7 @@ declare module "../index" { * TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary, * but TypeScript cannot select overload signatures based on number vs string index key type. */ - mapValues(obj: Dictionary | NumericDictionary | null | undefined, callback: ObjectIterator, TResult>): Dictionary; + mapValues(obj: Dictionary | NumericDictionary | null | undefined, callback: DictionaryIterator): Dictionary; /** * @see _.mapValues @@ -2358,7 +2358,7 @@ declare module "../index" { */ mapValues( this: LoDashImplicitWrapper | NumericDictionary | null | undefined>, - callback: ObjectIterator, TResult> + callback: DictionaryIterator ): LoDashImplicitWrapper>; /** @@ -2454,7 +2454,7 @@ declare module "../index" { */ mapValues( this: LoDashExplicitWrapper | NumericDictionary | null | undefined>, - callback: ObjectIterator, TResult> + callback: DictionaryIterator ): LoDashExplicitWrapper>; /** @@ -2680,6 +2680,10 @@ declare module "../index" { * @see _.merge */ merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 ): LoDashExplicitWrapper; /** @@ -2692,7 +2696,7 @@ declare module "../index" { // mergeWith - type MergeWithCustomizer = { bivariantHack(value: any, srcValue: any, key: string, object: any, source: any): any; }["bivariantHack"] + type MergeWithCustomizer = { bivariantHack(value: any, srcValue: any, key: string, object: any, source: any): any; }["bivariantHack"]; interface LoDashStatic { /** @@ -2823,6 +2827,53 @@ declare module "../index" { ): LoDashImplicitWrapper; } + interface LoDashExplicitWrapper { + /** + * @see _.mergeWith + */ + mergeWith( + source: TSource, + customizer: MergeWithCustomizer + ): LoDashExplicitWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + customizer: MergeWithCustomizer + ): LoDashExplicitWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: MergeWithCustomizer + ): LoDashExplicitWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: MergeWithCustomizer + ): LoDashExplicitWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + ...otherArgs: any[] + ): LoDashExplicitWrapper; + } + // omit interface LoDashStatic { @@ -3719,4 +3770,4 @@ declare module "../index" { */ valuesIn(this: LoDashExplicitWrapper): LoDashExplicitWrapper>; } -} \ No newline at end of file +} diff --git a/types/lodash/common/seq.d.ts b/types/lodash/common/seq.d.ts index f3139056cd..22a7a14746 100644 --- a/types/lodash/common/seq.d.ts +++ b/types/lodash/common/seq.d.ts @@ -195,4 +195,4 @@ declare module "../index" { */ thru(interceptor: (value: TValue) => TResult): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/common/string.d.ts b/types/lodash/common/string.d.ts index 436a2bb9f1..d940406d0d 100644 --- a/types/lodash/common/string.d.ts +++ b/types/lodash/common/string.d.ts @@ -1056,4 +1056,4 @@ declare module "../index" { */ words(pattern?: string|RegExp): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/common/util.d.ts b/types/lodash/common/util.d.ts index e365750018..69fbc42cc0 100644 --- a/types/lodash/common/util.d.ts +++ b/types/lodash/common/util.d.ts @@ -584,9 +584,17 @@ declare module "../index" { * // => [{ 'user': 'fred', 'age': 40 }] */ iteratee any>( - func: TFunction | string | object + func: TFunction ): TFunction; + /** + * @see _.iteratee + */ + // tslint:disable-next-line:unified-signatures Tests fail in TS2.3 if the overloads are joined + iteratee( + func: string | object + ): (...args: any[]) => any; + /** * @see _.iteratee */ @@ -1452,4 +1460,4 @@ declare module "../index" { */ uniqueId(): LoDashExplicitWrapper; } -} \ No newline at end of file +} diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts new file mode 100644 index 0000000000..783a56a98f --- /dev/null +++ b/types/lodash/fp.d.ts @@ -0,0 +1,790 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import add = require("./fp/add"); +import after = require("./fp/after"); +import all = require("./fp/all"); +import allPass = require("./fp/allPass"); +import always = require("./fp/always"); +import any = require("./fp/any"); +import anyPass = require("./fp/anyPass"); +import apply = require("./fp/apply"); +import ary = require("./fp/ary"); +import assign = require("./fp/assign"); +import assignAll = require("./fp/assignAll"); +import assignAllWith = require("./fp/assignAllWith"); +import assignIn = require("./fp/assignIn"); +import assignInAll = require("./fp/assignInAll"); +import assignInAllWith = require("./fp/assignInAllWith"); +import assignInWith = require("./fp/assignInWith"); +import assignWith = require("./fp/assignWith"); +import assoc = require("./fp/assoc"); +import assocPath = require("./fp/assocPath"); +import at = require("./fp/at"); +import attempt = require("./fp/attempt"); +import before = require("./fp/before"); +import bind = require("./fp/bind"); +import bindAll = require("./fp/bindAll"); +import bindKey = require("./fp/bindKey"); +import camelCase = require("./fp/camelCase"); +import capitalize = require("./fp/capitalize"); +import castArray = require("./fp/castArray"); +import ceil = require("./fp/ceil"); +import chunk = require("./fp/chunk"); +import clamp = require("./fp/clamp"); +import clone = require("./fp/clone"); +import cloneDeep = require("./fp/cloneDeep"); +import cloneDeepWith = require("./fp/cloneDeepWith"); +import cloneWith = require("./fp/cloneWith"); +import compact = require("./fp/compact"); +import complement = require("./fp/complement"); +import compose = require("./fp/compose"); +import concat = require("./fp/concat"); +import cond = require("./fp/cond"); +import conforms = require("./fp/conforms"); +import conformsTo = require("./fp/conformsTo"); +import constant = require("./fp/constant"); +import contains = require("./fp/contains"); +import countBy = require("./fp/countBy"); +import create = require("./fp/create"); +import curry = require("./fp/curry"); +import curryN = require("./fp/curryN"); +import curryRight = require("./fp/curryRight"); +import curryRightN = require("./fp/curryRightN"); +import debounce = require("./fp/debounce"); +import deburr = require("./fp/deburr"); +import defaults = require("./fp/defaults"); +import defaultsAll = require("./fp/defaultsAll"); +import defaultsDeep = require("./fp/defaultsDeep"); +import defaultsDeepAll = require("./fp/defaultsDeepAll"); +import defaultTo = require("./fp/defaultTo"); +import defer = require("./fp/defer"); +import delay = require("./fp/delay"); +import difference = require("./fp/difference"); +import differenceBy = require("./fp/differenceBy"); +import differenceWith = require("./fp/differenceWith"); +import dissoc = require("./fp/dissoc"); +import dissocPath = require("./fp/dissocPath"); +import divide = require("./fp/divide"); +import drop = require("./fp/drop"); +import dropLast = require("./fp/dropLast"); +import dropLastWhile = require("./fp/dropLastWhile"); +import dropRight = require("./fp/dropRight"); +import dropRightWhile = require("./fp/dropRightWhile"); +import dropWhile = require("./fp/dropWhile"); +import each = require("./fp/each"); +import eachRight = require("./fp/eachRight"); +import endsWith = require("./fp/endsWith"); +import entries = require("./fp/entries"); +import entriesIn = require("./fp/entriesIn"); +import eq = require("./fp/eq"); +import equals = require("./fp/equals"); +import escape = require("./fp/escape"); +import escapeRegExp = require("./fp/escapeRegExp"); +import every = require("./fp/every"); +import extend = require("./fp/extend"); +import extendAll = require("./fp/extendAll"); +import extendAllWith = require("./fp/extendAllWith"); +import extendWith = require("./fp/extendWith"); +import F = require("./fp/F"); +import fill = require("./fp/fill"); +import filter = require("./fp/filter"); +import find = require("./fp/find"); +import findFrom = require("./fp/findFrom"); +import findIndex = require("./fp/findIndex"); +import findIndexFrom = require("./fp/findIndexFrom"); +import findKey = require("./fp/findKey"); +import findLast = require("./fp/findLast"); +import findLastFrom = require("./fp/findLastFrom"); +import findLastIndex = require("./fp/findLastIndex"); +import findLastIndexFrom = require("./fp/findLastIndexFrom"); +import findLastKey = require("./fp/findLastKey"); +import first = require("./fp/first"); +import flatMap = require("./fp/flatMap"); +import flatMapDeep = require("./fp/flatMapDeep"); +import flatMapDepth = require("./fp/flatMapDepth"); +import flatten = require("./fp/flatten"); +import flattenDeep = require("./fp/flattenDeep"); +import flattenDepth = require("./fp/flattenDepth"); +import flip = require("./fp/flip"); +import floor = require("./fp/floor"); +import flow = require("./fp/flow"); +import flowRight = require("./fp/flowRight"); +import forEach = require("./fp/forEach"); +import forEachRight = require("./fp/forEachRight"); +import forIn = require("./fp/forIn"); +import forInRight = require("./fp/forInRight"); +import forOwn = require("./fp/forOwn"); +import forOwnRight = require("./fp/forOwnRight"); +import fromPairs = require("./fp/fromPairs"); +import functions = require("./fp/functions"); +import functionsIn = require("./fp/functionsIn"); +import get = require("./fp/get"); +import getOr = require("./fp/getOr"); +import groupBy = require("./fp/groupBy"); +import gt = require("./fp/gt"); +import gte = require("./fp/gte"); +import has = require("./fp/has"); +import hasIn = require("./fp/hasIn"); +import head = require("./fp/head"); +import identical = require("./fp/identical"); +import identity = require("./fp/identity"); +import includes = require("./fp/includes"); +import includesFrom = require("./fp/includesFrom"); +import indexBy = require("./fp/indexBy"); +import indexOf = require("./fp/indexOf"); +import indexOfFrom = require("./fp/indexOfFrom"); +import init = require("./fp/init"); +import initial = require("./fp/initial"); +import inRange = require("./fp/inRange"); +import intersection = require("./fp/intersection"); +import intersectionBy = require("./fp/intersectionBy"); +import intersectionWith = require("./fp/intersectionWith"); +import invert = require("./fp/invert"); +import invertBy = require("./fp/invertBy"); +import invertObj = require("./fp/invertObj"); +import invoke = require("./fp/invoke"); +import invokeArgs = require("./fp/invokeArgs"); +import invokeArgsMap = require("./fp/invokeArgsMap"); +import invokeMap = require("./fp/invokeMap"); +import isArguments = require("./fp/isArguments"); +import isArray = require("./fp/isArray"); +import isArrayBuffer = require("./fp/isArrayBuffer"); +import isArrayLike = require("./fp/isArrayLike"); +import isArrayLikeObject = require("./fp/isArrayLikeObject"); +import isBoolean = require("./fp/isBoolean"); +import isBuffer = require("./fp/isBuffer"); +import isDate = require("./fp/isDate"); +import isElement = require("./fp/isElement"); +import isEmpty = require("./fp/isEmpty"); +import isEqual = require("./fp/isEqual"); +import isEqualWith = require("./fp/isEqualWith"); +import isError = require("./fp/isError"); +import isFinite = require("./fp/isFinite"); +import isFunction = require("./fp/isFunction"); +import isInteger = require("./fp/isInteger"); +import isLength = require("./fp/isLength"); +import isMap = require("./fp/isMap"); +import isMatch = require("./fp/isMatch"); +import isMatchWith = require("./fp/isMatchWith"); +import isNaN = require("./fp/isNaN"); +import isNative = require("./fp/isNative"); +import isNil = require("./fp/isNil"); +import isNull = require("./fp/isNull"); +import isNumber = require("./fp/isNumber"); +import isObject = require("./fp/isObject"); +import isObjectLike = require("./fp/isObjectLike"); +import isPlainObject = require("./fp/isPlainObject"); +import isRegExp = require("./fp/isRegExp"); +import isSafeInteger = require("./fp/isSafeInteger"); +import isSet = require("./fp/isSet"); +import isString = require("./fp/isString"); +import isSymbol = require("./fp/isSymbol"); +import isTypedArray = require("./fp/isTypedArray"); +import isUndefined = require("./fp/isUndefined"); +import isWeakMap = require("./fp/isWeakMap"); +import isWeakSet = require("./fp/isWeakSet"); +import iteratee = require("./fp/iteratee"); +import join = require("./fp/join"); +import juxt = require("./fp/juxt"); +import kebabCase = require("./fp/kebabCase"); +import keyBy = require("./fp/keyBy"); +import keys = require("./fp/keys"); +import keysIn = require("./fp/keysIn"); +import last = require("./fp/last"); +import lastIndexOf = require("./fp/lastIndexOf"); +import lastIndexOfFrom = require("./fp/lastIndexOfFrom"); +import lowerCase = require("./fp/lowerCase"); +import lowerFirst = require("./fp/lowerFirst"); +import lt = require("./fp/lt"); +import lte = require("./fp/lte"); +import map = require("./fp/map"); +import mapKeys = require("./fp/mapKeys"); +import mapValues = require("./fp/mapValues"); +import matches = require("./fp/matches"); +import matchesProperty = require("./fp/matchesProperty"); +import max = require("./fp/max"); +import maxBy = require("./fp/maxBy"); +import mean = require("./fp/mean"); +import meanBy = require("./fp/meanBy"); +import memoize = require("./fp/memoize"); +import merge = require("./fp/merge"); +import mergeAll = require("./fp/mergeAll"); +import mergeAllWith = require("./fp/mergeAllWith"); +import mergeWith = require("./fp/mergeWith"); +import method = require("./fp/method"); +import methodOf = require("./fp/methodOf"); +import min = require("./fp/min"); +import minBy = require("./fp/minBy"); +import multiply = require("./fp/multiply"); +import nAry = require("./fp/nAry"); +import negate = require("./fp/negate"); +import noConflict = require("./fp/noConflict"); +import noop = require("./fp/noop"); +import now = require("./fp/now"); +import nth = require("./fp/nth"); +import nthArg = require("./fp/nthArg"); +import omit = require("./fp/omit"); +import omitAll = require("./fp/omitAll"); +import omitBy = require("./fp/omitBy"); +import once = require("./fp/once"); +import orderBy = require("./fp/orderBy"); +import over = require("./fp/over"); +import overArgs = require("./fp/overArgs"); +import overEvery = require("./fp/overEvery"); +import overSome = require("./fp/overSome"); +import pad = require("./fp/pad"); +import padChars = require("./fp/padChars"); +import padCharsEnd = require("./fp/padCharsEnd"); +import padCharsStart = require("./fp/padCharsStart"); +import padEnd = require("./fp/padEnd"); +import padStart = require("./fp/padStart"); +import parseInt = require("./fp/parseInt"); +import partial = require("./fp/partial"); +import partialRight = require("./fp/partialRight"); +import partition = require("./fp/partition"); +import path = require("./fp/path"); +import pathEq = require("./fp/pathEq"); +import pathOr = require("./fp/pathOr"); +import paths = require("./fp/paths"); +import pick = require("./fp/pick"); +import pickAll = require("./fp/pickAll"); +import pickBy = require("./fp/pickBy"); +import pipe = require("./fp/pipe"); +import pluck = require("./fp/pluck"); +import prop = require("./fp/prop"); +import propEq = require("./fp/propEq"); +import property = require("./fp/property"); +import propertyOf = require("./fp/propertyOf"); +import propOr = require("./fp/propOr"); +import props = require("./fp/props"); +import pull = require("./fp/pull"); +import pullAll = require("./fp/pullAll"); +import pullAllBy = require("./fp/pullAllBy"); +import pullAllWith = require("./fp/pullAllWith"); +import pullAt = require("./fp/pullAt"); +import random = require("./fp/random"); +import range = require("./fp/range"); +import rangeRight = require("./fp/rangeRight"); +import rangeStep = require("./fp/rangeStep"); +import rangeStepRight = require("./fp/rangeStepRight"); +import rearg = require("./fp/rearg"); +import reduce = require("./fp/reduce"); +import reduceRight = require("./fp/reduceRight"); +import reject = require("./fp/reject"); +import remove = require("./fp/remove"); +import repeat = require("./fp/repeat"); +import replace = require("./fp/replace"); +import rest = require("./fp/rest"); +import restFrom = require("./fp/restFrom"); +import result = require("./fp/result"); +import reverse = require("./fp/reverse"); +import round = require("./fp/round"); +import runInContext = require("./fp/runInContext"); +import sample = require("./fp/sample"); +import sampleSize = require("./fp/sampleSize"); +import set = require("./fp/set"); +import setWith = require("./fp/setWith"); +import shuffle = require("./fp/shuffle"); +import size = require("./fp/size"); +import slice = require("./fp/slice"); +import snakeCase = require("./fp/snakeCase"); +import some = require("./fp/some"); +import sortBy = require("./fp/sortBy"); +import sortedIndex = require("./fp/sortedIndex"); +import sortedIndexBy = require("./fp/sortedIndexBy"); +import sortedIndexOf = require("./fp/sortedIndexOf"); +import sortedLastIndex = require("./fp/sortedLastIndex"); +import sortedLastIndexBy = require("./fp/sortedLastIndexBy"); +import sortedLastIndexOf = require("./fp/sortedLastIndexOf"); +import sortedUniq = require("./fp/sortedUniq"); +import sortedUniqBy = require("./fp/sortedUniqBy"); +import split = require("./fp/split"); +import spread = require("./fp/spread"); +import spreadFrom = require("./fp/spreadFrom"); +import startCase = require("./fp/startCase"); +import startsWith = require("./fp/startsWith"); +import stubArray = require("./fp/stubArray"); +import stubFalse = require("./fp/stubFalse"); +import stubObject = require("./fp/stubObject"); +import stubString = require("./fp/stubString"); +import stubTrue = require("./fp/stubTrue"); +import subtract = require("./fp/subtract"); +import sum = require("./fp/sum"); +import sumBy = require("./fp/sumBy"); +import symmetricDifference = require("./fp/symmetricDifference"); +import symmetricDifferenceBy = require("./fp/symmetricDifferenceBy"); +import symmetricDifferenceWith = require("./fp/symmetricDifferenceWith"); +import T = require("./fp/T"); +import tail = require("./fp/tail"); +import take = require("./fp/take"); +import takeLast = require("./fp/takeLast"); +import takeLastWhile = require("./fp/takeLastWhile"); +import takeRight = require("./fp/takeRight"); +import takeRightWhile = require("./fp/takeRightWhile"); +import takeWhile = require("./fp/takeWhile"); +import tap = require("./fp/tap"); +import template = require("./fp/template"); +import throttle = require("./fp/throttle"); +import thru = require("./fp/thru"); +import times = require("./fp/times"); +import toArray = require("./fp/toArray"); +import toFinite = require("./fp/toFinite"); +import toInteger = require("./fp/toInteger"); +import toLength = require("./fp/toLength"); +import toLower = require("./fp/toLower"); +import toNumber = require("./fp/toNumber"); +import toPairs = require("./fp/toPairs"); +import toPairsIn = require("./fp/toPairsIn"); +import toPath = require("./fp/toPath"); +import toPlainObject = require("./fp/toPlainObject"); +import toSafeInteger = require("./fp/toSafeInteger"); +import toString = require("./fp/toString"); +import toUpper = require("./fp/toUpper"); +import transform = require("./fp/transform"); +import trim = require("./fp/trim"); +import trimChars = require("./fp/trimChars"); +import trimCharsEnd = require("./fp/trimCharsEnd"); +import trimCharsStart = require("./fp/trimCharsStart"); +import trimEnd = require("./fp/trimEnd"); +import trimStart = require("./fp/trimStart"); +import truncate = require("./fp/truncate"); +import unapply = require("./fp/unapply"); +import unary = require("./fp/unary"); +import unescape = require("./fp/unescape"); +import union = require("./fp/union"); +import unionBy = require("./fp/unionBy"); +import unionWith = require("./fp/unionWith"); +import uniq = require("./fp/uniq"); +import uniqBy = require("./fp/uniqBy"); +import uniqueId = require("./fp/uniqueId"); +import uniqWith = require("./fp/uniqWith"); +import unnest = require("./fp/unnest"); +import unset = require("./fp/unset"); +import unzip = require("./fp/unzip"); +import unzipWith = require("./fp/unzipWith"); +import update = require("./fp/update"); +import updateWith = require("./fp/updateWith"); +import upperCase = require("./fp/upperCase"); +import upperFirst = require("./fp/upperFirst"); +import useWith = require("./fp/useWith"); +import values = require("./fp/values"); +import valuesIn = require("./fp/valuesIn"); +import where = require("./fp/where"); +import whereEq = require("./fp/whereEq"); +import without = require("./fp/without"); +import words = require("./fp/words"); +import wrap = require("./fp/wrap"); +import xor = require("./fp/xor"); +import xorBy = require("./fp/xorBy"); +import xorWith = require("./fp/xorWith"); +import zip = require("./fp/zip"); +import zipAll = require("./fp/zipAll"); +import zipObj = require("./fp/zipObj"); +import zipObject = require("./fp/zipObject"); +import zipObjectDeep = require("./fp/zipObjectDeep"); +import zipWith = require("./fp/zipWith"); + +export = _; + +declare const _: _.LoDashFp; +declare namespace _ { + interface LoDashFp { + add: typeof add; + after: typeof after; + all: typeof all; + allPass: typeof allPass; + always: typeof always; + any: typeof any; + anyPass: typeof anyPass; + apply: typeof apply; + ary: typeof ary; + assign: typeof assign; + assignAll: typeof assignAll; + assignAllWith: typeof assignAllWith; + assignIn: typeof assignIn; + assignInAll: typeof assignInAll; + assignInAllWith: typeof assignInAllWith; + assignInWith: typeof assignInWith; + assignWith: typeof assignWith; + assoc: typeof assoc; + assocPath: typeof assocPath; + at: typeof at; + attempt: typeof attempt; + before: typeof before; + bind: typeof bind; + bindAll: typeof bindAll; + bindKey: typeof bindKey; + camelCase: typeof camelCase; + capitalize: typeof capitalize; + castArray: typeof castArray; + ceil: typeof ceil; + chunk: typeof chunk; + clamp: typeof clamp; + clone: typeof clone; + cloneDeep: typeof cloneDeep; + cloneDeepWith: typeof cloneDeepWith; + cloneWith: typeof cloneWith; + compact: typeof compact; + complement: typeof complement; + compose: typeof compose; + concat: typeof concat; + cond: typeof cond; + conforms: typeof conforms; + conformsTo: typeof conformsTo; + constant: typeof constant; + contains: typeof contains; + countBy: typeof countBy; + create: typeof create; + curry: typeof curry; + curryN: typeof curryN; + curryRight: typeof curryRight; + curryRightN: typeof curryRightN; + debounce: typeof debounce; + deburr: typeof deburr; + defaults: typeof defaults; + defaultsAll: typeof defaultsAll; + defaultsDeep: typeof defaultsDeep; + defaultsDeepAll: typeof defaultsDeepAll; + defaultTo: typeof defaultTo; + defer: typeof defer; + delay: typeof delay; + difference: typeof difference; + differenceBy: typeof differenceBy; + differenceWith: typeof differenceWith; + dissoc: typeof dissoc; + dissocPath: typeof dissocPath; + divide: typeof divide; + drop: typeof drop; + dropLast: typeof dropLast; + dropLastWhile: typeof dropLastWhile; + dropRight: typeof dropRight; + dropRightWhile: typeof dropRightWhile; + dropWhile: typeof dropWhile; + each: typeof each; + eachRight: typeof eachRight; + endsWith: typeof endsWith; + entries: typeof entries; + entriesIn: typeof entriesIn; + eq: typeof eq; + equals: typeof equals; + escape: typeof escape; + escapeRegExp: typeof escapeRegExp; + every: typeof every; + extend: typeof extend; + extendAll: typeof extendAll; + extendAllWith: typeof extendAllWith; + extendWith: typeof extendWith; + F: typeof F; + fill: typeof fill; + filter: typeof filter; + find: typeof find; + findFrom: typeof findFrom; + findIndex: typeof findIndex; + findIndexFrom: typeof findIndexFrom; + findKey: typeof findKey; + findLast: typeof findLast; + findLastFrom: typeof findLastFrom; + findLastIndex: typeof findLastIndex; + findLastIndexFrom: typeof findLastIndexFrom; + findLastKey: typeof findLastKey; + first: typeof first; + flatMap: typeof flatMap; + flatMapDeep: typeof flatMapDeep; + flatMapDepth: typeof flatMapDepth; + flatten: typeof flatten; + flattenDeep: typeof flattenDeep; + flattenDepth: typeof flattenDepth; + flip: typeof flip; + floor: typeof floor; + flow: typeof flow; + flowRight: typeof flowRight; + forEach: typeof forEach; + forEachRight: typeof forEachRight; + forIn: typeof forIn; + forInRight: typeof forInRight; + forOwn: typeof forOwn; + forOwnRight: typeof forOwnRight; + fromPairs: typeof fromPairs; + functions: typeof functions; + functionsIn: typeof functionsIn; + get: typeof get; + getOr: typeof getOr; + groupBy: typeof groupBy; + gt: typeof gt; + gte: typeof gte; + has: typeof has; + hasIn: typeof hasIn; + head: typeof head; + identical: typeof identical; + identity: typeof identity; + includes: typeof includes; + includesFrom: typeof includesFrom; + indexBy: typeof indexBy; + indexOf: typeof indexOf; + indexOfFrom: typeof indexOfFrom; + init: typeof init; + initial: typeof initial; + inRange: typeof inRange; + intersection: typeof intersection; + intersectionBy: typeof intersectionBy; + intersectionWith: typeof intersectionWith; + invert: typeof invert; + invertBy: typeof invertBy; + invertObj: typeof invertObj; + invoke: typeof invoke; + invokeArgs: typeof invokeArgs; + invokeArgsMap: typeof invokeArgsMap; + invokeMap: typeof invokeMap; + isArguments: typeof isArguments; + isArray: typeof isArray; + isArrayBuffer: typeof isArrayBuffer; + isArrayLike: typeof isArrayLike; + isArrayLikeObject: typeof isArrayLikeObject; + isBoolean: typeof isBoolean; + isBuffer: typeof isBuffer; + isDate: typeof isDate; + isElement: typeof isElement; + isEmpty: typeof isEmpty; + isEqual: typeof isEqual; + isEqualWith: typeof isEqualWith; + isError: typeof isError; + isFinite: typeof isFinite; + isFunction: typeof isFunction; + isInteger: typeof isInteger; + isLength: typeof isLength; + isMap: typeof isMap; + isMatch: typeof isMatch; + isMatchWith: typeof isMatchWith; + isNaN: typeof isNaN; + isNative: typeof isNative; + isNil: typeof isNil; + isNull: typeof isNull; + isNumber: typeof isNumber; + isObject: typeof isObject; + isObjectLike: typeof isObjectLike; + isPlainObject: typeof isPlainObject; + isRegExp: typeof isRegExp; + isSafeInteger: typeof isSafeInteger; + isSet: typeof isSet; + isString: typeof isString; + isSymbol: typeof isSymbol; + isTypedArray: typeof isTypedArray; + isUndefined: typeof isUndefined; + isWeakMap: typeof isWeakMap; + isWeakSet: typeof isWeakSet; + iteratee: typeof iteratee; + join: typeof join; + juxt: typeof juxt; + kebabCase: typeof kebabCase; + keyBy: typeof keyBy; + keys: typeof keys; + keysIn: typeof keysIn; + last: typeof last; + lastIndexOf: typeof lastIndexOf; + lastIndexOfFrom: typeof lastIndexOfFrom; + lowerCase: typeof lowerCase; + lowerFirst: typeof lowerFirst; + lt: typeof lt; + lte: typeof lte; + map: typeof map; + mapKeys: typeof mapKeys; + mapValues: typeof mapValues; + matches: typeof matches; + matchesProperty: typeof matchesProperty; + max: typeof max; + maxBy: typeof maxBy; + mean: typeof mean; + meanBy: typeof meanBy; + memoize: typeof memoize; + merge: typeof merge; + mergeAll: typeof mergeAll; + mergeAllWith: typeof mergeAllWith; + mergeWith: typeof mergeWith; + method: typeof method; + methodOf: typeof methodOf; + min: typeof min; + minBy: typeof minBy; + multiply: typeof multiply; + nAry: typeof nAry; + negate: typeof negate; + noConflict: typeof noConflict; + noop: typeof noop; + now: typeof now; + nth: typeof nth; + nthArg: typeof nthArg; + omit: typeof omit; + omitAll: typeof omitAll; + omitBy: typeof omitBy; + once: typeof once; + orderBy: typeof orderBy; + over: typeof over; + overArgs: typeof overArgs; + overEvery: typeof overEvery; + overSome: typeof overSome; + pad: typeof pad; + padChars: typeof padChars; + padCharsEnd: typeof padCharsEnd; + padCharsStart: typeof padCharsStart; + padEnd: typeof padEnd; + padStart: typeof padStart; + parseInt: typeof parseInt; + partial: typeof partial; + partialRight: typeof partialRight; + partition: typeof partition; + path: typeof path; + pathEq: typeof pathEq; + pathOr: typeof pathOr; + paths: typeof paths; + pick: typeof pick; + pickAll: typeof pickAll; + pickBy: typeof pickBy; + pipe: typeof pipe; + pluck: typeof pluck; + prop: typeof prop; + propEq: typeof propEq; + property: typeof property; + propertyOf: typeof propertyOf; + propOr: typeof propOr; + props: typeof props; + pull: typeof pull; + pullAll: typeof pullAll; + pullAllBy: typeof pullAllBy; + pullAllWith: typeof pullAllWith; + pullAt: typeof pullAt; + random: typeof random; + range: typeof range; + rangeRight: typeof rangeRight; + rangeStep: typeof rangeStep; + rangeStepRight: typeof rangeStepRight; + rearg: typeof rearg; + reduce: typeof reduce; + reduceRight: typeof reduceRight; + reject: typeof reject; + remove: typeof remove; + repeat: typeof repeat; + replace: typeof replace; + rest: typeof rest; + restFrom: typeof restFrom; + result: typeof result; + reverse: typeof reverse; + round: typeof round; + runInContext: typeof runInContext; + sample: typeof sample; + sampleSize: typeof sampleSize; + set: typeof set; + setWith: typeof setWith; + shuffle: typeof shuffle; + size: typeof size; + slice: typeof slice; + snakeCase: typeof snakeCase; + some: typeof some; + sortBy: typeof sortBy; + sortedIndex: typeof sortedIndex; + sortedIndexBy: typeof sortedIndexBy; + sortedIndexOf: typeof sortedIndexOf; + sortedLastIndex: typeof sortedLastIndex; + sortedLastIndexBy: typeof sortedLastIndexBy; + sortedLastIndexOf: typeof sortedLastIndexOf; + sortedUniq: typeof sortedUniq; + sortedUniqBy: typeof sortedUniqBy; + split: typeof split; + spread: typeof spread; + spreadFrom: typeof spreadFrom; + startCase: typeof startCase; + startsWith: typeof startsWith; + stubArray: typeof stubArray; + stubFalse: typeof stubFalse; + stubObject: typeof stubObject; + stubString: typeof stubString; + stubTrue: typeof stubTrue; + subtract: typeof subtract; + sum: typeof sum; + sumBy: typeof sumBy; + symmetricDifference: typeof symmetricDifference; + symmetricDifferenceBy: typeof symmetricDifferenceBy; + symmetricDifferenceWith: typeof symmetricDifferenceWith; + T: typeof T; + tail: typeof tail; + take: typeof take; + takeLast: typeof takeLast; + takeLastWhile: typeof takeLastWhile; + takeRight: typeof takeRight; + takeRightWhile: typeof takeRightWhile; + takeWhile: typeof takeWhile; + tap: typeof tap; + template: typeof template; + throttle: typeof throttle; + thru: typeof thru; + times: typeof times; + toArray: typeof toArray; + toFinite: typeof toFinite; + toInteger: typeof toInteger; + toLength: typeof toLength; + toLower: typeof toLower; + toNumber: typeof toNumber; + toPairs: typeof toPairs; + toPairsIn: typeof toPairsIn; + toPath: typeof toPath; + toPlainObject: typeof toPlainObject; + toSafeInteger: typeof toSafeInteger; + toString: typeof toString; + toUpper: typeof toUpper; + transform: typeof transform; + trim: typeof trim; + trimChars: typeof trimChars; + trimCharsEnd: typeof trimCharsEnd; + trimCharsStart: typeof trimCharsStart; + trimEnd: typeof trimEnd; + trimStart: typeof trimStart; + truncate: typeof truncate; + unapply: typeof unapply; + unary: typeof unary; + unescape: typeof unescape; + union: typeof union; + unionBy: typeof unionBy; + unionWith: typeof unionWith; + uniq: typeof uniq; + uniqBy: typeof uniqBy; + uniqueId: typeof uniqueId; + uniqWith: typeof uniqWith; + unnest: typeof unnest; + unset: typeof unset; + unzip: typeof unzip; + unzipWith: typeof unzipWith; + update: typeof update; + updateWith: typeof updateWith; + upperCase: typeof upperCase; + upperFirst: typeof upperFirst; + useWith: typeof useWith; + values: typeof values; + valuesIn: typeof valuesIn; + where: typeof where; + whereEq: typeof whereEq; + without: typeof without; + words: typeof words; + wrap: typeof wrap; + xor: typeof xor; + xorBy: typeof xorBy; + xorWith: typeof xorWith; + zip: typeof zip; + zipAll: typeof zipAll; + zipObj: typeof zipObj; + zipObject: typeof zipObject; + zipObjectDeep: typeof zipObjectDeep; + zipWith: typeof zipWith; + } +} + +// Backward compatibility with --target es5 +declare global { + // tslint:disable-next-line:no-empty-interface + interface Set { } + // tslint:disable-next-line:no-empty-interface + interface Map { } + // tslint:disable-next-line:no-empty-interface + interface WeakSet { } + // tslint:disable-next-line:no-empty-interface + interface WeakMap { } +} diff --git a/types/lodash/fp/F.d.ts b/types/lodash/fp/F.d.ts new file mode 100644 index 0000000000..8d7802efd8 --- /dev/null +++ b/types/lodash/fp/F.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubFalse = + /** + * This method returns `false`. + * + * @returns Returns `false`. + */ + () => boolean; + +declare const F: StubFalse; +export = F; diff --git a/types/lodash/fp/T.d.ts b/types/lodash/fp/T.d.ts new file mode 100644 index 0000000000..ea1dc32ee8 --- /dev/null +++ b/types/lodash/fp/T.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubTrue = + /** + * This method returns `true`. + * + * @returns Returns `true`. + */ + () => boolean; + +declare const T: StubTrue; +export = T; diff --git a/types/lodash/fp/add.d.ts b/types/lodash/fp/add.d.ts new file mode 100644 index 0000000000..2977814de9 --- /dev/null +++ b/types/lodash/fp/add.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Add { + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (): Add; + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (augend: number): Add1x1; + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (augend: number, addend: number): number; +} +interface Add1x1 { + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (): Add1x1; + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + (addend: number): number; +} + +declare const add: Add; +export = add; diff --git a/types/lodash/fp/after.d.ts b/types/lodash/fp/after.d.ts new file mode 100644 index 0000000000..c6b21973d0 --- /dev/null +++ b/types/lodash/fp/after.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface After { + /** + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + (): After; + /** + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + any>(func: TFunc): After1x1; + /** + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + any>(func: TFunc, n: number): TFunc; +} +interface After1x1 any> { + /** + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + (): After1x1; + /** + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + (n: number): TFunc; +} + +declare const after: After; +export = after; diff --git a/types/lodash/fp/all.d.ts b/types/lodash/fp/all.d.ts new file mode 100644 index 0000000000..15f37bae09 --- /dev/null +++ b/types/lodash/fp/all.d.ts @@ -0,0 +1,67 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Every { + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (): Every; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom): Every1x1; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): boolean; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): boolean; +} +interface Every1x1 { + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (): Every1x1; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (collection: _.List | object | null | undefined): boolean; +} + +declare const all: Every; +export = all; diff --git a/types/lodash/fp/allPass.d.ts b/types/lodash/fp/allPass.d.ts new file mode 100644 index 0000000000..564484494e --- /dev/null +++ b/types/lodash/fp/allPass.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type OverEvery = + /** + * Creates a function that checks if all of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + (predicates: _.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean; + +declare const allPass: OverEvery; +export = allPass; diff --git a/types/lodash/fp/always.d.ts b/types/lodash/fp/always.d.ts new file mode 100644 index 0000000000..bd22aed21f --- /dev/null +++ b/types/lodash/fp/always.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Constant = + /** + * Creates a function that returns value. + * + * @param value The value to return from the new function. + * @return Returns the new function. + */ + (value: T) => () => T; + +declare const always: Constant; +export = always; diff --git a/types/lodash/fp/any.d.ts b/types/lodash/fp/any.d.ts new file mode 100644 index 0000000000..32cf83d382 --- /dev/null +++ b/types/lodash/fp/any.d.ts @@ -0,0 +1,67 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Some { + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (): Some; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom): Some1x1; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): boolean; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): boolean; +} +interface Some1x1 { + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (): Some1x1; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (collection: _.List | object | null | undefined): boolean; +} + +declare const any: Some; +export = any; diff --git a/types/lodash/fp/anyPass.d.ts b/types/lodash/fp/anyPass.d.ts new file mode 100644 index 0000000000..0666de68ba --- /dev/null +++ b/types/lodash/fp/anyPass.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type OverSome = + /** + * Creates a function that checks if any of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + (predicates: _.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean; + +declare const anyPass: OverSome; +export = anyPass; diff --git a/types/lodash/fp/apply.d.ts b/types/lodash/fp/apply.d.ts new file mode 100644 index 0000000000..6a052218aa --- /dev/null +++ b/types/lodash/fp/apply.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Spread = + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + (func: (...args: any[]) => TResult) => (...args: any[]) => TResult; + +declare const apply: Spread; +export = apply; diff --git a/types/lodash/fp/ary.d.ts b/types/lodash/fp/ary.d.ts new file mode 100644 index 0000000000..c241921795 --- /dev/null +++ b/types/lodash/fp/ary.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Ary { + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (): Ary; + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (n: number): Ary1x1; + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (n: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Ary1x1 { + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (): Ary1x1; + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const ary: Ary; +export = ary; diff --git a/types/lodash/fp/assign.d.ts b/types/lodash/fp/assign.d.ts new file mode 100644 index 0000000000..df05fbe118 --- /dev/null +++ b/types/lodash/fp/assign.d.ts @@ -0,0 +1,156 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Assign { + /** + * Assigns own enumerable properties of source objects to the destination + * object. Source objects are applied from left to right. Subsequent sources + * overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.c = 3; + * } + * + * function Bar() { + * this.e = 5; + * } + * + * Foo.prototype.d = 4; + * Bar.prototype.f = 6; + * + * _.assign({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3, 'e': 5 } + */ + (): Assign; + /** + * Assigns own enumerable properties of source objects to the destination + * object. Source objects are applied from left to right. Subsequent sources + * overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.c = 3; + * } + * + * function Bar() { + * this.e = 5; + * } + * + * Foo.prototype.d = 4; + * Bar.prototype.f = 6; + * + * _.assign({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3, 'e': 5 } + */ + (object: TObject): Assign1x1; + /** + * Assigns own enumerable properties of source objects to the destination + * object. Source objects are applied from left to right. Subsequent sources + * overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.c = 3; + * } + * + * function Bar() { + * this.e = 5; + * } + * + * Foo.prototype.d = 4; + * Bar.prototype.f = 6; + * + * _.assign({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3, 'e': 5 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface Assign1x1 { + /** + * Assigns own enumerable properties of source objects to the destination + * object. Source objects are applied from left to right. Subsequent sources + * overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.c = 3; + * } + * + * function Bar() { + * this.e = 5; + * } + * + * Foo.prototype.d = 4; + * Bar.prototype.f = 6; + * + * _.assign({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3, 'e': 5 } + */ + (): Assign1x1; + /** + * Assigns own enumerable properties of source objects to the destination + * object. Source objects are applied from left to right. Subsequent sources + * overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.c = 3; + * } + * + * function Bar() { + * this.e = 5; + * } + * + * Foo.prototype.d = 4; + * Bar.prototype.f = 6; + * + * _.assign({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3, 'e': 5 } + */ + (source: TSource): TObject & TSource; +} + +declare const assign: Assign; +export = assign; diff --git a/types/lodash/fp/assignAll.d.ts b/types/lodash/fp/assignAll.d.ts new file mode 100644 index 0000000000..b6ba1dfba9 --- /dev/null +++ b/types/lodash/fp/assignAll.d.ts @@ -0,0 +1,37 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Assign = + /** + * Assigns own enumerable properties of source objects to the destination + * object. Source objects are applied from left to right. Subsequent sources + * overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.c = 3; + * } + * + * function Bar() { + * this.e = 5; + * } + * + * Foo.prototype.d = 4; + * Bar.prototype.f = 6; + * + * _.assign({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3, 'e': 5 } + */ + (object: ReadonlyArray) => any; + +declare const assignAll: Assign; +export = assignAll; diff --git a/types/lodash/fp/assignAllWith.d.ts b/types/lodash/fp/assignAllWith.d.ts new file mode 100644 index 0000000000..0f8d2d07ed --- /dev/null +++ b/types/lodash/fp/assignAllWith.d.ts @@ -0,0 +1,138 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignWith { + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignWith; + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer): AssignWith1x1; + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer, args: ReadonlyArray): any; +} +interface AssignWith1x1 { + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignWith1x1; + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (args: ReadonlyArray): any; +} + +declare const assignAllWith: AssignWith; +export = assignAllWith; diff --git a/types/lodash/fp/assignIn.d.ts b/types/lodash/fp/assignIn.d.ts new file mode 100644 index 0000000000..fcd201f901 --- /dev/null +++ b/types/lodash/fp/assignIn.d.ts @@ -0,0 +1,151 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface AssignIn { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (): AssignIn; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (object: TObject): AssignIn1x1; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignIn1x1 { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (): AssignIn1x1; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (source: TSource): TObject & TSource; +} + +declare const assignIn: AssignIn; +export = assignIn; diff --git a/types/lodash/fp/assignInAll.d.ts b/types/lodash/fp/assignInAll.d.ts new file mode 100644 index 0000000000..32290cc6cd --- /dev/null +++ b/types/lodash/fp/assignInAll.d.ts @@ -0,0 +1,36 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type AssignIn = + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (object: ReadonlyArray) => TResult; + +declare const assignInAll: AssignIn; +export = assignInAll; diff --git a/types/lodash/fp/assignInAllWith.d.ts b/types/lodash/fp/assignInAllWith.d.ts new file mode 100644 index 0000000000..631b28218a --- /dev/null +++ b/types/lodash/fp/assignInAllWith.d.ts @@ -0,0 +1,143 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignInWith { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer): AssignInWith1x1; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer, args: ReadonlyArray): any; +} +interface AssignInWith1x1 { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith1x1; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (args: ReadonlyArray): any; +} + +declare const assignInAllWith: AssignInWith; +export = assignInAllWith; diff --git a/types/lodash/fp/assignInWith.d.ts b/types/lodash/fp/assignInWith.d.ts new file mode 100644 index 0000000000..d2f9dbba6f --- /dev/null +++ b/types/lodash/fp/assignInWith.d.ts @@ -0,0 +1,249 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignInWith { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer): AssignInWith1x1; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer, object: TObject): AssignInWith1x2; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer, object: TObject, source: TSource): TObject & TSource; +} +interface AssignInWith1x1 { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith1x1; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (object: TObject): AssignInWith1x2; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignInWith1x2 { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith1x2; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (source: TSource): TObject & TSource; +} + +declare const assignInWith: AssignInWith; +export = assignInWith; diff --git a/types/lodash/fp/assignWith.d.ts b/types/lodash/fp/assignWith.d.ts new file mode 100644 index 0000000000..2313bd2614 --- /dev/null +++ b/types/lodash/fp/assignWith.d.ts @@ -0,0 +1,240 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignWith { + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignWith; + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer): AssignWith1x1; + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer, object: TObject): AssignWith1x2; + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer, object: TObject, source: TSource): TObject & TSource; +} +interface AssignWith1x1 { + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignWith1x1; + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (object: TObject): AssignWith1x2; + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignWith1x2 { + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignWith1x2; + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (source: TSource): TObject & TSource; +} + +declare const assignWith: AssignWith; +export = assignWith; diff --git a/types/lodash/fp/assoc.d.ts b/types/lodash/fp/assoc.d.ts new file mode 100644 index 0000000000..41f176aaa9 --- /dev/null +++ b/types/lodash/fp/assoc.d.ts @@ -0,0 +1,147 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Set { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: object): TResult; +} +interface Set1x1 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: object): TResult; +} +interface Set1x2 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: object): TResult; +} + +declare const assoc: Set; +export = assoc; diff --git a/types/lodash/fp/assocPath.d.ts b/types/lodash/fp/assocPath.d.ts new file mode 100644 index 0000000000..ebd0a30a6e --- /dev/null +++ b/types/lodash/fp/assocPath.d.ts @@ -0,0 +1,147 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Set { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: object): TResult; +} +interface Set1x1 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: object): TResult; +} +interface Set1x2 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: object): TResult; +} + +declare const assocPath: Set; +export = assocPath; diff --git a/types/lodash/fp/at.d.ts b/types/lodash/fp/at.d.ts new file mode 100644 index 0000000000..c8777af286 --- /dev/null +++ b/types/lodash/fp/at.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface At { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (): At; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.PropertyPath): At1x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.PropertyPath, object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.Many): At2x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.Many, object: T | null | undefined): Array; +} +interface At1x1 { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (): At1x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; +} +interface At2x1 { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (): At2x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (object: T | null | undefined): Array; +} + +declare const at: At; +export = at; diff --git a/types/lodash/fp/attempt.d.ts b/types/lodash/fp/attempt.d.ts new file mode 100644 index 0000000000..b2626b6112 --- /dev/null +++ b/types/lodash/fp/attempt.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Attempt = + /** + * Attempts to invoke func, returning either the result or the caught error object. Any additional arguments + * are provided to func when it’s invoked. + * + * @param func The function to attempt. + * @return Returns the func result or error object. + */ + (func: (...args: any[]) => TResult) => TResult|Error; + +declare const attempt: Attempt; +export = attempt; diff --git a/types/lodash/fp/before.d.ts b/types/lodash/fp/before.d.ts new file mode 100644 index 0000000000..f3e4591275 --- /dev/null +++ b/types/lodash/fp/before.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Before { + /** + * Creates a function that invokes func, with the this binding and arguments of the created function, while + * it’s called less than n times. Subsequent calls to the created function return the result of the last func + * invocation. + * + * @param n The number of calls at which func is no longer invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + (): Before; + /** + * Creates a function that invokes func, with the this binding and arguments of the created function, while + * it’s called less than n times. Subsequent calls to the created function return the result of the last func + * invocation. + * + * @param n The number of calls at which func is no longer invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + any>(func: TFunc): Before1x1; + /** + * Creates a function that invokes func, with the this binding and arguments of the created function, while + * it’s called less than n times. Subsequent calls to the created function return the result of the last func + * invocation. + * + * @param n The number of calls at which func is no longer invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + any>(func: TFunc, n: number): TFunc; +} +interface Before1x1 any> { + /** + * Creates a function that invokes func, with the this binding and arguments of the created function, while + * it’s called less than n times. Subsequent calls to the created function return the result of the last func + * invocation. + * + * @param n The number of calls at which func is no longer invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + (): Before1x1; + /** + * Creates a function that invokes func, with the this binding and arguments of the created function, while + * it’s called less than n times. Subsequent calls to the created function return the result of the last func + * invocation. + * + * @param n The number of calls at which func is no longer invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + (n: number): TFunc; +} + +declare const before: Before; +export = before; diff --git a/types/lodash/fp/bind.d.ts b/types/lodash/fp/bind.d.ts new file mode 100644 index 0000000000..b62fb3de1f --- /dev/null +++ b/types/lodash/fp/bind.d.ts @@ -0,0 +1,86 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Bind { + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (): Bind; + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (func: (...args: any[]) => any): Bind1x1; + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (func: (...args: any[]) => any, thisArg: any): (...args: any[]) => any; +} +interface Bind1x1 { + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (): Bind1x1; + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (thisArg: any): (...args: any[]) => any; +} + +declare const bind: Bind; +export = bind; diff --git a/types/lodash/fp/bindAll.d.ts b/types/lodash/fp/bindAll.d.ts new file mode 100644 index 0000000000..98275d8d79 --- /dev/null +++ b/types/lodash/fp/bindAll.d.ts @@ -0,0 +1,78 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface BindAll { + /** + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ + (): BindAll; + /** + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ + (methodNames: _.Many): BindAll1x1; + /** + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ + (methodNames: _.Many, object: T): T; +} +interface BindAll1x1 { + /** + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ + (): BindAll1x1; + /** + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ + (object: T): T; +} + +declare const bindAll: BindAll; +export = bindAll; diff --git a/types/lodash/fp/bindKey.d.ts b/types/lodash/fp/bindKey.d.ts new file mode 100644 index 0000000000..c20c5b1901 --- /dev/null +++ b/types/lodash/fp/bindKey.d.ts @@ -0,0 +1,91 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface BindKey { + /** + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (): BindKey; + /** + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (object: object): BindKey1x1; + /** + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (object: object, key: string): (...args: any[]) => any; +} +interface BindKey1x1 { + /** + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (): BindKey1x1; + /** + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + (key: string): (...args: any[]) => any; +} + +declare const bindKey: BindKey; +export = bindKey; diff --git a/types/lodash/fp/camelCase.d.ts b/types/lodash/fp/camelCase.d.ts new file mode 100644 index 0000000000..81d33d61c7 --- /dev/null +++ b/types/lodash/fp/camelCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type CamelCase = + /** + * Converts string to camel case. + * + * @param string The string to convert. + * @return Returns the camel cased string. + */ + (string: string) => string; + +declare const camelCase: CamelCase; +export = camelCase; diff --git a/types/lodash/fp/capitalize.d.ts b/types/lodash/fp/capitalize.d.ts new file mode 100644 index 0000000000..988421b101 --- /dev/null +++ b/types/lodash/fp/capitalize.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Capitalize = + /** + * Converts the first character of string to upper case and the remaining to lower case. + * + * @param string The string to capitalize. + * @return Returns the capitalized string. + */ + (string: string) => string; + +declare const capitalize: Capitalize; +export = capitalize; diff --git a/types/lodash/fp/castArray.d.ts b/types/lodash/fp/castArray.d.ts new file mode 100644 index 0000000000..9d5b5fc11b --- /dev/null +++ b/types/lodash/fp/castArray.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type CastArray = + /** + * Casts value as an array if it’s not one. + * + * @param value The value to inspect. + * @return Returns the cast array. + */ + (value: _.Many) => T[]; + +declare const castArray: CastArray; +export = castArray; diff --git a/types/lodash/fp/ceil.d.ts b/types/lodash/fp/ceil.d.ts new file mode 100644 index 0000000000..e360c5bc08 --- /dev/null +++ b/types/lodash/fp/ceil.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Ceil = + /** + * Calculates n rounded up to precision. + * + * @param n The number to round up. + * @param precision The precision to round up to. + * @return Returns the rounded up number. + */ + (n: number) => number; + +declare const ceil: Ceil; +export = ceil; diff --git a/types/lodash/fp/chunk.d.ts b/types/lodash/fp/chunk.d.ts new file mode 100644 index 0000000000..8506a60c56 --- /dev/null +++ b/types/lodash/fp/chunk.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Chunk { + /** + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + (): Chunk; + /** + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + (size: number): Chunk1x1; + /** + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + (size: number, array: _.List | null | undefined): T[][]; +} +interface Chunk1x1 { + /** + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + (): Chunk1x1; + /** + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + (array: _.List | null | undefined): T[][]; +} + +declare const chunk: Chunk; +export = chunk; diff --git a/types/lodash/fp/clamp.d.ts b/types/lodash/fp/clamp.d.ts new file mode 100644 index 0000000000..7683abc761 --- /dev/null +++ b/types/lodash/fp/clamp.d.ts @@ -0,0 +1,166 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Clamp { + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (): Clamp; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (lower: number): Clamp1x1; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (lower: number, upper: number): Clamp1x2; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (lower: number, upper: number, number: number): number; +} +interface Clamp1x1 { + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (): Clamp1x1; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (upper: number): Clamp1x2; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (upper: number, number: number): number; +} +interface Clamp1x2 { + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (): Clamp1x2; + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @category Number + * @param number The number to clamp. + * @param [lower] The lower bound. + * @param upper The upper bound. + * @returns Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + (number: number): number; +} + +declare const clamp: Clamp; +export = clamp; diff --git a/types/lodash/fp/clone.d.ts b/types/lodash/fp/clone.d.ts new file mode 100644 index 0000000000..b6b00ae301 --- /dev/null +++ b/types/lodash/fp/clone.d.ts @@ -0,0 +1,20 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Clone = + /** + * Creates a shallow clone of value. + * + * Note: This method is loosely based on the structured clone algorithm and supports cloning arrays, + * array buffers, booleans, date objects, maps, numbers, Object objects, regexes, sets, strings, symbols, + * and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. An empty + * object is returned for uncloneable values such as error objects, functions, DOM nodes, and WeakMaps. + * + * @param value The value to clone. + * @return Returns the cloned value. + */ + (value: T) => T; + +declare const clone: Clone; +export = clone; diff --git a/types/lodash/fp/cloneDeep.d.ts b/types/lodash/fp/cloneDeep.d.ts new file mode 100644 index 0000000000..85d7137e57 --- /dev/null +++ b/types/lodash/fp/cloneDeep.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type CloneDeep = + /** + * This method is like _.clone except that it recursively clones value. + * + * @param value The value to recursively clone. + * @return Returns the deep cloned value. + */ + (value: T) => T; + +declare const cloneDeep: CloneDeep; +export = cloneDeep; diff --git a/types/lodash/fp/cloneDeepWith.d.ts b/types/lodash/fp/cloneDeepWith.d.ts new file mode 100644 index 0000000000..caaeb278a7 --- /dev/null +++ b/types/lodash/fp/cloneDeepWith.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CloneDeepWith { + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (): CloneDeepWith; + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (customizer: _.CloneDeepWithCustomizer): CloneDeepWith1x1; + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (customizer: _.CloneDeepWithCustomizer, value: T): any; +} +interface CloneDeepWith1x1 { + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (): CloneDeepWith1x1; + /** + * This method is like _.cloneWith except that it recursively clones value. + * + * @param value The value to recursively clone. + * @param customizer The function to customize cloning. + * @return Returns the deep cloned value. + */ + (value: T): any; +} + +declare const cloneDeepWith: CloneDeepWith; +export = cloneDeepWith; diff --git a/types/lodash/fp/cloneWith.d.ts b/types/lodash/fp/cloneWith.d.ts new file mode 100644 index 0000000000..de29399631 --- /dev/null +++ b/types/lodash/fp/cloneWith.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CloneWith { + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (): CloneWith; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (customizer: _.CloneWithCustomizer): CloneWith1x1; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (customizer: _.CloneWithCustomizer, value: T): TResult; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (customizer: _.CloneWithCustomizer): CloneWith2x1; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (customizer: _.CloneWithCustomizer, value: T): TResult | T; +} +interface CloneWith1x1 { + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (): CloneWith1x1; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (value: T): TResult; +} +interface CloneWith2x1 { + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (): CloneWith2x1; + /** + * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. + * If customizer returns undefined cloning is handled by the method instead. + * + * @param value The value to clone. + * @param customizer The function to customize cloning. + * @return Returns the cloned value. + */ + (value: T): TResult | T; +} + +declare const cloneWith: CloneWith; +export = cloneWith; diff --git a/types/lodash/fp/compact.d.ts b/types/lodash/fp/compact.d.ts new file mode 100644 index 0000000000..4b1c509117 --- /dev/null +++ b/types/lodash/fp/compact.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Compact = + /** + * Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are + * falsey. + * + * @param array The array to compact. + * @return Returns the new array of filtered values. + */ + (array: _.List | null | undefined) => T[]; + +declare const compact: Compact; +export = compact; diff --git a/types/lodash/fp/complement.d.ts b/types/lodash/fp/complement.d.ts new file mode 100644 index 0000000000..397bab4997 --- /dev/null +++ b/types/lodash/fp/complement.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Negate = + /** + * Creates a function that negates the result of the predicate func. The func predicate is invoked with + * the this binding and arguments of the created function. + * + * @param predicate The predicate to negate. + * @return Returns the new function. + */ + any>(predicate: T) => T; + +declare const complement: Negate; +export = complement; diff --git a/types/lodash/fp/compose.d.ts b/types/lodash/fp/compose.d.ts new file mode 100644 index 0000000000..6d626496ae --- /dev/null +++ b/types/lodash/fp/compose.d.ts @@ -0,0 +1,315 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlowRight { + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: () => R1): () => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: any) => any, f6: (a: any) => any, f5: (a: any) => any, f4: (a: any) => any, f3: (a: any) => any, f2: (a: any) => any, f1: () => any, ...funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; +} + +declare const compose: FlowRight; +export = compose; diff --git a/types/lodash/fp/concat.d.ts b/types/lodash/fp/concat.d.ts new file mode 100644 index 0000000000..a68dce878a --- /dev/null +++ b/types/lodash/fp/concat.d.ts @@ -0,0 +1,113 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Concat { + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + (): Concat; + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + (array: _.Many): Concat1x1; + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + (array: _.Many, values: _.Many): T[]; +} +interface Concat1x1 { + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + (): Concat1x1; + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @category Array + * @param array The array to concatenate. + * @param [values] The values to concatenate. + * @returns Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + (values: _.Many): T[]; +} + +declare const concat: Concat; +export = concat; diff --git a/types/lodash/fp/cond.d.ts b/types/lodash/fp/cond.d.ts new file mode 100644 index 0000000000..c5a18575a6 --- /dev/null +++ b/types/lodash/fp/cond.d.ts @@ -0,0 +1,38 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Cond = + /** + * Creates a function that iterates over `pairs` and invokes the corresponding + * function of the first predicate to return truthy. The predicate-function + * pairs are invoked with the `this` binding and arguments of the created + * function. + * + * @since 4.0.0 + * @category Util + * @param pairs The predicate-function pairs. + * @returns Returns the new composite function. + * @example + * + * var func = _.cond([ + * [_.matches({ 'a': 1 }), _.constant('matches A')], + * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], + * [_.stubTrue, _.constant('no match')] + * ]); + * + * func({ 'a': 1, 'b': 2 }); + * // => 'matches A' + * + * func({ 'a': 0, 'b': 1 }); + * // => 'matches B' + * + * func({ 'a': '1', 'b': '2' }); + * // => 'no match' + */ + (pairs: Array<_.CondPair>) => (Target: T) => R; + +declare const cond: Cond; +export = cond; diff --git a/types/lodash/fp/conforms.d.ts b/types/lodash/fp/conforms.d.ts new file mode 100644 index 0000000000..6499cccf55 --- /dev/null +++ b/types/lodash/fp/conforms.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ConformsTo { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject, object: T): boolean; +} +interface ConformsTo1x1 { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (object: T): boolean; +} + +declare const conforms: ConformsTo; +export = conforms; diff --git a/types/lodash/fp/conformsTo.d.ts b/types/lodash/fp/conformsTo.d.ts new file mode 100644 index 0000000000..9512e4adf6 --- /dev/null +++ b/types/lodash/fp/conformsTo.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ConformsTo { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject, object: T): boolean; +} +interface ConformsTo1x1 { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (object: T): boolean; +} + +declare const conformsTo: ConformsTo; +export = conformsTo; diff --git a/types/lodash/fp/constant.d.ts b/types/lodash/fp/constant.d.ts new file mode 100644 index 0000000000..718805e17f --- /dev/null +++ b/types/lodash/fp/constant.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Constant = + /** + * Creates a function that returns value. + * + * @param value The value to return from the new function. + * @return Returns the new function. + */ + (value: T) => () => T; + +declare const constant: Constant; +export = constant; diff --git a/types/lodash/fp/contains.d.ts b/types/lodash/fp/contains.d.ts new file mode 100644 index 0000000000..b80ca7f1fa --- /dev/null +++ b/types/lodash/fp/contains.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Includes { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (): Includes; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (target: T): Includes1x1; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (target: T, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} +interface Includes1x1 { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (): Includes1x1; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} + +declare const contains: Includes; +export = contains; diff --git a/types/lodash/fp/convert.d.ts b/types/lodash/fp/convert.d.ts new file mode 100644 index 0000000000..c06ecd9370 --- /dev/null +++ b/types/lodash/fp/convert.d.ts @@ -0,0 +1,15 @@ +interface ConvertOptions { + cap?: boolean; + curry?: boolean; + fixed?: boolean; + immutable?: boolean; + rearg?: boolean; +} + +interface Convert { + (func: object, options?: ConvertOptions): any; + (name: string, func: (...args: any[]) => any, options?: ConvertOptions): any; +} + +declare const convert: Convert; +export = convert; diff --git a/types/lodash/fp/countBy.d.ts b/types/lodash/fp/countBy.d.ts new file mode 100644 index 0000000000..cca0ac3b02 --- /dev/null +++ b/types/lodash/fp/countBy.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CountBy { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): CountBy; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: (value: string) => T): CountBy1x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: (value: string) => T, collection: string | null | undefined): _.Dictionary; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIteratee): CountBy2x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): _.Dictionary; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIteratee, collection: T | null | undefined): _.Dictionary; +} +interface CountBy1x1 { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): CountBy1x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (collection: string | null | undefined): _.Dictionary; +} +interface CountBy2x1 { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): CountBy2x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (collection: _.List | object | null | undefined): _.Dictionary; +} + +declare const countBy: CountBy; +export = countBy; diff --git a/types/lodash/fp/create.d.ts b/types/lodash/fp/create.d.ts new file mode 100644 index 0000000000..6025931062 --- /dev/null +++ b/types/lodash/fp/create.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Create = + /** + * Creates an object that inherits from the given prototype object. If a properties object is provided its own + * enumerable properties are assigned to the created object. + * + * @param prototype The object to inherit from. + * @param properties The properties to assign to the object. + * @return Returns the new object. + */ + (prototype: T) => T & U; + +declare const create: Create; +export = create; diff --git a/types/lodash/fp/curry.d.ts b/types/lodash/fp/curry.d.ts new file mode 100644 index 0000000000..6c946bbf67 --- /dev/null +++ b/types/lodash/fp/curry.d.ts @@ -0,0 +1,65 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Curry { + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1) => R): _.CurriedFunction1; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2) => R): _.CurriedFunction2; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3) => R): _.CurriedFunction3; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): _.CurriedFunction4; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): _.CurriedFunction5; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const curry: Curry; +export = curry; diff --git a/types/lodash/fp/curryN.d.ts b/types/lodash/fp/curryN.d.ts new file mode 100644 index 0000000000..4acbd81811 --- /dev/null +++ b/types/lodash/fp/curryN.d.ts @@ -0,0 +1,148 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Curry { + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (): Curry; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number): Curry1x1; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1) => R): _.CurriedFunction1; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1, t2: T2) => R): _.CurriedFunction2; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1, t2: T2, t3: T3) => R): _.CurriedFunction3; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): _.CurriedFunction4; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): _.CurriedFunction5; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Curry1x1 { + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (): Curry1x1; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1) => R): _.CurriedFunction1; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2) => R): _.CurriedFunction2; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3) => R): _.CurriedFunction3; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): _.CurriedFunction4; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): _.CurriedFunction5; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const curryN: Curry; +export = curryN; diff --git a/types/lodash/fp/curryRight.d.ts b/types/lodash/fp/curryRight.d.ts new file mode 100644 index 0000000000..5ff81e2004 --- /dev/null +++ b/types/lodash/fp/curryRight.d.ts @@ -0,0 +1,59 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CurryRight { + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1) => R): _.RightCurriedFunction1; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2) => R): _.RightCurriedFunction2; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3) => R): _.RightCurriedFunction3; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): _.RightCurriedFunction4; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): _.RightCurriedFunction5; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const curryRight: CurryRight; +export = curryRight; diff --git a/types/lodash/fp/curryRightN.d.ts b/types/lodash/fp/curryRightN.d.ts new file mode 100644 index 0000000000..98694df731 --- /dev/null +++ b/types/lodash/fp/curryRightN.d.ts @@ -0,0 +1,133 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface CurryRight { + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (): CurryRight; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number): CurryRight1x1; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1) => R): _.RightCurriedFunction1; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1, t2: T2) => R): _.RightCurriedFunction2; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1, t2: T2, t3: T3) => R): _.RightCurriedFunction3; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): _.RightCurriedFunction4; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): _.RightCurriedFunction5; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (arity: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface CurryRight1x1 { + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (): CurryRight1x1; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1) => R): _.RightCurriedFunction1; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2) => R): _.RightCurriedFunction2; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3) => R): _.RightCurriedFunction3; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): _.RightCurriedFunction4; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): _.RightCurriedFunction5; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const curryRightN: CurryRight; +export = curryRightN; diff --git a/types/lodash/fp/debounce.d.ts b/types/lodash/fp/debounce.d.ts new file mode 100644 index 0000000000..6aa4ca891b --- /dev/null +++ b/types/lodash/fp/debounce.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Debounce { + /** + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to + * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent + * calls to the debounced function return the result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ + (): Debounce; + /** + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to + * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent + * calls to the debounced function return the result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ + (wait: number): Debounce1x1; + /** + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to + * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent + * calls to the debounced function return the result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ + any>(wait: number, func: T): T & _.Cancelable; +} +interface Debounce1x1 { + /** + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to + * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent + * calls to the debounced function return the result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ + (): Debounce1x1; + /** + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to + * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent + * calls to the debounced function return the result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ + any>(func: T): T & _.Cancelable; +} + +declare const debounce: Debounce; +export = debounce; diff --git a/types/lodash/fp/deburr.d.ts b/types/lodash/fp/deburr.d.ts new file mode 100644 index 0000000000..582ef58205 --- /dev/null +++ b/types/lodash/fp/deburr.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Deburr = + /** + * Deburrs string by converting latin-1 supplementary letters to basic latin letters and removing combining + * diacritical marks. + * + * @param string The string to deburr. + * @return Returns the deburred string. + */ + (string: string) => string; + +declare const deburr: Deburr; +export = deburr; diff --git a/types/lodash/fp/defaultTo.d.ts b/types/lodash/fp/defaultTo.d.ts new file mode 100644 index 0000000000..2137ee3307 --- /dev/null +++ b/types/lodash/fp/defaultTo.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface DefaultTo { + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (): DefaultTo; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (defaultValue: T): DefaultTo1x1; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (defaultValue: T, value: T | null | undefined): T; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (defaultValue: TDefault): DefaultTo2x1; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (defaultValue: TDefault, value: T | null | undefined): T | TDefault; +} +interface DefaultTo1x1 { + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (): DefaultTo1x1; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (value: T | null | undefined): T; +} +interface DefaultTo2x1 { + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (): DefaultTo2x1; + /** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @param value The value to check. + * @param defaultValue The default value. + * @returns Returns the resolved value. + */ + (value: T | null | undefined): T | TDefault; +} + +declare const defaultTo: DefaultTo; +export = defaultTo; diff --git a/types/lodash/fp/defaults.d.ts b/types/lodash/fp/defaults.d.ts new file mode 100644 index 0000000000..306534d374 --- /dev/null +++ b/types/lodash/fp/defaults.d.ts @@ -0,0 +1,71 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Defaults { + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + (): Defaults; + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + (source: TSource): Defaults1x1; + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + (source: TSource, object: TObject): TSource & TObject; +} +interface Defaults1x1 { + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + (): Defaults1x1; + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + (object: TObject): TSource & TObject; +} + +declare const defaults: Defaults; +export = defaults; diff --git a/types/lodash/fp/defaultsAll.d.ts b/types/lodash/fp/defaultsAll.d.ts new file mode 100644 index 0000000000..371f6db282 --- /dev/null +++ b/types/lodash/fp/defaultsAll.d.ts @@ -0,0 +1,20 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Defaults = + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + (object: ReadonlyArray) => any; + +declare const defaultsAll: Defaults; +export = defaultsAll; diff --git a/types/lodash/fp/defaultsDeep.d.ts b/types/lodash/fp/defaultsDeep.d.ts new file mode 100644 index 0000000000..86eace1bb9 --- /dev/null +++ b/types/lodash/fp/defaultsDeep.d.ts @@ -0,0 +1,46 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface DefaultsDeep { + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + (): DefaultsDeep; + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + (sources: any): DefaultsDeep1x1; + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + (sources: any, object: any): any; +} +interface DefaultsDeep1x1 { + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + (): DefaultsDeep1x1; + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + (object: any): any; +} + +declare const defaultsDeep: DefaultsDeep; +export = defaultsDeep; diff --git a/types/lodash/fp/defaultsDeepAll.d.ts b/types/lodash/fp/defaultsDeepAll.d.ts new file mode 100644 index 0000000000..cb6157662d --- /dev/null +++ b/types/lodash/fp/defaultsDeepAll.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type DefaultsDeep = + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + (object: ReadonlyArray) => any; + +declare const defaultsDeepAll: DefaultsDeep; +export = defaultsDeepAll; diff --git a/types/lodash/fp/defer.d.ts b/types/lodash/fp/defer.d.ts new file mode 100644 index 0000000000..a9bab80092 --- /dev/null +++ b/types/lodash/fp/defer.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Defer = + /** + * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to + * func when it’s invoked. + * + * @param func The function to defer. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + (func: (...args: any[]) => any, ...args: any[]) => number; + +declare const defer: Defer; +export = defer; diff --git a/types/lodash/fp/delay.d.ts b/types/lodash/fp/delay.d.ts new file mode 100644 index 0000000000..8709a9c0e2 --- /dev/null +++ b/types/lodash/fp/delay.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Delay { + /** + * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. + * + * @param func The function to delay. + * @param wait The number of milliseconds to delay invocation. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + (): Delay; + /** + * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. + * + * @param func The function to delay. + * @param wait The number of milliseconds to delay invocation. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + (wait: number): Delay1x1; + /** + * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. + * + * @param func The function to delay. + * @param wait The number of milliseconds to delay invocation. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + (wait: number, func: (...args: any[]) => any): number; +} +interface Delay1x1 { + /** + * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. + * + * @param func The function to delay. + * @param wait The number of milliseconds to delay invocation. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + (): Delay1x1; + /** + * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. + * + * @param func The function to delay. + * @param wait The number of milliseconds to delay invocation. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + (func: (...args: any[]) => any): number; +} + +declare const delay: Delay; +export = delay; diff --git a/types/lodash/fp/difference.d.ts b/types/lodash/fp/difference.d.ts new file mode 100644 index 0000000000..774539bba7 --- /dev/null +++ b/types/lodash/fp/difference.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Difference { + /** + * Creates an array of unique array values not included in the other provided arrays using SameValueZero for + * equality comparisons. + * + * @param array The array to inspect. + * @param values The arrays of values to exclude. + * @return Returns the new array of filtered values. + */ + (): Difference; + /** + * Creates an array of unique array values not included in the other provided arrays using SameValueZero for + * equality comparisons. + * + * @param array The array to inspect. + * @param values The arrays of values to exclude. + * @return Returns the new array of filtered values. + */ + (array: _.List | null | undefined): Difference1x1; + /** + * Creates an array of unique array values not included in the other provided arrays using SameValueZero for + * equality comparisons. + * + * @param array The array to inspect. + * @param values The arrays of values to exclude. + * @return Returns the new array of filtered values. + */ + (array: _.List | null | undefined, values: _.List): T[]; +} +interface Difference1x1 { + /** + * Creates an array of unique array values not included in the other provided arrays using SameValueZero for + * equality comparisons. + * + * @param array The array to inspect. + * @param values The arrays of values to exclude. + * @return Returns the new array of filtered values. + */ + (): Difference1x1; + /** + * Creates an array of unique array values not included in the other provided arrays using SameValueZero for + * equality comparisons. + * + * @param array The array to inspect. + * @param values The arrays of values to exclude. + * @return Returns the new array of filtered values. + */ + (values: _.List): T[]; +} + +declare const difference: Difference; +export = difference; diff --git a/types/lodash/fp/differenceBy.d.ts b/types/lodash/fp/differenceBy.d.ts new file mode 100644 index 0000000000..64975c1b17 --- /dev/null +++ b/types/lodash/fp/differenceBy.d.ts @@ -0,0 +1,114 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DifferenceBy { + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (): DifferenceBy; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (iteratee: _.ValueIteratee): DifferenceBy1x1; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (iteratee: _.ValueIteratee, array: _.List | null | undefined): DifferenceBy1x2; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (iteratee: _.ValueIteratee, array: _.List | null | undefined, values: _.List): T1[]; +} +interface DifferenceBy1x1 { + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (): DifferenceBy1x1; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (array: _.List | null | undefined): DifferenceBy1x2; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (array: _.List | null | undefined, values: _.List): T1[]; +} +interface DifferenceBy1x2 { + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (): DifferenceBy1x2; + /** + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). + * + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. + */ + (values: _.List): T1[]; +} + +declare const differenceBy: DifferenceBy; +export = differenceBy; diff --git a/types/lodash/fp/differenceWith.d.ts b/types/lodash/fp/differenceWith.d.ts new file mode 100644 index 0000000000..2ef1961ff7 --- /dev/null +++ b/types/lodash/fp/differenceWith.d.ts @@ -0,0 +1,168 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DifferenceWith { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (): DifferenceWith; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (comparator: _.Comparator2): DifferenceWith1x1; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (comparator: _.Comparator2, array: _.List | null | undefined): DifferenceWith1x2; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (comparator: _.Comparator2, array: _.List | null | undefined, values: _.List): T1[]; +} +interface DifferenceWith1x1 { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (): DifferenceWith1x1; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (array: _.List | null | undefined): DifferenceWith1x2; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (array: _.List | null | undefined, values: _.List): T1[]; +} +interface DifferenceWith1x2 { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (): DifferenceWith1x2; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + (values: _.List): T1[]; +} + +declare const differenceWith: DifferenceWith; +export = differenceWith; diff --git a/types/lodash/fp/dissoc.d.ts b/types/lodash/fp/dissoc.d.ts new file mode 100644 index 0000000000..ad931b90da --- /dev/null +++ b/types/lodash/fp/dissoc.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Unset { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath, object: any): boolean; +} +interface Unset1x1 { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (object: any): boolean; +} + +declare const dissoc: Unset; +export = dissoc; diff --git a/types/lodash/fp/dissocPath.d.ts b/types/lodash/fp/dissocPath.d.ts new file mode 100644 index 0000000000..8d98858a6c --- /dev/null +++ b/types/lodash/fp/dissocPath.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Unset { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath, object: any): boolean; +} +interface Unset1x1 { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (object: any): boolean; +} + +declare const dissocPath: Unset; +export = dissocPath; diff --git a/types/lodash/fp/divide.d.ts b/types/lodash/fp/divide.d.ts new file mode 100644 index 0000000000..293acebb68 --- /dev/null +++ b/types/lodash/fp/divide.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Divide { + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (): Divide; + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (dividend: number): Divide1x1; + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (dividend: number, divisor: number): number; +} +interface Divide1x1 { + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (): Divide1x1; + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + (divisor: number): number; +} + +declare const divide: Divide; +export = divide; diff --git a/types/lodash/fp/drop.d.ts b/types/lodash/fp/drop.d.ts new file mode 100644 index 0000000000..3c524f1321 --- /dev/null +++ b/types/lodash/fp/drop.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Drop { + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (): Drop; + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (n: number): Drop1x1; + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface Drop1x1 { + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (): Drop1x1; + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const drop: Drop; +export = drop; diff --git a/types/lodash/fp/dropLast.d.ts b/types/lodash/fp/dropLast.d.ts new file mode 100644 index 0000000000..e0fb5db69e --- /dev/null +++ b/types/lodash/fp/dropLast.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropRight { + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (): DropRight; + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (n: number): DropRight1x1; + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface DropRight1x1 { + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (): DropRight1x1; + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropLast: DropRight; +export = dropLast; diff --git a/types/lodash/fp/dropLastWhile.d.ts b/types/lodash/fp/dropLastWhile.d.ts new file mode 100644 index 0000000000..3d0d5634ef --- /dev/null +++ b/types/lodash/fp/dropLastWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropRightWhile { + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): DropRightWhile; + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee): DropRightWhile1x1; + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface DropRightWhile1x1 { + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): DropRightWhile1x1; + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropLastWhile: DropRightWhile; +export = dropLastWhile; diff --git a/types/lodash/fp/dropRight.d.ts b/types/lodash/fp/dropRight.d.ts new file mode 100644 index 0000000000..4c07c3c8a5 --- /dev/null +++ b/types/lodash/fp/dropRight.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropRight { + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (): DropRight; + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (n: number): DropRight1x1; + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface DropRight1x1 { + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (): DropRight1x1; + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropRight: DropRight; +export = dropRight; diff --git a/types/lodash/fp/dropRightWhile.d.ts b/types/lodash/fp/dropRightWhile.d.ts new file mode 100644 index 0000000000..e346a77e97 --- /dev/null +++ b/types/lodash/fp/dropRightWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropRightWhile { + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): DropRightWhile; + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee): DropRightWhile1x1; + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface DropRightWhile1x1 { + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): DropRightWhile1x1; + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropRightWhile: DropRightWhile; +export = dropRightWhile; diff --git a/types/lodash/fp/dropWhile.d.ts b/types/lodash/fp/dropWhile.d.ts new file mode 100644 index 0000000000..056a06bc3e --- /dev/null +++ b/types/lodash/fp/dropWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface DropWhile { + /** + * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): DropWhile; + /** + * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee): DropWhile1x1; + /** + * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface DropWhile1x1 { + /** + * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): DropWhile1x1; + /** + * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const dropWhile: DropWhile; +export = dropWhile; diff --git a/types/lodash/fp/each.d.ts b/types/lodash/fp/each.d.ts new file mode 100644 index 0000000000..df0afae30f --- /dev/null +++ b/types/lodash/fp/each.d.ts @@ -0,0 +1,330 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ForEach { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (): ForEach; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T) => any): ForEach1x1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T) => any, collection: ReadonlyArray): T[]; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: string) => any): ForEach2x1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: string) => any, collection: string): string; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T) => any, collection: _.List): _.List; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T[keyof T]) => any, collection: T): T; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T) => any, collection: TArray & (T[] | null | undefined)): TArray; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: string) => any, collection: TString): TString; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + | null | undefined>(iteratee: (value: T) => any, collection: TList & (_.List | null | undefined)): TList; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined; +} +interface ForEach1x1 { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (): ForEach1x1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: ReadonlyArray): T[]; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: _.List): _.List; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: T1): T1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: TArray & (T[] | null | undefined)): TArray; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + | null | undefined>(collection: TList & (_.List | null | undefined)): TList; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: T1 | null | undefined): T1 | null | undefined; +} +interface ForEach2x1 { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (): ForEach2x1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: string): string; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: TString): TString; +} + +declare const each: ForEach; +export = each; diff --git a/types/lodash/fp/eachRight.d.ts b/types/lodash/fp/eachRight.d.ts new file mode 100644 index 0000000000..06af73ca68 --- /dev/null +++ b/types/lodash/fp/eachRight.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ForEachRight { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (): ForEachRight; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T) => any): ForEachRight1x1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T) => any, collection: ReadonlyArray): T[]; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: string) => any): ForEachRight2x1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: string) => any, collection: string): string; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T) => any, collection: _.List): _.List; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T[keyof T]) => any, collection: T): T; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T) => any, collection: TArray & (T[] | null | undefined)): TArray; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: string) => any, collection: TString): TString; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + | null | undefined>(iteratee: (value: T) => any, collection: TList & (_.List | null | undefined)): TList; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined; +} +interface ForEachRight1x1 { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (): ForEachRight1x1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: ReadonlyArray): T[]; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: _.List): _.List; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: T1): T1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: TArray & (T[] | null | undefined)): TArray; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + | null | undefined>(collection: TList & (_.List | null | undefined)): TList; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: T1 | null | undefined): T1 | null | undefined; +} +interface ForEachRight2x1 { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (): ForEachRight2x1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: string): string; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: TString): TString; +} + +declare const eachRight: ForEachRight; +export = eachRight; diff --git a/types/lodash/fp/endsWith.d.ts b/types/lodash/fp/endsWith.d.ts new file mode 100644 index 0000000000..5808870c50 --- /dev/null +++ b/types/lodash/fp/endsWith.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface EndsWith { + /** + * Checks if string ends with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string ends with target, else false. + */ + (): EndsWith; + /** + * Checks if string ends with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string ends with target, else false. + */ + (target: string): EndsWith1x1; + /** + * Checks if string ends with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string ends with target, else false. + */ + (target: string, string: string): boolean; +} +interface EndsWith1x1 { + /** + * Checks if string ends with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string ends with target, else false. + */ + (): EndsWith1x1; + /** + * Checks if string ends with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string ends with target, else false. + */ + (string: string): boolean; +} + +declare const endsWith: EndsWith; +export = endsWith; diff --git a/types/lodash/fp/entries.d.ts b/types/lodash/fp/entries.d.ts new file mode 100644 index 0000000000..99b04076c7 --- /dev/null +++ b/types/lodash/fp/entries.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToPairs { + /** + * Creates an array of own enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: _.Dictionary | _.NumericDictionary): Array<[string, T]>; + /** + * Creates an array of own enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: object): Array<[string, any]>; +} + +declare const entries: ToPairs; +export = entries; diff --git a/types/lodash/fp/entriesIn.d.ts b/types/lodash/fp/entriesIn.d.ts new file mode 100644 index 0000000000..3579959f84 --- /dev/null +++ b/types/lodash/fp/entriesIn.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToPairsIn { + /** + * Creates an array of own and inherited enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: _.Dictionary | _.NumericDictionary): Array<[string, T]>; + /** + * Creates an array of own and inherited enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: object): Array<[string, any]>; +} + +declare const entriesIn: ToPairsIn; +export = entriesIn; diff --git a/types/lodash/fp/eq.d.ts b/types/lodash/fp/eq.d.ts new file mode 100644 index 0000000000..4c3278ae3d --- /dev/null +++ b/types/lodash/fp/eq.d.ts @@ -0,0 +1,156 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Eq { + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (): Eq; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (value: any): Eq1x1; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (value: any, other: any): boolean; +} +interface Eq1x1 { + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (): Eq1x1; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (other: any): boolean; +} + +declare const eq: Eq; +export = eq; diff --git a/types/lodash/fp/equals.d.ts b/types/lodash/fp/equals.d.ts new file mode 100644 index 0000000000..3e3f9b1853 --- /dev/null +++ b/types/lodash/fp/equals.d.ts @@ -0,0 +1,141 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsEqual { + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (): IsEqual; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (value: any): IsEqual1x1; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (value: any, other: any): boolean; +} +interface IsEqual1x1 { + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (): IsEqual1x1; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (other: any): boolean; +} + +declare const equals: IsEqual; +export = equals; diff --git a/types/lodash/fp/escape.d.ts b/types/lodash/fp/escape.d.ts new file mode 100644 index 0000000000..18f704928d --- /dev/null +++ b/types/lodash/fp/escape.d.ts @@ -0,0 +1,26 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Escape = + /** + * Converts the characters "&", "<", ">", '"', "'", and "`" in string to their corresponding HTML entities. + * + * Note: No other characters are escaped. To escape additional characters use a third-party library like he. + * + * hough the ">" character is escaped for symmetry, characters like ">" and "/" don’t need escaping in HTML + * and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynens’s + * article (under "semi-related fun fact") for more details. + * + * Backticks are escaped because in IE < 9, they can break out of attribute values or HTML comments. See #59, + * #102, #108, and #133 of the HTML5 Security Cheatsheet for more details. + * + * When working with HTML you should always quote attribute values to reduce XSS vectors. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + (string: string) => string; + +declare const escape: Escape; +export = escape; diff --git a/types/lodash/fp/escapeRegExp.d.ts b/types/lodash/fp/escapeRegExp.d.ts new file mode 100644 index 0000000000..f66fa150c8 --- /dev/null +++ b/types/lodash/fp/escapeRegExp.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type EscapeRegExp = + /** + * Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", + * "{", "}", and "|" in string. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + (string: string) => string; + +declare const escapeRegExp: EscapeRegExp; +export = escapeRegExp; diff --git a/types/lodash/fp/every.d.ts b/types/lodash/fp/every.d.ts new file mode 100644 index 0000000000..fc60615c96 --- /dev/null +++ b/types/lodash/fp/every.d.ts @@ -0,0 +1,67 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Every { + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (): Every; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom): Every1x1; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): boolean; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): boolean; +} +interface Every1x1 { + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (): Every1x1; + /** + * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate + * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if all elements pass the predicate check, else false. + */ + (collection: _.List | object | null | undefined): boolean; +} + +declare const every: Every; +export = every; diff --git a/types/lodash/fp/extend.d.ts b/types/lodash/fp/extend.d.ts new file mode 100644 index 0000000000..ee0889f8ae --- /dev/null +++ b/types/lodash/fp/extend.d.ts @@ -0,0 +1,151 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface AssignIn { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (): AssignIn; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (object: TObject): AssignIn1x1; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignIn1x1 { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (): AssignIn1x1; + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (source: TSource): TObject & TSource; +} + +declare const extend: AssignIn; +export = extend; diff --git a/types/lodash/fp/extendAll.d.ts b/types/lodash/fp/extendAll.d.ts new file mode 100644 index 0000000000..a8168d774d --- /dev/null +++ b/types/lodash/fp/extendAll.d.ts @@ -0,0 +1,36 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type AssignIn = + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @alias extend + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + (object: ReadonlyArray) => TResult; + +declare const extendAll: AssignIn; +export = extendAll; diff --git a/types/lodash/fp/extendAllWith.d.ts b/types/lodash/fp/extendAllWith.d.ts new file mode 100644 index 0000000000..6e2d7602d3 --- /dev/null +++ b/types/lodash/fp/extendAllWith.d.ts @@ -0,0 +1,143 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignInWith { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer): AssignInWith1x1; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer, args: ReadonlyArray): any; +} +interface AssignInWith1x1 { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith1x1; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (args: ReadonlyArray): any; +} + +declare const extendAllWith: AssignInWith; +export = extendAllWith; diff --git a/types/lodash/fp/extendWith.d.ts b/types/lodash/fp/extendWith.d.ts new file mode 100644 index 0000000000..39b50e9ebf --- /dev/null +++ b/types/lodash/fp/extendWith.d.ts @@ -0,0 +1,249 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface AssignInWith { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer): AssignInWith1x1; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer, object: TObject): AssignInWith1x2; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (customizer: _.AssignCustomizer, object: TObject, source: TSource): TObject & TSource; +} +interface AssignInWith1x1 { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith1x1; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (object: TObject): AssignInWith1x2; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface AssignInWith1x2 { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (): AssignInWith1x2; + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @alias extendWith + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + (source: TSource): TObject & TSource; +} + +declare const extendWith: AssignInWith; +export = extendWith; diff --git a/types/lodash/fp/fill.d.ts b/types/lodash/fp/fill.d.ts new file mode 100644 index 0000000000..5349e8e067 --- /dev/null +++ b/types/lodash/fp/fill.d.ts @@ -0,0 +1,233 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Fill { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (): Fill; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (start: number): Fill1x1; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (start: number, end: number): Fill1x2; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (start: number, end: number, value: T): Fill1x3; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (start: number, end: number, value: T, array: U[] | null | undefined): Array; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (start: number, end: number, value: T, array: _.List | null | undefined): _.List; +} +interface Fill1x1 { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (): Fill1x1; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (end: number): Fill1x2; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (end: number, value: T): Fill1x3; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (end: number, value: T, array: U[] | null | undefined): Array; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (end: number, value: T, array: _.List | null | undefined): _.List; +} +interface Fill1x2 { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (): Fill1x2; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (value: T): Fill1x3; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (value: T, array: U[] | null | undefined): Array; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (value: T, array: _.List | null | undefined): _.List; +} +interface Fill1x3 { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (): Fill1x3; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (array: U[] | null | undefined): Array; + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + (array: _.List | null | undefined): _.List; +} + +declare const fill: Fill; +export = fill; diff --git a/types/lodash/fp/filter.d.ts b/types/lodash/fp/filter.d.ts new file mode 100644 index 0000000000..289c0edcd5 --- /dev/null +++ b/types/lodash/fp/filter.d.ts @@ -0,0 +1,361 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Filter { + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (): Filter; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: (value: string) => boolean): Filter1x1; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: (value: string) => boolean, collection: string | null | undefined): string[]; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIteratorTypeGuard): Filter2x1; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIteratorTypeGuard, collection: _.List | null | undefined): S[]; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIterateeCustom): Filter3x1; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): T[]; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIteratorTypeGuard): Filter4x1; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIteratorTypeGuard, collection: T | null | undefined): S[]; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): Array; +} +interface Filter1x1 { + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (): Filter1x1; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (collection: string | null | undefined): string[]; +} +interface Filter2x1 { + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (): Filter2x1; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (collection: _.List | null | undefined): S[]; +} +interface Filter3x1 { + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (): Filter3x1; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (collection: _.List | object | null | undefined): T[]; +} +interface Filter4x1 { + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (): Filter4x1; + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (collection: T | null | undefined): S[]; +} + +declare const filter: Filter; +export = filter; diff --git a/types/lodash/fp/find.d.ts b/types/lodash/fp/find.d.ts new file mode 100644 index 0000000000..d562ef3894 --- /dev/null +++ b/types/lodash/fp/find.d.ts @@ -0,0 +1,283 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Find { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): Find1x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, collection: _.List | null | undefined): S|undefined; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom): Find2x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): T|undefined; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): Find3x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, collection: T | null | undefined): S|undefined; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined; +} +interface Find1x1 { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find1x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: _.List | null | undefined): S|undefined; +} +interface Find2x1 { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find2x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: _.List | object | null | undefined): T|undefined; +} +interface Find3x1 { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find3x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: T | null | undefined): S|undefined; +} + +declare const find: Find; +export = find; diff --git a/types/lodash/fp/findFrom.d.ts b/types/lodash/fp/findFrom.d.ts new file mode 100644 index 0000000000..c2c83b5644 --- /dev/null +++ b/types/lodash/fp/findFrom.d.ts @@ -0,0 +1,517 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Find { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): Find1x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number): Find1x2; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number, collection: _.List | null | undefined): S|undefined; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom): Find2x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number): Find2x2; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, collection: _.List | null | undefined): T|undefined; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): Find3x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number): Find3x2; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number, collection: T | null | undefined): S|undefined; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, collection: T | null | undefined): T[keyof T]|undefined; +} +interface Find1x1 { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find1x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number): Find1x2; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number, collection: _.List | null | undefined): S|undefined; +} +interface Find1x2 { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find1x2; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: _.List | null | undefined): S|undefined; +} +interface Find2x1 { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find2x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number): Find2x2; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number, collection: _.List | object | null | undefined): T|undefined; +} +interface Find2x2 { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find2x2; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: _.List | object | null | undefined): T|undefined; +} +interface Find3x1 { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find3x1; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number): Find3x2; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (fromIndex: number, collection: T | null | undefined): S|undefined; +} +interface Find3x2 { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (): Find3x2; + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the matched element, else undefined. + */ + (collection: T | null | undefined): S|undefined; +} + +declare const findFrom: Find; +export = findFrom; diff --git a/types/lodash/fp/findIndex.d.ts b/types/lodash/fp/findIndex.d.ts new file mode 100644 index 0000000000..18842b2513 --- /dev/null +++ b/types/lodash/fp/findIndex.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindIndex { + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex; + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom): FindIndex1x1; + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, array: _.List | null | undefined): number; +} +interface FindIndex1x1 { + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex1x1; + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const findIndex: FindIndex; +export = findIndex; diff --git a/types/lodash/fp/findIndexFrom.d.ts b/types/lodash/fp/findIndexFrom.d.ts new file mode 100644 index 0000000000..fbc5f7bac1 --- /dev/null +++ b/types/lodash/fp/findIndexFrom.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindIndex { + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex; + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom): FindIndex1x1; + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number): FindIndex1x2; + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, array: _.List | null | undefined): number; +} +interface FindIndex1x1 { + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex1x1; + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (fromIndex: number): FindIndex1x2; + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (fromIndex: number, array: _.List | null | undefined): number; +} +interface FindIndex1x2 { + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindIndex1x2; + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const findIndexFrom: FindIndex; +export = findIndexFrom; diff --git a/types/lodash/fp/findKey.d.ts b/types/lodash/fp/findKey.d.ts new file mode 100644 index 0000000000..a776272bc0 --- /dev/null +++ b/types/lodash/fp/findKey.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindKey { + /** + * This method is like _.find except that it returns the key of the first element predicate returns truthy for + * instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (): FindKey; + /** + * This method is like _.find except that it returns the key of the first element predicate returns truthy for + * instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (predicate: _.ValueIteratee): FindKey1x1; + /** + * This method is like _.find except that it returns the key of the first element predicate returns truthy for + * instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (predicate: _.ValueIteratee, object: T | null | undefined): string | undefined; +} +interface FindKey1x1 { + /** + * This method is like _.find except that it returns the key of the first element predicate returns truthy for + * instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (): FindKey1x1; + /** + * This method is like _.find except that it returns the key of the first element predicate returns truthy for + * instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (object: object | null | undefined): string | undefined; +} + +declare const findKey: FindKey; +export = findKey; diff --git a/types/lodash/fp/findLast.d.ts b/types/lodash/fp/findLast.d.ts new file mode 100644 index 0000000000..fb8c822bdf --- /dev/null +++ b/types/lodash/fp/findLast.d.ts @@ -0,0 +1,143 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLast { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): FindLast1x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, collection: _.List | null | undefined): S|undefined; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom): FindLast2x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): T|undefined; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): FindLast3x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, collection: T | null | undefined): S|undefined; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined; +} +interface FindLast1x1 { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast1x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: _.List | null | undefined): S|undefined; +} +interface FindLast2x1 { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast2x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: _.List | object | null | undefined): T|undefined; +} +interface FindLast3x1 { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast3x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: T | null | undefined): S|undefined; +} + +declare const findLast: FindLast; +export = findLast; diff --git a/types/lodash/fp/findLastFrom.d.ts b/types/lodash/fp/findLastFrom.d.ts new file mode 100644 index 0000000000..bd6bed3043 --- /dev/null +++ b/types/lodash/fp/findLastFrom.d.ts @@ -0,0 +1,257 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLast { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): FindLast1x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number): FindLast1x2; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number, collection: _.List | null | undefined): S|undefined; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom): FindLast2x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number): FindLast2x2; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, collection: _.List | null | undefined): T|undefined; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard): FindLast3x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number): FindLast3x2; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIteratorTypeGuard, fromIndex: number, collection: T | null | undefined): S|undefined; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, collection: T | null | undefined): T[keyof T]|undefined; +} +interface FindLast1x1 { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast1x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number): FindLast1x2; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number, collection: _.List | null | undefined): S|undefined; +} +interface FindLast1x2 { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast1x2; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: _.List | null | undefined): S|undefined; +} +interface FindLast2x1 { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast2x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number): FindLast2x2; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number, collection: _.List | object | null | undefined): T|undefined; +} +interface FindLast2x2 { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast2x2; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: _.List | object | null | undefined): T|undefined; +} +interface FindLast3x1 { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast3x1; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number): FindLast3x2; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (fromIndex: number, collection: T | null | undefined): S|undefined; +} +interface FindLast3x2 { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (): FindLast3x2; + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param predicate The function called per iteration. + * @param fromIndex The index to search from. + * @return The found element, else undefined. + */ + (collection: T | null | undefined): S|undefined; +} + +declare const findLastFrom: FindLast; +export = findLastFrom; diff --git a/types/lodash/fp/findLastIndex.d.ts b/types/lodash/fp/findLastIndex.d.ts new file mode 100644 index 0000000000..230736f814 --- /dev/null +++ b/types/lodash/fp/findLastIndex.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLastIndex { + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex; + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom): FindLastIndex1x1; + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, array: _.List | null | undefined): number; +} +interface FindLastIndex1x1 { + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex1x1; + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const findLastIndex: FindLastIndex; +export = findLastIndex; diff --git a/types/lodash/fp/findLastIndexFrom.d.ts b/types/lodash/fp/findLastIndexFrom.d.ts new file mode 100644 index 0000000000..df28dc685e --- /dev/null +++ b/types/lodash/fp/findLastIndexFrom.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLastIndex { + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex; + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom): FindLastIndex1x1; + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number): FindLastIndex1x2; + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (predicate: _.ValueIterateeCustom, fromIndex: number, array: _.List | null | undefined): number; +} +interface FindLastIndex1x1 { + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex1x1; + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (fromIndex: number): FindLastIndex1x2; + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (fromIndex: number, array: _.List | null | undefined): number; +} +interface FindLastIndex1x2 { + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (): FindLastIndex1x2; + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param fromIndex The index to search from. + * @return Returns the index of the found element, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const findLastIndexFrom: FindLastIndex; +export = findLastIndexFrom; diff --git a/types/lodash/fp/findLastKey.d.ts b/types/lodash/fp/findLastKey.d.ts new file mode 100644 index 0000000000..51e8d52ce1 --- /dev/null +++ b/types/lodash/fp/findLastKey.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FindLastKey { + /** + * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (): FindLastKey; + /** + * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (predicate: _.ValueIteratee): FindLastKey1x1; + /** + * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (predicate: _.ValueIteratee, object: T | null | undefined): string | undefined; +} +interface FindLastKey1x1 { + /** + * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (): FindLastKey1x1; + /** + * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + (object: object | null | undefined): string | undefined; +} + +declare const findLastKey: FindLastKey; +export = findLastKey; diff --git a/types/lodash/fp/first.d.ts b/types/lodash/fp/first.d.ts new file mode 100644 index 0000000000..e93bdf4e4e --- /dev/null +++ b/types/lodash/fp/first.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Head = + /** + * Gets the first element of array. + * + * @alias _.first + * + * @param array The array to query. + * @return Returns the first element of array. + */ + (array: _.List | null | undefined) => T | undefined; + +declare const first: Head; +export = first; diff --git a/types/lodash/fp/flatMap.d.ts b/types/lodash/fp/flatMap.d.ts new file mode 100644 index 0000000000..a6713fe34d --- /dev/null +++ b/types/lodash/fp/flatMap.d.ts @@ -0,0 +1,189 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlatMap { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: (value: T) => _.Many): FlatMap1x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: (value: T) => _.Many, collection: _.List | null | undefined): TResult[]; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: (value: T[keyof T]) => _.Many): FlatMap2x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: (value: T[keyof T]) => _.Many, collection: T | null | undefined): TResult[]; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: string): FlatMap3x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: string, collection: object | null | undefined): any[]; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: object): FlatMap4x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (iteratee: object, collection: object | null | undefined): boolean[]; +} +interface FlatMap1x1 { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap1x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (collection: _.List | null | undefined): TResult[]; +} +interface FlatMap2x1 { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap2x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (collection: T | null | undefined): TResult[]; +} +interface FlatMap3x1 { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap3x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (collection: object | null | undefined): any[]; +} +interface FlatMap4x1 { + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (): FlatMap4x1; + /** + * Creates an array of flattened values by running each element in collection through iteratee + * and concating its result to the other mapped values. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @return Returns the new flattened array. + */ + (collection: object | null | undefined): boolean[]; +} + +declare const flatMap: FlatMap; +export = flatMap; diff --git a/types/lodash/fp/flatMapDeep.d.ts b/types/lodash/fp/flatMapDeep.d.ts new file mode 100644 index 0000000000..9dad165793 --- /dev/null +++ b/types/lodash/fp/flatMapDeep.d.ts @@ -0,0 +1,342 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlatMapDeep { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult): FlatMapDeep1x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult, collection: _.List | null | undefined): TResult[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult): FlatMapDeep2x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult, collection: T | null | undefined): TResult[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: string): FlatMapDeep3x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: string, collection: object | null | undefined): any[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: object): FlatMapDeep4x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (iteratee: object, collection: object | null | undefined): boolean[]; +} +interface FlatMapDeep1x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep1x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (collection: _.List | null | undefined): TResult[]; +} +interface FlatMapDeep2x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep2x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (collection: T | null | undefined): TResult[]; +} +interface FlatMapDeep3x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep3x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (collection: object | null | undefined): any[]; +} +interface FlatMapDeep4x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (): FlatMapDeep4x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + (collection: object | null | undefined): boolean[]; +} + +declare const flatMapDeep: FlatMapDeep; +export = flatMapDeep; diff --git a/types/lodash/fp/flatMapDepth.d.ts b/types/lodash/fp/flatMapDepth.d.ts new file mode 100644 index 0000000000..d576c2a322 --- /dev/null +++ b/types/lodash/fp/flatMapDepth.d.ts @@ -0,0 +1,687 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlatMapDepth { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult): FlatMapDepth1x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult, depth: number): FlatMapDepth1x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T) => _.ListOfRecursiveArraysOrValues | TResult, depth: number, collection: _.List | null | undefined): TResult[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult): FlatMapDepth2x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult, depth: number): FlatMapDepth2x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: (value: T[keyof T]) => _.ListOfRecursiveArraysOrValues | TResult, depth: number, collection: T | null | undefined): TResult[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: string): FlatMapDepth3x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: string, depth: number): FlatMapDepth3x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: string, depth: number, collection: object | null | undefined): any[]; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: object): FlatMapDepth4x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: object, depth: number): FlatMapDepth4x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (iteratee: object, depth: number, collection: object | null | undefined): boolean[]; +} +interface FlatMapDepth1x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth1x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number): FlatMapDepth1x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number, collection: _.List | null | undefined): TResult[]; +} +interface FlatMapDepth1x2 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth1x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (collection: _.List | null | undefined): TResult[]; +} +interface FlatMapDepth2x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth2x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number): FlatMapDepth2x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number, collection: T | null | undefined): TResult[]; +} +interface FlatMapDepth2x2 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth2x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (collection: T | null | undefined): TResult[]; +} +interface FlatMapDepth3x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth3x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number): FlatMapDepth3x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number, collection: object | null | undefined): any[]; +} +interface FlatMapDepth3x2 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth3x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (collection: object | null | undefined): any[]; +} +interface FlatMapDepth4x1 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth4x1; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number): FlatMapDepth4x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (depth: number, collection: object | null | undefined): boolean[]; +} +interface FlatMapDepth4x2 { + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (): FlatMapDepth4x2; + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @since 4.7.0 + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [depth=1] The maximum recursion depth. + * @returns Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + (collection: object | null | undefined): boolean[]; +} + +declare const flatMapDepth: FlatMapDepth; +export = flatMapDepth; diff --git a/types/lodash/fp/flatten.d.ts b/types/lodash/fp/flatten.d.ts new file mode 100644 index 0000000000..88c928c7b0 --- /dev/null +++ b/types/lodash/fp/flatten.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Flatten = + /** + * Flattens `array` a single level deep. + * + * @param array The array to flatten. + * @return Returns the new flattened array. + */ + (array: _.List<_.Many> | null | undefined) => T[]; + +declare const flatten: Flatten; +export = flatten; diff --git a/types/lodash/fp/flattenDeep.d.ts b/types/lodash/fp/flattenDeep.d.ts new file mode 100644 index 0000000000..4cfb955e6b --- /dev/null +++ b/types/lodash/fp/flattenDeep.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type FlattenDeep = + /** + * Recursively flattens a nested array. + * + * @param array The array to recursively flatten. + * @return Returns the new flattened array. + */ + (array: _.ListOfRecursiveArraysOrValues | null | undefined) => T[]; + +declare const flattenDeep: FlattenDeep; +export = flattenDeep; diff --git a/types/lodash/fp/flattenDepth.d.ts b/types/lodash/fp/flattenDepth.d.ts new file mode 100644 index 0000000000..f5516cf82e --- /dev/null +++ b/types/lodash/fp/flattenDepth.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlattenDepth { + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (): FlattenDepth; + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (depth: number): FlattenDepth1x1; + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (depth: number, array: _.ListOfRecursiveArraysOrValues | null | undefined): T[]; +} +interface FlattenDepth1x1 { + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (): FlattenDepth1x1; + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + (array: _.ListOfRecursiveArraysOrValues | null | undefined): T[]; +} + +declare const flattenDepth: FlattenDepth; +export = flattenDepth; diff --git a/types/lodash/fp/flip.d.ts b/types/lodash/fp/flip.d.ts new file mode 100644 index 0000000000..db73a17b1a --- /dev/null +++ b/types/lodash/fp/flip.d.ts @@ -0,0 +1,24 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Flip = + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @category Function + * @param func The function to flip arguments for. + * @returns Returns the new function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + any>(func: T) => T; + +declare const flip: Flip; +export = flip; diff --git a/types/lodash/fp/floor.d.ts b/types/lodash/fp/floor.d.ts new file mode 100644 index 0000000000..3275466204 --- /dev/null +++ b/types/lodash/fp/floor.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Floor = + /** + * Calculates n rounded down to precision. + * + * @param n The number to round down. + * @param precision The precision to round down to. + * @return Returns the rounded down number. + */ + (n: number) => number; + +declare const floor: Floor; +export = floor; diff --git a/types/lodash/fp/flow.d.ts b/types/lodash/fp/flow.d.ts new file mode 100644 index 0000000000..843b0180f8 --- /dev/null +++ b/types/lodash/fp/flow.d.ts @@ -0,0 +1,355 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Flow { + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2): () => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): () => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): () => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): () => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): () => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): () => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): () => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2): (a1: A1) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3, a4: A4) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3, a4: A4) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3, a4: A4) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3, a4: A4) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3, a4: A4) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3, a4: A4) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; +} + +declare const flow: Flow; +export = flow; diff --git a/types/lodash/fp/flowRight.d.ts b/types/lodash/fp/flowRight.d.ts new file mode 100644 index 0000000000..16f5f2f031 --- /dev/null +++ b/types/lodash/fp/flowRight.d.ts @@ -0,0 +1,315 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FlowRight { + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: () => R1): () => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: () => R1): () => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1) => R1): (a1: A1) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2) => R1): (a1: A1, a2: A2) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3) => R1): (a1: A1, a2: A2, a3: A3) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R2; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R3; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R4; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R5; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R6; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: any[]) => R1): (...args: any[]) => R7; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f7: (a: any) => any, f6: (a: any) => any, f5: (a: any) => any, f4: (a: any) => any, f3: (a: any) => any, f2: (a: any) => any, f1: () => any, ...funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; +} + +declare const flowRight: FlowRight; +export = flowRight; diff --git a/types/lodash/fp/forEach.d.ts b/types/lodash/fp/forEach.d.ts new file mode 100644 index 0000000000..50b4a45bf4 --- /dev/null +++ b/types/lodash/fp/forEach.d.ts @@ -0,0 +1,330 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ForEach { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (): ForEach; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T) => any): ForEach1x1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T) => any, collection: ReadonlyArray): T[]; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: string) => any): ForEach2x1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: string) => any, collection: string): string; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T) => any, collection: _.List): _.List; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T[keyof T]) => any, collection: T): T; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T) => any, collection: TArray & (T[] | null | undefined)): TArray; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: string) => any, collection: TString): TString; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + | null | undefined>(iteratee: (value: T) => any, collection: TList & (_.List | null | undefined)): TList; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined; +} +interface ForEach1x1 { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (): ForEach1x1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: ReadonlyArray): T[]; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: _.List): _.List; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: T1): T1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: TArray & (T[] | null | undefined)): TArray; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + | null | undefined>(collection: TList & (_.List | null | undefined)): TList; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: T1 | null | undefined): T1 | null | undefined; +} +interface ForEach2x1 { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (): ForEach2x1; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: string): string; + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + (collection: TString): TString; +} + +declare const forEach: ForEach; +export = forEach; diff --git a/types/lodash/fp/forEachRight.d.ts b/types/lodash/fp/forEachRight.d.ts new file mode 100644 index 0000000000..75ed3e7fab --- /dev/null +++ b/types/lodash/fp/forEachRight.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ForEachRight { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (): ForEachRight; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T) => any): ForEachRight1x1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T) => any, collection: ReadonlyArray): T[]; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: string) => any): ForEachRight2x1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: string) => any, collection: string): string; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T) => any, collection: _.List): _.List; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T[keyof T]) => any, collection: T): T; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T) => any, collection: TArray & (T[] | null | undefined)): TArray; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: string) => any, collection: TString): TString; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + | null | undefined>(iteratee: (value: T) => any, collection: TList & (_.List | null | undefined)): TList; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined; +} +interface ForEachRight1x1 { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (): ForEachRight1x1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: ReadonlyArray): T[]; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: _.List): _.List; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: T1): T1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: TArray & (T[] | null | undefined)): TArray; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + | null | undefined>(collection: TList & (_.List | null | undefined)): TList; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: T1 | null | undefined): T1 | null | undefined; +} +interface ForEachRight2x1 { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (): ForEachRight2x1; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: string): string; + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + (collection: TString): TString; +} + +declare const forEachRight: ForEachRight; +export = forEachRight; diff --git a/types/lodash/fp/forIn.d.ts b/types/lodash/fp/forIn.d.ts new file mode 100644 index 0000000000..added8f66b --- /dev/null +++ b/types/lodash/fp/forIn.d.ts @@ -0,0 +1,88 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ForIn { + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (): ForIn; + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T) => any): ForIn1x1; + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T[keyof T]) => any, object: T): T; + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined; +} +interface ForIn1x1 { + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (): ForIn1x1; + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (object: T1): T1; + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (object: T1 | null | undefined): T1 | null | undefined; +} + +declare const forIn: ForIn; +export = forIn; diff --git a/types/lodash/fp/forInRight.d.ts b/types/lodash/fp/forInRight.d.ts new file mode 100644 index 0000000000..0525b46d07 --- /dev/null +++ b/types/lodash/fp/forInRight.d.ts @@ -0,0 +1,74 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ForInRight { + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (): ForInRight; + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T) => any): ForInRight1x1; + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T[keyof T]) => any, object: T): T; + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined; +} +interface ForInRight1x1 { + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (): ForInRight1x1; + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (object: T1): T1; + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (object: T1 | null | undefined): T1 | null | undefined; +} + +declare const forInRight: ForInRight; +export = forInRight; diff --git a/types/lodash/fp/forOwn.d.ts b/types/lodash/fp/forOwn.d.ts new file mode 100644 index 0000000000..222463960f --- /dev/null +++ b/types/lodash/fp/forOwn.d.ts @@ -0,0 +1,88 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ForOwn { + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (): ForOwn; + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T) => any): ForOwn1x1; + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T[keyof T]) => any, object: T): T; + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined; +} +interface ForOwn1x1 { + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (): ForOwn1x1; + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (object: T1): T1; + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (object: T1 | null | undefined): T1 | null | undefined; +} + +declare const forOwn: ForOwn; +export = forOwn; diff --git a/types/lodash/fp/forOwnRight.d.ts b/types/lodash/fp/forOwnRight.d.ts new file mode 100644 index 0000000000..310b720ace --- /dev/null +++ b/types/lodash/fp/forOwnRight.d.ts @@ -0,0 +1,74 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ForOwnRight { + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (): ForOwnRight; + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T) => any): ForOwnRight1x1; + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T[keyof T]) => any, object: T): T; + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined; +} +interface ForOwnRight1x1 { + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (): ForOwnRight1x1; + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (object: T1): T1; + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + (object: T1 | null | undefined): T1 | null | undefined; +} + +declare const forOwnRight: ForOwnRight; +export = forOwnRight; diff --git a/types/lodash/fp/fromPairs.d.ts b/types/lodash/fp/fromPairs.d.ts new file mode 100644 index 0000000000..5412865d75 --- /dev/null +++ b/types/lodash/fp/fromPairs.d.ts @@ -0,0 +1,37 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface FromPairs { + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @category Array + * @param pairs The key-value pairs. + * @returns Returns the new object. + * @example + * + * _.fromPairs([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + */ + (pairs: _.List<[_.PropertyName, T]> | null | undefined): _.Dictionary; + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @category Array + * @param pairs The key-value pairs. + * @returns Returns the new object. + * @example + * + * _.fromPairs([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + */ + (pairs: _.List | null | undefined): _.Dictionary; +} + +declare const fromPairs: FromPairs; +export = fromPairs; diff --git a/types/lodash/fp/functions.d.ts b/types/lodash/fp/functions.d.ts new file mode 100644 index 0000000000..bc5cb94ab1 --- /dev/null +++ b/types/lodash/fp/functions.d.ts @@ -0,0 +1,28 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Functions = + /** + * Creates an array of function property names from own enumerable properties + * of `object`. + * + * @category Object + * @param object The object to inspect. + * @returns Returns the new array of property names. + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functions(new Foo); + * // => ['a', 'b'] + */ + (object: any) => string[]; + +declare const functions: Functions; +export = functions; diff --git a/types/lodash/fp/functionsIn.d.ts b/types/lodash/fp/functionsIn.d.ts new file mode 100644 index 0000000000..0189c213d6 --- /dev/null +++ b/types/lodash/fp/functionsIn.d.ts @@ -0,0 +1,28 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type FunctionsIn = + /** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @category Object + * @param object The object to inspect. + * @returns Returns the new array of property names. + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ + (object: any) => string[]; + +declare const functionsIn: FunctionsIn; +export = functionsIn; diff --git a/types/lodash/fp/get.d.ts b/types/lodash/fp/get.d.ts new file mode 100644 index 0000000000..085f3d935f --- /dev/null +++ b/types/lodash/fp/get.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey]): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: any): any; +} + +declare const get: Get; +export = get; diff --git a/types/lodash/fp/getOr.d.ts b/types/lodash/fp/getOr.d.ts new file mode 100644 index 0000000000..db63bd4b1a --- /dev/null +++ b/types/lodash/fp/getOr.d.ts @@ -0,0 +1,313 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: TKey | [TKey]): Get1x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: number): Get2x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: _.PropertyPath): Get3x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: _.PropertyPath, object: null | undefined): TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: any): Get4x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: any, path: _.PropertyPath): Get4x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: any, path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey]): Get1x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number): Get2x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get3x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: null | undefined): TDefault; +} +interface Get1x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject | null | undefined): TObject[TKey] | TDefault; +} +interface Get2x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get2x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary | null | undefined): T | TDefault; +} +interface Get3x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get3x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: null | undefined): TDefault; +} +interface Get4x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get4x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get4x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get4x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get4x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: any): any; +} + +declare const getOr: Get; +export = getOr; diff --git a/types/lodash/fp/groupBy.d.ts b/types/lodash/fp/groupBy.d.ts new file mode 100644 index 0000000000..49f6946225 --- /dev/null +++ b/types/lodash/fp/groupBy.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface GroupBy { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): GroupBy; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: (value: string) => _.NotVoid): GroupBy1x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: (value: string) => _.NotVoid, collection: string | null | undefined): _.Dictionary; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIteratee): GroupBy2x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): _.Dictionary; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIteratee, collection: T | null | undefined): _.Dictionary>; +} +interface GroupBy1x1 { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): GroupBy1x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (collection: string | null | undefined): _.Dictionary; +} +interface GroupBy2x1 { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): GroupBy2x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (collection: _.List | object | null | undefined): _.Dictionary; +} + +declare const groupBy: GroupBy; +export = groupBy; diff --git a/types/lodash/fp/gt.d.ts b/types/lodash/fp/gt.d.ts new file mode 100644 index 0000000000..8102922aee --- /dev/null +++ b/types/lodash/fp/gt.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Gt { + /** + * Checks if value is greater than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than other, else false. + */ + (): Gt; + /** + * Checks if value is greater than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than other, else false. + */ + (value: any): Gt1x1; + /** + * Checks if value is greater than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than other, else false. + */ + (value: any, other: any): boolean; +} +interface Gt1x1 { + /** + * Checks if value is greater than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than other, else false. + */ + (): Gt1x1; + /** + * Checks if value is greater than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than other, else false. + */ + (other: any): boolean; +} + +declare const gt: Gt; +export = gt; diff --git a/types/lodash/fp/gte.d.ts b/types/lodash/fp/gte.d.ts new file mode 100644 index 0000000000..df663c4438 --- /dev/null +++ b/types/lodash/fp/gte.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Gte { + /** + * Checks if value is greater than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than or equal to other, else false. + */ + (): Gte; + /** + * Checks if value is greater than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than or equal to other, else false. + */ + (value: any): Gte1x1; + /** + * Checks if value is greater than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than or equal to other, else false. + */ + (value: any, other: any): boolean; +} +interface Gte1x1 { + /** + * Checks if value is greater than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than or equal to other, else false. + */ + (): Gte1x1; + /** + * Checks if value is greater than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than or equal to other, else false. + */ + (other: any): boolean; +} + +declare const gte: Gte; +export = gte; diff --git a/types/lodash/fp/has.d.ts b/types/lodash/fp/has.d.ts new file mode 100644 index 0000000000..950a57a43b --- /dev/null +++ b/types/lodash/fp/has.d.ts @@ -0,0 +1,138 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Has { + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + (): Has; + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + (path: _.PropertyPath): Has1x1; + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + (path: _.PropertyPath, object: T): boolean; +} +interface Has1x1 { + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + (): Has1x1; + /** + * Checks if `path` is a direct property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + (object: T): boolean; +} + +declare const has: Has; +export = has; diff --git a/types/lodash/fp/hasIn.d.ts b/types/lodash/fp/hasIn.d.ts new file mode 100644 index 0000000000..a5ffb7ae4e --- /dev/null +++ b/types/lodash/fp/hasIn.d.ts @@ -0,0 +1,133 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface HasIn { + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b.c'); + * // => true + * + * _.hasIn(object, ['a', 'b', 'c']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + (): HasIn; + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b.c'); + * // => true + * + * _.hasIn(object, ['a', 'b', 'c']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + (path: _.PropertyPath): HasIn1x1; + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b.c'); + * // => true + * + * _.hasIn(object, ['a', 'b', 'c']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + (path: _.PropertyPath, object: T): boolean; +} +interface HasIn1x1 { + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b.c'); + * // => true + * + * _.hasIn(object, ['a', 'b', 'c']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + (): HasIn1x1; + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @category Object + * @param object The object to query. + * @param path The path to check. + * @returns Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b.c'); + * // => true + * + * _.hasIn(object, ['a', 'b', 'c']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + (object: T): boolean; +} + +declare const hasIn: HasIn; +export = hasIn; diff --git a/types/lodash/fp/head.d.ts b/types/lodash/fp/head.d.ts new file mode 100644 index 0000000000..618e7ca561 --- /dev/null +++ b/types/lodash/fp/head.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Head = + /** + * Gets the first element of array. + * + * @alias _.first + * + * @param array The array to query. + * @return Returns the first element of array. + */ + (array: _.List | null | undefined) => T | undefined; + +declare const head: Head; +export = head; diff --git a/types/lodash/fp/identical.d.ts b/types/lodash/fp/identical.d.ts new file mode 100644 index 0000000000..689227ac95 --- /dev/null +++ b/types/lodash/fp/identical.d.ts @@ -0,0 +1,156 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Eq { + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (): Eq; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (value: any): Eq1x1; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (value: any, other: any): boolean; +} +interface Eq1x1 { + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (): Eq1x1; + /** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + (other: any): boolean; +} + +declare const identical: Eq; +export = identical; diff --git a/types/lodash/fp/identity.d.ts b/types/lodash/fp/identity.d.ts new file mode 100644 index 0000000000..46411f1db1 --- /dev/null +++ b/types/lodash/fp/identity.d.ts @@ -0,0 +1,23 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Identity { + /** + * This method returns the first argument provided to it. + * + * @param value Any value. + * @return Returns value. + */ + (value: T): T; + /** + * This method returns the first argument provided to it. + * + * @param value Any value. + * @return Returns value. + */ + (): undefined; +} + +declare const identity: Identity; +export = identity; diff --git a/types/lodash/fp/inRange.d.ts b/types/lodash/fp/inRange.d.ts new file mode 100644 index 0000000000..564ed81a4e --- /dev/null +++ b/types/lodash/fp/inRange.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface InRange { + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + (): InRange; + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + (start: number): InRange1x1; + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + (start: number, end: number): InRange1x2; + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + (start: number, end: number, n: number): boolean; +} +interface InRange1x1 { + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + (): InRange1x1; + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + (end: number): InRange1x2; + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + (end: number, n: number): boolean; +} +interface InRange1x2 { + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + (): InRange1x2; + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + (n: number): boolean; +} + +declare const inRange: InRange; +export = inRange; diff --git a/types/lodash/fp/includes.d.ts b/types/lodash/fp/includes.d.ts new file mode 100644 index 0000000000..b498f0e8aa --- /dev/null +++ b/types/lodash/fp/includes.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Includes { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (): Includes; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (target: T): Includes1x1; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (target: T, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} +interface Includes1x1 { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (): Includes1x1; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} + +declare const includes: Includes; +export = includes; diff --git a/types/lodash/fp/includesFrom.d.ts b/types/lodash/fp/includesFrom.d.ts new file mode 100644 index 0000000000..45d2f6bab8 --- /dev/null +++ b/types/lodash/fp/includesFrom.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Includes { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (): Includes; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (target: T): Includes1x1; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (target: T, fromIndex: number): Includes1x2; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (target: T, fromIndex: number, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} +interface Includes1x1 { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (): Includes1x1; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (fromIndex: number): Includes1x2; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (fromIndex: number, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} +interface Includes1x2 { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (): Includes1x2; + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean; +} + +declare const includesFrom: Includes; +export = includesFrom; diff --git a/types/lodash/fp/indexBy.d.ts b/types/lodash/fp/indexBy.d.ts new file mode 100644 index 0000000000..22a9e62a3b --- /dev/null +++ b/types/lodash/fp/indexBy.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface KeyBy { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): KeyBy; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: (value: string) => _.PropertyName): KeyBy1x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: (value: string) => _.PropertyName, collection: string | null | undefined): _.Dictionary; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIterateeCustom): KeyBy2x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIterateeCustom, collection: _.List | null | undefined): _.Dictionary; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIterateeCustom, collection: T | null | undefined): _.Dictionary; +} +interface KeyBy1x1 { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): KeyBy1x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (collection: string | null | undefined): _.Dictionary; +} +interface KeyBy2x1 { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): KeyBy2x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (collection: _.List | object | null | undefined): _.Dictionary; +} + +declare const indexBy: KeyBy; +export = indexBy; diff --git a/types/lodash/fp/indexOf.d.ts b/types/lodash/fp/indexOf.d.ts new file mode 100644 index 0000000000..71c684508f --- /dev/null +++ b/types/lodash/fp/indexOf.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IndexOf { + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (): IndexOf; + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (value: T): IndexOf1x1; + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (value: T, array: _.List | null | undefined): number; +} +interface IndexOf1x1 { + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (): IndexOf1x1; + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (array: _.List | null | undefined): number; +} + +declare const indexOf: IndexOf; +export = indexOf; diff --git a/types/lodash/fp/indexOfFrom.d.ts b/types/lodash/fp/indexOfFrom.d.ts new file mode 100644 index 0000000000..22c8315ae5 --- /dev/null +++ b/types/lodash/fp/indexOfFrom.d.ts @@ -0,0 +1,204 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IndexOf { + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (): IndexOf; + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (value: T): IndexOf1x1; + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (value: T, fromIndex: number): IndexOf1x2; + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (value: T, fromIndex: number, array: _.List | null | undefined): number; +} +interface IndexOf1x1 { + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (): IndexOf1x1; + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (fromIndex: number): IndexOf1x2; + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (fromIndex: number, array: _.List | null | undefined): number; +} +interface IndexOf1x2 { + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (): IndexOf1x2; + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @param [fromIndex=0] The index to search from. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + (array: _.List | null | undefined): number; +} + +declare const indexOfFrom: IndexOf; +export = indexOfFrom; diff --git a/types/lodash/fp/init.d.ts b/types/lodash/fp/init.d.ts new file mode 100644 index 0000000000..3c22717976 --- /dev/null +++ b/types/lodash/fp/init.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Initial = + /** + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined) => T[]; + +declare const init: Initial; +export = init; diff --git a/types/lodash/fp/initial.d.ts b/types/lodash/fp/initial.d.ts new file mode 100644 index 0000000000..e4d10ae946 --- /dev/null +++ b/types/lodash/fp/initial.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Initial = + /** + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined) => T[]; + +declare const initial: Initial; +export = initial; diff --git a/types/lodash/fp/intersection.d.ts b/types/lodash/fp/intersection.d.ts new file mode 100644 index 0000000000..ad290ebd3e --- /dev/null +++ b/types/lodash/fp/intersection.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Intersection { + /** + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + (): Intersection; + /** + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + (arrays2: _.List): Intersection1x1; + /** + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + (arrays2: _.List, arrays: _.List): T[]; +} +interface Intersection1x1 { + /** + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + (): Intersection1x1; + /** + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + (arrays: _.List): T[]; +} + +declare const intersection: Intersection; +export = intersection; diff --git a/types/lodash/fp/intersectionBy.d.ts b/types/lodash/fp/intersectionBy.d.ts new file mode 100644 index 0000000000..6b94ad98f7 --- /dev/null +++ b/types/lodash/fp/intersectionBy.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IntersectionBy { + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + (): IntersectionBy; + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + (iteratee: _.ValueIteratee): IntersectionBy1x1; + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + (iteratee: _.ValueIteratee, array: _.List | null): IntersectionBy1x2; + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + (iteratee: _.ValueIteratee, array: _.List | null, values: _.List): T1[]; +} +interface IntersectionBy1x1 { + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + (): IntersectionBy1x1; + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + (array: _.List | null): IntersectionBy1x2; + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + (array: _.List | null, values: _.List): T1[]; +} +interface IntersectionBy1x2 { + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + (): IntersectionBy1x2; + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + (values: _.List): T1[]; +} + +declare const intersectionBy: IntersectionBy; +export = intersectionBy; diff --git a/types/lodash/fp/intersectionWith.d.ts b/types/lodash/fp/intersectionWith.d.ts new file mode 100644 index 0000000000..275d2fb3a9 --- /dev/null +++ b/types/lodash/fp/intersectionWith.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IntersectionWith { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + (): IntersectionWith; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + (comparator: _.Comparator2): IntersectionWith1x1; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + (comparator: _.Comparator2, array: _.List | null | undefined): IntersectionWith1x2; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + (comparator: _.Comparator2, array: _.List | null | undefined, values: _.List): T1[]; +} +interface IntersectionWith1x1 { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + (): IntersectionWith1x1; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + (array: _.List | null | undefined): IntersectionWith1x2; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + (array: _.List | null | undefined, values: _.List): T1[]; +} +interface IntersectionWith1x2 { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + (): IntersectionWith1x2; + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @category Array + * @param [values] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + (values: _.List): T1[]; +} + +declare const intersectionWith: IntersectionWith; +export = intersectionWith; diff --git a/types/lodash/fp/invert.d.ts b/types/lodash/fp/invert.d.ts new file mode 100644 index 0000000000..fa6e62340e --- /dev/null +++ b/types/lodash/fp/invert.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Invert = + /** + * Creates an object composed of the inverted keys and values of object. If object contains duplicate values, + * subsequent values overwrite property assignments of previous values unless multiValue is true. + * + * @param object The object to invert. + * @param multiValue Allow multiple values per key. + * @return Returns the new inverted object. + */ + (object: object) => _.Dictionary; + +declare const invert: Invert; +export = invert; diff --git a/types/lodash/fp/invertBy.d.ts b/types/lodash/fp/invertBy.d.ts new file mode 100644 index 0000000000..5a386385ae --- /dev/null +++ b/types/lodash/fp/invertBy.d.ts @@ -0,0 +1,73 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface InvertBy { + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (): InvertBy; + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (interatee: _.ValueIteratee): InvertBy1x1; + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (interatee: _.ValueIteratee, object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (interatee: _.ValueIteratee, object: T | null | undefined): _.Dictionary; +} +interface InvertBy1x1 { + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (): InvertBy1x1; + /** + * This method is like _.invert except that the inverted object is generated from the results of running each + * element of object through iteratee. The corresponding inverted value of each inverted key is an array of + * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). + * + * @param object The object to invert. + * @param interatee The iteratee invoked per element. + * @return Returns the new inverted object. + */ + (object: _.List | _.Dictionary | _.NumericDictionary | object | null | undefined): _.Dictionary; +} + +declare const invertBy: InvertBy; +export = invertBy; diff --git a/types/lodash/fp/invertObj.d.ts b/types/lodash/fp/invertObj.d.ts new file mode 100644 index 0000000000..aeeb28ca48 --- /dev/null +++ b/types/lodash/fp/invertObj.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Invert = + /** + * Creates an object composed of the inverted keys and values of object. If object contains duplicate values, + * subsequent values overwrite property assignments of previous values unless multiValue is true. + * + * @param object The object to invert. + * @param multiValue Allow multiple values per key. + * @return Returns the new inverted object. + */ + (object: object) => _.Dictionary; + +declare const invertObj: Invert; +export = invertObj; diff --git a/types/lodash/fp/invoke.d.ts b/types/lodash/fp/invoke.d.ts new file mode 100644 index 0000000000..9a72390f8e --- /dev/null +++ b/types/lodash/fp/invoke.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Invoke { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath): Invoke1x1; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath, object: any): any; +} +interface Invoke1x1 { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke1x1; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (object: any): any; +} + +declare const invoke: Invoke; +export = invoke; diff --git a/types/lodash/fp/invokeArgs.d.ts b/types/lodash/fp/invokeArgs.d.ts new file mode 100644 index 0000000000..5c385579fd --- /dev/null +++ b/types/lodash/fp/invokeArgs.d.ts @@ -0,0 +1,78 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Invoke { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath): Invoke1x1; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath, args: ReadonlyArray): Invoke1x2; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (path: _.PropertyPath, args: ReadonlyArray, object: any): any; +} +interface Invoke1x1 { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke1x1; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (args: ReadonlyArray): Invoke1x2; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (args: ReadonlyArray, object: any): any; +} +interface Invoke1x2 { + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (): Invoke1x2; + /** + * Invokes the method at path of object. + * @param object The object to query. + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + **/ + (object: any): any; +} + +declare const invokeArgs: Invoke; +export = invokeArgs; diff --git a/types/lodash/fp/invokeArgsMap.d.ts b/types/lodash/fp/invokeArgsMap.d.ts new file mode 100644 index 0000000000..59e6170594 --- /dev/null +++ b/types/lodash/fp/invokeArgsMap.d.ts @@ -0,0 +1,187 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface InvokeMap { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (): InvokeMap; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (methodName: string): InvokeMap1x1; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (methodName: string, args: ReadonlyArray): InvokeMap1x2; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (methodName: string, args: ReadonlyArray, collection: object | null | undefined): any[]; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (method: (...args: any[]) => TResult): InvokeMap2x1; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (method: (...args: any[]) => TResult, args: ReadonlyArray): InvokeMap2x2; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (method: (...args: any[]) => TResult, args: ReadonlyArray, collection: object | null | undefined): TResult[]; +} +interface InvokeMap1x1 { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (): InvokeMap1x1; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (args: ReadonlyArray): InvokeMap1x2; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (args: ReadonlyArray, collection: object | null | undefined): any[]; +} +interface InvokeMap1x2 { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (): InvokeMap1x2; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (collection: object | null | undefined): any[]; +} +interface InvokeMap2x1 { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (): InvokeMap2x1; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (args: ReadonlyArray): InvokeMap2x2; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (args: ReadonlyArray, collection: object | null | undefined): TResult[]; +} +interface InvokeMap2x2 { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (): InvokeMap2x2; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (collection: object | null | undefined): TResult[]; +} + +declare const invokeArgsMap: InvokeMap; +export = invokeArgsMap; diff --git a/types/lodash/fp/invokeMap.d.ts b/types/lodash/fp/invokeMap.d.ts new file mode 100644 index 0000000000..3bb1072954 --- /dev/null +++ b/types/lodash/fp/invokeMap.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface InvokeMap { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (): InvokeMap; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (methodName: string): InvokeMap1x1; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (methodName: string, collection: object | null | undefined): any[]; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (method: (...args: any[]) => TResult): InvokeMap2x1; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (method: (...args: any[]) => TResult, collection: object | null | undefined): TResult[]; +} +interface InvokeMap1x1 { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (): InvokeMap1x1; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (collection: object | null | undefined): any[]; +} +interface InvokeMap2x1 { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (): InvokeMap2x1; + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + (collection: object | null | undefined): TResult[]; +} + +declare const invokeMap: InvokeMap; +export = invokeMap; diff --git a/types/lodash/fp/isArguments.d.ts b/types/lodash/fp/isArguments.d.ts new file mode 100644 index 0000000000..53841e17fc --- /dev/null +++ b/types/lodash/fp/isArguments.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsArguments = + /** + * Checks if value is classified as an arguments object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is IArguments; + +declare const isArguments: IsArguments; +export = isArguments; diff --git a/types/lodash/fp/isArray.d.ts b/types/lodash/fp/isArray.d.ts new file mode 100644 index 0000000000..6f96cdbe55 --- /dev/null +++ b/types/lodash/fp/isArray.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsArray = + /** + * Checks if value is classified as an Array object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is any[]; + +declare const isArray: IsArray; +export = isArray; diff --git a/types/lodash/fp/isArrayBuffer.d.ts b/types/lodash/fp/isArrayBuffer.d.ts new file mode 100644 index 0000000000..a9fab817ec --- /dev/null +++ b/types/lodash/fp/isArrayBuffer.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsArrayBuffer = + /** + * Checks if value is classified as an ArrayBuffer object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is ArrayBuffer; + +declare const isArrayBuffer: IsArrayBuffer; +export = isArrayBuffer; diff --git a/types/lodash/fp/isArrayLike.d.ts b/types/lodash/fp/isArrayLike.d.ts new file mode 100644 index 0000000000..4d99172433 --- /dev/null +++ b/types/lodash/fp/isArrayLike.d.ts @@ -0,0 +1,78 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsArrayLike { + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + (value: T & string & number): boolean; + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + (value: ((...args: any[]) => any) | null | undefined): value is never; + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + (value: any): value is { length: number }; +} + +declare const isArrayLike: IsArrayLike; +export = isArrayLike; diff --git a/types/lodash/fp/isArrayLikeObject.d.ts b/types/lodash/fp/isArrayLikeObject.d.ts new file mode 100644 index 0000000000..f21c1f6836 --- /dev/null +++ b/types/lodash/fp/isArrayLikeObject.d.ts @@ -0,0 +1,77 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsArrayLikeObject { + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is an array-like object, else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + (value: T & string & number): boolean; + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is an array-like object, else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + // tslint:disable-next-line:ban-types (type guard doesn't seem to work correctly without the Function type) + (value: ((...args: any[]) => any) | Function | string | boolean | number | null | undefined): value is never; + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is an array-like object, else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + // tslint:disable-next-line:ban-types (type guard doesn't seem to work correctly without the Function type) + (value: T | ((...args: any[]) => any) | Function | string | boolean | number | null | undefined): value is T & { length: number }; +} + +declare const isArrayLikeObject: IsArrayLikeObject; +export = isArrayLikeObject; diff --git a/types/lodash/fp/isBoolean.d.ts b/types/lodash/fp/isBoolean.d.ts new file mode 100644 index 0000000000..45aaa6d2f9 --- /dev/null +++ b/types/lodash/fp/isBoolean.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsBoolean = + /** + * Checks if value is classified as a boolean primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is boolean; + +declare const isBoolean: IsBoolean; +export = isBoolean; diff --git a/types/lodash/fp/isBuffer.d.ts b/types/lodash/fp/isBuffer.d.ts new file mode 100644 index 0000000000..a603cf2d68 --- /dev/null +++ b/types/lodash/fp/isBuffer.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsBuffer = + /** + * Checks if value is a buffer. + * + * @param value The value to check. + * @return Returns true if value is a buffer, else false. + */ + (value: any) => boolean; + +declare const isBuffer: IsBuffer; +export = isBuffer; diff --git a/types/lodash/fp/isDate.d.ts b/types/lodash/fp/isDate.d.ts new file mode 100644 index 0000000000..a602131f26 --- /dev/null +++ b/types/lodash/fp/isDate.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsDate = + /** + * Checks if value is classified as a Date object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is Date; + +declare const isDate: IsDate; +export = isDate; diff --git a/types/lodash/fp/isElement.d.ts b/types/lodash/fp/isElement.d.ts new file mode 100644 index 0000000000..56fe27d3a6 --- /dev/null +++ b/types/lodash/fp/isElement.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsElement = + /** + * Checks if value is a DOM element. + * + * @param value The value to check. + * @return Returns true if value is a DOM element, else false. + */ + (value: any) => boolean; + +declare const isElement: IsElement; +export = isElement; diff --git a/types/lodash/fp/isEmpty.d.ts b/types/lodash/fp/isEmpty.d.ts new file mode 100644 index 0000000000..b24d33f88e --- /dev/null +++ b/types/lodash/fp/isEmpty.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsEmpty = + /** + * Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or + * jQuery-like collection with a length greater than 0 or an object with own enumerable properties. + * + * @param value The value to inspect. + * @return Returns true if value is empty, else false. + */ + (value: any) => boolean; + +declare const isEmpty: IsEmpty; +export = isEmpty; diff --git a/types/lodash/fp/isEqual.d.ts b/types/lodash/fp/isEqual.d.ts new file mode 100644 index 0000000000..225f90f914 --- /dev/null +++ b/types/lodash/fp/isEqual.d.ts @@ -0,0 +1,141 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsEqual { + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (): IsEqual; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (value: any): IsEqual1x1; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (value: any, other: any): boolean; +} +interface IsEqual1x1 { + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (): IsEqual1x1; + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + (other: any): boolean; +} + +declare const isEqual: IsEqual; +export = isEqual; diff --git a/types/lodash/fp/isEqualWith.d.ts b/types/lodash/fp/isEqualWith.d.ts new file mode 100644 index 0000000000..832c80829c --- /dev/null +++ b/types/lodash/fp/isEqualWith.d.ts @@ -0,0 +1,285 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IsEqualWith { + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + (): IsEqualWith; + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + (customizer: _.IsEqualCustomizer): IsEqualWith1x1; + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + (customizer: _.IsEqualCustomizer, value: any): IsEqualWith1x2; + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + (customizer: _.IsEqualCustomizer, value: any, other: any): boolean; +} +interface IsEqualWith1x1 { + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + (): IsEqualWith1x1; + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + (value: any): IsEqualWith1x2; + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + (value: any, other: any): boolean; +} +interface IsEqualWith1x2 { + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + (): IsEqualWith1x2; + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @category Lang + * @param value The value to compare. + * @param other The other value to compare. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + (other: any): boolean; +} + +declare const isEqualWith: IsEqualWith; +export = isEqualWith; diff --git a/types/lodash/fp/isError.d.ts b/types/lodash/fp/isError.d.ts new file mode 100644 index 0000000000..6c6f429fdf --- /dev/null +++ b/types/lodash/fp/isError.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsError = + /** + * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError + * object. + * + * @param value The value to check. + * @return Returns true if value is an error object, else false. + */ + (value: any) => value is Error; + +declare const isError: IsError; +export = isError; diff --git a/types/lodash/fp/isFinite.d.ts b/types/lodash/fp/isFinite.d.ts new file mode 100644 index 0000000000..544f4c3fd5 --- /dev/null +++ b/types/lodash/fp/isFinite.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsFinite = + /** + * Checks if value is a finite primitive number. + * + * Note: This method is based on Number.isFinite. + * + * @param value The value to check. + * @return Returns true if value is a finite number, else false. + */ + (value: any) => boolean; + +declare const isFinite: IsFinite; +export = isFinite; diff --git a/types/lodash/fp/isFunction.d.ts b/types/lodash/fp/isFunction.d.ts new file mode 100644 index 0000000000..7a85054a1f --- /dev/null +++ b/types/lodash/fp/isFunction.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsFunction = + /** + * Checks if value is a callable function. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is (...args: any[]) => any; + +declare const isFunction: IsFunction; +export = isFunction; diff --git a/types/lodash/fp/isInteger.d.ts b/types/lodash/fp/isInteger.d.ts new file mode 100644 index 0000000000..d04a6f5cce --- /dev/null +++ b/types/lodash/fp/isInteger.d.ts @@ -0,0 +1,31 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsInteger = + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + (value: any) => boolean; + +declare const isInteger: IsInteger; +export = isInteger; diff --git a/types/lodash/fp/isLength.d.ts b/types/lodash/fp/isLength.d.ts new file mode 100644 index 0000000000..a48a867820 --- /dev/null +++ b/types/lodash/fp/isLength.d.ts @@ -0,0 +1,31 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsLength = + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + (value: any) => boolean; + +declare const isLength: IsLength; +export = isLength; diff --git a/types/lodash/fp/isMap.d.ts b/types/lodash/fp/isMap.d.ts new file mode 100644 index 0000000000..940cb8a4ad --- /dev/null +++ b/types/lodash/fp/isMap.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsMap = + /** + * Checks if value is classified as a Map object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + (value: any) => value is Map; + +declare const isMap: IsMap; +export = isMap; diff --git a/types/lodash/fp/isMatch.d.ts b/types/lodash/fp/isMatch.d.ts new file mode 100644 index 0000000000..231362c358 --- /dev/null +++ b/types/lodash/fp/isMatch.d.ts @@ -0,0 +1,116 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsMatch { + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (): IsMatch; + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (source: object): IsMatch1x1; + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (source: object, object: object): boolean; +} +interface IsMatch1x1 { + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (): IsMatch1x1; + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (object: object): boolean; +} + +declare const isMatch: IsMatch; +export = isMatch; diff --git a/types/lodash/fp/isMatchWith.d.ts b/types/lodash/fp/isMatchWith.d.ts new file mode 100644 index 0000000000..5345ad3863 --- /dev/null +++ b/types/lodash/fp/isMatchWith.d.ts @@ -0,0 +1,285 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface IsMatchWith { + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + (): IsMatchWith; + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + (customizer: _.isMatchWithCustomizer): IsMatchWith1x1; + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + (customizer: _.isMatchWithCustomizer, source: object): IsMatchWith1x2; + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + (customizer: _.isMatchWithCustomizer, source: object, object: object): boolean; +} +interface IsMatchWith1x1 { + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + (): IsMatchWith1x1; + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + (source: object): IsMatchWith1x2; + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + (source: object, object: object): boolean; +} +interface IsMatchWith1x2 { + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + (): IsMatchWith1x2; + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @param [customizer] The function to customize comparisons. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + (object: object): boolean; +} + +declare const isMatchWith: IsMatchWith; +export = isMatchWith; diff --git a/types/lodash/fp/isNaN.d.ts b/types/lodash/fp/isNaN.d.ts new file mode 100644 index 0000000000..f227cd2061 --- /dev/null +++ b/types/lodash/fp/isNaN.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNaN = + /** + * Checks if value is NaN. + * + * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values. + * + * @param value The value to check. + * @return Returns true if value is NaN, else false. + */ + (value: any) => boolean; + +declare const isNaN: IsNaN; +export = isNaN; diff --git a/types/lodash/fp/isNative.d.ts b/types/lodash/fp/isNative.d.ts new file mode 100644 index 0000000000..9dd6543388 --- /dev/null +++ b/types/lodash/fp/isNative.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNative = + /** + * Checks if value is a native function. + * @param value The value to check. + * + * @retrun Returns true if value is a native function, else false. + */ + (value: any) => value is (...args: any[]) => any; + +declare const isNative: IsNative; +export = isNative; diff --git a/types/lodash/fp/isNil.d.ts b/types/lodash/fp/isNil.d.ts new file mode 100644 index 0000000000..07005f1fa1 --- /dev/null +++ b/types/lodash/fp/isNil.d.ts @@ -0,0 +1,26 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNil = + /** + * Checks if `value` is `null` or `undefined`. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + (value: any) => value is null | undefined; + +declare const isNil: IsNil; +export = isNil; diff --git a/types/lodash/fp/isNull.d.ts b/types/lodash/fp/isNull.d.ts new file mode 100644 index 0000000000..b1d5b53e0b --- /dev/null +++ b/types/lodash/fp/isNull.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNull = + /** + * Checks if value is null. + * + * @param value The value to check. + * @return Returns true if value is null, else false. + */ + (value: any) => value is null; + +declare const isNull: IsNull; +export = isNull; diff --git a/types/lodash/fp/isNumber.d.ts b/types/lodash/fp/isNumber.d.ts new file mode 100644 index 0000000000..fda5cca1b8 --- /dev/null +++ b/types/lodash/fp/isNumber.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsNumber = + /** + * Checks if value is classified as a Number primitive or object. + * + * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is number; + +declare const isNumber: IsNumber; +export = isNumber; diff --git a/types/lodash/fp/isObject.d.ts b/types/lodash/fp/isObject.d.ts new file mode 100644 index 0000000000..9f55786107 --- /dev/null +++ b/types/lodash/fp/isObject.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsObject = + /** + * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), + * and new String('')) + * + * @param value The value to check. + * @return Returns true if value is an object, else false. + */ + (value: any) => boolean; + +declare const isObject: IsObject; +export = isObject; diff --git a/types/lodash/fp/isObjectLike.d.ts b/types/lodash/fp/isObjectLike.d.ts new file mode 100644 index 0000000000..17fc948a2d --- /dev/null +++ b/types/lodash/fp/isObjectLike.d.ts @@ -0,0 +1,30 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsObjectLike = + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + (value: any) => boolean; + +declare const isObjectLike: IsObjectLike; +export = isObjectLike; diff --git a/types/lodash/fp/isPlainObject.d.ts b/types/lodash/fp/isPlainObject.d.ts new file mode 100644 index 0000000000..e4cadb9806 --- /dev/null +++ b/types/lodash/fp/isPlainObject.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsPlainObject = + /** + * Checks if value is a plain object, that is, an object created by the Object constructor or one with a + * [[Prototype]] of null. + * + * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties. + * + * @param value The value to check. + * @return Returns true if value is a plain object, else false. + */ + (value: any) => boolean; + +declare const isPlainObject: IsPlainObject; +export = isPlainObject; diff --git a/types/lodash/fp/isRegExp.d.ts b/types/lodash/fp/isRegExp.d.ts new file mode 100644 index 0000000000..98adef2e36 --- /dev/null +++ b/types/lodash/fp/isRegExp.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsRegExp = + /** + * Checks if value is classified as a RegExp object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is RegExp; + +declare const isRegExp: IsRegExp; +export = isRegExp; diff --git a/types/lodash/fp/isSafeInteger.d.ts b/types/lodash/fp/isSafeInteger.d.ts new file mode 100644 index 0000000000..60d49e1be8 --- /dev/null +++ b/types/lodash/fp/isSafeInteger.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsSafeInteger = + /** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ + (value: any) => boolean; + +declare const isSafeInteger: IsSafeInteger; +export = isSafeInteger; diff --git a/types/lodash/fp/isSet.d.ts b/types/lodash/fp/isSet.d.ts new file mode 100644 index 0000000000..7be7de7600 --- /dev/null +++ b/types/lodash/fp/isSet.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsSet = + /** + * Checks if value is classified as a Set object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + (value: any) => value is Set; + +declare const isSet: IsSet; +export = isSet; diff --git a/types/lodash/fp/isString.d.ts b/types/lodash/fp/isString.d.ts new file mode 100644 index 0000000000..fea109178e --- /dev/null +++ b/types/lodash/fp/isString.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsString = + /** + * Checks if value is classified as a String primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => value is string; + +declare const isString: IsString; +export = isString; diff --git a/types/lodash/fp/isSymbol.d.ts b/types/lodash/fp/isSymbol.d.ts new file mode 100644 index 0000000000..fe30bad576 --- /dev/null +++ b/types/lodash/fp/isSymbol.d.ts @@ -0,0 +1,23 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsSymbol = + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @category Lang + * @param value The value to check. + * @returns Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + (value: any) => boolean; + +declare const isSymbol: IsSymbol; +export = isSymbol; diff --git a/types/lodash/fp/isTypedArray.d.ts b/types/lodash/fp/isTypedArray.d.ts new file mode 100644 index 0000000000..076fb84e05 --- /dev/null +++ b/types/lodash/fp/isTypedArray.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsTypedArray = + /** + * Checks if value is classified as a typed array. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + (value: any) => boolean; + +declare const isTypedArray: IsTypedArray; +export = isTypedArray; diff --git a/types/lodash/fp/isUndefined.d.ts b/types/lodash/fp/isUndefined.d.ts new file mode 100644 index 0000000000..3980dd5742 --- /dev/null +++ b/types/lodash/fp/isUndefined.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsUndefined = + /** + * Checks if value is undefined. + * + * @param value The value to check. + * @return Returns true if value is undefined, else false. + */ + (value: any) => value is undefined; + +declare const isUndefined: IsUndefined; +export = isUndefined; diff --git a/types/lodash/fp/isWeakMap.d.ts b/types/lodash/fp/isWeakMap.d.ts new file mode 100644 index 0000000000..9edb2fbb71 --- /dev/null +++ b/types/lodash/fp/isWeakMap.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsWeakMap = + /** + * Checks if value is classified as a WeakMap object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + (value: any) => value is WeakMap; + +declare const isWeakMap: IsWeakMap; +export = isWeakMap; diff --git a/types/lodash/fp/isWeakSet.d.ts b/types/lodash/fp/isWeakSet.d.ts new file mode 100644 index 0000000000..cf7bd7cf01 --- /dev/null +++ b/types/lodash/fp/isWeakSet.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type IsWeakSet = + /** + * Checks if value is classified as a WeakSet object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + (value: any) => value is WeakSet; + +declare const isWeakSet: IsWeakSet; +export = isWeakSet; diff --git a/types/lodash/fp/iteratee.d.ts b/types/lodash/fp/iteratee.d.ts new file mode 100644 index 0000000000..669d1d92d5 --- /dev/null +++ b/types/lodash/fp/iteratee.d.ts @@ -0,0 +1,65 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Iteratee { + /** + * Creates a function that invokes `func` with the arguments of the created + * function. If `func` is a property name the created callback returns the + * property value for a given element. If `func` is an object the created + * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. + * + * @category Util + * @param [func=_.identity] The value to convert to a callback. + * @returns Returns the callback. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // create custom iteratee shorthands + * _.iteratee = _.wrap(_.iteratee, function(callback, func) { + * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); + * return !p ? callback(func) : function(object) { + * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); + * }; + * }); + * + * _.filter(users, 'age > 36'); + * // => [{ 'user': 'fred', 'age': 40 }] + */ + any>(func: TFunction): TFunction; + /** + * Creates a function that invokes `func` with the arguments of the created + * function. If `func` is a property name the created callback returns the + * property value for a given element. If `func` is an object the created + * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. + * + * @category Util + * @param [func=_.identity] The value to convert to a callback. + * @returns Returns the callback. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // create custom iteratee shorthands + * _.iteratee = _.wrap(_.iteratee, function(callback, func) { + * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); + * return !p ? callback(func) : function(object) { + * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); + * }; + * }); + * + * _.filter(users, 'age > 36'); + * // => [{ 'user': 'fred', 'age': 40 }] + */ + (func: string | object): (...args: any[]) => any; +} + +declare const iteratee: Iteratee; +export = iteratee; diff --git a/types/lodash/fp/join.d.ts b/types/lodash/fp/join.d.ts new file mode 100644 index 0000000000..7b678d0738 --- /dev/null +++ b/types/lodash/fp/join.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Join { + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (): Join; + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (separator: string): Join1x1; + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (separator: string, array: _.List | null | undefined): string; +} +interface Join1x1 { + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (): Join1x1; + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @param array The array to convert. + * @param separator The element separator. + * @returns Returns the joined string. + */ + (array: _.List | null | undefined): string; +} + +declare const join: Join; +export = join; diff --git a/types/lodash/fp/juxt.d.ts b/types/lodash/fp/juxt.d.ts new file mode 100644 index 0000000000..9131ad7914 --- /dev/null +++ b/types/lodash/fp/juxt.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Over = + /** + * Creates a function that invokes iteratees with the arguments provided to the created function and returns + * their results. + * + * @param iteratees The iteratees to invoke. + * @return Returns the new function. + */ + (iteratees: _.Many<(...args: any[]) => TResult>) => (...args: any[]) => TResult[]; + +declare const juxt: Over; +export = juxt; diff --git a/types/lodash/fp/kebabCase.d.ts b/types/lodash/fp/kebabCase.d.ts new file mode 100644 index 0000000000..6a46ada134 --- /dev/null +++ b/types/lodash/fp/kebabCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type KebabCase = + /** + * Converts string to kebab case. + * + * @param string The string to convert. + * @return Returns the kebab cased string. + */ + (string: string) => string; + +declare const kebabCase: KebabCase; +export = kebabCase; diff --git a/types/lodash/fp/keyBy.d.ts b/types/lodash/fp/keyBy.d.ts new file mode 100644 index 0000000000..d9ebba52bf --- /dev/null +++ b/types/lodash/fp/keyBy.d.ts @@ -0,0 +1,225 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface KeyBy { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): KeyBy; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: (value: string) => _.PropertyName): KeyBy1x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: (value: string) => _.PropertyName, collection: string | null | undefined): _.Dictionary; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIterateeCustom): KeyBy2x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIterateeCustom, collection: _.List | null | undefined): _.Dictionary; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (iteratee: _.ValueIterateeCustom, collection: T | null | undefined): _.Dictionary; +} +interface KeyBy1x1 { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): KeyBy1x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (collection: string | null | undefined): _.Dictionary; +} +interface KeyBy2x1 { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (): KeyBy2x1; + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + (collection: _.List | object | null | undefined): _.Dictionary; +} + +declare const keyBy: KeyBy; +export = keyBy; diff --git a/types/lodash/fp/keys.d.ts b/types/lodash/fp/keys.d.ts new file mode 100644 index 0000000000..0cfa0ac21e --- /dev/null +++ b/types/lodash/fp/keys.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Keys = + /** + * Creates an array of the own enumerable property names of object. + * + * Note: Non-object values are coerced to objects. See the ES spec for more details. + * + * @param object The object to query. + * @return Returns the array of property names. + */ + (object: any) => string[]; + +declare const keys: Keys; +export = keys; diff --git a/types/lodash/fp/keysIn.d.ts b/types/lodash/fp/keysIn.d.ts new file mode 100644 index 0000000000..827f1edbaa --- /dev/null +++ b/types/lodash/fp/keysIn.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type KeysIn = + /** + * Creates an array of the own and inherited enumerable property names of object. + * + * Note: Non-object values are coerced to objects. + * + * @param object The object to query. + * @return An array of property names. + */ + (object: any) => string[]; + +declare const keysIn: KeysIn; +export = keysIn; diff --git a/types/lodash/fp/last.d.ts b/types/lodash/fp/last.d.ts new file mode 100644 index 0000000000..4473a221f9 --- /dev/null +++ b/types/lodash/fp/last.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Last = + /** + * Gets the last element of array. + * + * @param array The array to query. + * @return Returns the last element of array. + */ + (array: _.List | null | undefined) => T | undefined; + +declare const last: Last; +export = last; diff --git a/types/lodash/fp/lastIndexOf.d.ts b/types/lodash/fp/lastIndexOf.d.ts new file mode 100644 index 0000000000..a21af0a596 --- /dev/null +++ b/types/lodash/fp/lastIndexOf.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface LastIndexOf { + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (): LastIndexOf; + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (value: T): LastIndexOf1x1; + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (value: T, array: _.List | null | undefined): number; +} +interface LastIndexOf1x1 { + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (): LastIndexOf1x1; + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const lastIndexOf: LastIndexOf; +export = lastIndexOf; diff --git a/types/lodash/fp/lastIndexOfFrom.d.ts b/types/lodash/fp/lastIndexOfFrom.d.ts new file mode 100644 index 0000000000..0bea8e22c7 --- /dev/null +++ b/types/lodash/fp/lastIndexOfFrom.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface LastIndexOf { + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (): LastIndexOf; + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (value: T): LastIndexOf1x1; + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (value: T, fromIndex: true|number): LastIndexOf1x2; + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (value: T, fromIndex: true|number, array: _.List | null | undefined): number; +} +interface LastIndexOf1x1 { + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (): LastIndexOf1x1; + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (fromIndex: true|number): LastIndexOf1x2; + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (fromIndex: true|number, array: _.List | null | undefined): number; +} +interface LastIndexOf1x2 { + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (): LastIndexOf1x2; + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + (array: _.List | null | undefined): number; +} + +declare const lastIndexOfFrom: LastIndexOf; +export = lastIndexOfFrom; diff --git a/types/lodash/fp/lowerCase.d.ts b/types/lodash/fp/lowerCase.d.ts new file mode 100644 index 0000000000..628744e48b --- /dev/null +++ b/types/lodash/fp/lowerCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type LowerCase = + /** + * Converts `string`, as space separated words, to lower case. + * + * @param string The string to convert. + * @return Returns the lower cased string. + */ + (string: string) => string; + +declare const lowerCase: LowerCase; +export = lowerCase; diff --git a/types/lodash/fp/lowerFirst.d.ts b/types/lodash/fp/lowerFirst.d.ts new file mode 100644 index 0000000000..a88e572706 --- /dev/null +++ b/types/lodash/fp/lowerFirst.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type LowerFirst = + /** + * Converts the first character of `string` to lower case. + * + * @param string The string to convert. + * @return Returns the converted string. + */ + (string: string) => string; + +declare const lowerFirst: LowerFirst; +export = lowerFirst; diff --git a/types/lodash/fp/lt.d.ts b/types/lodash/fp/lt.d.ts new file mode 100644 index 0000000000..8259c6d845 --- /dev/null +++ b/types/lodash/fp/lt.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Lt { + /** + * Checks if value is less than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than other, else false. + */ + (): Lt; + /** + * Checks if value is less than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than other, else false. + */ + (value: any): Lt1x1; + /** + * Checks if value is less than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than other, else false. + */ + (value: any, other: any): boolean; +} +interface Lt1x1 { + /** + * Checks if value is less than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than other, else false. + */ + (): Lt1x1; + /** + * Checks if value is less than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than other, else false. + */ + (other: any): boolean; +} + +declare const lt: Lt; +export = lt; diff --git a/types/lodash/fp/lte.d.ts b/types/lodash/fp/lte.d.ts new file mode 100644 index 0000000000..e3ac6503f7 --- /dev/null +++ b/types/lodash/fp/lte.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Lte { + /** + * Checks if value is less than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than or equal to other, else false. + */ + (): Lte; + /** + * Checks if value is less than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than or equal to other, else false. + */ + (value: any): Lte1x1; + /** + * Checks if value is less than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than or equal to other, else false. + */ + (value: any, other: any): boolean; +} +interface Lte1x1 { + /** + * Checks if value is less than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than or equal to other, else false. + */ + (): Lte1x1; + /** + * Checks if value is less than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than or equal to other, else false. + */ + (other: any): boolean; +} + +declare const lte: Lte; +export = lte; diff --git a/types/lodash/fp/map.d.ts b/types/lodash/fp/map.d.ts new file mode 100644 index 0000000000..900e11d0d0 --- /dev/null +++ b/types/lodash/fp/map.d.ts @@ -0,0 +1,588 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Map { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: (value: T) => TResult): Map1x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: (value: T) => TResult, collection: T[] | _.List | null | undefined): TResult[]; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: (value: T[keyof T]) => TResult): Map3x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: (value: T[keyof T]) => TResult, collection: T | null | undefined): TResult[]; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: K): Map4x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: K, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): Array; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: string): Map5x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: string, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): any[]; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: object): Map6x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: object, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean[]; +} +interface Map1x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map1x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: T[] | _.List | null | undefined): TResult[]; +} +interface Map3x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map3x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: T | null | undefined): TResult[]; +} +interface Map4x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map4x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): Array; +} +interface Map5x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map5x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): any[]; +} +interface Map6x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map6x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean[]; +} + +declare const map: Map; +export = map; diff --git a/types/lodash/fp/mapKeys.d.ts b/types/lodash/fp/mapKeys.d.ts new file mode 100644 index 0000000000..348fdff591 --- /dev/null +++ b/types/lodash/fp/mapKeys.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MapKeys { + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + (): MapKeys; + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + (iteratee: _.ValueIteratee): MapKeys1x1; + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + (iteratee: _.ValueIteratee, object: _.List | null | undefined): _.Dictionary; + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + (iteratee: _.ValueIteratee): MapKeys2x1; + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + (iteratee: _.ValueIteratee, object: T | null | undefined): _.Dictionary; +} +interface MapKeys1x1 { + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + (): MapKeys1x1; + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + (object: _.List | null | undefined): _.Dictionary; +} +interface MapKeys2x1 { + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + (): MapKeys2x1; + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + (object: T | null | undefined): _.Dictionary; +} + +declare const mapKeys: MapKeys; +export = mapKeys; diff --git a/types/lodash/fp/mapValues.d.ts b/types/lodash/fp/mapValues.d.ts new file mode 100644 index 0000000000..ce44dda737 --- /dev/null +++ b/types/lodash/fp/mapValues.d.ts @@ -0,0 +1,603 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MapValues { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: string) => TResult): MapValues1x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: string) => TResult, obj: string | null | undefined): _.NumericDictionary; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: T) => TResult): MapValues2x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: T) => TResult, obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: T[keyof T]) => TResult): MapValues3x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (callback: (value: T[keyof T]) => TResult, obj: T | null | undefined): { [P in keyof T]: TResult }; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: object): MapValues4x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: object, obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: object, obj: T | null | undefined): { [P in keyof T]: boolean }; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: TKey): MapValues6x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: TKey, obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: string): MapValues7x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: string, obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (iteratee: string, obj: T | null | undefined): { [P in keyof T]: any }; +} +interface MapValues1x1 { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues1x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: string | null | undefined): _.NumericDictionary; +} +interface MapValues2x1 { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues2x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; +} +interface MapValues3x1 { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues3x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: T | null | undefined): { [P in keyof T]: TResult }; +} +interface MapValues4x1 { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues4x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: T | null | undefined): { [P in keyof T]: boolean }; +} +interface MapValues6x1 { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues6x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; +} +interface MapValues7x1 { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (): MapValues7x1; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: _.Dictionary | _.NumericDictionary | null | undefined): _.Dictionary; + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param [iteratee=_.identity] The function invoked per iteration. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new mapped object. + */ + (obj: T | null | undefined): { [P in keyof T]: any }; +} + +declare const mapValues: MapValues; +export = mapValues; diff --git a/types/lodash/fp/matches.d.ts b/types/lodash/fp/matches.d.ts new file mode 100644 index 0000000000..e197d6b711 --- /dev/null +++ b/types/lodash/fp/matches.d.ts @@ -0,0 +1,116 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsMatch { + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (): IsMatch; + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (source: object): IsMatch1x1; + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (source: object, object: object): boolean; +} +interface IsMatch1x1 { + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (): IsMatch1x1; + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (object: object): boolean; +} + +declare const matches: IsMatch; +export = matches; diff --git a/types/lodash/fp/matchesProperty.d.ts b/types/lodash/fp/matchesProperty.d.ts new file mode 100644 index 0000000000..8fec785733 --- /dev/null +++ b/types/lodash/fp/matchesProperty.d.ts @@ -0,0 +1,90 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MatchesProperty { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (): MatchesProperty; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (path: _.PropertyPath): MatchesProperty1x1; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (path: _.PropertyPath, srcValue: T): (value: any) => boolean; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (path: _.PropertyPath, srcValue: T): (value: V) => boolean; +} +interface MatchesProperty1x1 { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (): MatchesProperty1x1; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (srcValue: T): (value: any) => boolean; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (srcValue: T): (value: V) => boolean; +} + +declare const matchesProperty: MatchesProperty; +export = matchesProperty; diff --git a/types/lodash/fp/max.d.ts b/types/lodash/fp/max.d.ts new file mode 100644 index 0000000000..138dba542d --- /dev/null +++ b/types/lodash/fp/max.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Max = + /** + * Computes the maximum value of `array`. If `array` is empty or falsey + * `undefined` is returned. + * + * @category Math + * @param array The array to iterate over. + * @returns Returns the maximum value. + */ + (collection: _.List | null | undefined) => T | undefined; + +declare const max: Max; +export = max; diff --git a/types/lodash/fp/maxBy.d.ts b/types/lodash/fp/maxBy.d.ts new file mode 100644 index 0000000000..44fb2ff7b1 --- /dev/null +++ b/types/lodash/fp/maxBy.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MaxBy { + /** + * This method is like `_.max` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the maximum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.maxBy(objects, function(o) { return o.a; }); + * // => { 'n': 2 } + * + * // using the `_.property` iteratee shorthand + * _.maxBy(objects, 'n'); + * // => { 'n': 2 } + */ + (): MaxBy; + /** + * This method is like `_.max` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the maximum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.maxBy(objects, function(o) { return o.a; }); + * // => { 'n': 2 } + * + * // using the `_.property` iteratee shorthand + * _.maxBy(objects, 'n'); + * // => { 'n': 2 } + */ + (iteratee: _.ValueIteratee): MaxBy1x1; + /** + * This method is like `_.max` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the maximum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.maxBy(objects, function(o) { return o.a; }); + * // => { 'n': 2 } + * + * // using the `_.property` iteratee shorthand + * _.maxBy(objects, 'n'); + * // => { 'n': 2 } + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): T | undefined; +} +interface MaxBy1x1 { + /** + * This method is like `_.max` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the maximum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.maxBy(objects, function(o) { return o.a; }); + * // => { 'n': 2 } + * + * // using the `_.property` iteratee shorthand + * _.maxBy(objects, 'n'); + * // => { 'n': 2 } + */ + (): MaxBy1x1; + /** + * This method is like `_.max` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the maximum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.maxBy(objects, function(o) { return o.a; }); + * // => { 'n': 2 } + * + * // using the `_.property` iteratee shorthand + * _.maxBy(objects, 'n'); + * // => { 'n': 2 } + */ + (collection: _.List | null | undefined): T | undefined; +} + +declare const maxBy: MaxBy; +export = maxBy; diff --git a/types/lodash/fp/mean.d.ts b/types/lodash/fp/mean.d.ts new file mode 100644 index 0000000000..0e37afaeaf --- /dev/null +++ b/types/lodash/fp/mean.d.ts @@ -0,0 +1,22 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Mean = + /** + * Computes the mean of the values in `array`. + * + * @category Math + * @param array The array to iterate over. + * @returns Returns the mean. + * @example + * + * _.mean([4, 2, 8, 6]); + * // => 5 + */ + (collection: _.List | null | undefined) => number; + +declare const mean: Mean; +export = mean; diff --git a/types/lodash/fp/meanBy.d.ts b/types/lodash/fp/meanBy.d.ts new file mode 100644 index 0000000000..7ae670a7b5 --- /dev/null +++ b/types/lodash/fp/meanBy.d.ts @@ -0,0 +1,78 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MeanBy { + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (): MeanBy; + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (iteratee: _.ValueIteratee): MeanBy1x1; + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): number; +} +interface MeanBy1x1 { + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (): MeanBy1x1; + /** + * Computes the mean of the provided propties of the objects in the `array` + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the mean. + * @example + * + * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); + * // => 5 + */ + (collection: _.List | null | undefined): number; +} + +declare const meanBy: MeanBy; +export = meanBy; diff --git a/types/lodash/fp/memoize.d.ts b/types/lodash/fp/memoize.d.ts new file mode 100644 index 0000000000..c694ae0909 --- /dev/null +++ b/types/lodash/fp/memoize.d.ts @@ -0,0 +1,21 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Memoize = + /** + * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for + * storing the result based on the arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with + * the this binding of the memoized function. + * + * @param func The function to have its output memoized. + * @param resolver The function to resolve the cache key. + * @return Returns the new memoizing function. + */ + any>(func: T) => T & _.MemoizedFunction; + +declare const memoize: Memoize; +export = memoize; diff --git a/types/lodash/fp/merge.d.ts b/types/lodash/fp/merge.d.ts new file mode 100644 index 0000000000..fe05c22488 --- /dev/null +++ b/types/lodash/fp/merge.d.ts @@ -0,0 +1,151 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Merge { + /** + * Recursively merges own and inherited enumerable properties of source + * objects into the destination object, skipping source properties that resolve + * to `undefined`. Array and plain object properties are merged recursively. + * Other objects and value types are overridden by assignment. Source objects + * are applied from left to right. Subsequent sources overwrite property + * assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } + */ + (): Merge; + /** + * Recursively merges own and inherited enumerable properties of source + * objects into the destination object, skipping source properties that resolve + * to `undefined`. Array and plain object properties are merged recursively. + * Other objects and value types are overridden by assignment. Source objects + * are applied from left to right. Subsequent sources overwrite property + * assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } + */ + (object: TObject): Merge1x1; + /** + * Recursively merges own and inherited enumerable properties of source + * objects into the destination object, skipping source properties that resolve + * to `undefined`. Array and plain object properties are merged recursively. + * Other objects and value types are overridden by assignment. Source objects + * are applied from left to right. Subsequent sources overwrite property + * assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface Merge1x1 { + /** + * Recursively merges own and inherited enumerable properties of source + * objects into the destination object, skipping source properties that resolve + * to `undefined`. Array and plain object properties are merged recursively. + * Other objects and value types are overridden by assignment. Source objects + * are applied from left to right. Subsequent sources overwrite property + * assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } + */ + (): Merge1x1; + /** + * Recursively merges own and inherited enumerable properties of source + * objects into the destination object, skipping source properties that resolve + * to `undefined`. Array and plain object properties are merged recursively. + * Other objects and value types are overridden by assignment. Source objects + * are applied from left to right. Subsequent sources overwrite property + * assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } + */ + (source: TSource): TObject & TSource; +} + +declare const merge: Merge; +export = merge; diff --git a/types/lodash/fp/mergeAll.d.ts b/types/lodash/fp/mergeAll.d.ts new file mode 100644 index 0000000000..350ef6110c --- /dev/null +++ b/types/lodash/fp/mergeAll.d.ts @@ -0,0 +1,36 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Merge = + /** + * Recursively merges own and inherited enumerable properties of source + * objects into the destination object, skipping source properties that resolve + * to `undefined`. Array and plain object properties are merged recursively. + * Other objects and value types are overridden by assignment. Source objects + * are applied from left to right. Subsequent sources overwrite property + * assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @category Object + * @param object The destination object. + * @param [sources] The source objects. + * @returns Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } + */ + (object: ReadonlyArray) => any; + +declare const mergeAll: Merge; +export = mergeAll; diff --git a/types/lodash/fp/mergeAllWith.d.ts b/types/lodash/fp/mergeAllWith.d.ts new file mode 100644 index 0000000000..96be3f4db9 --- /dev/null +++ b/types/lodash/fp/mergeAllWith.d.ts @@ -0,0 +1,183 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MergeWith { + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (): MergeWith; + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (customizer: _.MergeWithCustomizer): MergeWith1x1; + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (customizer: _.MergeWithCustomizer, args: ReadonlyArray): any; +} +interface MergeWith1x1 { + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (): MergeWith1x1; + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (args: ReadonlyArray): any; +} + +declare const mergeAllWith: MergeWith; +export = mergeAllWith; diff --git a/types/lodash/fp/mergeWith.d.ts b/types/lodash/fp/mergeWith.d.ts new file mode 100644 index 0000000000..64556114df --- /dev/null +++ b/types/lodash/fp/mergeWith.d.ts @@ -0,0 +1,321 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MergeWith { + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (): MergeWith; + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (customizer: _.MergeWithCustomizer): MergeWith1x1; + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (customizer: _.MergeWithCustomizer, object: TObject): MergeWith1x2; + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (customizer: _.MergeWithCustomizer, object: TObject, source: TSource): TObject & TSource; +} +interface MergeWith1x1 { + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (): MergeWith1x1; + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (object: TObject): MergeWith1x2; + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (object: TObject, source: TSource): TObject & TSource; +} +interface MergeWith1x2 { + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (): MergeWith1x2; + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @category Object + * @param object The destination object. + * @param sources The source objects. + * @param customizer The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + (source: TSource): TObject & TSource; +} + +declare const mergeWith: MergeWith; +export = mergeWith; diff --git a/types/lodash/fp/method.d.ts b/types/lodash/fp/method.d.ts new file mode 100644 index 0000000000..e44efd9f07 --- /dev/null +++ b/types/lodash/fp/method.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Method = + /** + * Creates a function that invokes the method at path on a given object. Any additional arguments are provided + * to the invoked method. + * + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + (path: _.PropertyPath) => (object: any) => any; + +declare const method: Method; +export = method; diff --git a/types/lodash/fp/methodOf.d.ts b/types/lodash/fp/methodOf.d.ts new file mode 100644 index 0000000000..6a1a908de7 --- /dev/null +++ b/types/lodash/fp/methodOf.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type MethodOf = + /** + * The opposite of _.method; this method creates a function that invokes the method at a given path on object. + * Any additional arguments are provided to the invoked method. + * + * @param object The object to query. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + (object: object) => (path: _.PropertyPath) => any; + +declare const methodOf: MethodOf; +export = methodOf; diff --git a/types/lodash/fp/min.d.ts b/types/lodash/fp/min.d.ts new file mode 100644 index 0000000000..f637f397ac --- /dev/null +++ b/types/lodash/fp/min.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Min = + /** + * Computes the minimum value of `array`. If `array` is empty or falsey + * `undefined` is returned. + * + * @category Math + * @param array The array to iterate over. + * @returns Returns the minimum value. + */ + (collection: _.List | null | undefined) => T | undefined; + +declare const min: Min; +export = min; diff --git a/types/lodash/fp/minBy.d.ts b/types/lodash/fp/minBy.d.ts new file mode 100644 index 0000000000..b9bdebecd8 --- /dev/null +++ b/types/lodash/fp/minBy.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MinBy { + /** + * This method is like `_.min` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the minimum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.minBy(objects, function(o) { return o.a; }); + * // => { 'n': 1 } + * + * // using the `_.property` iteratee shorthand + * _.minBy(objects, 'n'); + * // => { 'n': 1 } + */ + (): MinBy; + /** + * This method is like `_.min` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the minimum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.minBy(objects, function(o) { return o.a; }); + * // => { 'n': 1 } + * + * // using the `_.property` iteratee shorthand + * _.minBy(objects, 'n'); + * // => { 'n': 1 } + */ + (iteratee: _.ValueIteratee): MinBy1x1; + /** + * This method is like `_.min` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the minimum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.minBy(objects, function(o) { return o.a; }); + * // => { 'n': 1 } + * + * // using the `_.property` iteratee shorthand + * _.minBy(objects, 'n'); + * // => { 'n': 1 } + */ + (iteratee: _.ValueIteratee, collection: _.List | null | undefined): T | undefined; +} +interface MinBy1x1 { + /** + * This method is like `_.min` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the minimum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.minBy(objects, function(o) { return o.a; }); + * // => { 'n': 1 } + * + * // using the `_.property` iteratee shorthand + * _.minBy(objects, 'n'); + * // => { 'n': 1 } + */ + (): MinBy1x1; + /** + * This method is like `_.min` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the minimum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.minBy(objects, function(o) { return o.a; }); + * // => { 'n': 1 } + * + * // using the `_.property` iteratee shorthand + * _.minBy(objects, 'n'); + * // => { 'n': 1 } + */ + (collection: _.List | null | undefined): T | undefined; +} + +declare const minBy: MinBy; +export = minBy; diff --git a/types/lodash/fp/multiply.d.ts b/types/lodash/fp/multiply.d.ts new file mode 100644 index 0000000000..a335372aac --- /dev/null +++ b/types/lodash/fp/multiply.d.ts @@ -0,0 +1,46 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Multiply { + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (): Multiply; + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (multiplier: number): Multiply1x1; + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (multiplier: number, multiplicand: number): number; +} +interface Multiply1x1 { + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (): Multiply1x1; + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + (multiplicand: number): number; +} + +declare const multiply: Multiply; +export = multiply; diff --git a/types/lodash/fp/nAry.d.ts b/types/lodash/fp/nAry.d.ts new file mode 100644 index 0000000000..daede14899 --- /dev/null +++ b/types/lodash/fp/nAry.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Ary { + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (): Ary; + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (n: number): Ary1x1; + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (n: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Ary1x1 { + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (): Ary1x1; + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const nAry: Ary; +export = nAry; diff --git a/types/lodash/fp/negate.d.ts b/types/lodash/fp/negate.d.ts new file mode 100644 index 0000000000..681c5be961 --- /dev/null +++ b/types/lodash/fp/negate.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Negate = + /** + * Creates a function that negates the result of the predicate func. The func predicate is invoked with + * the this binding and arguments of the created function. + * + * @param predicate The predicate to negate. + * @return Returns the new function. + */ + any>(predicate: T) => T; + +declare const negate: Negate; +export = negate; diff --git a/types/lodash/fp/noConflict.d.ts b/types/lodash/fp/noConflict.d.ts new file mode 100644 index 0000000000..2b1a6c71c9 --- /dev/null +++ b/types/lodash/fp/noConflict.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type NoConflict = + /** + * Reverts the _ variable to its previous value and returns a reference to the lodash function. + * + * @return Returns the lodash function. + */ + () => typeof _; + +declare const noConflict: NoConflict; +export = noConflict; diff --git a/types/lodash/fp/noop.d.ts b/types/lodash/fp/noop.d.ts new file mode 100644 index 0000000000..29ce7267ea --- /dev/null +++ b/types/lodash/fp/noop.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Noop = + /** + * A no-operation function that returns undefined regardless of the arguments it receives. + * + * @return undefined + */ + (...args: any[]) => void; + +declare const noop: Noop; +export = noop; diff --git a/types/lodash/fp/now.d.ts b/types/lodash/fp/now.d.ts new file mode 100644 index 0000000000..d450c76116 --- /dev/null +++ b/types/lodash/fp/now.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Now = + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @return The number of milliseconds. + */ + () => number; + +declare const now: Now; +export = now; diff --git a/types/lodash/fp/nth.d.ts b/types/lodash/fp/nth.d.ts new file mode 100644 index 0000000000..a1fbedb1bf --- /dev/null +++ b/types/lodash/fp/nth.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Nth { + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (): Nth; + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (n: number): Nth1x1; + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (n: number, array: _.List | null | undefined): T | undefined; +} +interface Nth1x1 { + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (): Nth1x1; + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + (array: _.List | null | undefined): T | undefined; +} + +declare const nth: Nth; +export = nth; diff --git a/types/lodash/fp/nthArg.d.ts b/types/lodash/fp/nthArg.d.ts new file mode 100644 index 0000000000..5e8335943b --- /dev/null +++ b/types/lodash/fp/nthArg.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type NthArg = + /** + * Creates a function that returns its nth argument. + * + * @param n The index of the argument to return. + * @return Returns the new function. + */ + (n: number) => (...args: any[]) => any; + +declare const nthArg: NthArg; +export = nthArg; diff --git a/types/lodash/fp/omit.d.ts b/types/lodash/fp/omit.d.ts new file mode 100644 index 0000000000..5c7a553b9f --- /dev/null +++ b/types/lodash/fp/omit.d.ts @@ -0,0 +1,132 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Omit { + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (): Omit; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath): Omit1x1; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath, object: T | null | undefined): T; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath, object: T | null | undefined): _.PartialObject; +} +interface Omit1x1 { + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (): Omit1x1; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (object: T | null | undefined): T; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (object: T | null | undefined): _.PartialObject; +} + +declare const omit: Omit; +export = omit; diff --git a/types/lodash/fp/omitAll.d.ts b/types/lodash/fp/omitAll.d.ts new file mode 100644 index 0000000000..a3aec48c5f --- /dev/null +++ b/types/lodash/fp/omitAll.d.ts @@ -0,0 +1,132 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Omit { + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (): Omit; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath): Omit1x1; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath, object: T | null | undefined): T; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (paths: _.PropertyPath, object: T | null | undefined): _.PartialObject; +} +interface Omit1x1 { + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (): Omit1x1; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (object: T | null | undefined): T; + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. + * + * @category Object + * @param object The source object. + * @param [paths] The property names to omit, specified + * individually or in arrays.. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + (object: T | null | undefined): _.PartialObject; +} + +declare const omitAll: Omit; +export = omitAll; diff --git a/types/lodash/fp/omitBy.d.ts b/types/lodash/fp/omitBy.d.ts new file mode 100644 index 0000000000..b0bf665afc --- /dev/null +++ b/types/lodash/fp/omitBy.d.ts @@ -0,0 +1,98 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface OmitBy { + /** + * The opposite of `_.pickBy`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that `predicate` + * doesn't return truthy for. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (): OmitBy; + /** + * The opposite of `_.pickBy`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that `predicate` + * doesn't return truthy for. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (predicate: _.ValueKeyIteratee): OmitBy1x1; + /** + * The opposite of `_.pickBy`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that `predicate` + * doesn't return truthy for. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (predicate: _.ValueKeyIteratee, object: T | null | undefined): _.PartialObject; +} +interface OmitBy1x1 { + /** + * The opposite of `_.pickBy`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that `predicate` + * doesn't return truthy for. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (): OmitBy1x1; + /** + * The opposite of `_.pickBy`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that `predicate` + * doesn't return truthy for. + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + (object: T1 | null | undefined): _.PartialObject; +} + +declare const omitBy: OmitBy; +export = omitBy; diff --git a/types/lodash/fp/once.d.ts b/types/lodash/fp/once.d.ts new file mode 100644 index 0000000000..f97a08a13e --- /dev/null +++ b/types/lodash/fp/once.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Once = + /** + * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value + * of the first call. The func is invoked with the this binding and arguments of the created function. + * + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + any>(func: T) => T; + +declare const once: Once; +export = once; diff --git a/types/lodash/fp/orderBy.d.ts b/types/lodash/fp/orderBy.d.ts new file mode 100644 index 0000000000..4cf7048978 --- /dev/null +++ b/types/lodash/fp/orderBy.d.ts @@ -0,0 +1,461 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface OrderBy { + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (): OrderBy; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (iteratees: _.Many<(value: T) => _.NotVoid>): OrderBy1x1; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (iteratees: _.Many<(value: T) => _.NotVoid>, orders: _.Many): OrderBy1x2; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (iteratees: _.Many<(value: T) => _.NotVoid> | _.Many<_.ValueIteratee>, orders: _.Many, collection: _.List | null | undefined): T[]; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (iteratees: _.Many<_.ValueIteratee>): OrderBy2x1; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (iteratees: _.Many<_.ValueIteratee>, orders: _.Many): OrderBy2x2; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (iteratees: _.Many<(value: T[keyof T]) => _.NotVoid> | _.Many<_.ValueIteratee>, orders: _.Many, collection: T | null | undefined): Array; +} +interface OrderBy1x1 { + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (): OrderBy1x1; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (orders: _.Many): OrderBy1x2; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (orders: _.Many, collection: _.List | object | null | undefined): T[]; +} +interface OrderBy1x2 { + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (): OrderBy1x2; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (collection: _.List | object | null | undefined): T[]; +} +interface OrderBy2x1 { + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (): OrderBy2x1; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (orders: _.Many): OrderBy2x2; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (orders: _.Many, collection: _.List | object | null | undefined): T[]; +} +interface OrderBy2x2 { + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (): OrderBy2x2; + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] The iteratees to sort by. + * @param [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (collection: _.List | object | null | undefined): T[]; +} + +declare const orderBy: OrderBy; +export = orderBy; diff --git a/types/lodash/fp/over.d.ts b/types/lodash/fp/over.d.ts new file mode 100644 index 0000000000..4bd1803827 --- /dev/null +++ b/types/lodash/fp/over.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Over = + /** + * Creates a function that invokes iteratees with the arguments provided to the created function and returns + * their results. + * + * @param iteratees The iteratees to invoke. + * @return Returns the new function. + */ + (iteratees: _.Many<(...args: any[]) => TResult>) => (...args: any[]) => TResult[]; + +declare const over: Over; +export = over; diff --git a/types/lodash/fp/overArgs.d.ts b/types/lodash/fp/overArgs.d.ts new file mode 100644 index 0000000000..84241e3e58 --- /dev/null +++ b/types/lodash/fp/overArgs.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface OverArgs { + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (): OverArgs; + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (func: (...args: any[]) => any): OverArgs1x1; + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (func: (...args: any[]) => any, transforms: _.Many<(...args: any[]) => any>): (...args: any[]) => any; +} +interface OverArgs1x1 { + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (): OverArgs1x1; + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (transforms: _.Many<(...args: any[]) => any>): (...args: any[]) => any; +} + +declare const overArgs: OverArgs; +export = overArgs; diff --git a/types/lodash/fp/overEvery.d.ts b/types/lodash/fp/overEvery.d.ts new file mode 100644 index 0000000000..3ebf8e2abf --- /dev/null +++ b/types/lodash/fp/overEvery.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type OverEvery = + /** + * Creates a function that checks if all of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + (predicates: _.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean; + +declare const overEvery: OverEvery; +export = overEvery; diff --git a/types/lodash/fp/overSome.d.ts b/types/lodash/fp/overSome.d.ts new file mode 100644 index 0000000000..75315b07d0 --- /dev/null +++ b/types/lodash/fp/overSome.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type OverSome = + /** + * Creates a function that checks if any of the predicates return truthy when invoked with the arguments + * provided to the created function. + * + * @param predicates The predicates to check. + * @return Returns the new function. + */ + (predicates: _.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean; + +declare const overSome: OverSome; +export = overSome; diff --git a/types/lodash/fp/pad.d.ts b/types/lodash/fp/pad.d.ts new file mode 100644 index 0000000000..e6581046a2 --- /dev/null +++ b/types/lodash/fp/pad.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Pad { + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): Pad; + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number): Pad1x1; + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number, string: string): string; +} +interface Pad1x1 { + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): Pad1x1; + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (string: string): string; +} + +declare const pad: Pad; +export = pad; diff --git a/types/lodash/fp/padChars.d.ts b/types/lodash/fp/padChars.d.ts new file mode 100644 index 0000000000..11d797db06 --- /dev/null +++ b/types/lodash/fp/padChars.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Pad { + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): Pad; + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (chars: string): Pad1x1; + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (chars: string, length: number): Pad1x2; + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (chars: string, length: number, string: string): string; +} +interface Pad1x1 { + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): Pad1x1; + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number): Pad1x2; + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number, string: string): string; +} +interface Pad1x2 { + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): Pad1x2; + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (string: string): string; +} + +declare const padChars: Pad; +export = padChars; diff --git a/types/lodash/fp/padCharsEnd.d.ts b/types/lodash/fp/padCharsEnd.d.ts new file mode 100644 index 0000000000..01ec387810 --- /dev/null +++ b/types/lodash/fp/padCharsEnd.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PadEnd { + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadEnd; + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (chars: string): PadEnd1x1; + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (chars: string, length: number): PadEnd1x2; + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (chars: string, length: number, string: string): string; +} +interface PadEnd1x1 { + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadEnd1x1; + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number): PadEnd1x2; + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number, string: string): string; +} +interface PadEnd1x2 { + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadEnd1x2; + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (string: string): string; +} + +declare const padCharsEnd: PadEnd; +export = padCharsEnd; diff --git a/types/lodash/fp/padCharsStart.d.ts b/types/lodash/fp/padCharsStart.d.ts new file mode 100644 index 0000000000..cc760b7d0a --- /dev/null +++ b/types/lodash/fp/padCharsStart.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PadStart { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadStart; + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (chars: string): PadStart1x1; + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (chars: string, length: number): PadStart1x2; + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (chars: string, length: number, string: string): string; +} +interface PadStart1x1 { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadStart1x1; + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number): PadStart1x2; + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number, string: string): string; +} +interface PadStart1x2 { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadStart1x2; + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (string: string): string; +} + +declare const padCharsStart: PadStart; +export = padCharsStart; diff --git a/types/lodash/fp/padEnd.d.ts b/types/lodash/fp/padEnd.d.ts new file mode 100644 index 0000000000..aefc8b35ff --- /dev/null +++ b/types/lodash/fp/padEnd.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PadEnd { + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadEnd; + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number): PadEnd1x1; + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number, string: string): string; +} +interface PadEnd1x1 { + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadEnd1x1; + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (string: string): string; +} + +declare const padEnd: PadEnd; +export = padEnd; diff --git a/types/lodash/fp/padStart.d.ts b/types/lodash/fp/padStart.d.ts new file mode 100644 index 0000000000..a40e611e8c --- /dev/null +++ b/types/lodash/fp/padStart.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PadStart { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadStart; + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number): PadStart1x1; + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (length: number, string: string): string; +} +interface PadStart1x1 { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (): PadStart1x1; + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + (string: string): string; +} + +declare const padStart: PadStart; +export = padStart; diff --git a/types/lodash/fp/parseInt.d.ts b/types/lodash/fp/parseInt.d.ts new file mode 100644 index 0000000000..b4257213bd --- /dev/null +++ b/types/lodash/fp/parseInt.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface ParseInt { + /** + * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used + * unless value is a hexadecimal, in which case a radix of 16 is used. + * + * Note: This method aligns with the ES5 implementation of parseInt. + * + * @param string The string to convert. + * @param radix The radix to interpret value by. + * @return Returns the converted integer. + */ + (): ParseInt; + /** + * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used + * unless value is a hexadecimal, in which case a radix of 16 is used. + * + * Note: This method aligns with the ES5 implementation of parseInt. + * + * @param string The string to convert. + * @param radix The radix to interpret value by. + * @return Returns the converted integer. + */ + (radix: number): ParseInt1x1; + /** + * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used + * unless value is a hexadecimal, in which case a radix of 16 is used. + * + * Note: This method aligns with the ES5 implementation of parseInt. + * + * @param string The string to convert. + * @param radix The radix to interpret value by. + * @return Returns the converted integer. + */ + (radix: number, string: string): number; +} +interface ParseInt1x1 { + /** + * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used + * unless value is a hexadecimal, in which case a radix of 16 is used. + * + * Note: This method aligns with the ES5 implementation of parseInt. + * + * @param string The string to convert. + * @param radix The radix to interpret value by. + * @return Returns the converted integer. + */ + (): ParseInt1x1; + /** + * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used + * unless value is a hexadecimal, in which case a radix of 16 is used. + * + * Note: This method aligns with the ES5 implementation of parseInt. + * + * @param string The string to convert. + * @param radix The radix to interpret value by. + * @return Returns the converted integer. + */ + (string: string): number; +} + +declare const parseInt: ParseInt; +export = parseInt; diff --git a/types/lodash/fp/partial.d.ts b/types/lodash/fp/partial.d.ts new file mode 100644 index 0000000000..37c796b0b8 --- /dev/null +++ b/types/lodash/fp/partial.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Partial { + /** + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except + * it does not alter the this binding. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (): Partial; + /** + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except + * it does not alter the this binding. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (args: ReadonlyArray): Partial1x1; + /** + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except + * it does not alter the this binding. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Partial1x1 { + /** + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except + * it does not alter the this binding. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (): Partial1x1; + /** + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except + * it does not alter the this binding. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const partial: Partial; +export = partial; diff --git a/types/lodash/fp/partialRight.d.ts b/types/lodash/fp/partialRight.d.ts new file mode 100644 index 0000000000..d148198d3b --- /dev/null +++ b/types/lodash/fp/partialRight.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface PartialRight { + /** + * This method is like _.partial except that partial arguments are appended to those provided + * to the new function. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (): PartialRight; + /** + * This method is like _.partial except that partial arguments are appended to those provided + * to the new function. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (args: ReadonlyArray): PartialRight1x1; + /** + * This method is like _.partial except that partial arguments are appended to those provided + * to the new function. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface PartialRight1x1 { + /** + * This method is like _.partial except that partial arguments are appended to those provided + * to the new function. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (): PartialRight1x1; + /** + * This method is like _.partial except that partial arguments are appended to those provided + * to the new function. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const partialRight: PartialRight; +export = partialRight; diff --git a/types/lodash/fp/partition.d.ts b/types/lodash/fp/partition.d.ts new file mode 100644 index 0000000000..5e97fd95de --- /dev/null +++ b/types/lodash/fp/partition.d.ts @@ -0,0 +1,133 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Partition { + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + (): Partition; + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + (callback: _.ValueIteratee): Partition1x1; + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + (callback: _.ValueIteratee, collection: _.List | null | undefined): [T[], T[]]; + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + (callback: _.ValueIteratee, collection: T | null | undefined): [Array, Array]; +} +interface Partition1x1 { + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + (): Partition1x1; + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + (collection: _.List | object | null | undefined): [T[], T[]]; +} + +declare const partition: Partition; +export = partition; diff --git a/types/lodash/fp/path.d.ts b/types/lodash/fp/path.d.ts new file mode 100644 index 0000000000..cb8b94efaf --- /dev/null +++ b/types/lodash/fp/path.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey]): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: any): any; +} + +declare const path: Get; +export = path; diff --git a/types/lodash/fp/pathEq.d.ts b/types/lodash/fp/pathEq.d.ts new file mode 100644 index 0000000000..569fffabf8 --- /dev/null +++ b/types/lodash/fp/pathEq.d.ts @@ -0,0 +1,90 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MatchesProperty { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (): MatchesProperty; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (path: _.PropertyPath): MatchesProperty1x1; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (path: _.PropertyPath, srcValue: T): (value: any) => boolean; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (path: _.PropertyPath, srcValue: T): (value: V) => boolean; +} +interface MatchesProperty1x1 { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (): MatchesProperty1x1; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (srcValue: T): (value: any) => boolean; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (srcValue: T): (value: V) => boolean; +} + +declare const pathEq: MatchesProperty; +export = pathEq; diff --git a/types/lodash/fp/pathOr.d.ts b/types/lodash/fp/pathOr.d.ts new file mode 100644 index 0000000000..a62252ce03 --- /dev/null +++ b/types/lodash/fp/pathOr.d.ts @@ -0,0 +1,313 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: TKey | [TKey]): Get1x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: number): Get2x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: _.PropertyPath): Get3x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: _.PropertyPath, object: null | undefined): TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: any): Get4x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: any, path: _.PropertyPath): Get4x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: any, path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey]): Get1x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number): Get2x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get3x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: null | undefined): TDefault; +} +interface Get1x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject | null | undefined): TObject[TKey] | TDefault; +} +interface Get2x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get2x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary | null | undefined): T | TDefault; +} +interface Get3x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get3x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: null | undefined): TDefault; +} +interface Get4x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get4x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get4x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get4x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get4x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: any): any; +} + +declare const pathOr: Get; +export = pathOr; diff --git a/types/lodash/fp/paths.d.ts b/types/lodash/fp/paths.d.ts new file mode 100644 index 0000000000..6aa6bcb6e5 --- /dev/null +++ b/types/lodash/fp/paths.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface At { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (): At; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.PropertyPath): At1x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.PropertyPath, object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.Many): At2x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.Many, object: T | null | undefined): Array; +} +interface At1x1 { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (): At1x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; +} +interface At2x1 { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (): At2x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (object: T | null | undefined): Array; +} + +declare const paths: At; +export = paths; diff --git a/types/lodash/fp/pick.d.ts b/types/lodash/fp/pick.d.ts new file mode 100644 index 0000000000..d90def9925 --- /dev/null +++ b/types/lodash/fp/pick.d.ts @@ -0,0 +1,159 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface LodashPick { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.Many): LodashPick1x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.Many, object: T): Pick; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.PropertyPath): LodashPick2x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.PropertyPath, object: T | null | undefined): _.PartialDeep; +} +interface LodashPick1x1 { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick1x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (object: T): Pick; +} +interface LodashPick2x1 { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick2x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (object: T | null | undefined): _.PartialDeep; +} + +declare const pick: LodashPick; +export = pick; diff --git a/types/lodash/fp/pickAll.d.ts b/types/lodash/fp/pickAll.d.ts new file mode 100644 index 0000000000..0b103c02b7 --- /dev/null +++ b/types/lodash/fp/pickAll.d.ts @@ -0,0 +1,159 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface LodashPick { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.Many): LodashPick1x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.Many, object: T): Pick; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.PropertyPath): LodashPick2x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (props: _.PropertyPath, object: T | null | undefined): _.PartialDeep; +} +interface LodashPick1x1 { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick1x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (object: T): Pick; +} +interface LodashPick2x1 { + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (): LodashPick2x1; + /** + * Creates an object composed of the picked `object` properties. + * + * @category Object + * @param object The source object. + * @param [props] The property names to pick, specified + * individually or in arrays. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + (object: T | null | undefined): _.PartialDeep; +} + +declare const pickAll: LodashPick; +export = pickAll; diff --git a/types/lodash/fp/pickBy.d.ts b/types/lodash/fp/pickBy.d.ts new file mode 100644 index 0000000000..189084f980 --- /dev/null +++ b/types/lodash/fp/pickBy.d.ts @@ -0,0 +1,93 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PickBy { + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (): PickBy; + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (predicate: _.ValueKeyIteratee): PickBy1x1; + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (predicate: _.ValueKeyIteratee, object: T | null | undefined): _.PartialObject; +} +interface PickBy1x1 { + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (): PickBy1x1; + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @category Object + * @param object The source object. + * @param [predicate=_.identity] The function invoked per property. + * @returns Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + (object: T1 | null | undefined): _.PartialObject; +} + +declare const pickBy: PickBy; +export = pickBy; diff --git a/types/lodash/fp/pipe.d.ts b/types/lodash/fp/pipe.d.ts new file mode 100644 index 0000000000..d5fae221ec --- /dev/null +++ b/types/lodash/fp/pipe.d.ts @@ -0,0 +1,355 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Flow { + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2): () => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): () => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): () => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): () => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): () => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): () => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: () => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): () => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2): (a1: A1) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3, a4: A4) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3, a4: A4) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3, a4: A4) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3, a4: A4) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3, a4: A4) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3, a4: A4) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R2; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R3; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R4; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R5; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R6; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R7; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (f1: (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...funcs: Array<_.Many<(a: any) => any>>): (a1: A1, a2: A2, a3: A3, a4: A4, ...args: any[]) => any; + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + (funcs: Array<_.Many<(...args: any[]) => any>>): (...args: any[]) => any; +} + +declare const pipe: Flow; +export = pipe; diff --git a/types/lodash/fp/pluck.d.ts b/types/lodash/fp/pluck.d.ts new file mode 100644 index 0000000000..eec49c3f59 --- /dev/null +++ b/types/lodash/fp/pluck.d.ts @@ -0,0 +1,588 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Map { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: (value: T) => TResult): Map1x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: (value: T) => TResult, collection: T[] | _.List | null | undefined): TResult[]; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: (value: T[keyof T]) => TResult): Map3x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: (value: T[keyof T]) => TResult, collection: T | null | undefined): TResult[]; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: K): Map4x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: K, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): Array; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: string): Map5x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: string, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): any[]; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: object): Map6x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (iteratee: object, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean[]; +} +interface Map1x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map1x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: T[] | _.List | null | undefined): TResult[]; +} +interface Map3x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map3x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: T | null | undefined): TResult[]; +} +interface Map4x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map4x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): Array; +} +interface Map5x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map5x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): any[]; +} +interface Map6x1 { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (): Map6x1; + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * _.Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): boolean[]; +} + +declare const pluck: Map; +export = pluck; diff --git a/types/lodash/fp/prop.d.ts b/types/lodash/fp/prop.d.ts new file mode 100644 index 0000000000..c7d097d000 --- /dev/null +++ b/types/lodash/fp/prop.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey]): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: any): any; +} + +declare const prop: Get; +export = prop; diff --git a/types/lodash/fp/propEq.d.ts b/types/lodash/fp/propEq.d.ts new file mode 100644 index 0000000000..64175cc00a --- /dev/null +++ b/types/lodash/fp/propEq.d.ts @@ -0,0 +1,90 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface MatchesProperty { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (): MatchesProperty; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (path: _.PropertyPath): MatchesProperty1x1; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (path: _.PropertyPath, srcValue: T): (value: any) => boolean; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (path: _.PropertyPath, srcValue: T): (value: V) => boolean; +} +interface MatchesProperty1x1 { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (): MatchesProperty1x1; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (srcValue: T): (value: any) => boolean; + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + (srcValue: T): (value: V) => boolean; +} + +declare const propEq: MatchesProperty; +export = propEq; diff --git a/types/lodash/fp/propOr.d.ts b/types/lodash/fp/propOr.d.ts new file mode 100644 index 0000000000..cfe67fc51c --- /dev/null +++ b/types/lodash/fp/propOr.d.ts @@ -0,0 +1,313 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: TKey | [TKey]): Get1x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: number): Get2x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: _.PropertyPath): Get3x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: TDefault, path: _.PropertyPath, object: null | undefined): TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: any): Get4x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: any, path: _.PropertyPath): Get4x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (defaultValue: any, path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey]): Get1x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number): Get2x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | TDefault; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get3x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: null | undefined): TDefault; +} +interface Get1x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject | null | undefined): TObject[TKey] | TDefault; +} +interface Get2x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get2x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary | null | undefined): T | TDefault; +} +interface Get3x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get3x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: null | undefined): TDefault; +} +interface Get4x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get4x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get4x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get4x2 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get4x2; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: any): any; +} + +declare const propOr: Get; +export = propOr; diff --git a/types/lodash/fp/property.d.ts b/types/lodash/fp/property.d.ts new file mode 100644 index 0000000000..47a4285028 --- /dev/null +++ b/types/lodash/fp/property.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey]): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: any): any; +} + +declare const property: Get; +export = property; diff --git a/types/lodash/fp/propertyOf.d.ts b/types/lodash/fp/propertyOf.d.ts new file mode 100644 index 0000000000..66e2afdaf8 --- /dev/null +++ b/types/lodash/fp/propertyOf.d.ts @@ -0,0 +1,207 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Get { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey]): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: number, object: _.NumericDictionary | null | undefined): T | undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: any): any; +} +interface Get1x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get1x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject): TObject[TKey]; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: TObject | null | undefined): TObject[TKey] | undefined; +} +interface Get3x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get3x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary): T; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: _.NumericDictionary | null | undefined): T | undefined; +} +interface Get5x1 { + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Get5x1; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: null | undefined): undefined; + /** + * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used + * in its place. + * + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: any): any; +} + +declare const propertyOf: Get; +export = propertyOf; diff --git a/types/lodash/fp/props.d.ts b/types/lodash/fp/props.d.ts new file mode 100644 index 0000000000..2b22346229 --- /dev/null +++ b/types/lodash/fp/props.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface At { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (): At; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.PropertyPath): At1x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.PropertyPath, object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.Many): At2x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (props: _.Many, object: T | null | undefined): Array; +} +interface At1x1 { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (): At1x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (object: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; +} +interface At2x1 { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (): At2x1; + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param object The object to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + (object: T | null | undefined): Array; +} + +declare const props: At; +export = props; diff --git a/types/lodash/fp/pull.d.ts b/types/lodash/fp/pull.d.ts new file mode 100644 index 0000000000..3ae9a76b4c --- /dev/null +++ b/types/lodash/fp/pull.d.ts @@ -0,0 +1,83 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Pull { + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + (): Pull; + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + (values: T): Pull1x1; + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + (values: T, array: ReadonlyArray): T[]; + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + (values: T, array: _.List): _.List; +} +interface Pull1x1 { + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + (): Pull1x1; + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + (array: ReadonlyArray): T[]; + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + (array: _.List): _.List; +} + +declare const pull: Pull; +export = pull; diff --git a/types/lodash/fp/pullAll.d.ts b/types/lodash/fp/pullAll.d.ts new file mode 100644 index 0000000000..6df0d3fbe6 --- /dev/null +++ b/types/lodash/fp/pullAll.d.ts @@ -0,0 +1,139 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PullAll { + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (): PullAll; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (values: _.List): PullAll1x1; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (values: _.List, array: ReadonlyArray): T[]; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAll1x1 { + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (): PullAll1x1; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (array: ReadonlyArray): T[]; + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + (array: _.List): _.List; +} + +declare const pullAll: PullAll; +export = pullAll; diff --git a/types/lodash/fp/pullAllBy.d.ts b/types/lodash/fp/pullAllBy.d.ts new file mode 100644 index 0000000000..05a528de2d --- /dev/null +++ b/types/lodash/fp/pullAllBy.d.ts @@ -0,0 +1,502 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PullAllBy { + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (): PullAllBy; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee): PullAllBy1x1; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, values: _.List): PullAllBy1x2; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, values: _.List, array: ReadonlyArray): T[]; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, values: _.List, array: _.List): _.List; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee): PullAllBy3x1; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, values: _.List): PullAllBy3x2; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, values: _.List, array: ReadonlyArray): T1[]; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, values: _.List, array: _.List): _.List; +} +interface PullAllBy1x1 { + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (): PullAllBy1x1; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (values: _.List): PullAllBy1x2; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (values: _.List, array: ReadonlyArray): T[]; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAllBy1x2 { + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (): PullAllBy1x2; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (array: ReadonlyArray): T[]; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (array: _.List): _.List; +} +interface PullAllBy3x1 { + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (): PullAllBy3x1; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (values: _.List): PullAllBy3x2; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (values: _.List, array: ReadonlyArray): T1[]; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAllBy3x2 { + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (): PullAllBy3x2; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (array: ReadonlyArray): T1[]; + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + (array: _.List): _.List; +} + +declare const pullAllBy: PullAllBy; +export = pullAllBy; diff --git a/types/lodash/fp/pullAllWith.d.ts b/types/lodash/fp/pullAllWith.d.ts new file mode 100644 index 0000000000..566eb5ae84 --- /dev/null +++ b/types/lodash/fp/pullAllWith.d.ts @@ -0,0 +1,502 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PullAllWith { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator): PullAllWith1x1; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator, values: _.List): PullAllWith1x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator, values: _.List, array: ReadonlyArray): T[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator, values: _.List, array: _.List): _.List; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator2): PullAllWith3x1; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator2, values: _.List): PullAllWith3x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator2, values: _.List, array: ReadonlyArray): T1[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (comparator: _.Comparator2, values: _.List, array: _.List): _.List; +} +interface PullAllWith1x1 { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith1x1; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List): PullAllWith1x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List, array: ReadonlyArray): T[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAllWith1x2 { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith1x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (array: ReadonlyArray): T[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (array: _.List): _.List; +} +interface PullAllWith3x1 { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith3x1; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List): PullAllWith3x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List, array: ReadonlyArray): T1[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (values: _.List, array: _.List): _.List; +} +interface PullAllWith3x2 { + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (): PullAllWith3x2; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (array: ReadonlyArray): T1[]; + /** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @category Array + * @param array The array to modify. + * @param values The values to remove. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + (array: _.List): _.List; +} + +declare const pullAllWith: PullAllWith; +export = pullAllWith; diff --git a/types/lodash/fp/pullAt.d.ts b/types/lodash/fp/pullAt.d.ts new file mode 100644 index 0000000000..61d6fd04f0 --- /dev/null +++ b/types/lodash/fp/pullAt.d.ts @@ -0,0 +1,90 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface PullAt { + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + (): PullAt; + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + (indexes: _.Many): PullAt1x1; + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + (indexes: _.Many, array: ReadonlyArray): T[]; + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + (indexes: _.Many, array: _.List): _.List; +} +interface PullAt1x1 { + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + (): PullAt1x1; + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + (array: ReadonlyArray): T[]; + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + (array: _.List): _.List; +} + +declare const pullAt: PullAt; +export = pullAt; diff --git a/types/lodash/fp/random.d.ts b/types/lodash/fp/random.d.ts new file mode 100644 index 0000000000..075b54b2e4 --- /dev/null +++ b/types/lodash/fp/random.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Random { + /** + * Produces a random number between min and max (inclusive). If only one argument is provided a number between + * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point + * number is returned instead of an integer. + * + * @param min The minimum possible value. + * @param max The maximum possible value. + * @param floating Specify returning a floating-point number. + * @return Returns the random number. + */ + (): Random; + /** + * Produces a random number between min and max (inclusive). If only one argument is provided a number between + * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point + * number is returned instead of an integer. + * + * @param min The minimum possible value. + * @param max The maximum possible value. + * @param floating Specify returning a floating-point number. + * @return Returns the random number. + */ + (maxOrMin: number): Random1x1; + /** + * Produces a random number between min and max (inclusive). If only one argument is provided a number between + * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point + * number is returned instead of an integer. + * + * @param min The minimum possible value. + * @param max The maximum possible value. + * @param floating Specify returning a floating-point number. + * @return Returns the random number. + */ + (maxOrMin: number, floatingOrMax: boolean | number): number; +} +interface Random1x1 { + /** + * Produces a random number between min and max (inclusive). If only one argument is provided a number between + * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point + * number is returned instead of an integer. + * + * @param min The minimum possible value. + * @param max The maximum possible value. + * @param floating Specify returning a floating-point number. + * @return Returns the random number. + */ + (): Random1x1; + /** + * Produces a random number between min and max (inclusive). If only one argument is provided a number between + * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point + * number is returned instead of an integer. + * + * @param min The minimum possible value. + * @param max The maximum possible value. + * @param floating Specify returning a floating-point number. + * @return Returns the random number. + */ + (floatingOrMax: boolean | number): number; +} + +declare const random: Random; +export = random; diff --git a/types/lodash/fp/range.d.ts b/types/lodash/fp/range.d.ts new file mode 100644 index 0000000000..7526d40e03 --- /dev/null +++ b/types/lodash/fp/range.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Range { + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (): Range; + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (start: number): Range1x1; + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (start: number, end: number): number[]; +} +interface Range1x1 { + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (): Range1x1; + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (end: number): number[]; +} + +declare const range: Range; +export = range; diff --git a/types/lodash/fp/rangeRight.d.ts b/types/lodash/fp/rangeRight.d.ts new file mode 100644 index 0000000000..89337d055a --- /dev/null +++ b/types/lodash/fp/rangeRight.d.ts @@ -0,0 +1,176 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface RangeRight { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (): RangeRight; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (start: number): RangeRight1x1; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (start: number, end: number): number[]; +} +interface RangeRight1x1 { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (): RangeRight1x1; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (end: number): number[]; +} + +declare const rangeRight: RangeRight; +export = rangeRight; diff --git a/types/lodash/fp/rangeStep.d.ts b/types/lodash/fp/rangeStep.d.ts new file mode 100644 index 0000000000..1bd70ebf55 --- /dev/null +++ b/types/lodash/fp/rangeStep.d.ts @@ -0,0 +1,112 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Range { + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (): Range; + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (start: number): Range1x1; + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (start: number, end: number): Range1x2; + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (start: number, end: number, step: number): number[]; +} +interface Range1x1 { + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (): Range1x1; + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (end: number): Range1x2; + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (end: number, step: number): number[]; +} +interface Range1x2 { + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (): Range1x2; + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + (step: number): number[]; +} + +declare const rangeStep: Range; +export = rangeStep; diff --git a/types/lodash/fp/rangeStepRight.d.ts b/types/lodash/fp/rangeStepRight.d.ts new file mode 100644 index 0000000000..dcc223f569 --- /dev/null +++ b/types/lodash/fp/rangeStepRight.d.ts @@ -0,0 +1,310 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface RangeRight { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (): RangeRight; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (start: number): RangeRight1x1; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (start: number, end: number): RangeRight1x2; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (start: number, end: number, step: number): number[]; +} +interface RangeRight1x1 { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (): RangeRight1x1; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (end: number): RangeRight1x2; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (end: number, step: number): number[]; +} +interface RangeRight1x2 { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (): RangeRight1x2; + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @category Util + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @returns Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + (step: number): number[]; +} + +declare const rangeStepRight: RangeRight; +export = rangeStepRight; diff --git a/types/lodash/fp/rearg.d.ts b/types/lodash/fp/rearg.d.ts new file mode 100644 index 0000000000..9ff0dbccfb --- /dev/null +++ b/types/lodash/fp/rearg.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Rearg { + /** + * Creates a function that invokes func with arguments arranged according to the specified indexes where the + * argument value at the first index is provided as the first argument, the argument value at the second index + * is provided as the second argument, and so on. + * @param func The function to rearrange arguments for. + * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. + * @return Returns the new function. + */ + (): Rearg; + /** + * Creates a function that invokes func with arguments arranged according to the specified indexes where the + * argument value at the first index is provided as the first argument, the argument value at the second index + * is provided as the second argument, and so on. + * @param func The function to rearrange arguments for. + * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. + * @return Returns the new function. + */ + (indexes: _.Many): Rearg1x1; + /** + * Creates a function that invokes func with arguments arranged according to the specified indexes where the + * argument value at the first index is provided as the first argument, the argument value at the second index + * is provided as the second argument, and so on. + * @param func The function to rearrange arguments for. + * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. + * @return Returns the new function. + */ + (indexes: _.Many, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Rearg1x1 { + /** + * Creates a function that invokes func with arguments arranged according to the specified indexes where the + * argument value at the first index is provided as the first argument, the argument value at the second index + * is provided as the second argument, and so on. + * @param func The function to rearrange arguments for. + * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. + * @return Returns the new function. + */ + (): Rearg1x1; + /** + * Creates a function that invokes func with arguments arranged according to the specified indexes where the + * argument value at the first index is provided as the first argument, the argument value at the second index + * is provided as the second argument, and so on. + * @param func The function to rearrange arguments for. + * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. + * @return Returns the new function. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const rearg: Rearg; +export = rearg; diff --git a/types/lodash/fp/reduce.d.ts b/types/lodash/fp/reduce.d.ts new file mode 100644 index 0000000000..70071a64e3 --- /dev/null +++ b/types/lodash/fp/reduce.d.ts @@ -0,0 +1,223 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Reduce { + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (): Reduce; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped): Reduce1x1; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped, accumulator: TResult): Reduce1x2; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped, accumulator: TResult, collection: T[] | _.List | null | undefined): TResult; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped): Reduce3x1; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped, accumulator: TResult): Reduce3x2; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (callback: _.MemoIteratorCapped, accumulator: TResult, collection: T | null | undefined): TResult; +} +interface Reduce1x1 { + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (): Reduce1x1; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (accumulator: TResult): Reduce1x2; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (accumulator: TResult, collection: T[] | _.List | null | undefined): TResult; +} +interface Reduce1x2 { + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (): Reduce1x2; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (collection: T[] | _.List | null | undefined): TResult; +} +interface Reduce3x1 { + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (): Reduce3x1; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (accumulator: TResult): Reduce3x2; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (accumulator: TResult, collection: T | null | undefined): TResult; +} +interface Reduce3x2 { + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (): Reduce3x2; + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return Returns the accumulated value. + **/ + (collection: T | null | undefined): TResult; +} + +declare const reduce: Reduce; +export = reduce; diff --git a/types/lodash/fp/reduceRight.d.ts b/types/lodash/fp/reduceRight.d.ts new file mode 100644 index 0000000000..0c8813aa01 --- /dev/null +++ b/types/lodash/fp/reduceRight.d.ts @@ -0,0 +1,172 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ReduceRight { + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (): ReduceRight; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight): ReduceRight1x1; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight, accumulator: TResult): ReduceRight1x2; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight, accumulator: TResult, collection: T[] | _.List | null | undefined): TResult; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight): ReduceRight3x1; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight, accumulator: TResult): ReduceRight3x2; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (callback: _.MemoIteratorCappedRight, accumulator: TResult, collection: T | null | undefined): TResult; +} +interface ReduceRight1x1 { + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (): ReduceRight1x1; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (accumulator: TResult): ReduceRight1x2; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (accumulator: TResult, collection: T[] | _.List | null | undefined): TResult; +} +interface ReduceRight1x2 { + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (): ReduceRight1x2; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (collection: T[] | _.List | null | undefined): TResult; +} +interface ReduceRight3x1 { + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (): ReduceRight3x1; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (accumulator: TResult): ReduceRight3x2; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (accumulator: TResult, collection: T | null | undefined): TResult; +} +interface ReduceRight3x2 { + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (): ReduceRight3x2; + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @return The accumulated value. + **/ + (collection: T | null | undefined): TResult; +} + +declare const reduceRight: ReduceRight; +export = reduceRight; diff --git a/types/lodash/fp/reject.d.ts b/types/lodash/fp/reject.d.ts new file mode 100644 index 0000000000..74a93c3783 --- /dev/null +++ b/types/lodash/fp/reject.d.ts @@ -0,0 +1,115 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Reject { + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (): Reject; + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: (value: string) => boolean): Reject1x1; + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: (value: string) => boolean, collection: string | null | undefined): string[]; + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIterateeCustom): Reject2x1; + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): T[]; + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): Array; +} +interface Reject1x1 { + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (): Reject1x1; + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (collection: string | null | undefined): string[]; +} +interface Reject2x1 { + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (): Reject2x1; + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + (collection: _.List | object | null | undefined): T[]; +} + +declare const reject: Reject; +export = reject; diff --git a/types/lodash/fp/remove.d.ts b/types/lodash/fp/remove.d.ts new file mode 100644 index 0000000000..51ac8aecf8 --- /dev/null +++ b/types/lodash/fp/remove.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Remove { + /** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed + * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Note: Unlike _.filter, this method mutates array. + * + * @param array The array to modify. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new array of removed elements. + */ + (): Remove; + /** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed + * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Note: Unlike _.filter, this method mutates array. + * + * @param array The array to modify. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new array of removed elements. + */ + (predicate: _.ValueIteratee): Remove1x1; + /** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed + * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Note: Unlike _.filter, this method mutates array. + * + * @param array The array to modify. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new array of removed elements. + */ + (predicate: _.ValueIteratee, array: _.List): T[]; +} +interface Remove1x1 { + /** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed + * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Note: Unlike _.filter, this method mutates array. + * + * @param array The array to modify. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new array of removed elements. + */ + (): Remove1x1; + /** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed + * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Note: Unlike _.filter, this method mutates array. + * + * @param array The array to modify. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new array of removed elements. + */ + (array: _.List): T[]; +} + +declare const remove: Remove; +export = remove; diff --git a/types/lodash/fp/repeat.d.ts b/types/lodash/fp/repeat.d.ts new file mode 100644 index 0000000000..4ba7cd4e17 --- /dev/null +++ b/types/lodash/fp/repeat.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Repeat { + /** + * Repeats the given string n times. + * + * @param string The string to repeat. + * @param n The number of times to repeat the string. + * @return Returns the repeated string. + */ + (): Repeat; + /** + * Repeats the given string n times. + * + * @param string The string to repeat. + * @param n The number of times to repeat the string. + * @return Returns the repeated string. + */ + (n: number): Repeat1x1; + /** + * Repeats the given string n times. + * + * @param string The string to repeat. + * @param n The number of times to repeat the string. + * @return Returns the repeated string. + */ + (n: number, string: string): string; +} +interface Repeat1x1 { + /** + * Repeats the given string n times. + * + * @param string The string to repeat. + * @param n The number of times to repeat the string. + * @return Returns the repeated string. + */ + (): Repeat1x1; + /** + * Repeats the given string n times. + * + * @param string The string to repeat. + * @param n The number of times to repeat the string. + * @return Returns the repeated string. + */ + (string: string): string; +} + +declare const repeat: Repeat; +export = repeat; diff --git a/types/lodash/fp/replace.d.ts b/types/lodash/fp/replace.d.ts new file mode 100644 index 0000000000..18e76a4388 --- /dev/null +++ b/types/lodash/fp/replace.d.ts @@ -0,0 +1,87 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Replace { + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (): Replace; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (pattern: RegExp | string): Replace1x1; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (pattern: RegExp | string, replacement: _.ReplaceFunction | string): Replace1x2; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (pattern: RegExp | string, replacement: _.ReplaceFunction | string, string: string): string; +} +interface Replace1x1 { + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (): Replace1x1; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (replacement: _.ReplaceFunction | string): Replace1x2; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (replacement: _.ReplaceFunction | string, string: string): string; +} +interface Replace1x2 { + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (): Replace1x2; + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @return Returns the modified string. + */ + (string: string): string; +} + +declare const replace: Replace; +export = replace; diff --git a/types/lodash/fp/rest.d.ts b/types/lodash/fp/rest.d.ts new file mode 100644 index 0000000000..b92f5adb85 --- /dev/null +++ b/types/lodash/fp/rest.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Rest = + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + (func: (...args: any[]) => any) => (...args: any[]) => any; + +declare const rest: Rest; +export = rest; diff --git a/types/lodash/fp/restFrom.d.ts b/types/lodash/fp/restFrom.d.ts new file mode 100644 index 0000000000..3ca5389f0e --- /dev/null +++ b/types/lodash/fp/restFrom.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Rest { + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + (): Rest; + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + (start: number): Rest1x1; + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + (start: number, func: (...args: any[]) => any): (...args: any[]) => any; +} +interface Rest1x1 { + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + (): Rest1x1; + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + (func: (...args: any[]) => any): (...args: any[]) => any; +} + +declare const restFrom: Rest; +export = restFrom; diff --git a/types/lodash/fp/result.d.ts b/types/lodash/fp/result.d.ts new file mode 100644 index 0000000000..de99d91ff9 --- /dev/null +++ b/types/lodash/fp/result.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Result { + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Result; + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath): Result1x1; + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (path: _.PropertyPath, object: any): TResult; +} +interface Result1x1 { + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (): Result1x1; + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + (object: any): TResult; +} + +declare const result: Result; +export = result; diff --git a/types/lodash/fp/reverse.d.ts b/types/lodash/fp/reverse.d.ts new file mode 100644 index 0000000000..5aa826c5eb --- /dev/null +++ b/types/lodash/fp/reverse.d.ts @@ -0,0 +1,30 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Reverse = + /** + * Reverses `array` so that the first element becomes the last, the second + * element becomes the second to last, and so on. + * + * **Note:** This method mutates `array` and is based on + * [`Array#reverse`](https://mdn.io/Array/reverse). + * + * @category Array + * @returns Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + >(array: TList) => TList; + +declare const reverse: Reverse; +export = reverse; diff --git a/types/lodash/fp/round.d.ts b/types/lodash/fp/round.d.ts new file mode 100644 index 0000000000..359693f99e --- /dev/null +++ b/types/lodash/fp/round.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Round = + /** + * Calculates n rounded to precision. + * + * @param n The number to round. + * @param precision The precision to round to. + * @return Returns the rounded number. + */ + (n: number) => number; + +declare const round: Round; +export = round; diff --git a/types/lodash/fp/runInContext.d.ts b/types/lodash/fp/runInContext.d.ts new file mode 100644 index 0000000000..a09369abec --- /dev/null +++ b/types/lodash/fp/runInContext.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type RunInContext = + /** + * Create a new pristine lodash function using the given context object. + * + * @param context The context object. + * @return Returns a new lodash function. + */ + (context: object) => typeof _; + +declare const runInContext: RunInContext; +export = runInContext; diff --git a/types/lodash/fp/sample.d.ts b/types/lodash/fp/sample.d.ts new file mode 100644 index 0000000000..3ba7c5b6e2 --- /dev/null +++ b/types/lodash/fp/sample.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Sample { + /** + * Gets a random element from collection. + * + * @param collection The collection to sample. + * @return Returns the random element. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T | undefined; + /** + * Gets a random element from collection. + * + * @param collection The collection to sample. + * @return Returns the random element. + */ + (collection: T | null | undefined): T[keyof T] | undefined; +} + +declare const sample: Sample; +export = sample; diff --git a/types/lodash/fp/sampleSize.d.ts b/types/lodash/fp/sampleSize.d.ts new file mode 100644 index 0000000000..17ec045353 --- /dev/null +++ b/types/lodash/fp/sampleSize.d.ts @@ -0,0 +1,69 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SampleSize { + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (): SampleSize; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (n: number): SampleSize1x1; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (n: number, collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (n: number, collection: T | null | undefined): Array; +} +interface SampleSize1x1 { + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (): SampleSize1x1; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (collection: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * Gets n random elements at unique keys from collection up to the size of collection. + * + * @param collection The collection to sample. + * @param n The number of elements to sample. + * @return Returns the random elements. + */ + (collection: T | null | undefined): Array; +} + +declare const sampleSize: SampleSize; +export = sampleSize; diff --git a/types/lodash/fp/set.d.ts b/types/lodash/fp/set.d.ts new file mode 100644 index 0000000000..ea13605dcc --- /dev/null +++ b/types/lodash/fp/set.d.ts @@ -0,0 +1,147 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Set { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: object): TResult; +} +interface Set1x1 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x1; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (value: any, object: object): TResult; +} +interface Set1x2 { + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (): Set1x2; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: T): T; + /** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for + * missing index properties while objects are created for all other missing properties. Use _.setWith to + * customize path creation. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + (object: object): TResult; +} + +declare const set: Set; +export = set; diff --git a/types/lodash/fp/setWith.d.ts b/types/lodash/fp/setWith.d.ts new file mode 100644 index 0000000000..d26b1a88a1 --- /dev/null +++ b/types/lodash/fp/setWith.d.ts @@ -0,0 +1,233 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SetWith { + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (): SetWith; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer): SetWith1x1; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath): SetWith1x2; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, value: any): SetWith1x3; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, value: any, object: T): T; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, value: any, object: T): TResult; +} +interface SetWith1x1 { + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (): SetWith1x1; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (path: _.PropertyPath): SetWith1x2; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (path: _.PropertyPath, value: any): SetWith1x3; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): T; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (path: _.PropertyPath, value: any, object: T): TResult; +} +interface SetWith1x2 { + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (): SetWith1x2; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (value: any): SetWith1x3; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (value: any, object: T): T; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (value: any, object: T): TResult; +} +interface SetWith1x3 { + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (): SetWith1x3; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (object: T): T; + /** + * This method is like _.set except that it accepts customizer which is invoked to produce the objects of + * path. If customizer returns undefined path creation is handled by the method instead. The customizer is + * invoked with three arguments: (nsValue, key, nsObject). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @parem customizer The function to customize assigned values. + * @return Returns object. + */ + (object: T): TResult; +} + +declare const setWith: SetWith; +export = setWith; diff --git a/types/lodash/fp/shuffle.d.ts b/types/lodash/fp/shuffle.d.ts new file mode 100644 index 0000000000..b49c3d10dc --- /dev/null +++ b/types/lodash/fp/shuffle.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Shuffle { + /** + * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. + * + * @param collection The collection to shuffle. + * @return Returns the new shuffled array. + */ + (collection: _.List | null | undefined): T[]; + /** + * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. + * + * @param collection The collection to shuffle. + * @return Returns the new shuffled array. + */ + (collection: T | null | undefined): Array; +} + +declare const shuffle: Shuffle; +export = shuffle; diff --git a/types/lodash/fp/size.d.ts b/types/lodash/fp/size.d.ts new file mode 100644 index 0000000000..cf4ca2d03b --- /dev/null +++ b/types/lodash/fp/size.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Size = + /** + * Gets the size of collection by returning its length for array-like values or the number of own enumerable + * properties for objects. + * + * @param collection The collection to inspect. + * @return Returns the size of collection. + */ + (collection: object | string | null | undefined) => number; + +declare const size: Size; +export = size; diff --git a/types/lodash/fp/slice.d.ts b/types/lodash/fp/slice.d.ts new file mode 100644 index 0000000000..e602154fa1 --- /dev/null +++ b/types/lodash/fp/slice.d.ts @@ -0,0 +1,96 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Slice { + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + (): Slice; + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + (start: number): Slice1x1; + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + (start: number, end: number): Slice1x2; + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + (start: number, end: number, array: _.List | null | undefined): T[]; +} +interface Slice1x1 { + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + (): Slice1x1; + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + (end: number): Slice1x2; + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + (end: number, array: _.List | null | undefined): T[]; +} +interface Slice1x2 { + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + (): Slice1x2; + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const slice: Slice; +export = slice; diff --git a/types/lodash/fp/snakeCase.d.ts b/types/lodash/fp/snakeCase.d.ts new file mode 100644 index 0000000000..ef35bad608 --- /dev/null +++ b/types/lodash/fp/snakeCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type SnakeCase = + /** + * Converts string to snake case. + * + * @param string The string to convert. + * @return Returns the snake cased string. + */ + (string: string) => string; + +declare const snakeCase: SnakeCase; +export = snakeCase; diff --git a/types/lodash/fp/some.d.ts b/types/lodash/fp/some.d.ts new file mode 100644 index 0000000000..f554e380c5 --- /dev/null +++ b/types/lodash/fp/some.d.ts @@ -0,0 +1,67 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Some { + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (): Some; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom): Some1x1; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: _.List | null | undefined): boolean; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (predicate: _.ValueIterateeCustom, collection: T | null | undefined): boolean; +} +interface Some1x1 { + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (): Some1x1; + /** + * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate + * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @return Returns true if any element passes the predicate check, else false. + */ + (collection: _.List | object | null | undefined): boolean; +} + +declare const some: Some; +export = some; diff --git a/types/lodash/fp/sortBy.d.ts b/types/lodash/fp/sortBy.d.ts new file mode 100644 index 0000000000..3b0a1c128c --- /dev/null +++ b/types/lodash/fp/sortBy.d.ts @@ -0,0 +1,205 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortBy { + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.sortBy(users, 'user', function(o) { + * return Math.floor(o.age / 10); + * }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (): SortBy; + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.sortBy(users, 'user', function(o) { + * return Math.floor(o.age / 10); + * }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (iteratees: _.Many<_.ValueIteratee>): SortBy1x1; + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.sortBy(users, 'user', function(o) { + * return Math.floor(o.age / 10); + * }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (iteratees: _.Many<_.ValueIteratee>, collection: _.List | null | undefined): T[]; + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.sortBy(users, 'user', function(o) { + * return Math.floor(o.age / 10); + * }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (iteratees: _.Many<_.ValueIteratee>, collection: T | null | undefined): Array; +} +interface SortBy1x1 { + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.sortBy(users, 'user', function(o) { + * return Math.floor(o.age / 10); + * }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (): SortBy1x1; + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @category Collection + * @param collection The collection to iterate over. + * @param [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.sortBy(users, 'user', function(o) { + * return Math.floor(o.age / 10); + * }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ + (collection: _.List | object | null | undefined): T[]; +} + +declare const sortBy: SortBy; +export = sortBy; diff --git a/types/lodash/fp/sortedIndex.d.ts b/types/lodash/fp/sortedIndex.d.ts new file mode 100644 index 0000000000..c230bd6858 --- /dev/null +++ b/types/lodash/fp/sortedIndex.d.ts @@ -0,0 +1,98 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedIndex { + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (): SortedIndex; + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (value: T): SortedIndex1x1; + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedIndex1x1 { + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (): SortedIndex1x1; + /** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 5], 4); + * // => 0 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedIndex: SortedIndex; +export = sortedIndex; diff --git a/types/lodash/fp/sortedIndexBy.d.ts b/types/lodash/fp/sortedIndexBy.d.ts new file mode 100644 index 0000000000..02a1ffbae6 --- /dev/null +++ b/types/lodash/fp/sortedIndexBy.d.ts @@ -0,0 +1,213 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedIndexBy { + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + (): SortedIndexBy; + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + (iteratee: _.ValueIteratee): SortedIndexBy1x1; + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + (iteratee: _.ValueIteratee, value: T): SortedIndexBy1x2; + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + (iteratee: _.ValueIteratee, value: T, array: _.List | null | undefined): number; +} +interface SortedIndexBy1x1 { + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + (): SortedIndexBy1x1; + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + (value: T): SortedIndexBy1x2; + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedIndexBy1x2 { + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + (): SortedIndexBy1x2; + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedIndexBy: SortedIndexBy; +export = sortedIndexBy; diff --git a/types/lodash/fp/sortedIndexOf.d.ts b/types/lodash/fp/sortedIndexOf.d.ts new file mode 100644 index 0000000000..0b9f5503ab --- /dev/null +++ b/types/lodash/fp/sortedIndexOf.d.ts @@ -0,0 +1,83 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedIndexOf { + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (): SortedIndexOf; + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (value: T): SortedIndexOf1x1; + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedIndexOf1x1 { + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (): SortedIndexOf1x1; + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedIndexOf: SortedIndexOf; +export = sortedIndexOf; diff --git a/types/lodash/fp/sortedLastIndex.d.ts b/types/lodash/fp/sortedLastIndex.d.ts new file mode 100644 index 0000000000..26b45fe1df --- /dev/null +++ b/types/lodash/fp/sortedLastIndex.d.ts @@ -0,0 +1,88 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedLastIndex { + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (): SortedLastIndex; + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (value: T): SortedLastIndex1x1; + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedLastIndex1x1 { + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (): SortedLastIndex1x1; + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedLastIndex: SortedLastIndex; +export = sortedLastIndex; diff --git a/types/lodash/fp/sortedLastIndexBy.d.ts b/types/lodash/fp/sortedLastIndexBy.d.ts new file mode 100644 index 0000000000..6f00b9c982 --- /dev/null +++ b/types/lodash/fp/sortedLastIndexBy.d.ts @@ -0,0 +1,168 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedLastIndexBy { + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + (): SortedLastIndexBy; + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + (iteratee: _.ValueIteratee): SortedLastIndexBy1x1; + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + (iteratee: _.ValueIteratee, value: T): SortedLastIndexBy1x2; + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + (iteratee: _.ValueIteratee, value: T, array: _.List | null | undefined): number; +} +interface SortedLastIndexBy1x1 { + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + (): SortedLastIndexBy1x1; + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + (value: T): SortedLastIndexBy1x2; + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedLastIndexBy1x2 { + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + (): SortedLastIndexBy1x2; + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedLastIndexBy: SortedLastIndexBy; +export = sortedLastIndexBy; diff --git a/types/lodash/fp/sortedLastIndexOf.d.ts b/types/lodash/fp/sortedLastIndexOf.d.ts new file mode 100644 index 0000000000..3fb6d2d77b --- /dev/null +++ b/types/lodash/fp/sortedLastIndexOf.d.ts @@ -0,0 +1,83 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedLastIndexOf { + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (): SortedLastIndexOf; + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (value: T): SortedLastIndexOf1x1; + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (value: T, array: _.List | null | undefined): number; +} +interface SortedLastIndexOf1x1 { + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (): SortedLastIndexOf1x1; + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @category Array + * @param array The array to search. + * @param value The value to search for. + * @returns Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + (array: _.List | null | undefined): number; +} + +declare const sortedLastIndexOf: SortedLastIndexOf; +export = sortedLastIndexOf; diff --git a/types/lodash/fp/sortedUniq.d.ts b/types/lodash/fp/sortedUniq.d.ts new file mode 100644 index 0000000000..ae5c6a826b --- /dev/null +++ b/types/lodash/fp/sortedUniq.d.ts @@ -0,0 +1,23 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type SortedUniq = + /** + * This method is like `_.uniq` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniq([1, 1, 2]); + * // => [1, 2] + */ + (array: _.List | null | undefined) => T[]; + +declare const sortedUniq: SortedUniq; +export = sortedUniq; diff --git a/types/lodash/fp/sortedUniqBy.d.ts b/types/lodash/fp/sortedUniqBy.d.ts new file mode 100644 index 0000000000..9300e80b75 --- /dev/null +++ b/types/lodash/fp/sortedUniqBy.d.ts @@ -0,0 +1,141 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SortedUniqBy { + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (): SortedUniqBy; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (iteratee: (value: string) => _.NotVoid): SortedUniqBy1x1; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (iteratee: (value: string) => _.NotVoid, array: string | null | undefined): string[]; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (iteratee: _.ValueIteratee): SortedUniqBy2x1; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (iteratee: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface SortedUniqBy1x1 { + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (): SortedUniqBy1x1; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (array: string | null | undefined): string[]; +} +interface SortedUniqBy2x1 { + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (): SortedUniqBy2x1; + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @category Array + * @param array The array to inspect. + * @param [iteratee] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + (array: _.List | null | undefined): T[]; +} + +declare const sortedUniqBy: SortedUniqBy; +export = sortedUniqBy; diff --git a/types/lodash/fp/split.d.ts b/types/lodash/fp/split.d.ts new file mode 100644 index 0000000000..50ad820360 --- /dev/null +++ b/types/lodash/fp/split.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Split { + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (): Split; + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (separator: RegExp|string): Split1x1; + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (separator: RegExp|string, string: string): string[]; +} +interface Split1x1 { + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (): Split1x1; + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string The string to trim. + * @param separator The separator pattern to split by. + * @param limit The length to truncate results to. + * @return Returns the new array of string segments. + */ + (string: string): string[]; +} + +declare const split: Split; +export = split; diff --git a/types/lodash/fp/spread.d.ts b/types/lodash/fp/spread.d.ts new file mode 100644 index 0000000000..197c49278d --- /dev/null +++ b/types/lodash/fp/spread.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Spread = + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + (func: (...args: any[]) => TResult) => (...args: any[]) => TResult; + +declare const spread: Spread; +export = spread; diff --git a/types/lodash/fp/spreadFrom.d.ts b/types/lodash/fp/spreadFrom.d.ts new file mode 100644 index 0000000000..7ac31bc9fe --- /dev/null +++ b/types/lodash/fp/spreadFrom.d.ts @@ -0,0 +1,61 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Spread { + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + (): Spread; + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + (start: number): Spread1x1; + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + (start: number, func: (...args: any[]) => TResult): (...args: any[]) => TResult; +} +interface Spread1x1 { + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + (): Spread1x1; + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + (func: (...args: any[]) => TResult): (...args: any[]) => TResult; +} + +declare const spreadFrom: Spread; +export = spreadFrom; diff --git a/types/lodash/fp/startCase.d.ts b/types/lodash/fp/startCase.d.ts new file mode 100644 index 0000000000..ca27b6b47f --- /dev/null +++ b/types/lodash/fp/startCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StartCase = + /** + * Converts string to start case. + * + * @param string The string to convert. + * @return Returns the start cased string. + */ + (string: string) => string; + +declare const startCase: StartCase; +export = startCase; diff --git a/types/lodash/fp/startsWith.d.ts b/types/lodash/fp/startsWith.d.ts new file mode 100644 index 0000000000..962f880742 --- /dev/null +++ b/types/lodash/fp/startsWith.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface StartsWith { + /** + * Checks if string starts with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string starts with target, else false. + */ + (): StartsWith; + /** + * Checks if string starts with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string starts with target, else false. + */ + (target: string): StartsWith1x1; + /** + * Checks if string starts with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string starts with target, else false. + */ + (target: string, string: string): boolean; +} +interface StartsWith1x1 { + /** + * Checks if string starts with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string starts with target, else false. + */ + (): StartsWith1x1; + /** + * Checks if string starts with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string starts with target, else false. + */ + (string: string): boolean; +} + +declare const startsWith: StartsWith; +export = startsWith; diff --git a/types/lodash/fp/stubArray.d.ts b/types/lodash/fp/stubArray.d.ts new file mode 100644 index 0000000000..1dd9667827 --- /dev/null +++ b/types/lodash/fp/stubArray.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubArray = + /** + * This method returns a new empty array. + * + * @returns Returns the new empty array. + */ + () => any[]; + +declare const stubArray: StubArray; +export = stubArray; diff --git a/types/lodash/fp/stubFalse.d.ts b/types/lodash/fp/stubFalse.d.ts new file mode 100644 index 0000000000..abea160b5f --- /dev/null +++ b/types/lodash/fp/stubFalse.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubFalse = + /** + * This method returns `false`. + * + * @returns Returns `false`. + */ + () => boolean; + +declare const stubFalse: StubFalse; +export = stubFalse; diff --git a/types/lodash/fp/stubObject.d.ts b/types/lodash/fp/stubObject.d.ts new file mode 100644 index 0000000000..6765c18b5a --- /dev/null +++ b/types/lodash/fp/stubObject.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubObject = + /** + * This method returns a new empty object. + * + * @returns Returns the new empty object. + */ + () => any; + +declare const stubObject: StubObject; +export = stubObject; diff --git a/types/lodash/fp/stubString.d.ts b/types/lodash/fp/stubString.d.ts new file mode 100644 index 0000000000..66da9843e9 --- /dev/null +++ b/types/lodash/fp/stubString.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubString = + /** + * This method returns an empty string. + * + * @returns Returns the empty string. + */ + () => string; + +declare const stubString: StubString; +export = stubString; diff --git a/types/lodash/fp/stubTrue.d.ts b/types/lodash/fp/stubTrue.d.ts new file mode 100644 index 0000000000..25cba4fcde --- /dev/null +++ b/types/lodash/fp/stubTrue.d.ts @@ -0,0 +1,14 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type StubTrue = + /** + * This method returns `true`. + * + * @returns Returns `true`. + */ + () => boolean; + +declare const stubTrue: StubTrue; +export = stubTrue; diff --git a/types/lodash/fp/subtract.d.ts b/types/lodash/fp/subtract.d.ts new file mode 100644 index 0000000000..b19ddb1f7e --- /dev/null +++ b/types/lodash/fp/subtract.d.ts @@ -0,0 +1,76 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Subtract { + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (): Subtract; + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (minuend: number): Subtract1x1; + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (minuend: number, subtrahend: number): number; +} +interface Subtract1x1 { + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (): Subtract1x1; + /** + * Subtract two numbers. + * + * @category Math + * @param minuend The first number in a subtraction. + * @param subtrahend The second number in a subtraction. + * @returns Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + (subtrahend: number): number; +} + +declare const subtract: Subtract; +export = subtract; diff --git a/types/lodash/fp/sum.d.ts b/types/lodash/fp/sum.d.ts new file mode 100644 index 0000000000..84f6849067 --- /dev/null +++ b/types/lodash/fp/sum.d.ts @@ -0,0 +1,22 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Sum = + /** + * Computes the sum of the values in `array`. + * + * @category Math + * @param array The array to iterate over. + * @returns Returns the sum. + * @example + * + * _.sum([4, 2, 8, 6]); + * // => 20 + */ + (collection: _.List | null | undefined) => number; + +declare const sum: Sum; +export = sum; diff --git a/types/lodash/fp/sumBy.d.ts b/types/lodash/fp/sumBy.d.ts new file mode 100644 index 0000000000..93d6be33f7 --- /dev/null +++ b/types/lodash/fp/sumBy.d.ts @@ -0,0 +1,118 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface SumBy { + /** + * This method is like `_.sum` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the value to be summed. + * The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the sum. + * @example + * + * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; + * + * _.sumBy(objects, function(o) { return o.n; }); + * // => 20 + * + * // using the `_.property` iteratee shorthand + * _.sumBy(objects, 'n'); + * // => 20 + */ + (): SumBy; + /** + * This method is like `_.sum` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the value to be summed. + * The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the sum. + * @example + * + * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; + * + * _.sumBy(objects, function(o) { return o.n; }); + * // => 20 + * + * // using the `_.property` iteratee shorthand + * _.sumBy(objects, 'n'); + * // => 20 + */ + (iteratee: ((value: T) => number) | string): SumBy1x1; + /** + * This method is like `_.sum` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the value to be summed. + * The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the sum. + * @example + * + * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; + * + * _.sumBy(objects, function(o) { return o.n; }); + * // => 20 + * + * // using the `_.property` iteratee shorthand + * _.sumBy(objects, 'n'); + * // => 20 + */ + (iteratee: ((value: T) => number) | string, collection: _.List | null | undefined): number; +} +interface SumBy1x1 { + /** + * This method is like `_.sum` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the value to be summed. + * The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the sum. + * @example + * + * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; + * + * _.sumBy(objects, function(o) { return o.n; }); + * // => 20 + * + * // using the `_.property` iteratee shorthand + * _.sumBy(objects, 'n'); + * // => 20 + */ + (): SumBy1x1; + /** + * This method is like `_.sum` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the value to be summed. + * The iteratee is invoked with one argument: (value). + * + * @category Math + * @param array The array to iterate over. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the sum. + * @example + * + * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; + * + * _.sumBy(objects, function(o) { return o.n; }); + * // => 20 + * + * // using the `_.property` iteratee shorthand + * _.sumBy(objects, 'n'); + * // => 20 + */ + (collection: _.List | null | undefined): number; +} + +declare const sumBy: SumBy; +export = sumBy; diff --git a/types/lodash/fp/symmetricDifference.d.ts b/types/lodash/fp/symmetricDifference.d.ts new file mode 100644 index 0000000000..8d09e4f1a3 --- /dev/null +++ b/types/lodash/fp/symmetricDifference.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Xor { + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (): Xor; + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (arrays2: _.List | null | undefined): Xor1x1; + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (arrays2: _.List | null | undefined, arrays: _.List | null | undefined): T[]; +} +interface Xor1x1 { + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (): Xor1x1; + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (arrays: _.List | null | undefined): T[]; +} + +declare const symmetricDifference: Xor; +export = symmetricDifference; diff --git a/types/lodash/fp/symmetricDifferenceBy.d.ts b/types/lodash/fp/symmetricDifferenceBy.d.ts new file mode 100644 index 0000000000..1bfeb6c6cd --- /dev/null +++ b/types/lodash/fp/symmetricDifferenceBy.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface XorBy { + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (): XorBy; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee): XorBy1x1; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, arrays: _.List | null | undefined): XorBy1x2; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorBy1x1 { + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (): XorBy1x1; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (arrays: _.List | null | undefined): XorBy1x2; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorBy1x2 { + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (): XorBy1x2; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const symmetricDifferenceBy: XorBy; +export = symmetricDifferenceBy; diff --git a/types/lodash/fp/symmetricDifferenceWith.d.ts b/types/lodash/fp/symmetricDifferenceWith.d.ts new file mode 100644 index 0000000000..0aa1d417fb --- /dev/null +++ b/types/lodash/fp/symmetricDifferenceWith.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface XorWith { + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (): XorWith; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (comparator: _.Comparator): XorWith1x1; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined): XorWith1x2; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorWith1x1 { + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (): XorWith1x1; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (arrays: _.List | null | undefined): XorWith1x2; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorWith1x2 { + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (): XorWith1x2; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const symmetricDifferenceWith: XorWith; +export = symmetricDifferenceWith; diff --git a/types/lodash/fp/tail.d.ts b/types/lodash/fp/tail.d.ts new file mode 100644 index 0000000000..1f4e5baea5 --- /dev/null +++ b/types/lodash/fp/tail.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Tail = + /** + * Gets all but the first element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined) => T[]; + +declare const tail: Tail; +export = tail; diff --git a/types/lodash/fp/take.d.ts b/types/lodash/fp/take.d.ts new file mode 100644 index 0000000000..8c64452d27 --- /dev/null +++ b/types/lodash/fp/take.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Take { + /** + * Creates a slice of array with n elements taken from the beginning. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (): Take; + /** + * Creates a slice of array with n elements taken from the beginning. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (n: number): Take1x1; + /** + * Creates a slice of array with n elements taken from the beginning. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface Take1x1 { + /** + * Creates a slice of array with n elements taken from the beginning. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (): Take1x1; + /** + * Creates a slice of array with n elements taken from the beginning. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const take: Take; +export = take; diff --git a/types/lodash/fp/takeLast.d.ts b/types/lodash/fp/takeLast.d.ts new file mode 100644 index 0000000000..6677d06e16 --- /dev/null +++ b/types/lodash/fp/takeLast.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeRight { + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (): TakeRight; + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (n: number): TakeRight1x1; + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface TakeRight1x1 { + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (): TakeRight1x1; + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeLast: TakeRight; +export = takeLast; diff --git a/types/lodash/fp/takeLastWhile.d.ts b/types/lodash/fp/takeLastWhile.d.ts new file mode 100644 index 0000000000..4e2cd0a933 --- /dev/null +++ b/types/lodash/fp/takeLastWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeRightWhile { + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): TakeRightWhile; + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee): TakeRightWhile1x1; + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface TakeRightWhile1x1 { + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): TakeRightWhile1x1; + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeLastWhile: TakeRightWhile; +export = takeLastWhile; diff --git a/types/lodash/fp/takeRight.d.ts b/types/lodash/fp/takeRight.d.ts new file mode 100644 index 0000000000..385f447919 --- /dev/null +++ b/types/lodash/fp/takeRight.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeRight { + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (): TakeRight; + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (n: number): TakeRight1x1; + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (n: number, array: _.List | null | undefined): T[]; +} +interface TakeRight1x1 { + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (): TakeRight1x1; + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeRight: TakeRight; +export = takeRight; diff --git a/types/lodash/fp/takeRightWhile.d.ts b/types/lodash/fp/takeRightWhile.d.ts new file mode 100644 index 0000000000..b2a8934a14 --- /dev/null +++ b/types/lodash/fp/takeRightWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeRightWhile { + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): TakeRightWhile; + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee): TakeRightWhile1x1; + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface TakeRightWhile1x1 { + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): TakeRightWhile1x1; + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeRightWhile: TakeRightWhile; +export = takeRightWhile; diff --git a/types/lodash/fp/takeWhile.d.ts b/types/lodash/fp/takeWhile.d.ts new file mode 100644 index 0000000000..3082de833b --- /dev/null +++ b/types/lodash/fp/takeWhile.d.ts @@ -0,0 +1,108 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface TakeWhile { + /** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): TakeWhile; + /** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee): TakeWhile1x1; + /** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (predicate: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface TakeWhile1x1 { + /** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (): TakeWhile1x1; + /** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + (array: _.List | null | undefined): T[]; +} + +declare const takeWhile: TakeWhile; +export = takeWhile; diff --git a/types/lodash/fp/tap.d.ts b/types/lodash/fp/tap.d.ts new file mode 100644 index 0000000000..2091f9301a --- /dev/null +++ b/types/lodash/fp/tap.d.ts @@ -0,0 +1,66 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Tap { + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + (): Tap; + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + (interceptor: (value: T) => void): Tap1x1; + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + (interceptor: (value: T) => void, value: T): T; +} +interface Tap1x1 { + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + (): Tap1x1; + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + (value: T): T; +} + +declare const tap: Tap; +export = tap; diff --git a/types/lodash/fp/template.d.ts b/types/lodash/fp/template.d.ts new file mode 100644 index 0000000000..f913171374 --- /dev/null +++ b/types/lodash/fp/template.d.ts @@ -0,0 +1,37 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Template = + /** + * Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, + * HTML-escape interpolated data properties in "escape" delimiters, and execute JavaScript in "evaluate" + * delimiters. Data properties may be accessed as free variables in the template. If a setting object is + * provided it takes precedence over _.templateSettings values. + * + * Note: In the development build _.template utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier + * debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @param string The template string. + * @param options The options object. + * @param options.escape The HTML "escape" delimiter. + * @param options.evaluate The "evaluate" delimiter. + * @param options.imports An object to import into the template as free variables. + * @param options.interpolate The "interpolate" delimiter. + * @param options.sourceURL The sourceURL of the template's compiled source. + * @param options.variable The data object variable name. + * @return Returns the compiled template function. + */ + (string: string) => _.TemplateExecutor; + +declare const template: Template; +export = template; diff --git a/types/lodash/fp/throttle.d.ts b/types/lodash/fp/throttle.d.ts new file mode 100644 index 0000000000..7644c669e4 --- /dev/null +++ b/types/lodash/fp/throttle.d.ts @@ -0,0 +1,98 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Throttle { + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations and a flush method to immediately invoke + * them. Provide an options object to indicate that func should be invoked on the leading and/or trailing edge + * of the wait timeout. Subsequent calls to the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + (): Throttle; + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations and a flush method to immediately invoke + * them. Provide an options object to indicate that func should be invoked on the leading and/or trailing edge + * of the wait timeout. Subsequent calls to the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + (wait: number): Throttle1x1; + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations and a flush method to immediately invoke + * them. Provide an options object to indicate that func should be invoked on the leading and/or trailing edge + * of the wait timeout. Subsequent calls to the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + any>(wait: number, func: T): T & _.Cancelable; +} +interface Throttle1x1 { + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations and a flush method to immediately invoke + * them. Provide an options object to indicate that func should be invoked on the leading and/or trailing edge + * of the wait timeout. Subsequent calls to the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + (): Throttle1x1; + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations and a flush method to immediately invoke + * them. Provide an options object to indicate that func should be invoked on the leading and/or trailing edge + * of the wait timeout. Subsequent calls to the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + any>(func: T): T & _.Cancelable; +} + +declare const throttle: Throttle; +export = throttle; diff --git a/types/lodash/fp/thru.d.ts b/types/lodash/fp/thru.d.ts new file mode 100644 index 0000000000..d7f60ba8d0 --- /dev/null +++ b/types/lodash/fp/thru.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Thru { + /** + * This method is like _.tap except that it returns the result of interceptor. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + (): Thru; + /** + * This method is like _.tap except that it returns the result of interceptor. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + (interceptor: (value: T) => TResult): Thru1x1; + /** + * This method is like _.tap except that it returns the result of interceptor. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + (interceptor: (value: T) => TResult, value: T): TResult; +} +interface Thru1x1 { + /** + * This method is like _.tap except that it returns the result of interceptor. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + (): Thru1x1; + /** + * This method is like _.tap except that it returns the result of interceptor. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + (value: T): TResult; +} + +declare const thru: Thru; +export = thru; diff --git a/types/lodash/fp/times.d.ts b/types/lodash/fp/times.d.ts new file mode 100644 index 0000000000..777f7423fc --- /dev/null +++ b/types/lodash/fp/times.d.ts @@ -0,0 +1,56 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Times { + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (): Times; + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (iteratee: (num: number) => TResult): Times1x1; + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (iteratee: (num: number) => TResult, n: number): TResult[]; +} +interface Times1x1 { + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (): Times1x1; + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee + * is invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @return Returns the array of results. + */ + (n: number): TResult[]; +} + +declare const times: Times; +export = times; diff --git a/types/lodash/fp/toArray.d.ts b/types/lodash/fp/toArray.d.ts new file mode 100644 index 0000000000..78d50b3fe3 --- /dev/null +++ b/types/lodash/fp/toArray.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToArray { + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + (value: _.List | _.Dictionary | _.NumericDictionary | null | undefined): T[]; + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + (value: T): Array; + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + (): any[]; +} + +declare const toArray: ToArray; +export = toArray; diff --git a/types/lodash/fp/toFinite.d.ts b/types/lodash/fp/toFinite.d.ts new file mode 100644 index 0000000000..7f28cb70da --- /dev/null +++ b/types/lodash/fp/toFinite.d.ts @@ -0,0 +1,30 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToFinite = + /** + * Converts `value` to a finite number. + * + * @since 4.12.0 + * @category Lang + * @param value The value to convert. + * @returns Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + (value: any) => number; + +declare const toFinite: ToFinite; +export = toFinite; diff --git a/types/lodash/fp/toInteger.d.ts b/types/lodash/fp/toInteger.d.ts new file mode 100644 index 0000000000..7eb32253d7 --- /dev/null +++ b/types/lodash/fp/toInteger.d.ts @@ -0,0 +1,31 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToInteger = + /** + * Converts `value` to an integer. + * + * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @category Lang + * @param value The value to convert. + * @returns Returns the converted integer. + * @example + * + * _.toInteger(3); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3'); + * // => 3 + */ + (value: any) => number; + +declare const toInteger: ToInteger; +export = toInteger; diff --git a/types/lodash/fp/toLength.d.ts b/types/lodash/fp/toLength.d.ts new file mode 100644 index 0000000000..9df6af979b --- /dev/null +++ b/types/lodash/fp/toLength.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToLength = + /** + * Converts `value` to an integer suitable for use as the length of an + * array-like object. + * + * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @category Lang + * @param value The value to convert. + * @return Returns the converted integer. + * @example + * + * _.toLength(3); + * // => 3 + * + * _.toLength(Number.MIN_VALUE); + * // => 0 + * + * _.toLength(Infinity); + * // => 4294967295 + * + * _.toLength('3'); + * // => 3 + */ + (value: any) => number; + +declare const toLength: ToLength; +export = toLength; diff --git a/types/lodash/fp/toLower.d.ts b/types/lodash/fp/toLower.d.ts new file mode 100644 index 0000000000..6423a579b2 --- /dev/null +++ b/types/lodash/fp/toLower.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToLower = + /** + * Converts `string`, as a whole, to lower case. + * + * @param string The string to convert. + * @return Returns the lower cased string. + */ + (string: string) => string; + +declare const toLower: ToLower; +export = toLower; diff --git a/types/lodash/fp/toNumber.d.ts b/types/lodash/fp/toNumber.d.ts new file mode 100644 index 0000000000..346ded8778 --- /dev/null +++ b/types/lodash/fp/toNumber.d.ts @@ -0,0 +1,29 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToNumber = + /** + * Converts `value` to a number. + * + * @category Lang + * @param value The value to process. + * @returns Returns the number. + * @example + * + * _.toNumber(3); + * // => 3 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3'); + * // => 3 + */ + (value: any) => number; + +declare const toNumber: ToNumber; +export = toNumber; diff --git a/types/lodash/fp/toPairs.d.ts b/types/lodash/fp/toPairs.d.ts new file mode 100644 index 0000000000..4097690ac8 --- /dev/null +++ b/types/lodash/fp/toPairs.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToPairs { + /** + * Creates an array of own enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: _.Dictionary | _.NumericDictionary): Array<[string, T]>; + /** + * Creates an array of own enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: object): Array<[string, any]>; +} + +declare const toPairs: ToPairs; +export = toPairs; diff --git a/types/lodash/fp/toPairsIn.d.ts b/types/lodash/fp/toPairsIn.d.ts new file mode 100644 index 0000000000..80859cc318 --- /dev/null +++ b/types/lodash/fp/toPairsIn.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ToPairsIn { + /** + * Creates an array of own and inherited enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: _.Dictionary | _.NumericDictionary): Array<[string, T]>; + /** + * Creates an array of own and inherited enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + (object: object): Array<[string, any]>; +} + +declare const toPairsIn: ToPairsIn; +export = toPairsIn; diff --git a/types/lodash/fp/toPath.d.ts b/types/lodash/fp/toPath.d.ts new file mode 100644 index 0000000000..a501811e14 --- /dev/null +++ b/types/lodash/fp/toPath.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToPath = + /** + * Converts `value` to a property path array. + * + * @category Util + * @param value The value to convert. + * @returns Returns the new property path array. + * @example + * + * _.toPath('a.b.c'); + * // => ['a', 'b', 'c'] + * + * _.toPath('a[0].b.c'); + * // => ['a', '0', 'b', 'c'] + * + * var path = ['a', 'b', 'c'], + * newPath = _.toPath(path); + * + * console.log(newPath); + * // => ['a', 'b', 'c'] + * + * console.log(path === newPath); + * // => false + */ + (value: any) => string[]; + +declare const toPath: ToPath; +export = toPath; diff --git a/types/lodash/fp/toPlainObject.d.ts b/types/lodash/fp/toPlainObject.d.ts new file mode 100644 index 0000000000..18b2eada62 --- /dev/null +++ b/types/lodash/fp/toPlainObject.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToPlainObject = + /** + * Converts value to a plain object flattening inherited enumerable properties of value to own properties + * of the plain object. + * + * @param value The value to convert. + * @return Returns the converted plain object. + */ + (value: any) => any; + +declare const toPlainObject: ToPlainObject; +export = toPlainObject; diff --git a/types/lodash/fp/toSafeInteger.d.ts b/types/lodash/fp/toSafeInteger.d.ts new file mode 100644 index 0000000000..9ddc6a79a1 --- /dev/null +++ b/types/lodash/fp/toSafeInteger.d.ts @@ -0,0 +1,30 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToSafeInteger = + /** + * Converts `value` to a safe integer. A safe integer can be compared and + * represented correctly. + * + * @category Lang + * @param value The value to convert. + * @returns Returns the converted integer. + * @example + * + * _.toSafeInteger(3); + * // => 3 + * + * _.toSafeInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toSafeInteger(Infinity); + * // => 9007199254740991 + * + * _.toSafeInteger('3'); + * // => 3 + */ + (value: any) => number; + +declare const toSafeInteger: ToSafeInteger; +export = toSafeInteger; diff --git a/types/lodash/fp/toString.d.ts b/types/lodash/fp/toString.d.ts new file mode 100644 index 0000000000..0dcf51fecf --- /dev/null +++ b/types/lodash/fp/toString.d.ts @@ -0,0 +1,27 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToString = + /** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` and `undefined` values. The sign of `-0` is preserved. + * + * @category Lang + * @param value The value to process. + * @returns Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + (value: any) => string; + +declare const toString: ToString; +export = toString; diff --git a/types/lodash/fp/toUpper.d.ts b/types/lodash/fp/toUpper.d.ts new file mode 100644 index 0000000000..af46b1dba8 --- /dev/null +++ b/types/lodash/fp/toUpper.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type ToUpper = + /** + * Converts `string`, as a whole, to upper case. + * + * @param string The string to convert. + * @return Returns the upper cased string. + */ + (string: string) => string; + +declare const toUpper: ToUpper; +export = toUpper; diff --git a/types/lodash/fp/transform.d.ts b/types/lodash/fp/transform.d.ts new file mode 100644 index 0000000000..420258c514 --- /dev/null +++ b/types/lodash/fp/transform.d.ts @@ -0,0 +1,240 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Transform { + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (): Transform; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (iteratee: _.MemoVoidIteratorCapped): Transform1x1; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (iteratee: _.MemoVoidIteratorCapped, accumulator: ReadonlyArray): Transform1x2; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (iteratee: _.MemoVoidIteratorCapped, accumulator: ReadonlyArray, object: ReadonlyArray | _.Dictionary): TResult[]; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (iteratee: _.MemoVoidIteratorCapped>): Transform2x1; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (iteratee: _.MemoVoidIteratorCapped>, accumulator: _.Dictionary): Transform2x2; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (iteratee: _.MemoVoidIteratorCapped>, accumulator: _.Dictionary, object: ReadonlyArray | _.Dictionary): _.Dictionary; +} +interface Transform1x1 { + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (): Transform1x1; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (accumulator: ReadonlyArray): Transform1x2; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (accumulator: ReadonlyArray, object: ReadonlyArray | _.Dictionary): TResult[]; +} +interface Transform1x2 { + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (): Transform1x2; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (object: ReadonlyArray | _.Dictionary): TResult[]; +} +interface Transform2x1 { + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (): Transform2x1; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (accumulator: _.Dictionary): Transform2x2; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (accumulator: _.Dictionary, object: ReadonlyArray | _.Dictionary): _.Dictionary; +} +interface Transform2x2 { + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (): Transform2x2; + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + (object: ReadonlyArray | _.Dictionary): _.Dictionary; +} + +declare const transform: Transform; +export = transform; diff --git a/types/lodash/fp/trim.d.ts b/types/lodash/fp/trim.d.ts new file mode 100644 index 0000000000..7b1c8696b4 --- /dev/null +++ b/types/lodash/fp/trim.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Trim = + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (string: string) => string; + +declare const trim: Trim; +export = trim; diff --git a/types/lodash/fp/trimChars.d.ts b/types/lodash/fp/trimChars.d.ts new file mode 100644 index 0000000000..8c0a97e9f5 --- /dev/null +++ b/types/lodash/fp/trimChars.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Trim { + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (): Trim; + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (chars: string): Trim1x1; + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (chars: string, string: string): string; +} +interface Trim1x1 { + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (): Trim1x1; + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (string: string): string; +} + +declare const trimChars: Trim; +export = trimChars; diff --git a/types/lodash/fp/trimCharsEnd.d.ts b/types/lodash/fp/trimCharsEnd.d.ts new file mode 100644 index 0000000000..f8b74c9c5a --- /dev/null +++ b/types/lodash/fp/trimCharsEnd.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface TrimEnd { + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (): TrimEnd; + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (chars: string): TrimEnd1x1; + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (chars: string, string: string): string; +} +interface TrimEnd1x1 { + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (): TrimEnd1x1; + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (string: string): string; +} + +declare const trimCharsEnd: TrimEnd; +export = trimCharsEnd; diff --git a/types/lodash/fp/trimCharsStart.d.ts b/types/lodash/fp/trimCharsStart.d.ts new file mode 100644 index 0000000000..5b4da3996d --- /dev/null +++ b/types/lodash/fp/trimCharsStart.d.ts @@ -0,0 +1,51 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface TrimStart { + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (): TrimStart; + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (chars: string): TrimStart1x1; + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (chars: string, string: string): string; +} +interface TrimStart1x1 { + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (): TrimStart1x1; + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (string: string): string; +} + +declare const trimCharsStart: TrimStart; +export = trimCharsStart; diff --git a/types/lodash/fp/trimEnd.d.ts b/types/lodash/fp/trimEnd.d.ts new file mode 100644 index 0000000000..02754779a2 --- /dev/null +++ b/types/lodash/fp/trimEnd.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type TrimEnd = + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (string: string) => string; + +declare const trimEnd: TrimEnd; +export = trimEnd; diff --git a/types/lodash/fp/trimStart.d.ts b/types/lodash/fp/trimStart.d.ts new file mode 100644 index 0000000000..567dc22e5e --- /dev/null +++ b/types/lodash/fp/trimStart.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type TrimStart = + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + (string: string) => string; + +declare const trimStart: TrimStart; +export = trimStart; diff --git a/types/lodash/fp/truncate.d.ts b/types/lodash/fp/truncate.d.ts new file mode 100644 index 0000000000..6645f41697 --- /dev/null +++ b/types/lodash/fp/truncate.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Truncate { + /** + * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated + * string are replaced with the omission string which defaults to "…". + * + * @param string The string to truncate. + * @param options The options object or maximum string length. + * @return Returns the truncated string. + */ + (): Truncate; + /** + * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated + * string are replaced with the omission string which defaults to "…". + * + * @param string The string to truncate. + * @param options The options object or maximum string length. + * @return Returns the truncated string. + */ + (options: _.TruncateOptions): Truncate1x1; + /** + * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated + * string are replaced with the omission string which defaults to "…". + * + * @param string The string to truncate. + * @param options The options object or maximum string length. + * @return Returns the truncated string. + */ + (options: _.TruncateOptions, string: string): string; +} +interface Truncate1x1 { + /** + * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated + * string are replaced with the omission string which defaults to "…". + * + * @param string The string to truncate. + * @param options The options object or maximum string length. + * @return Returns the truncated string. + */ + (): Truncate1x1; + /** + * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated + * string are replaced with the omission string which defaults to "…". + * + * @param string The string to truncate. + * @param options The options object or maximum string length. + * @return Returns the truncated string. + */ + (string: string): string; +} + +declare const truncate: Truncate; +export = truncate; diff --git a/types/lodash/fp/unapply.d.ts b/types/lodash/fp/unapply.d.ts new file mode 100644 index 0000000000..8bde142263 --- /dev/null +++ b/types/lodash/fp/unapply.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Rest = + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + (func: (...args: any[]) => any) => (...args: any[]) => any; + +declare const unapply: Rest; +export = unapply; diff --git a/types/lodash/fp/unary.d.ts b/types/lodash/fp/unary.d.ts new file mode 100644 index 0000000000..19e2946e96 --- /dev/null +++ b/types/lodash/fp/unary.d.ts @@ -0,0 +1,21 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Unary = + /** + * Creates a function that accepts up to one argument, ignoring any + * additional arguments. + * + * @category Function + * @param func The function to cap arguments for. + * @returns Returns the new function. + * @example + * + * _.map(['6', '8', '10'], _.unary(parseInt)); + * // => [6, 8, 10] + */ + (func: (arg1: T, ...args: any[]) => TResult) => (arg1: T) => TResult; + +declare const unary: Unary; +export = unary; diff --git a/types/lodash/fp/unescape.d.ts b/types/lodash/fp/unescape.d.ts new file mode 100644 index 0000000000..20b602a298 --- /dev/null +++ b/types/lodash/fp/unescape.d.ts @@ -0,0 +1,19 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Unescape = + /** + * The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` + * in string to their corresponding characters. + * + * Note: No other HTML entities are unescaped. To unescape additional HTML entities use a third-party library + * like he. + * + * @param string The string to unescape. + * @return Returns the unescaped string. + */ + (string: string) => string; + +declare const unescape: Unescape; +export = unescape; diff --git a/types/lodash/fp/union.d.ts b/types/lodash/fp/union.d.ts new file mode 100644 index 0000000000..99c9e3d4ff --- /dev/null +++ b/types/lodash/fp/union.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Union { + /** + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ + (): Union; + /** + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ + (arrays2: _.List | null | undefined): Union1x1; + /** + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ + (arrays2: _.List | null | undefined, arrays: _.List | null | undefined): T[]; +} +interface Union1x1 { + /** + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ + (): Union1x1; + /** + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ + (arrays: _.List | null | undefined): T[]; +} + +declare const union: Union; +export = union; diff --git a/types/lodash/fp/unionBy.d.ts b/types/lodash/fp/unionBy.d.ts new file mode 100644 index 0000000000..42db2e6352 --- /dev/null +++ b/types/lodash/fp/unionBy.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UnionBy { + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (): UnionBy; + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (iteratee: _.ValueIteratee): UnionBy1x1; + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (iteratee: _.ValueIteratee, arrays1: _.List | null | undefined): UnionBy1x2; + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (iteratee: _.ValueIteratee, arrays1: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface UnionBy1x1 { + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (): UnionBy1x1; + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (arrays1: _.List | null | undefined): UnionBy1x2; + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (arrays1: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface UnionBy1x2 { + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (): UnionBy1x2; + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @param arrays The arrays to inspect. + * @param iteratee The iteratee invoked per element. + * @return Returns the new array of combined values. + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const unionBy: UnionBy; +export = unionBy; diff --git a/types/lodash/fp/unionWith.d.ts b/types/lodash/fp/unionWith.d.ts new file mode 100644 index 0000000000..89a5066ec0 --- /dev/null +++ b/types/lodash/fp/unionWith.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UnionWith { + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (): UnionWith; + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (comparator: _.Comparator): UnionWith1x1; + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined): UnionWith1x2; + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface UnionWith1x1 { + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (): UnionWith1x1; + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (arrays: _.List | null | undefined): UnionWith1x2; + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface UnionWith1x2 { + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (): UnionWith1x2; + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const unionWith: UnionWith; +export = unionWith; diff --git a/types/lodash/fp/uniq.d.ts b/types/lodash/fp/uniq.d.ts new file mode 100644 index 0000000000..a627214680 --- /dev/null +++ b/types/lodash/fp/uniq.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Uniq = + /** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each element + * is kept. + * + * @category Array + * @param array The array to inspect. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + */ + (array: _.List | null | undefined) => T[]; + +declare const uniq: Uniq; +export = uniq; diff --git a/types/lodash/fp/uniqBy.d.ts b/types/lodash/fp/uniqBy.d.ts new file mode 100644 index 0000000000..d89b8908c5 --- /dev/null +++ b/types/lodash/fp/uniqBy.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UniqBy { + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + (): UniqBy; + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + (iteratee: (value: string) => _.NotVoid): UniqBy1x1; + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + (iteratee: (value: string) => _.NotVoid, array: string | null | undefined): string[]; + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + (iteratee: _.ValueIteratee): UniqBy2x1; + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + (iteratee: _.ValueIteratee, array: _.List | null | undefined): T[]; +} +interface UniqBy1x1 { + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + (): UniqBy1x1; + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + (array: string | null | undefined): string[]; +} +interface UniqBy2x1 { + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + (): UniqBy2x1; + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param array The array to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + (array: _.List | null | undefined): T[]; +} + +declare const uniqBy: UniqBy; +export = uniqBy; diff --git a/types/lodash/fp/uniqWith.d.ts b/types/lodash/fp/uniqWith.d.ts new file mode 100644 index 0000000000..f0e6de90ff --- /dev/null +++ b/types/lodash/fp/uniqWith.d.ts @@ -0,0 +1,98 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UniqWith { + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + (): UniqWith; + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + (comparator: _.Comparator): UniqWith1x1; + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + (comparator: _.Comparator, array: _.List | null | undefined): T[]; +} +interface UniqWith1x1 { + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + (): UniqWith1x1; + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param array The array to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + (array: _.List | null | undefined): T[]; +} + +declare const uniqWith: UniqWith; +export = uniqWith; diff --git a/types/lodash/fp/uniqueId.d.ts b/types/lodash/fp/uniqueId.d.ts new file mode 100644 index 0000000000..d9ba028d53 --- /dev/null +++ b/types/lodash/fp/uniqueId.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type UniqueId = + /** + * Generates a unique ID. If prefix is provided the ID is appended to it. + * + * @param prefix The value to prefix the ID with. + * @return Returns the unique ID. + */ + (prefix: string) => string; + +declare const uniqueId: UniqueId; +export = uniqueId; diff --git a/types/lodash/fp/unnest.d.ts b/types/lodash/fp/unnest.d.ts new file mode 100644 index 0000000000..fc05e923c5 --- /dev/null +++ b/types/lodash/fp/unnest.d.ts @@ -0,0 +1,17 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Flatten = + /** + * Flattens `array` a single level deep. + * + * @param array The array to flatten. + * @return Returns the new flattened array. + */ + (array: _.List<_.Many> | null | undefined) => T[]; + +declare const unnest: Flatten; +export = unnest; diff --git a/types/lodash/fp/unset.d.ts b/types/lodash/fp/unset.d.ts new file mode 100644 index 0000000000..12199c061a --- /dev/null +++ b/types/lodash/fp/unset.d.ts @@ -0,0 +1,63 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Unset { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (path: _.PropertyPath, object: any): boolean; +} +interface Unset1x1 { + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (): Unset1x1; + /** + * Removes the property at path of object. + * + * Note: This method mutates object. + * + * @param object The object to modify. + * @param path The path of the property to unset. + * @return Returns true if the property is deleted, else false. + */ + (object: any): boolean; +} + +declare const unset: Unset; +export = unset; diff --git a/types/lodash/fp/unzip.d.ts b/types/lodash/fp/unzip.d.ts new file mode 100644 index 0000000000..e6ce334d48 --- /dev/null +++ b/types/lodash/fp/unzip.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Unzip = + /** + * This method is like _.zip except that it accepts an array of grouped elements and creates an array + * regrouping the elements to their pre-zip configuration. + * + * @param array The array of grouped elements to process. + * @return Returns the new array of regrouped elements. + */ + (array: T[][] | _.List<_.List> | null | undefined) => T[][]; + +declare const unzip: Unzip; +export = unzip; diff --git a/types/lodash/fp/unzipWith.d.ts b/types/lodash/fp/unzipWith.d.ts new file mode 100644 index 0000000000..36fd2e6bf0 --- /dev/null +++ b/types/lodash/fp/unzipWith.d.ts @@ -0,0 +1,68 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UnzipWith { + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + (): UnzipWith; + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + (iteratee: (...values: T[]) => TResult): UnzipWith1x1; + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + (iteratee: (...values: T[]) => TResult, array: _.List<_.List> | null | undefined): TResult[]; +} +interface UnzipWith1x1 { + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + (): UnzipWith1x1; + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + (array: _.List<_.List> | null | undefined): TResult[]; +} + +declare const unzipWith: UnzipWith; +export = unzipWith; diff --git a/types/lodash/fp/update.d.ts b/types/lodash/fp/update.d.ts new file mode 100644 index 0000000000..011a8ea61e --- /dev/null +++ b/types/lodash/fp/update.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Update { + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (): Update; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (path: _.PropertyPath): Update1x1; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (path: _.PropertyPath, updater: (value: any) => any): Update1x2; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (path: _.PropertyPath, updater: (value: any) => any, object: object): any; +} +interface Update1x1 { + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (): Update1x1; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (updater: (value: any) => any): Update1x2; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (updater: (value: any) => any, object: object): any; +} +interface Update1x2 { + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (): Update1x2; + /** + * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to + * customize path creation. The updater is invoked with one argument: (value). + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @return Returns object. + */ + (object: object): any; +} + +declare const update: Update; +export = update; diff --git a/types/lodash/fp/updateWith.d.ts b/types/lodash/fp/updateWith.d.ts new file mode 100644 index 0000000000..e26ed161d2 --- /dev/null +++ b/types/lodash/fp/updateWith.d.ts @@ -0,0 +1,431 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface UpdateWith { + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (): UpdateWith; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer): UpdateWith1x1; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath): UpdateWith1x2; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, updater: (oldValue: any) => any): UpdateWith1x3; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, updater: (oldValue: any) => any, object: T): T; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (customizer: _.SetWithCustomizer, path: _.PropertyPath, updater: (oldValue: any) => any, object: T): TResult; +} +interface UpdateWith1x1 { + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (): UpdateWith1x1; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (path: _.PropertyPath): UpdateWith1x2; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (path: _.PropertyPath, updater: (oldValue: any) => any): UpdateWith1x3; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (path: _.PropertyPath, updater: (oldValue: any) => any, object: T): T; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (path: _.PropertyPath, updater: (oldValue: any) => any, object: T): TResult; +} +interface UpdateWith1x2 { + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (): UpdateWith1x2; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (updater: (oldValue: any) => any): UpdateWith1x3; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (updater: (oldValue: any) => any, object: T): T; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (updater: (oldValue: any) => any, object: T): TResult; +} +interface UpdateWith1x3 { + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (): UpdateWith1x3; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (object: T): T; + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @since 4.6.0 + * @category Object + * @param object The object to modify. + * @param path The path of the property to set. + * @param updater The function to produce the updated value. + * @param [customizer] The function to customize assigned values. + * @returns Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + (object: T): TResult; +} + +declare const updateWith: UpdateWith; +export = updateWith; diff --git a/types/lodash/fp/upperCase.d.ts b/types/lodash/fp/upperCase.d.ts new file mode 100644 index 0000000000..5e6cab91bf --- /dev/null +++ b/types/lodash/fp/upperCase.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type UpperCase = + /** + * Converts `string`, as space separated words, to upper case. + * + * @param string The string to convert. + * @return Returns the upper cased string. + */ + (string: string) => string; + +declare const upperCase: UpperCase; +export = upperCase; diff --git a/types/lodash/fp/upperFirst.d.ts b/types/lodash/fp/upperFirst.d.ts new file mode 100644 index 0000000000..54a442030e --- /dev/null +++ b/types/lodash/fp/upperFirst.d.ts @@ -0,0 +1,15 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type UpperFirst = + /** + * Converts the first character of `string` to upper case. + * + * @param string The string to convert. + * @return Returns the converted string. + */ + (string: string) => string; + +declare const upperFirst: UpperFirst; +export = upperFirst; diff --git a/types/lodash/fp/useWith.d.ts b/types/lodash/fp/useWith.d.ts new file mode 100644 index 0000000000..1196dfbade --- /dev/null +++ b/types/lodash/fp/useWith.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface OverArgs { + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (): OverArgs; + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (func: (...args: any[]) => any): OverArgs1x1; + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (func: (...args: any[]) => any, transforms: _.Many<(...args: any[]) => any>): (...args: any[]) => any; +} +interface OverArgs1x1 { + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (): OverArgs1x1; + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + (transforms: _.Many<(...args: any[]) => any>): (...args: any[]) => any; +} + +declare const useWith: OverArgs; +export = useWith; diff --git a/types/lodash/fp/values.d.ts b/types/lodash/fp/values.d.ts new file mode 100644 index 0000000000..ec0ef37c08 --- /dev/null +++ b/types/lodash/fp/values.d.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Values { + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + (object: _.Dictionary | _.NumericDictionary | _.List | null | undefined): T[]; + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + (object: T | null | undefined): Array; + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + (object: any): any[]; +} + +declare const values: Values; +export = values; diff --git a/types/lodash/fp/valuesIn.d.ts b/types/lodash/fp/valuesIn.d.ts new file mode 100644 index 0000000000..35e9073535 --- /dev/null +++ b/types/lodash/fp/valuesIn.d.ts @@ -0,0 +1,25 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ValuesIn { + /** + * Creates an array of the own and inherited enumerable property values of object. + * + * @param object The object to query. + * @return Returns the array of property values. + */ + (object: _.Dictionary|_.NumericDictionary|_.List | null | undefined): T[]; + /** + * Creates an array of the own and inherited enumerable property values of object. + * + * @param object The object to query. + * @return Returns the array of property values. + */ + (object: T | null | undefined): Array; +} + +declare const valuesIn: ValuesIn; +export = valuesIn; diff --git a/types/lodash/fp/where.d.ts b/types/lodash/fp/where.d.ts new file mode 100644 index 0000000000..4270edf2e4 --- /dev/null +++ b/types/lodash/fp/where.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ConformsTo { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (source: _.ConformsPredicateObject, object: T): boolean; +} +interface ConformsTo1x1 { + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (): ConformsTo1x1; + /** + * Checks if object conforms to source by invoking the predicate properties of source with the + * corresponding property values of object. + * + * Note: This method is equivalent to _.conforms when source is partially applied. + */ + (object: T): boolean; +} + +declare const where: ConformsTo; +export = where; diff --git a/types/lodash/fp/whereEq.d.ts b/types/lodash/fp/whereEq.d.ts new file mode 100644 index 0000000000..1a660655f8 --- /dev/null +++ b/types/lodash/fp/whereEq.d.ts @@ -0,0 +1,116 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface IsMatch { + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (): IsMatch; + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (source: object): IsMatch1x1; + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (source: object, object: object): boolean; +} +interface IsMatch1x1 { + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (): IsMatch1x1; + /** + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @category Lang + * @param object The object to inspect. + * @param source The object of property values to match. + * @returns Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false + */ + (object: object): boolean; +} + +declare const whereEq: IsMatch; +export = whereEq; diff --git a/types/lodash/fp/without.d.ts b/types/lodash/fp/without.d.ts new file mode 100644 index 0000000000..9c30e47289 --- /dev/null +++ b/types/lodash/fp/without.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Without { + /** + * Creates an array excluding all provided values using SameValueZero for equality comparisons. + * + * @param array The array to filter. + * @param values The values to exclude. + * @return Returns the new array of filtered values. + */ + (): Without; + /** + * Creates an array excluding all provided values using SameValueZero for equality comparisons. + * + * @param array The array to filter. + * @param values The values to exclude. + * @return Returns the new array of filtered values. + */ + (values: ReadonlyArray): Without1x1; + /** + * Creates an array excluding all provided values using SameValueZero for equality comparisons. + * + * @param array The array to filter. + * @param values The values to exclude. + * @return Returns the new array of filtered values. + */ + (values: ReadonlyArray, array: _.List | null | undefined): T[]; +} +interface Without1x1 { + /** + * Creates an array excluding all provided values using SameValueZero for equality comparisons. + * + * @param array The array to filter. + * @param values The values to exclude. + * @return Returns the new array of filtered values. + */ + (): Without1x1; + /** + * Creates an array excluding all provided values using SameValueZero for equality comparisons. + * + * @param array The array to filter. + * @param values The values to exclude. + * @return Returns the new array of filtered values. + */ + (array: _.List | null | undefined): T[]; +} + +declare const without: Without; +export = without; diff --git a/types/lodash/fp/words.d.ts b/types/lodash/fp/words.d.ts new file mode 100644 index 0000000000..c827eafb15 --- /dev/null +++ b/types/lodash/fp/words.d.ts @@ -0,0 +1,16 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +type Words = + /** + * Splits `string` into an array of its words. + * + * @param string The string to inspect. + * @param pattern The pattern to match words. + * @return Returns the words of `string`. + */ + (string: string) => string[]; + +declare const words: Words; +export = words; diff --git a/types/lodash/fp/wrap.d.ts b/types/lodash/fp/wrap.d.ts new file mode 100644 index 0000000000..a906abe0f2 --- /dev/null +++ b/types/lodash/fp/wrap.d.ts @@ -0,0 +1,103 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +interface Wrap { + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + (): Wrap; + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + (wrapper: (value: T, ...args: TArgs[]) => TResult): Wrap1x1; + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + (wrapper: (value: T, ...args: TArgs[]) => TResult, value: T): (...args: TArgs[]) => TResult; + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + (wrapper: (value: T, ...args: any[]) => TResult): Wrap2x1; + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + (wrapper: (value: T, ...args: any[]) => TResult, value: T): (...args: any[]) => TResult; +} +interface Wrap1x1 { + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + (): Wrap1x1; + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + (value: T): (...args: TArgs[]) => TResult; +} +interface Wrap2x1 { + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + (): Wrap2x1; + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + (value: T): (...args: any[]) => TResult; +} + +declare const wrap: Wrap; +export = wrap; diff --git a/types/lodash/fp/xor.d.ts b/types/lodash/fp/xor.d.ts new file mode 100644 index 0000000000..d3e250cb5a --- /dev/null +++ b/types/lodash/fp/xor.d.ts @@ -0,0 +1,48 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Xor { + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (): Xor; + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (arrays2: _.List | null | undefined): Xor1x1; + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (arrays2: _.List | null | undefined, arrays: _.List | null | undefined): T[]; +} +interface Xor1x1 { + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (): Xor1x1; + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + (arrays: _.List | null | undefined): T[]; +} + +declare const xor: Xor; +export = xor; diff --git a/types/lodash/fp/xorBy.d.ts b/types/lodash/fp/xorBy.d.ts new file mode 100644 index 0000000000..8d5b2fd05a --- /dev/null +++ b/types/lodash/fp/xorBy.d.ts @@ -0,0 +1,186 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface XorBy { + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (): XorBy; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee): XorBy1x1; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, arrays: _.List | null | undefined): XorBy1x2; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (iteratee: _.ValueIteratee, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorBy1x1 { + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (): XorBy1x1; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (arrays: _.List | null | undefined): XorBy1x2; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorBy1x2 { + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (): XorBy1x2; + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [iteratee=_.identity] The iteratee invoked per element. + * @returns Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const xorBy: XorBy; +export = xorBy; diff --git a/types/lodash/fp/xorWith.d.ts b/types/lodash/fp/xorWith.d.ts new file mode 100644 index 0000000000..6bdcabdbd2 --- /dev/null +++ b/types/lodash/fp/xorWith.d.ts @@ -0,0 +1,177 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface XorWith { + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (): XorWith; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (comparator: _.Comparator): XorWith1x1; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined): XorWith1x2; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (comparator: _.Comparator, arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorWith1x1 { + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (): XorWith1x1; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (arrays: _.List | null | undefined): XorWith1x2; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (arrays: _.List | null | undefined, arrays2: _.List | null | undefined): T[]; +} +interface XorWith1x2 { + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (): XorWith1x2; + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @category Array + * @param [arrays] The arrays to inspect. + * @param [comparator] The comparator invoked per element. + * @returns Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + (arrays2: _.List | null | undefined): T[]; +} + +declare const xorWith: XorWith; +export = xorWith; diff --git a/types/lodash/fp/zip.d.ts b/types/lodash/fp/zip.d.ts new file mode 100644 index 0000000000..dd4e6a1e3c --- /dev/null +++ b/types/lodash/fp/zip.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface Zip { + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + (): Zip; + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + (arrays1: _.List): Zip1x1; + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + (arrays1: _.List, arrays2: _.List): Array<[T1 | undefined, T2 | undefined]>; +} +interface Zip1x1 { + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + (): Zip1x1; + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + (arrays2: _.List): Array<[T1 | undefined, T2 | undefined]>; +} + +declare const zip: Zip; +export = zip; diff --git a/types/lodash/fp/zipAll.d.ts b/types/lodash/fp/zipAll.d.ts new file mode 100644 index 0000000000..62cf6eb647 --- /dev/null +++ b/types/lodash/fp/zipAll.d.ts @@ -0,0 +1,18 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +type Zip = + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + (arrays: ReadonlyArray<_.List | null | undefined>) => Array>; + +declare const zipAll: Zip; +export = zipAll; diff --git a/types/lodash/fp/zipObj.d.ts b/types/lodash/fp/zipObj.d.ts new file mode 100644 index 0000000000..7b1c5bb91a --- /dev/null +++ b/types/lodash/fp/zipObj.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ZipObject { + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObject; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (props: _.List<_.PropertyName>): ZipObject1x1; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (props: _.List<_.PropertyName>, values: _.List): _.Dictionary; +} +interface ZipObject1x1 { + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObject1x1; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (values: _.List): _.Dictionary; +} + +declare const zipObj: ZipObject; +export = zipObj; diff --git a/types/lodash/fp/zipObject.d.ts b/types/lodash/fp/zipObject.d.ts new file mode 100644 index 0000000000..61f5d04e79 --- /dev/null +++ b/types/lodash/fp/zipObject.d.ts @@ -0,0 +1,58 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ZipObject { + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObject; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (props: _.List<_.PropertyName>): ZipObject1x1; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (props: _.List<_.PropertyName>, values: _.List): _.Dictionary; +} +interface ZipObject1x1 { + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObject1x1; + /** + * This method is like _.fromPairs except that it accepts two arrays, one of property + * identifiers and one of corresponding values. + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + (values: _.List): _.Dictionary; +} + +declare const zipObject: ZipObject; +export = zipObject; diff --git a/types/lodash/fp/zipObjectDeep.d.ts b/types/lodash/fp/zipObjectDeep.d.ts new file mode 100644 index 0000000000..0fd3f218ab --- /dev/null +++ b/types/lodash/fp/zipObjectDeep.d.ts @@ -0,0 +1,53 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ZipObjectDeep { + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObjectDeep; + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (paths: _.List<_.PropertyPath>): ZipObjectDeep1x1; + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (paths: _.List<_.PropertyPath>, values: _.List): object; +} +interface ZipObjectDeep1x1 { + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (): ZipObjectDeep1x1; + /** + * This method is like _.zipObject except that it supports property paths. + * + * @param paths The property names. + * @param values The property values. + * @return Returns the new object. + */ + (values: _.List): object; +} + +declare const zipObjectDeep: ZipObjectDeep; +export = zipObjectDeep; diff --git a/types/lodash/fp/zipWith.d.ts b/types/lodash/fp/zipWith.d.ts new file mode 100644 index 0000000000..36c02c053c --- /dev/null +++ b/types/lodash/fp/zipWith.d.ts @@ -0,0 +1,105 @@ +// AUTO-GENERATED: do not modify this file directly. +// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: +// npm run fp + +import _ = require("../index"); + +interface ZipWith { + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (): ZipWith; + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (iteratee: (value1: T1, value2: T2) => TResult): ZipWith1x1; + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (iteratee: (value1: T1, value2: T2) => TResult, arrays1: _.List): ZipWith1x2; + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (iteratee: (value1: T1, value2: T2) => TResult, arrays1: _.List, arrays2: _.List): TResult[]; +} +interface ZipWith1x1 { + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (): ZipWith1x1; + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (arrays1: _.List): ZipWith1x2; + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (arrays1: _.List, arrays2: _.List): TResult[]; +} +interface ZipWith1x2 { + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (): ZipWith1x2; + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param [arrays] The arrays to process. + * @param [iteratee] The function to combine grouped values. + * @param [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + (arrays2: _.List): TResult[]; +} + +declare const zipWith: ZipWith; +export = zipWith; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 20bde973aa..28d2967c86 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -1,26 +1,7 @@ -declare const $: any; +import fp = require("lodash/fp"); +import _ = require("lodash"); -interface FoodOrganic { - name: string; - organic: boolean; -} -interface StoogesAge { - name: string; - age: number; -} - -const foodsOrganic: FoodOrganic[] = [ - { name: 'banana', organic: true }, - { name: 'beet', organic: false }, -]; -const stoogesAges: StoogesAge[] = [ - { 'name': 'moe', 'age': 40 }, - { 'name': 'larry', 'age': 50 } -]; - -let result: any; - -let anything: any; +declare const anything: any; interface AbcObject { a: number; @@ -28,58 +9,6 @@ interface AbcObject { c: boolean; } -// _.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 {}; }, - clear() { }, -}; -result = <(key: string) => boolean>testMapCache.delete; -result = <(key: string) => any>testMapCache.get; -result = <(key: string) => boolean>testMapCache.has; -result = <(key: string, value: any) => _.Dictionary>testMapCache.set; -result = <() => void>testMapCache.clear; - -// _ -namespace TestWrapper { - { - let result: _.LoDashImplicitWrapper; - result = _(''); - } - - { - let result: _.LoDashImplicitWrapper; - result = _(42); - } - - { - let result: _.LoDashImplicitWrapper; - result = _(true); - } - - { - let result: _.LoDashImplicitArrayWrapper; - result = _(['']); - } - - { - let result: _.LoDashImplicitObjectWrapper<{a: string}>; - result = _<{a: string}>({a: ''}); - } - - { - let a: AbcObject[] = []; - _(a); // $ExpectType LoDashImplicitWrapper - } - - { - let a: AbcObject[] | null | undefined = anything; - _(a); // $ExpectType LoDashImplicitWrapper - } -} - // Wrapped array shortcut methods _([1, 2, 3, 4]).pop(); // $ExpectType number | undefined _([1, 2, 3, 4]).push(5, 6, 7); // $ExpectType LoDashImplicitWrapper @@ -97,317 +26,122 @@ _.chain([1, 2, 3, 4]).splice(1); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).splice(1, 2, 5, 6); // $ExpectType LoDashExplicitWrapper _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper -/********* - * Array * - *********/ - // _.chunk -namespace TestChunk { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[][]; + _.chunk(list); // $ExpectType AbcObject[][] + _.chunk(list, 42); // $ExpectType AbcObject[][] - result = _.chunk(array); - result = _.chunk(array, 42); + _(list).chunk(); // $ExpectType LoDashImplicitWrapper + _(list).chunk(42); // $ExpectType LoDashImplicitWrapper - result = _.chunk(list); - result = _.chunk(list, 42); - } + _.chain(list).chunk(); // $ExpectType LoDashExplicitWrapper + _.chain(list).chunk(42); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).chunk(); - result = _(array).chunk(42); - - result = _(list).chunk(); - result = _(list).chunk(42); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _.chain(array).chunk(); - result = _(array).chain().chunk(); - result = _(array).chain().chunk(42); - - result = _(list).chain().chunk(); - result = _(list).chain().chunk(42); - } + fp.chunk(42, list); // $ExpectType AbcObject[][] + fp.chunk(42)(list); // $ExpectType AbcObject[][] + fp.chunk()(42)()(list); // $ExpectType AbcObject[][] } // _.compact -namespace TestCompact { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let array2: Array | null | undefined = anything; - let list2: _.List | null | undefined = anything; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; - - result = _.compact(array); - result = _.compact(list); - result = _.compact(array2); - result = _.compact(list2); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).compact(); - result = _(list).compact(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().compact(); - result = _(list).chain().compact(); - } + _.compact(list); // $ExpectType AbcObject[] + _(list).compact(); // $ExpectType LoDashImplicitWrapper + _.chain(list).compact(); // $ExpectType LoDashExplicitWrapper + fp.compact(list); // $ExpectType AbcObject[] } // _.difference -namespace TestDifference { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let arrayParam: AbcObject[] = []; - let listParam: _.List = []; +{ + const list: _.List | null | undefined = anything; + const arrayParam: AbcObject[] = []; + const listParam: _.List = []; - { - let result: AbcObject[]; + _.difference(list); // $ExpectType AbcObject[] + _.difference(list, listParam); // $ExpectType AbcObject[] + _.difference(list, listParam, arrayParam, listParam); // $ExpectType AbcObject[] - result = _.difference(array); - result = _.difference(array, arrayParam); - result = _.difference(array, listParam, arrayParam); - result = _.difference(array, listParam, listParam, arrayParam); + _(list).difference(); // $ExpectType LoDashImplicitWrapper + _(list).difference(listParam); // $ExpectType LoDashImplicitWrapper + _(list).difference(listParam, arrayParam, listParam); // $ExpectType LoDashImplicitWrapper - result = _.difference(list); - result = _.difference(list, listParam); - result = _.difference(list, arrayParam, listParam); - result = _.difference(list, listParam, arrayParam, listParam); - } + _.chain(list).difference(); // $ExpectType LoDashExplicitWrapper + _.chain(list).difference(listParam); // $ExpectType LoDashExplicitWrapper + _.chain(list).difference(listParam, arrayParam, listParam); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).difference(); - result = _(array).difference(arrayParam); - result = _(array).difference(listParam, arrayParam); - result = _(array).difference(arrayParam, listParam, arrayParam); - - result = _(list).difference(); - result = _(list).difference(listParam); - result = _(list).difference(arrayParam, listParam); - result = _(list).difference(listParam, arrayParam, listParam); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().difference(); - result = _(array).chain().difference(arrayParam); - result = _(array).chain().difference(listParam, arrayParam); - result = _(array).chain().difference(arrayParam, listParam, arrayParam); - - result = _(list).chain().difference(); - result = _(list).chain().difference(listParam); - result = _(list).chain().difference(arrayParam, listParam); - result = _(list).chain().difference(listParam, arrayParam, listParam); - } + fp.difference(list, arrayParam); // $ExpectType AbcObject[] + fp.difference(list)(arrayParam); // $ExpectType AbcObject[] } // _.differenceBy -namespace TestDifferenceBy { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let arrayParam: AbcObject[] = []; - let listParam: _.List = []; - let iteratee: (value: AbcObject) => any = (value: AbcObject) => 1; +{ + const list: _.List | null | undefined = anything; + const arrayParam: AbcObject[] = []; + const listParam: _.List = []; + const iteratee = (value: AbcObject) => 1; - { - let result: AbcObject[]; + _.differenceBy(list); // $ExpectType AbcObject[] + _.differenceBy(list, listParam); // $ExpectType AbcObject[] + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType AbcObject[] - result = _.differenceBy(array); - result = _.differenceBy(array, arrayParam); - result = _.differenceBy(array, listParam, arrayParam); - result = _.differenceBy(array, arrayParam, listParam, arrayParam); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, listParam, arrayParam); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); + _.differenceBy(list, listParam, iteratee); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType AbcObject[] + // $ExpectType AbcObject[] + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(array, arrayParam, iteratee); - result = _.differenceBy(array, listParam, arrayParam, iteratee); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, iteratee); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); + _.differenceBy(list, listParam, "a"); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType AbcObject[] + // $ExpectType AbcObject[] + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, "a"); - result = _.differenceBy(array, arrayParam, 'a'); - result = _.differenceBy(array, listParam, arrayParam, 'a'); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, 'a'); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, 'a'); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); + _.differenceBy(list, listParam, {a: 1}); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); // $ExpectType AbcObject[] + // $ExpectType AbcObject[] + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(array, arrayParam, {a: 1}); - result = _.differenceBy(array, listParam, arrayParam, {a: 1}); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, {a: 1}); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _.differenceBy(array, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); + _(list).differenceBy(listParam); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType LoDashImplicitWrapper - result = _.differenceBy(list); - result = _.differenceBy(list, listParam); - result = _.differenceBy(list, arrayParam, listParam); - result = _.differenceBy(list, listParam, arrayParam, listParam); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam); - result = _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); + _(list).differenceBy(listParam, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(list, listParam, iteratee); - result = _.differenceBy(list, arrayParam, listParam, iteratee); - result = _.differenceBy(list, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); + _(list).differenceBy(listParam, "a"); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, "a"); - result = _.differenceBy(list, listParam, 'a'); - result = _.differenceBy(list, arrayParam, listParam, 'a'); - result = _.differenceBy(list, listParam, arrayParam, listParam, 'a'); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, 'a'); - result = _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, 'a'); + _(list).differenceBy(listParam, {a: 1}); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, listParam, {a: 1}); - result = _.differenceBy(list, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - } + _.chain(list).differenceBy(arrayParam); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitWrapper; + _.chain(list).differenceBy(arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).differenceBy(arrayParam); - result = _(array).differenceBy(listParam, arrayParam); - result = _(array).differenceBy(arrayParam, listParam, arrayParam); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); + _.chain(list).differenceBy(arrayParam, "a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, "a"); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, "a"); - result = _(array).differenceBy(arrayParam, iteratee); - result = _(array).differenceBy(listParam, arrayParam, iteratee); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, iteratee); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); + _.chain(list).differenceBy(arrayParam, {a: 1}); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(arrayParam, 'a'); - result = _(array).differenceBy(listParam, arrayParam, 'a'); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, 'a'); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, 'a'); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - - result = _(array).differenceBy(arrayParam, {a: 1}); - result = _(array).differenceBy(listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - - result = _(list).differenceBy(listParam); - result = _(list).differenceBy(arrayParam, listParam); - result = _(list).differenceBy(listParam, arrayParam, listParam); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam); - result = _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); - - result = _(list).differenceBy(listParam, iteratee); - result = _(list).differenceBy(arrayParam, listParam, iteratee); - result = _(list).differenceBy(listParam, arrayParam, listParam, iteratee); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, iteratee); - result = _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - - result = _(list).differenceBy(listParam, 'a'); - result = _(list).differenceBy(arrayParam, listParam, 'a'); - result = _(list).differenceBy(listParam, arrayParam, listParam, 'a'); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, 'a'); - result = _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - - result = _(list).differenceBy(listParam, {a: 1}); - result = _(list).differenceBy(arrayParam, listParam, {a: 1}); - result = _(list).differenceBy(listParam, arrayParam, listParam, {a: 1}); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().differenceBy(arrayParam); - result = _(array).chain().differenceBy(listParam, arrayParam); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); - - result = _(array).chain().differenceBy(arrayParam, iteratee); - result = _(array).chain().differenceBy(listParam, arrayParam, iteratee); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, iteratee); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); - - result = _(array).chain().differenceBy(arrayParam, 'a'); - result = _(array).chain().differenceBy(listParam, arrayParam, 'a'); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, 'a'); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, 'a'); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, 'a'); - - result = _(array).chain().differenceBy(arrayParam, {a: 1}); - result = _(array).chain().differenceBy(listParam, arrayParam, {a: 1}); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - - result = _(list).chain().differenceBy(listParam); - result = _(list).chain().differenceBy(arrayParam, listParam); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); - - result = _(list).chain().differenceBy(listParam, iteratee); - result = _(list).chain().differenceBy(arrayParam, listParam, iteratee); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, iteratee); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, iteratee); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); - - result = _(list).chain().differenceBy(listParam, 'a'); - result = _(list).chain().differenceBy(arrayParam, listParam, 'a'); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, 'a'); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, 'a'); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, 'a'); - - result = _(list).chain().differenceBy(listParam, {a: 1}); - result = _(list).chain().differenceBy(arrayParam, listParam, {a: 1}); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, {a: 1}); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _(list).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); - } + fp.differenceBy(iteratee, list, arrayParam); // $ExpectType AbcObject[] + fp.differenceBy(iteratee)(list)(listParam); // $ExpectType AbcObject[] + fp.differenceBy("a", list, arrayParam); // $ExpectType AbcObject[] + fp.differenceBy({a: 1}, list, arrayParam); // $ExpectType AbcObject[] { interface T1 { @@ -427,13 +161,13 @@ namespace TestDifferenceBy { b: any[]; } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 30 }; - const t3: T3 = { a: 'a', b: true }; - const t4: T4 = { a: 'a', b: [] }; + const t1: T1 = { a: "a", b: "b" }; + const t2: T2 = { a: "a", b: 30 }; + const t3: T3 = { a: "a", b: true }; + const t4: T4 = { a: "a", b: [] }; // $ExpectType T1[] - _.differenceBy([t1], [t2], 'name'); + _.differenceBy([t1], [t2], "name"); // $ExpectType T1[] _.differenceBy([t1], [t2], (value) => { value; // $ExpectType T1 | T2 @@ -460,18 +194,18 @@ namespace TestDifferenceBy { return 0; }); // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], [''], (value) => { + _.differenceBy([t1], [t2], [t3], [t4], [""], (value) => { value; // $ExpectType string | T1 | T2 | T3 | T4 return 0; }); // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], [''], [42], (value) => { + _.differenceBy([t1], [t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], 'name'); + _([t1]).differenceBy([t2], "name"); // $ExpectType LoDashImplicitWrapper _([t1]).differenceBy([t2], (value) => { value; // $ExpectType T1 | T2 @@ -498,18 +232,18 @@ namespace TestDifferenceBy { return 0; }); // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], [''], (value) => { + _([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { value; // $ExpectType string | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], [''], [42], (value) => { + _([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], 'name'); + _.chain([t1]).differenceBy([t2], "name"); // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceBy([t2], (value) => { value; // $ExpectType T1 | T2 @@ -536,79 +270,49 @@ namespace TestDifferenceBy { return 0; }); // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], [''], (value) => { + _.chain([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { value; // $ExpectType string | T1 | T2 | T3 | T4 return 0; }); // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], [''], [42], (value) => { + _.chain([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; }); + + fp.differenceBy("name", [t1], [t2]); // $ExpectType T1[] + fp.differenceBy((value: T1 | T2) => 0, [t1], [t2]); // $ExpectType T1[] + fp.differenceBy((value: T1 | T2 | T3) => 0, [t1], [t2, t3]); // $ExpectType T1[] } } // _.differenceWith { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let arrayParam: AbcObject[] = []; - let listParam: _.List = []; - let comparator = (a: AbcObject, b: AbcObject) => true; + const list: _.List | null | undefined = [] as any; + const arrayParam: AbcObject[] = []; + const listParam: _.List = []; + const comparator = (a: AbcObject, b: AbcObject) => true; - { - // $ExpectType AbcObject[] - _.differenceWith(array); - // $ExpectType AbcObject[] - _.differenceWith(array, arrayParam); - // $ExpectType AbcObject[] - _.differenceWith(array, listParam, arrayParam); - // $ExpectType AbcObject[] - _.differenceWith(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); + _.differenceWith(list); // $ExpectType AbcObject[] + _.differenceWith(list, arrayParam); // $ExpectType AbcObject[] + _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType AbcObject[] + _.differenceWith(list, arrayParam, comparator); // $ExpectType AbcObject[] + _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType AbcObject[] - // $ExpectType AbcObject[] - _.differenceWith(array, arrayParam, comparator); - // $ExpectType AbcObject[] - _.differenceWith(array, listParam, arrayParam, comparator); - // $ExpectType AbcObject[] - _.differenceWith(array, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); - } + _(list).differenceWith(arrayParam); // $ExpectType LoDashImplicitWrapper + _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashImplicitWrapper + _(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashImplicitWrapper + _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashImplicitWrapper - { - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(arrayParam); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(listParam, arrayParam); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(arrayParam, listParam, arrayParam); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); + _.chain(list).differenceWith(arrayParam); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(arrayParam, comparator); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(listParam, arrayParam, comparator); - // $ExpectType LoDashImplicitWrapper - _(array).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); - } - - { - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(arrayParam); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(listParam, arrayParam); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(arrayParam, listParam, arrayParam); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); - - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(arrayParam, comparator); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(listParam, arrayParam, comparator); - // $ExpectType LoDashExplicitWrapper - _.chain(array).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); - } + fp.differenceWith(comparator, list, arrayParam); // $ExpectType AbcObject[] + fp.differenceWith(comparator)(list)(arrayParam); // $ExpectType AbcObject[] + fp.differenceWith(comparator)(list, arrayParam); // $ExpectType AbcObject[] + fp.differenceWith(comparator, list)(arrayParam); // $ExpectType AbcObject[] { interface T1 { @@ -620,7 +324,7 @@ namespace TestDifferenceBy { b: number; } - const t1: T1 = { a: 'a', b: 'b' }; + const t1: T1 = { a: "a", b: "b" }; const t2: T2 | undefined = anything; // $ExpectType T1[] @@ -643,824 +347,371 @@ namespace TestDifferenceBy { b; // $ExpectType T2 | undefined return true; }); + + fp.differenceWith((a: T1, b: T2 | undefined) => true, [t1], [t2]); // $ExpectType T1[] } } // _.drop -{ - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - - { - let result: AbcObject[]; - result = _.drop(array); - result = _.drop(array, 42); - - result = _.drop(list); - result = _.drop(list, 42); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).drop(); - result = _(array).drop(42); - - result = _(list).drop(); - result = _(list).drop(42); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().drop(); - result = _(array).chain().drop(42); - - result = _(list).chain().drop(); - result = _(list).chain().drop(42); - } -} - // _.dropRight -namespace TestDropRight { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; + _.drop(list); // $ExpectType AbcObject[] + _.drop(list, 42); // $ExpectType AbcObject[] + _(list).drop(42); // $ExpectType LoDashImplicitWrapper + _.chain(list).drop(42); // $ExpectType LoDashExplicitWrapper - result = _.dropRight(array); - result = _.dropRight(array, 42); + fp.drop(42, list); // $ExpectType AbcObject[] + fp.drop(42)(list); // $ExpectType AbcObject[] - result = _.dropRight(list); - result = _.dropRight(list, 42); - } + _.dropRight(list); // $ExpectType AbcObject[] + _.dropRight(list, 42); // $ExpectType AbcObject[] + _(list).dropRight(42); // $ExpectType LoDashImplicitWrapper + _.chain(list).dropRight(42); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).dropRight(); - result = _(array).dropRight(42); - - result = _(list).dropRight(); - result = _(list).dropRight(42); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().dropRight(); - result = _(array).chain().dropRight(42); - - result = _(list).chain().dropRight(); - result = _(list).chain().dropRight(42); - } -} - -// _.dropRightWhile -namespace TestDropRightWhile { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - - { - let result: AbcObject[]; - - result = _.dropRightWhile(array); - result = _.dropRightWhile(array, predicateFn); - result = _.dropRightWhile(array, ''); - result = _.dropRightWhile(array, {a: 42}); - - result = _.dropRightWhile(list); - result = _.dropRightWhile(list, predicateFn); - result = _.dropRightWhile(list, ''); - result = _.dropRightWhile(list, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).dropRightWhile(); - result = _(array).dropRightWhile(predicateFn); - result = _(array).dropRightWhile(''); - result = _(array).dropRightWhile({a: 42}); - - result = _(list).dropRightWhile(); - result = _(list).dropRightWhile(predicateFn); - result = _(list).dropRightWhile(''); - result = _(list).dropRightWhile({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().dropRightWhile(); - result = _(array).chain().dropRightWhile(predicateFn); - result = _(array).chain().dropRightWhile(''); - result = _(array).chain().dropRightWhile({a: 42}); - - result = _(list).chain().dropRightWhile(); - result = _(list).chain().dropRightWhile(predicateFn); - result = _(list).chain().dropRightWhile(''); - result = _(list).chain().dropRightWhile({a: 42}); - } + fp.dropRight(42, list); // $ExpectType AbcObject[] + fp.dropRight(42)(list); // $ExpectType AbcObject[] } // _.dropWhile -namespace TestDropWhile { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; +// _.dropRightWhile +{ + const list: _.List | null | undefined = anything; + const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; + const predicateFn2 = (value: AbcObject) => true; - { - let result: AbcObject[]; + _.dropWhile(list); // $ExpectType AbcObject[] + _.dropWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropWhile(list, ""); // $ExpectType AbcObject[] + _.dropWhile(list, {a: 42}); // $ExpectType AbcObject[] - result = _.dropWhile(array); - result = _.dropWhile(array, predicateFn); - result = _.dropWhile(array, ''); - result = _.dropWhile(array, {a: 42}); + _(list).dropWhile(); // $ExpectType LoDashImplicitWrapper + _(list).dropWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropWhile(""); // $ExpectType LoDashImplicitWrapper + _(list).dropWhile({a: 42}); // $ExpectType LoDashImplicitWrapper - result = _.dropWhile(list); - result = _.dropWhile(list, predicateFn); - result = _.dropWhile(list, ''); - result = _.dropWhile(list, {a: 42}); - } + _.chain(list).dropWhile(); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropWhile(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; + fp.dropWhile(predicateFn2, list); // $ExpectType AbcObject[] + fp.dropWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropWhile("", list); // $ExpectType AbcObject[] + fp.dropWhile({ a: 42 }, list); // $ExpectType AbcObject[] - result = _(array).dropWhile(); - result = _(array).dropWhile(predicateFn); - result = _(array).dropWhile(''); - result = _(array).dropWhile({a: 42}); + _.dropRightWhile(list); // $ExpectType AbcObject[] + _.dropRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropRightWhile(list, ""); // $ExpectType AbcObject[] + _.dropRightWhile(list, {a: 42}); // $ExpectType AbcObject[] - result = _(list).dropWhile(); - result = _(list).dropWhile(predicateFn); - result = _(list).dropWhile(''); - result = _(list).dropWhile({a: 42}); - } + _(list).dropRightWhile(); // $ExpectType LoDashImplicitWrapper + _(list).dropRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropRightWhile(""); // $ExpectType LoDashImplicitWrapper + _(list).dropRightWhile({a: 42}); // $ExpectType LoDashImplicitWrapper - { - let result: _.LoDashExplicitArrayWrapper; + _.chain(list).dropRightWhile(); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropRightWhile(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropRightWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - result = _(array).chain().dropWhile(); - result = _(array).chain().dropWhile(predicateFn); - result = _(array).chain().dropWhile(''); - result = _(array).chain().dropWhile({a: 42}); - - result = _(list).chain().dropWhile(); - result = _(list).chain().dropWhile(predicateFn); - result = _(list).chain().dropWhile(''); - result = _(list).chain().dropWhile({a: 42}); - } + fp.dropRightWhile(predicateFn2, list); // $ExpectType AbcObject[] + fp.dropRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropRightWhile("", list); // $ExpectType AbcObject[] + fp.dropRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.fill -namespace TestFill { - let array: number[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const array: number[] | null | undefined = anything; + const list: _.List | null | undefined = anything; - { - let result: number[]; + _.fill(array, 42); // $ExpectType number[] + _.fill(array, 42, 0); // $ExpectType number[] + _.fill(array, 42, 0, 10); // $ExpectType number[] - result = _.fill(array, 42); - result = _.fill(array, 42, 0); - result = _.fill(array, 42, 0, 10); - } + _.fill(list, 42); // $ExpectType ArrayLike + _.fill(list, 42, 0); // $ExpectType ArrayLike + _.fill(list, 42, 0, 10); // $ExpectType ArrayLike - { - let result: _.List; + _(list).fill(42); // $ExpectType LoDashImplicitWrapper> + _(list).fill(42, 0); // $ExpectType LoDashImplicitWrapper> + _(list).fill(42, 0, 10); // $ExpectType LoDashImplicitWrapper> - result = _.fill(list, 42); - result = _.fill(list, 42, 0); - result = _.fill(list, 42, 0, 10); - } + _.chain(list).fill(42); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(42, 0); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(42, 0, 10); // $ExpectType LoDashExplicitWrapper> - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).fill(42); - result = _(array).fill(42, 0); - result = _(array).fill(42, 0, 10); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.List>; - - result = _(list).fill(42); - result = _(list).fill(42, 0); - result = _(list).fill(42, 0, 10); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().fill(42); - result = _(array).chain().fill(42, 0); - result = _(array).chain().fill(42, 0, 10); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.List>; - - result = _(list).chain().fill(42); - result = _(list).chain().fill(42, 0); - result = _(list).chain().fill(42, 0, 10); - } + fp.fill(0, 10, 42, array); // $ExpectType number[] + fp.fill(0)(10)(42)(array); // $ExpectType number[] + fp.fill(0, 10, 42, list); // $ExpectType ArrayLike } // _.findIndex -namespace TestFindIndex { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - let fromIndex = 0; - - { - let result: number; - - result = _.findIndex(array); - result = _.findIndex(array, predicateFn); - result = _.findIndex(array, ''); - result = _.findIndex(array, {a: 42}); - result = _.findIndex(array, predicateFn, fromIndex); - - result = _.findIndex(list); - result = _.findIndex(list, predicateFn); - result = _.findIndex(list, ''); - result = _.findIndex(list, {a: 42}); - result = _.findIndex(list, predicateFn, fromIndex); - result = _.findIndex([{ b: 5 }], ['b', 5]); - - result = _(array).findIndex(); - result = _(array).findIndex(predicateFn); - result = _(array).findIndex(''); - result = _(array).findIndex<{a: number}>({a: 42}); - result = _(array).findIndex(predicateFn, fromIndex); - - result = _(list).findIndex(); - result = _(list).findIndex(predicateFn); - result = _(list).findIndex(''); - result = _(list).findIndex<{a: number}>({a: 42}); - result = _(list).findIndex(predicateFn, fromIndex); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().findIndex(); - result = _(array).chain().findIndex(predicateFn); - result = _(array).chain().findIndex(''); - result = _(array).chain().findIndex<{a: number}>({a: 42}); - result = _(array).chain().findIndex(predicateFn, fromIndex); - - result = _(list).chain().findIndex(); - result = _(list).chain().findIndex(predicateFn); - result = _(list).chain().findIndex(''); - result = _(list).chain().findIndex<{a: number}>({a: 42}); - result = _(list).chain().findIndex(predicateFn, fromIndex); - } -} - // _.findLastIndex -namespace TestFindLastIndex { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; + const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; + const predicateFn2 = (value: AbcObject) => true; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - let fromIndex = 0; + _.findIndex(list); // $ExpectType number + _.findIndex(list, predicateFn); // $ExpectType number + _.findIndex(list, ""); // $ExpectType number + _.findIndex(list, {a: 42}); // $ExpectType number + _.findIndex(list, predicateFn, 1); // $ExpectType number - { - let result: number; + _(list).findIndex(); // $ExpectType number + _(list).findIndex(predicateFn); // $ExpectType number + _(list).findIndex(""); // $ExpectType number + _(list).findIndex<{a: number}>({a: 42}); // $ExpectType number + _(list).findIndex(predicateFn, 1); // $ExpectType number - result = _.findLastIndex(array); - result = _.findLastIndex(array, predicateFn); - result = _.findLastIndex(array, ''); - result = _.findLastIndex(array, {a: 42}); - result = _.findLastIndex(array, predicateFn, fromIndex); + _.chain(list).findIndex(); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper - result = _.findLastIndex(list); - result = _.findLastIndex(list, predicateFn); - result = _.findLastIndex(list, ''); - result = _.findLastIndex(list, {a: 42}); - result = _.findLastIndex(list, predicateFn, fromIndex); - result = _.findLastIndex([{ b: 5 }], ['b', 5]); + fp.findIndex(predicateFn2, list); // $ExpectType number + fp.findIndex(predicateFn2)(list); // $ExpectType number + fp.findIndex("", list); // $ExpectType number + fp.findIndex({ a: 42 }, list); // $ExpectType number - result = _(array).findLastIndex(); - result = _(array).findLastIndex(predicateFn); - result = _(array).findLastIndex(''); - result = _(array).findLastIndex<{a: number}>({a: 42}); - result = _(array).findLastIndex(predicateFn, fromIndex); + fp.findIndexFrom(predicateFn2, 1, list); // $ExpectType number + fp.findIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findIndexFrom("", 1, list); // $ExpectType number + fp.findIndexFrom({ a: 42 }, 1, list); // $ExpectType number - result = _(list).findLastIndex(); - result = _(list).findLastIndex(predicateFn); - result = _(list).findLastIndex(''); - result = _(list).findLastIndex<{a: number}>({a: 42}); - result = _(list).findLastIndex(predicateFn, fromIndex); - } + _.findLastIndex(list); // $ExpectType number + _.findLastIndex(list, predicateFn); // $ExpectType number + _.findLastIndex(list, ""); // $ExpectType number + _.findLastIndex(list, {a: 42}); // $ExpectType number + _.findLastIndex(list, predicateFn, 1); // $ExpectType number - { - let result: _.LoDashExplicitWrapper; + _(list).findLastIndex(); // $ExpectType number + _(list).findLastIndex(predicateFn); // $ExpectType number + _(list).findLastIndex(""); // $ExpectType number + _(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType number + _(list).findLastIndex(predicateFn, 1); // $ExpectType number - result = _(array).chain().findLastIndex(); - result = _(array).chain().findLastIndex(predicateFn); - result = _(array).chain().findLastIndex(''); - result = _(array).chain().findLastIndex<{a: number}>({a: 42}); - result = _(array).chain().findLastIndex(predicateFn, fromIndex); + _.chain(list).findLastIndex(); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper - result = _(list).chain().findLastIndex(); - result = _(list).chain().findLastIndex(predicateFn); - result = _(list).chain().findLastIndex(''); - result = _(list).chain().findLastIndex<{a: number}>({a: 42}); - result = _(list).chain().findLastIndex(predicateFn, fromIndex); - } + fp.findLastIndex(predicateFn2, list); // $ExpectType number + fp.findLastIndex(predicateFn2)(list); // $ExpectType number + fp.findLastIndex("", list); // $ExpectType number + fp.findLastIndex({ a: 42 }, list); // $ExpectType number + + fp.findLastIndexFrom(predicateFn2, 1, list); // $ExpectType number + fp.findLastIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findLastIndexFrom("", 1, list); // $ExpectType number + fp.findLastIndexFrom({ a: 42 }, 1, list); // $ExpectType number } // _.first -namespace TestFirst { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: string | undefined; + _.first("abc"); // $ExpectType string | undefined + _.first(list); // $ExpectType AbcObject | undefined - result = _.first('abc'); - result = _('abc').first(); - } + _("abc").first(); // $ExpectType string | undefined + _(list).first(); // $ExpectType AbcObject | undefined - { - let result: AbcObject | undefined; + _.chain("abc").first(); // $ExpectType LoDashExplicitWrapper + _.chain(list).first(); // $ExpectType LoDashExplicitWrapper - result = _.first(array); - result = _.first(list); - - result = _(array).first(); - result = _(list).first(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().first(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().first(); - result = _(list).chain().first(); - } + fp.first("abc"); // $ExpectType string | undefined + fp.first(list); // $ExpectType AbcObject | undefined } // _.flatten -namespace TestFlatten { - let array: number[][] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + _.flatten("abc"); // $ExpectType string[] + _.flatten([1, 2, 3]); // $ExpectType number[] + _.flatten([1, [2, 3]]); // $ExpectType number[] + _.flatten({0: 1, 1: [2, 3], length: 2}); // $ExpectType number[] - { - let result: string[]; + _("abc").flatten(); // $ExpectType LoDashImplicitWrapper + _([1, 2, 3]).flatten(); // $ExpectType LoDashImplicitWrapper + _([1, [2, 3]]).flatten(); // $ExpectType LoDashImplicitWrapper + _({0: 1, 1: [2, 3], length: 2}).flatten(); // $ExpectType LoDashImplicitWrapper - result = _.flatten('abc'); - } + _.chain("abc").flatten(); // $ExpectType LoDashExplicitWrapper + _.chain([1, 2, 3]).flatten(); // $ExpectType LoDashExplicitWrapper + _.chain([1, [2, 3]]).flatten(); // $ExpectType LoDashExplicitWrapper + _.chain({0: 1, 1: [2, 3], length: 2}).flatten(); // $ExpectType LoDashExplicitWrapper - { - let result: number[]; - - result = _.flatten(array); - result = _.flatten(list); - result = _.flatten([1, 2, 3]); - result = _.flatten([1, 2, 3]); - result = _.flatten([1, 2, 3]); - result = _.flatten([1, [2, 3]]); - result = _.flatten([1, [2, [3]]], true); - result = _.flatten([1, [2, [3]], [[4]]], true); - - result = _.flatten({0: 1, 1: 2, 2: 3, length: 3}); - result = _.flatten({0: 1, 1: [2, 3], length: 2}); - result = _.flatten({0: 1, 1: [2, [3]], length: 2}, true); - result = _.flatten({0: 1, 1: [2, [3]], 2: [[4]], length: 3}, true); - } - - { - let result: _.RecursiveArray; - - result = _.flatten([1, [2, [3]]]); - result = _.flatten([1, [2, [3]], [[4]]]); - - result = _.flatten({0: 1, 1: [2, [3]], length: 2}); - result = _.flatten({0: 1, 1: [2, [3]], 2: [[4]], length: 3}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').flatten(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _([1, 2, 3]).flatten(); - result = _([1, [2, 3]]).flatten(); - result = _([1, [2, [3]]]).flatten(true); - result = _([1, [2, [3]], [[4]]]).flatten(true); - - result = _({0: 1, 1: 2, 2: 3, length: 3}).flatten(); - result = _({0: 1, 1: [2, 3], length: 2}).flatten(); - result = _({0: 1, 1: [2, [3]], length: 2}).flatten(true); - result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flatten(true); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _([1, [2, [3]]]).flatten(); - result = _([1, [2, [3]], [[4]]]).flatten(); - - result = _({0: 1, 1: [2, [3]], length: 2}).flatten(); - result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flatten(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().flatten(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([1, 2, 3]).chain().flatten(); - result = _([1, [2, 3]]).chain().flatten(); - result = _([1, [2, [3]]]).chain().flatten(true); - result = _([1, [2, [3]], [[4]]]).chain().flatten(true); - - result = _({0: 1, 1: 2, 2: 3, length: 3}).chain().flatten(); - result = _({0: 1, 1: [2, 3], length: 2}).chain().flatten(); - result = _({0: 1, 1: [2, [3]], length: 2}).chain().flatten(true); - result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flatten(true); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([1, [2, [3]]]).chain().flatten(); - result = _([1, [2, [3]], [[4]]]).chain().flatten(); - - result = _({0: 1, 1: [2, [3]], length: 2}).chain().flatten(); - result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flatten(); - } + fp.flatten("abc"); // $ExpectType string[] + fp.flatten([1, 2, 3]); // $ExpectType number[] + fp.flatten([1, [2, 3]]); // $ExpectType number[] + fp.flatten({0: 1, 1: [2, 3], length: 2}); // $ExpectType number[] + fp.unnest([1, [2, 3]]); // $ExpectType number[] } // _.flattenDeep -namespace TestFlattenDeep { - let array: number[][] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + _.flattenDeep([1, 2, 3]); // $ExpectType number[] + _.flattenDeep([1, [2, [3, [4, 5]]]]); // $ExpectType number[] + _.flattenDeep({0: 1, 1: [2, [3, [4, 5]]], length: 2}); // $ExpectType number[] - { - let result: string[]; + _([1, 2, 3]).flattenDeep(); // $ExpectType LoDashImplicitWrapper + _([1, [2, [3, [4, 5]]]]).flattenDeep(); // $ExpectType LoDashImplicitWrapper + _({0: 1, 1: [2, [3, [4, 5]]], length: 2}).flattenDeep(); // $ExpectType LoDashImplicitWrapper - result = _.flattenDeep('abc'); - } + _.chain([1, 2, 3]).flattenDeep(); // $ExpectType LoDashExplicitWrapper + _.chain([1, [2, [3, [4, 5]]]]).flattenDeep(); // $ExpectType LoDashExplicitWrapper + _.chain({0: 1, 1: [2, [3, [4, 5]]], length: 2}).flattenDeep(); // $ExpectType LoDashExplicitWrapper - { - let result: number[]; - - result = _.flattenDeep(array); - result = _.flattenDeep(list); - result = _.flattenDeep([1, 2, 3]); - result = _.flattenDeep([1, [2, 3]]); - result = _.flattenDeep([1, [2, [3]]]); - result = _.flattenDeep([1, [2, [3]], [[4]]]); - - result = _.flattenDeep({0: 1, 1: 2, 2: 3, length: 3}); - result = _.flattenDeep({0: 1, 1: [2, 3], length: 2}); - result = _.flattenDeep({0: 1, 1: [2, [3]], length: 2}); - result = _.flattenDeep({0: 1, 1: [2, [3]], 2: [[4]], length: 3}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').flattenDeep(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _([1, 2, 3]).flattenDeep(); - result = _([1, [2, 3]]).flattenDeep(); - result = _([1, [2, [3]]]).flattenDeep(); - result = _([1, [2, [3]], [[4]]]).flattenDeep(); - - result = _({0: 1, 1: 2, 2: 3, length: 3}).flattenDeep(); - result = _({0: 1, 1: [2, 3], length: 2}).flattenDeep(); - result = _({0: 1, 1: [2, [3]], length: 2}).flattenDeep(); - result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flattenDeep(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _([1, [2, [3]]]).flattenDeep(); - result = _([1, [2, [3]], [[4]]]).flattenDeep(); - - result = _({0: 1, 1: [2, [3]], length: 2}).flattenDeep(); - result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flattenDeep(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().flattenDeep(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([1, 2, 3]).chain().flattenDeep(); - result = _([1, [2, 3]]).chain().flattenDeep(); - result = _([1, [2, [3]]]).chain().flattenDeep(); - result = _([1, [2, [3]], [[4]]]).chain().flattenDeep(); - - result = _({0: 1, 1: 2, 2: 3, length: 3}).chain().flattenDeep(); - result = _({0: 1, 1: [2, 3], length: 2}).chain().flattenDeep(); - result = _({0: 1, 1: [2, [3]], length: 2}).chain().flattenDeep(); - result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flattenDeep(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([1, [2, [3]]]).chain().flattenDeep(); - result = _([1, [2, [3]], [[4]]]).chain().flattenDeep(); - - result = _({0: 1, 1: [2, [3]], length: 2}).chain().flattenDeep(); - result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flattenDeep(); - } + fp.flattenDeep([1, 2, 3]); // $ExpectType number[] + fp.flattenDeep([1, [2, [3, [4, 5]]]]); // $ExpectType number[] + fp.flattenDeep({0: 1, 1: [2, [3, [4, 5]]], length: 2}); // $ExpectType number[] } // _.fromPairs -namespace TestFromPairs { - let twoDimensionalArray: string[][] | null | undefined = [] as any; - let numberTupleArray: Array<[string, number]> | null | undefined = [] as any; - let stringDict: _.Dictionary; - let numberDict: _.Dictionary; +{ + const twoDimensionalArray: string[][] | null | undefined = anything; + const numberTupleArray: Array<[string, number]> | null | undefined = anything; - { - stringDict = _.fromPairs(twoDimensionalArray); - numberDict = _.fromPairs(numberTupleArray); - // Ensure we're getting the parameterized overload rather than the 'any' catch-all. - numberDict = _.fromPairs(numberTupleArray); - // This doesn't compile because you can't assign arrays to tuples. - // stringDict = _.fromPairs(twoDimensionalArray); - } - - { - stringDict = _(twoDimensionalArray).fromPairs().value(); - } - - { - stringDict = _.chain(twoDimensionalArray).fromPairs().value(); - } + _.fromPairs(twoDimensionalArray); // $ExpectType Dictionary + _.fromPairs(numberTupleArray); // $ExpectType Dictionary + _(twoDimensionalArray).fromPairs(); // $ExpectType LoDashImplicitWrapper> + _.chain(twoDimensionalArray).fromPairs(); // $ExpectType LoDashExplicitWrapper> + fp.fromPairs(numberTupleArray); // $ExpectType Dictionary } // _.head -namespace TestHead { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: string | undefined; + _.head("abc"); // $ExpectType string | undefined + _.head(list); // $ExpectType AbcObject | undefined - result = _.head('abc'); - result = _('abc').head(); - } + _("abc").head(); // $ExpectType string | undefined + _(list).head(); // $ExpectType AbcObject | undefined - { - let result: AbcObject | undefined; + _.chain("abc").head(); // $ExpectType LoDashExplicitWrapper + _.chain(list).head(); // $ExpectType LoDashExplicitWrapper - result = _.head(array); - result = _.head(list); - - result = _(array).head(); - result = _(list).head(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().head(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().head(); - result = _(list).chain().head(); - } + fp.head("abc"); // $ExpectType string | undefined + fp.head(list); // $ExpectType AbcObject | undefined } // _.indexOf -namespace TestIndexOf { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let value: AbcObject = { a: 1, b: "", c: true }; - - { - let result: number; - - result = _.indexOf(array, value); - result = _.indexOf(array, value, true); - result = _.indexOf(array, value, 42); - - result = _.indexOf(list, value); - result = _.indexOf(list, value, true); - result = _.indexOf(list, value, 42); - - result = _(array).indexOf(value); - result = _(array).indexOf(value, true); - result = _(array).indexOf(value, 42); - - result = _(list).indexOf(value); - result = _(list).indexOf(value, true); - result = _(list).indexOf(value, 42); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().indexOf(value); - result = _(array).chain().indexOf(value, true); - result = _(array).chain().indexOf(value, 42); - - result = _(list).chain().indexOf(value); - result = _(list).chain().indexOf(value, true); - result = _(list).chain().indexOf(value, 42); - } -} - +// _.lastIndexOf // _.sortedIndexOf +// _.sortedLastIndexOf { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let value: AbcObject = { a: 1, b: "", c: true }; + const list: _.List | null | undefined = anything; + const value: AbcObject = { a: 1, b: "", c: true }; - { - let result: number; + _.indexOf(list, value); // $ExpectType number + _.indexOf(list, value, 42); // $ExpectType number + _(list).indexOf(value); // $ExpectType number + _(list).indexOf(value, 42); // $ExpectType number + _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper + _.chain(list).indexOf(value, 42); // $ExpectType LoDashExplicitWrapper + fp.indexOf(value, list); // $ExpectType number + fp.indexOf(value)(list); // $ExpectType number + fp.indexOfFrom(value)(42)(list); // $ExpectType number - result = _.sortedIndexOf(array, value); - result = _.sortedIndexOf(list, value); - result = _(array).sortedIndexOf(value); - result = _(list).sortedIndexOf(value); - } + _.lastIndexOf(list, value); // $ExpectType number + _.lastIndexOf(list, value, 42); // $ExpectType number + _(list).lastIndexOf(value); // $ExpectType number + _(list).lastIndexOf(value, 42); // $ExpectType number + _.chain(list).lastIndexOf(value); // $ExpectType LoDashExplicitWrapper + _.chain(list).lastIndexOf(value, 42); // $ExpectType LoDashExplicitWrapper + fp.lastIndexOf(value, list); // $ExpectType number + fp.lastIndexOf(value)(list); // $ExpectType number + fp.lastIndexOfFrom(value)(42)(list); // $ExpectType number - { - let result: _.LoDashExplicitWrapper; + _.sortedIndexOf(list, value); // $ExpectType number + _(list).sortedIndexOf(value); // $ExpectType number + _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexOf(value, list); // $ExpectType number + fp.sortedIndexOf(value)(list); // $ExpectType number - result = _(array).chain().sortedIndexOf(value); - result = _(list).chain().sortedIndexOf(value); - } + _.sortedLastIndexOf(list, value); // $ExpectType number + _(list).sortedLastIndexOf(value); // $ExpectType number + _.chain(list).sortedLastIndexOf(value); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexOf(value, list); // $ExpectType number + fp.sortedLastIndexOf(value)(list); // $ExpectType number } -//_.initial -namespace TestInitial { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +// _.initial +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; - - result = _.initial(array); - result = _.initial(list); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).initial(); - result = _(list).initial(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().initial(); - result = _(list).chain().initial(); - } + _.initial(list); // $ExpectType AbcObject[] + _(list).initial(); // $ExpectType LoDashImplicitWrapper + _.chain(list).initial(); // $ExpectType LoDashExplicitWrapper + fp.initial(list); // $ExpectType AbcObject[] } // _.intersection -namespace TestIntersection { - let array: AbcObject[] = [] as any; - let list: _.List = [] as any; - let arrayParam: AbcObject[] = [] as any; - let listParam: _.List = [] as any; +{ + const list: _.List = anything; - { - let result: AbcObject[]; - - result = _.intersection(array, list); - result = _.intersection(list, array, list); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).intersection(arrayParam); - result = _(array).intersection(listParam, arrayParam); - - result = _(list).intersection(arrayParam); - result = _(list).intersection(listParam, arrayParam); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().intersection(arrayParam); - result = _(array).chain().intersection(listParam, arrayParam); - - result = _(list).chain().intersection(arrayParam); - result = _(list).chain().intersection(listParam, arrayParam); - } + _.intersection(list, list); // $ExpectType AbcObject[] + _.intersection(list, list, list); // $ExpectType AbcObject[] + _(list).intersection(list); // $ExpectType LoDashImplicitWrapper + _(list).intersection(list, list); // $ExpectType LoDashImplicitWrapper + _.chain(list).intersection(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersection(list, list); // $ExpectType LoDashExplicitWrapper + fp.intersection(list, list); // $ExpectType AbcObject[] + fp.intersection(list)(list); // $ExpectType AbcObject[] } // _.intersectionBy { - let array: AbcObject[] = [] as any; - let list: _.List = [] as any; - let arrayParam: AbcObject[] = [] as any; - let listParam: _.List = [] as any; + const list: _.List = anything; + _.intersectionBy(list, list); // $ExpectType AbcObject[] + _.intersectionBy(list, list, list); // $ExpectType AbcObject[] + _.intersectionBy(list, list, "a"); // $ExpectType AbcObject[] + _.intersectionBy(list, list, list, { a: 42 }); // $ExpectType AbcObject[] + _.intersectionBy(list, list, ["a", 42]); // $ExpectType AbcObject[] // $ExpectType AbcObject[] - result = _.intersectionBy(array, list); - // $ExpectType AbcObject[] - result = _.intersectionBy(list, array, list); - // $ExpectType AbcObject[] - result = _.intersectionBy(array, list, 'a'); - // $ExpectType AbcObject[] - result = _.intersectionBy(array, list, { a: 42 }); - // $ExpectType AbcObject[] - result = _.intersectionBy(list, array, list, { a: 42 }); - // $ExpectType AbcObject[] - result = _.intersectionBy(array, list, ['a', 42]); - // $ExpectType AbcObject[] - result = _.intersectionBy(array, list, (value) => { + _.intersectionBy(list, list, (value) => { value; // $ExpectType AbcObject return 0; }); // $ExpectType AbcObject[] - result = _.intersectionBy(list, array, list, (value) => { + _.intersectionBy(list, list, list, (value) => { value; // $ExpectType AbcObject return 0; }); + _(list).intersectionBy(list); // $ExpectType LoDashImplicitWrapper + _(list).intersectionBy(list, "a"); // $ExpectType LoDashImplicitWrapper + _(list).intersectionBy(list, list, { a: 42 }); // $ExpectType LoDashImplicitWrapper + _(list).intersectionBy(list, ["a", 42]); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(arrayParam); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(listParam, arrayParam); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(list, 'a'); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(list, { a: 42 }); - // $ExpectType LoDashImplicitWrapper - result = _(list).intersectionBy(array, list, { a: 42 }); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(list, ['a', 42]); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionBy(list, (value) => { - value; // $ExpectType AbcObject - return ""; - }); - // $ExpectType LoDashImplicitWrapper - result = _(list).intersectionBy(array, list, (value) => { + _(list).intersectionBy(list, (value) => { value; // $ExpectType AbcObject return 1; }); + _.chain(list).intersectionBy(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersectionBy(list, "a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersectionBy(list, list, { a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersectionBy(list, ["a", 42]); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(arrayParam); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(listParam, arrayParam); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(list, 'a'); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(list, { a: 42 }); - // $ExpectType LoDashExplicitWrapper - result = _.chain(list).intersectionBy(array, list, { a: 42 }); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(list, ['a', 42]); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionBy(list, (value) => { - value; // $ExpectType AbcObject - return false; - }); - // $ExpectType LoDashExplicitWrapper - result = _.chain(list).intersectionBy(array, list, (value) => { + _.chain(list).intersectionBy(list, (value) => { value; // $ExpectType AbcObject return null; }); + fp.intersectionBy("a", list, list); // $ExpectType AbcObject[] + fp.intersectionBy("a", list, list); // $ExpectType AbcObject[] + fp.intersectionBy({ a: 42 }, list, list); // $ExpectType AbcObject[] + fp.intersectionBy(["a", 42], list, list); // $ExpectType AbcObject[] + fp.intersectionBy((value: AbcObject) => 0, list, list); // $ExpectType AbcObject[] + interface T1 { a: string; b: string; @@ -1469,20 +720,20 @@ namespace TestIntersection { a: string; b: number; } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 1 }; + const t1: T1 = { a: "a", b: "b" }; + const t2: T2 = { a: "a", b: 1 }; // $ExpectType T1[] - result = _.intersectionBy([t1], [t2], (value) => { + _.intersectionBy([t1], [t2], (value) => { value; // $ExpectType T1 | T2 return undefined; }); // $ExpectType LoDashImplicitWrapper - result = _([t1]).intersectionBy([t2], (value) => { + _([t1]).intersectionBy([t2], (value) => { value; // $ExpectType T1 | T2 return {}; }); // $ExpectType LoDashExplicitWrapper - result = _.chain([t1]).intersectionBy([t2], (value) => { + _.chain([t1]).intersectionBy([t2], (value) => { value; // $ExpectType T1 | T2 return {}; }); @@ -1490,62 +741,44 @@ namespace TestIntersection { // _.intersectionWith { - let array: AbcObject[] = [] as any; - let list: _.List = [] as any; - let arrayParam: AbcObject[] = [] as any; - let listParam: _.List = [] as any; + const list: _.List = anything; + _.intersectionWith(list, list); // $ExpectType AbcObject[] + _.intersectionWith(list, list, list); // $ExpectType AbcObject[] // $ExpectType AbcObject[] - result = _.intersectionWith(array, list); - // $ExpectType AbcObject[] - result = _.intersectionWith(list, array, list); - // $ExpectType AbcObject[] - result = _.intersectionWith(array, list, (a, b) => { + _.intersectionWith(list, list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); // $ExpectType AbcObject[] - result = _.intersectionWith(list, array, list, (a, b) => { + _.intersectionWith(list, list, list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); + _(list).intersectionWith(list); // $ExpectType LoDashImplicitWrapper + _(list).intersectionWith(list, list); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionWith(arrayParam); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionWith(listParam, arrayParam); - // $ExpectType LoDashImplicitWrapper - result = _(array).intersectionWith(list, (a, b) => { - a; // $ExpectType AbcObject - b; // $ExpectType AbcObject - return true; - }); - // $ExpectType LoDashImplicitWrapper - result = _(list).intersectionWith(array, list, (a, b) => { + _(list).intersectionWith(list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); + _.chain(list).intersectionWith(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).intersectionWith(list, list); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionWith(arrayParam); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionWith(listParam, arrayParam); - // $ExpectType LoDashExplicitWrapper - result = _.chain(array).intersectionWith(list, (a, b) => { - a; // $ExpectType AbcObject - b; // $ExpectType AbcObject - return true; - }); - // $ExpectType LoDashExplicitWrapper - result = _.chain(list).intersectionWith(array, list, (a, b) => { + _.chain(list).intersectionWith(list, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); + fp.intersectionWith((a: AbcObject, b: AbcObject) => true, list, list); // $ExpectType AbcObject[] + fp.intersectionWith((a: AbcObject, b: AbcObject) => true)(list)(list); // $ExpectType AbcObject[] + interface T1 { a: string; b: string; @@ -1554,434 +787,244 @@ namespace TestIntersection { a: string; b: number; } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 1 }; + const t1: T1 = { a: "a", b: "b" }; + const t2: T2 = { a: "a", b: 1 }; // $ExpectType T1[] - result = _.intersectionWith([t1], [t2], (a, b) => { + _.intersectionWith([t1], [t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashImplicitWrapper - result = _([t1]).intersectionWith([t2], (a, b) => { + _([t1]).intersectionWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashExplicitWrapper - result = _.chain([t1]).intersectionWith([t2], (a, b) => { + _.chain([t1]).intersectionWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); + + fp.intersectionWith((a: T1, b: T2) => true)([t1])([t2]); // $ExpectType T1[] } // _.join -namespace TestJoin { - let array = [1, 2]; - let list = {0: 1, 1: 2, length: 2}; - let nilArray: string[] | null | undefined = undefined as any; - let nilList: _.List | null | undefined = undefined as any; +{ + const list: _.List | null | undefined = anything; - { - let result: string; + _.join("abc"); // $ExpectType string + _.join("abc", "_"); // $ExpectType string + _.join(list); // $ExpectType string + _.join(list, "_"); // $ExpectType string - result = _.join('abc'); - result = _.join('abc', '_'); - result = _.join(array); - result = _.join(array, '_'); - result = _.join(list); - result = _.join(list, '_'); - result = _.join(nilArray); - result = _.join(nilArray, '_'); - result = _.join(nilList); - result = _.join(nilList, '_'); + _("abc").join(); // $ExpectType string + _("abc").join("_"); // $ExpectType string + _(list).join(); // $ExpectType string + _(list).join("_"); // $ExpectType string - result = _('abc').join(); - result = _('abc').join('_'); - result = _(array).join(); - result = _(array).join('_'); - result = _(list).join(); - result = _(list).join('_'); - } + _.chain("abc").join(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").join("_"); // $ExpectType LoDashExplicitWrapper + _.chain(list).join(); // $ExpectType LoDashExplicitWrapper + _.chain(list).join("_"); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().join(); - result = _('abc').chain().join('_'); - result = _(array).chain().join(); - result = _(array).chain().join('_'); - result = _(list).chain().join(); - result = _(list).chain().join('_'); - } + fp.join("_", "abc"); // $ExpectType string + fp.join("_")(list); // $ExpectType string } // _.last -namespace TestLast { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: string | undefined; + _.last("abc"); // $ExpectType string | undefined + _.last(list); // $ExpectType AbcObject | undefined - result = _.last('abc'); - result = _('abc').last(); - } + _("abc").last(); // $ExpectType string | undefined + _(list).last(); // $ExpectType AbcObject | undefined - { - let result: AbcObject | undefined; + _.chain("abc").last(); // $ExpectType LoDashExplicitWrapper + _.chain(list).last(); // $ExpectType LoDashExplicitWrapper - result = _.last(array); - result = _.last(list); - - result = _(array).last(); - result = _(list).last(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().last(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().last(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(list).chain().last(); - } -} - -// _.lastIndexOf -namespace TestLastIndexOf { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let value: AbcObject = { a: 1, b: "", c: true }; - - { - let result: number; - - result = _.lastIndexOf(array, value); - result = _.lastIndexOf(array, value, true); - result = _.lastIndexOf(array, value, 42); - - result = _.lastIndexOf(list, value); - result = _.lastIndexOf(list, value, true); - result = _.lastIndexOf(list, value, 42); - - result = _(array).lastIndexOf(value); - result = _(array).lastIndexOf(value, true); - result = _(array).lastIndexOf(value, 42); - - result = _(list).lastIndexOf(value); - result = _(list).lastIndexOf(value, true); - result = _(list).lastIndexOf(value, 42); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().lastIndexOf(value); - result = _(array).chain().lastIndexOf(value, true); - result = _(array).chain().lastIndexOf(value, 42); - - result = _(list).chain().lastIndexOf(value); - result = _(list).chain().lastIndexOf(value, true); - result = _(list).chain().lastIndexOf(value, 42); - } + fp.last("abc"); // $ExpectType string | undefined + fp.last(list); // $ExpectType AbcObject | undefined } // _.nth -namespace TestNth { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let value = 0; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject | undefined; + _.nth(list, 42); // $ExpectType AbcObject | undefined + _(list).nth(42); // $ExpectType AbcObject | undefined + _.chain(list).nth(42); // $ExpectType LoDashExplicitWrapper - result = _.nth(array); - - result = _.nth(array, 42); - - result = _(array).nth(); - result = _(array).nth(42); - - result = _(list).nth(); - result = _(list).nth(42); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().nth(); - result = _(array).chain().nth(42); - - result = _(list).chain().nth(); - result = _(list).chain().nth(42); - } + fp.nth(42, list); // $ExpectType AbcObject | undefined + fp.nth(42)(list); // $ExpectType AbcObject | undefined } // _.pull -namespace TestPull { - let array: AbcObject[] = []; - let list: _.List = []; - let value: AbcObject = { a: 1, b: "", c: true }; +{ + const array: AbcObject[] = []; + const list: _.List = []; + const value: AbcObject = { a: 1, b: "", c: true }; - { - let result: AbcObject[]; + _.pull(array); // $ExpectType AbcObject[] + _.pull(array, value); // $ExpectType AbcObject[] + _.pull(array, value, value, value); // $ExpectType AbcObject[] + _.pull(list); // $ExpectType ArrayLike + _.pull(list, value); // $ExpectType ArrayLike + _.pull(list, value, value, value); // $ExpectType ArrayLike - result = _.pull(array); - result = _.pull(array, value); - result = _.pull(array, value, value); - result = _.pull(array, value, value, value); - } + _(array).pull(); // $ExpectType LoDashImplicitWrapper + _(array).pull(value); // $ExpectType LoDashImplicitWrapper + _(array).pull(value, value, value); // $ExpectType LoDashImplicitWrapper + _(list).pull(); // $ExpectType LoDashImplicitWrapper> + _(list).pull(value); // $ExpectType LoDashImplicitWrapper> + _(list).pull(value, value, value); // $ExpectType LoDashImplicitWrapper> - { - let result: _.List; + _.chain(array).pull(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(value); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(value, value, value); // $ExpectType LoDashExplicitWrapper + _.chain(list).pull(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(value); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(value, value, value); // $ExpectType LoDashExplicitWrapper> - result = _.pull(list); - result = _.pull(list, value); - result = _.pull(list, value, value); - result = _.pull(list, value, value, value); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).pull(); - result = _(array).pull(value); - result = _(array).pull(value, value); - result = _(array).pull(value, value, value); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.List>; - - result = _(list).pull(); - result = _(list).pull(value); - result = _(list).pull(value, value); - result = _(list).pull(value, value, value); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().pull(); - result = _(array).chain().pull(value); - result = _(array).chain().pull(value, value); - result = _(array).chain().pull(value, value, value); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.List>; - - result = _(list).chain().pull(); - result = _(list).chain().pull(value); - result = _(list).chain().pull(value, value); - result = _(list).chain().pull(value, value, value); - } + fp.pull(value, array); // $ExpectType AbcObject[] + fp.pull(value, list); // $ExpectType ArrayLike + fp.pull(value)(list); // $ExpectType ArrayLike } // _.pullAt -namespace TestPullAt { - let array: AbcObject[] = []; - let list: _.List = []; +{ + const array: AbcObject[] = []; + const list: _.List = []; - { - let result: AbcObject[]; + _.pullAt(array); // $ExpectType AbcObject[] + _.pullAt(array, 1); // $ExpectType AbcObject[] + _.pullAt(array, [2, 3], 4); // $ExpectType AbcObject[] + _.pullAt(list); // $ExpectType ArrayLike + _.pullAt(list, 1); // $ExpectType ArrayLike + _.pullAt(list, [2, 3], 4); // $ExpectType ArrayLike - result = _.pullAt(array); - result = _.pullAt(array, 1); - result = _.pullAt(array, [2, 3], 1); - result = _.pullAt(array, 4, [2, 3], 1); - } + _(array).pullAt(); // $ExpectType LoDashImplicitWrapper + _(array).pullAt(1); // $ExpectType LoDashImplicitWrapper + _(array).pullAt([2, 3], 4); // $ExpectType LoDashImplicitWrapper + _(list).pullAt(); // $ExpectType LoDashImplicitWrapper> + _(list).pullAt(1); // $ExpectType LoDashImplicitWrapper> + _(list).pullAt([2, 3], 4); // $ExpectType LoDashImplicitWrapper> - { - let result: ArrayLike; + _.chain(array).pullAt(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAt(1); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAt([2, 3], 4); // $ExpectType LoDashExplicitWrapper + _.chain(list).pullAt(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pullAt(1); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pullAt([2, 3], 4); // $ExpectType LoDashExplicitWrapper> - result = _.pullAt(list); - result = _.pullAt(list, 1); - result = _.pullAt(list, [2, 3], 1); - result = _.pullAt(list, 4, [2, 3], 1); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).pullAt(); - result = _(array).pullAt(1); - result = _(array).pullAt([2, 3], 1); - result = _(array).pullAt(4, [2, 3], 1); - } - - { - let result: _.LoDashImplicitWrapper>; - - result = _(list).pullAt(); - result = _(list).pullAt(1); - result = _(list).pullAt([2, 3], 1); - result = _(list).pullAt(4, [2, 3], 1); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().pullAt(); - result = _(array).chain().pullAt(1); - result = _(array).chain().pullAt([2, 3], 1); - result = _(array).chain().pullAt(4, [2, 3], 1); - } - - { - let result: _.LoDashExplicitWrapper>; - - result = _(list).chain().pullAt(); - result = _(list).chain().pullAt(1); - result = _(list).chain().pullAt([2, 3], 1); - result = _(list).chain().pullAt(4, [2, 3], 1); - } + fp.pullAt(1, array); // $ExpectType AbcObject[] + fp.pullAt([2, 3], array); // $ExpectType AbcObject[] + fp.pullAt(1, list); // $ExpectType ArrayLike + fp.pullAt([2, 3], list); // $ExpectType ArrayLike + fp.pullAt(1)(list); // $ExpectType ArrayLike } // _.pullAll { - let array: AbcObject[] = anything; - let list: _.List = anything; - let values: _.List = anything; + const array: AbcObject[] = anything; + const list: _.List = anything; + const values: _.List = anything; - // $ExpectType AbcObject[] - _.pullAll(array); - // $ExpectType AbcObject[] - _.pullAll(array, values); - // $ExpectType ArrayLike - _.pullAll(list); - // $ExpectType ArrayLike - _.pullAll(list, values); + _.pullAll(array); // $ExpectType AbcObject[] + _.pullAll(array, values); // $ExpectType AbcObject[] + _.pullAll(list); // $ExpectType ArrayLike + _.pullAll(list, values); // $ExpectType ArrayLike - // $ExpectType LoDashImplicitWrapper - _(array).pullAll(); - // $ExpectType LoDashImplicitWrapper - _(array).pullAll(values); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAll(); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAll(values); + _(array).pullAll(); // $ExpectType LoDashImplicitWrapper + _(array).pullAll(values); // $ExpectType LoDashImplicitWrapper + _(list).pullAll(); // $ExpectType LoDashImplicitWrapper> + _(list).pullAll(values); // $ExpectType LoDashImplicitWrapper> - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAll(); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAll(values); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAll(); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAll(values); + _.chain(array).pullAll(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAll(values); // $ExpectType LoDashExplicitWrapper + _.chain(list).pullAll(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pullAll(values); // $ExpectType LoDashExplicitWrapper> + + fp.pullAll(values, array); // $ExpectType AbcObject[] + fp.pullAll(values, list); // $ExpectType ArrayLike + fp.pullAll(values)(list); // $ExpectType ArrayLike } // _.pullAllBy +// _.pullAllWith { - let array: AbcObject[] = anything; - let list: _.List = anything; - let values: _.List = anything; + const array: AbcObject[] = anything; + const list: _.List = anything; + const values: _.List = anything; - // $ExpectType AbcObject[] - _.pullAllBy(array); - // $ExpectType AbcObject[] - _.pullAllBy(array, values); - // $ExpectType AbcObject[] - _.pullAllBy(array, values, 'a'); - // $ExpectType AbcObject[] - _.pullAllBy(array, values, { a: 42 }); - // $ExpectType AbcObject[] - _.pullAllBy(array, values, ['a', 42]); + _.pullAllBy(array); // $ExpectType AbcObject[] + _.pullAllBy(array, values, "a"); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.pullAllBy(array, values, (value) => { value; // $ExpectType AbcObject return []; }); - // $ExpectType ArrayLike - _.pullAllBy(list); - // $ExpectType ArrayLike - _.pullAllBy(list, values); - // $ExpectType ArrayLike - _.pullAllBy(list, values, 'a'); - // $ExpectType ArrayLike - _.pullAllBy(list, values, { a: 42 }); - // $ExpectType ArrayLike - _.pullAllBy(list, values, ['a', 42]); + + _.pullAllBy(list); // $ExpectType ArrayLike + _.pullAllBy(list, values); // $ExpectType ArrayLike + _.pullAllBy(list, values, "a"); // $ExpectType ArrayLike + _.pullAllBy(list, values, { a: 42 }); // $ExpectType ArrayLike + _.pullAllBy(list, values, ["a", 42]); // $ExpectType ArrayLike // $ExpectType ArrayLike _.pullAllBy(list, values, (value) => { value; // $ExpectType AbcObject return () => {}; }); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(values); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(values, 'a'); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(values, { a: 42 }); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllBy(values, ['a', 42]); + _(array).pullAllBy(); // $ExpectType LoDashImplicitWrapper + _(array).pullAllBy(values, "a"); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(array).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(values); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(values, 'a'); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(values, { a: 42 }); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllBy(values, ['a', 42]); + _(list).pullAllBy(); // $ExpectType LoDashImplicitWrapper> + _(list).pullAllBy(values, "a"); // $ExpectType LoDashImplicitWrapper> // $ExpectType LoDashImplicitWrapper> _(list).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(values); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(values, 'a'); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(values, { a: 42 }); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllBy(values, ['a', 42]); + _.chain(array).pullAllBy(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAllBy(values, "a"); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(array).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(values); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(values, 'a'); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(values, { a: 42 }); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllBy(values, ['a', 42]); + _.chain(list).pullAllBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pullAllBy(values, "a"); // $ExpectType LoDashExplicitWrapper> // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAllBy(values, (value) => { value; // $ExpectType AbcObject return 0; }); + fp.pullAllBy("a", values, array); // $ExpectType AbcObject[] + fp.pullAllBy({ a: 42 }, values, array); // $ExpectType AbcObject[] + fp.pullAllBy(["a", 42], values, array); // $ExpectType AbcObject[] + fp.pullAllBy((value: AbcObject) => true, values, array); // $ExpectType AbcObject[] + fp.pullAllBy((value: AbcObject) => true)(values, array); // $ExpectType AbcObject[] + fp.pullAllBy((value: AbcObject) => true, values)(array); // $ExpectType AbcObject[] + fp.pullAllBy((value: AbcObject) => true)(values)(array); // $ExpectType AbcObject[] + fp.pullAllBy("a", values, list); // $ExpectType ArrayLike + fp.pullAllBy({ a: 42 }, values, list); // $ExpectType ArrayLike + fp.pullAllBy(["a", 42], values, list); // $ExpectType ArrayLike + fp.pullAllBy((value: AbcObject) => true, values, list); // $ExpectType ArrayLike + fp.pullAllBy((value: AbcObject) => true)(values, list); // $ExpectType ArrayLike + fp.pullAllBy((value: AbcObject) => true, values)(list); // $ExpectType ArrayLike + fp.pullAllBy((value: AbcObject) => true)(values)(list); // $ExpectType ArrayLike + interface T1 { a: string; b: string; @@ -1990,45 +1033,36 @@ namespace TestPullAt { a: string; b: number; } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 1 }; + const t1: T1 = { a: "a", b: "b" }; + const t2: T2 = { a: "a", b: 1 }; // $ExpectType T1[] - result = _.pullAllBy([t1], [t2], (value) => { + _.pullAllBy([t1], [t2], (value) => { value; // $ExpectType T1 | T2 return ""; }); // $ExpectType LoDashImplicitWrapper - result = _([t1]).pullAllBy([t2], (value) => { + _([t1]).pullAllBy([t2], (value) => { value; // $ExpectType T1 | T2 return ""; }); // $ExpectType LoDashExplicitWrapper - result = _.chain([t1]).pullAllBy([t2], (value) => { + _.chain([t1]).pullAllBy([t2], (value) => { value; // $ExpectType T1 | T2 return ""; }); -} -// _.pullAllWith -{ - let array: AbcObject[] = anything; - let list: _.List = anything; - let values: _.List = anything; + fp.pullAllBy((value: T1 | T2) => value.a, [t2], [t1]); // $ExpectType T1[] + fp.pullAllBy((value: T1 | T2) => value.a)([t2])([t1]); // $ExpectType (T1 | T2)[] - // $ExpectType AbcObject[] - _.pullAllWith(array); - // $ExpectType AbcObject[] - _.pullAllWith(array, values); + _.pullAllWith(array); // $ExpectType AbcObject[] + _.pullAllWith(array, values); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.pullAllWith(array, values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); - // $ExpectType ArrayLike - _.pullAllWith(list); - // $ExpectType ArrayLike - _.pullAllWith(list, values); + _.pullAllWith(list); // $ExpectType ArrayLike // $ExpectType ArrayLike _.pullAllWith(list, values, (a, b) => { a; // $ExpectType AbcObject @@ -2036,20 +1070,15 @@ namespace TestPullAt { return true; }); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllWith(); - // $ExpectType LoDashImplicitWrapper - _(array).pullAllWith(values); + _(array).pullAllWith(); // $ExpectType LoDashImplicitWrapper + _(array).pullAllWith(values); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper _(array).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllWith(); - // $ExpectType LoDashImplicitWrapper> - _(list).pullAllWith(values); + _(list).pullAllWith(); // $ExpectType LoDashImplicitWrapper> // $ExpectType LoDashImplicitWrapper> _(list).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject @@ -2057,20 +1086,15 @@ namespace TestPullAt { return true; }); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllWith(); - // $ExpectType LoDashExplicitWrapper - _.chain(array).pullAllWith(values); + _.chain(array).pullAllWith(); // $ExpectType LoDashExplicitWrapper + _.chain(array).pullAllWith(values); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper _.chain(array).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject b; // $ExpectType AbcObject return true; }); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllWith(); - // $ExpectType LoDashExplicitWrapper> - _.chain(list).pullAllWith(values); + _.chain(list).pullAllWith(); // $ExpectType LoDashExplicitWrapper> // $ExpectType LoDashExplicitWrapper> _.chain(list).pullAllWith(values, (a, b) => { a; // $ExpectType AbcObject @@ -2078,1987 +1102,585 @@ namespace TestPullAt { return true; }); - interface T1 { - a: string; - b: string; - } - interface T2 { - a: string; - b: number; - } - const t1: T1 = { a: 'a', b: 'b' }; - const t2: T2 = { a: 'a', b: 1 }; + fp.pullAllWith((a, b) => true, values, array); // $ExpectType AbcObject[] + fp.pullAllWith((a: AbcObject, b: AbcObject) => true)(values, array); // $ExpectType AbcObject[] + fp.pullAllWith((a, b) => true, values, list); // $ExpectType ArrayLike + fp.pullAllWith((a: AbcObject, b: AbcObject) => true)(values, list); // $ExpectType ArrayLike + // $ExpectType T1[] - result = _.pullAllWith([t1], [t2], (a, b) => { + _.pullAllWith([t1], [t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashImplicitWrapper - result = _([t1]).pullAllWith([t2], (a, b) => { + _([t1]).pullAllWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); // $ExpectType LoDashExplicitWrapper - result = _.chain([t1]).pullAllWith([t2], (a, b) => { + _.chain([t1]).pullAllWith([t2], (a, b) => { a; // $ExpectType T1 b; // $ExpectType T2 return true; }); + + fp.pullAllWith((a, b) => a.a === b.a, [t2], [t1]); // $ExpectType T1[] + fp.pullAllWith((a: T1, b: T2) => a.a === b.a)([t2], [t1]); // $ExpectType T1[] } // _.remove -namespace TestRemove { - let array: AbcObject[] = []; - let list: _.List = []; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; +{ + const list: _.List = []; + const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - { - let result: AbcObject[]; + _.remove(list); // $ExpectType AbcObject[] + _.remove(list, predicateFn); // $ExpectType AbcObject[] + _.remove(list, ""); // $ExpectType AbcObject[] + _.remove(list, { a: 42 }); // $ExpectType AbcObject[] - result = _.remove(array); - result = _.remove(array, predicateFn); - result = _.remove(array, ''); - result = _.remove(array, {a: 42}); + _(list).remove(); // $ExpectType LoDashImplicitWrapper + _(list).remove(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).remove(""); // $ExpectType LoDashImplicitWrapper + _(list).remove({ a: 42 }); // $ExpectType LoDashImplicitWrapper - result = _.remove(list); - result = _.remove(list, predicateFn); - result = _.remove(list, ''); - result = _.remove(list, {a: 42}); - } + _.chain(list).remove(); // $ExpectType LoDashExplicitWrapper + _.chain(list).remove(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).remove(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).remove({ a: 42 }); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).remove(); - result = _(array).remove(predicateFn); - result = _(array).remove(''); - result = _(array).remove({a: 42}); - - result = _(list).remove(); - result = _(list).remove(predicateFn); - result = _(list).remove(''); - result = _(list).remove({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().remove(); - result = _(array).chain().remove(predicateFn); - result = _(array).chain().remove(''); - result = _(array).chain().remove({a: 42}); - - result = _(list).chain().remove(); - result = _(list).chain().remove(predicateFn); - result = _(list).chain().remove(''); - result = _(list).chain().remove({a: 42}); - } + const predicateFn2 = (value: AbcObject) => true; + fp.remove(predicateFn2, list); // $ExpectType AbcObject[] + fp.remove(predicateFn2)(list); // $ExpectType AbcObject[] + fp.remove("", list); // $ExpectType AbcObject[] + fp.remove({ a: 42 }, list); // $ExpectType AbcObject[] } // _.tail -namespace TestTail { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; - - result = _.tail(array); - result = _.tail(list); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).tail(); - result = _(list).tail(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().tail(); - result = _(list).chain().tail(); - } + _.tail(list); // $ExpectType AbcObject[] + _(list).tail(); // $ExpectType LoDashImplicitWrapper + _.chain(list).tail(); // $ExpectType LoDashExplicitWrapper + fp.tail(list); // $ExpectType AbcObject[] } // _.slice -namespace TestSlice { - let array: AbcObject[] | null | undefined = [] as any; +{ + const array: AbcObject[] | null | undefined = anything; - { - let result: AbcObject[]; - - result = _.slice(array); - result = _.slice(array, 42); - result = _.slice(array, 42, 42); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).slice(); - result = _(array).slice(42); - result = _(array).slice(42, 42); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().slice(); - result = _(array).chain().slice(42); - result = _(array).chain().slice(42, 42); - } -} - -// _.sortedIndex -namespace TestSortedIndex { - type SampleType = {a: number; b: string; c: boolean;}; - - let array: SampleType[] = []; - let list: _.List = []; - - let value: SampleType = { a: 1, b: "", c: true }; - - let stringIterator: (x: string) => number; - let arrayIterator: (x: SampleType) => number; - let listIterator: (x: SampleType) => number; - - { - let result: number; - - result = _.sortedIndex('', ''); - - result = _.sortedIndex(array, value); - - result = _.sortedIndex(list, value); - - result = _('').sortedIndex(''); - - result = _(array).sortedIndex(value); - - result = _(list).sortedIndex(value); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().sortedIndex(''); - - result = _(array).chain().sortedIndex(value); - - result = _(list).chain().sortedIndex(value); - } + _.slice(array); // $ExpectType AbcObject[] + _.slice(array, 42); // $ExpectType AbcObject[] + _.slice(array, 42, 42); // $ExpectType AbcObject[] + _(array).slice(); // $ExpectType LoDashImplicitWrapper + _(array).slice(42, 42); // $ExpectType LoDashImplicitWrapper + _.chain(array).slice(); // $ExpectType LoDashExplicitWrapper + _.chain(array).slice(42, 42); // $ExpectType LoDashExplicitWrapper + fp.slice(0, 10, array); // $ExpectType AbcObject[] + fp.slice(0)(10, array); // $ExpectType AbcObject[] + fp.slice(0)(10)(array); // $ExpectType AbcObject[] } // _.sortedIndexBy -namespace TestSortedIndexBy { - type SampleType = {a: number; b: string; c: boolean;}; - - let array: SampleType[] = []; - let list: _.List = []; - - let value: SampleType = { a: 1, b: "", c: true }; - - let stringIterator = (x: string) => 0; - let arrayIterator = (x: SampleType) => 0; - let listIterator = (x: SampleType) => 0; - - { - let result: number; - - result = _.sortedIndexBy('', '', stringIterator); - - result = _.sortedIndexBy(array, value, arrayIterator); - result = _.sortedIndexBy(array, value, ''); - result = _.sortedIndexBy(array, value, {a: 42}); - - result = _.sortedIndexBy(list, value, listIterator); - result = _.sortedIndexBy(list, value, ''); - result = _.sortedIndexBy(list, value, {a: 42}); - - result = _('').sortedIndexBy('', stringIterator); - - result = _(array).sortedIndexBy(value, arrayIterator); - result = _(array).sortedIndexBy(value, ''); - result = _(array).sortedIndexBy(value, {a: 42}); - - result = _(list).sortedIndexBy(value, listIterator); - result = _(list).sortedIndexBy(value, ''); - result = _(list).sortedIndexBy(value, {a: 42}); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().sortedIndexBy('', stringIterator); - - result = _(array).chain().sortedIndexBy(value, arrayIterator); - result = _(array).chain().sortedIndexBy(value, ''); - result = _(array).chain().sortedIndexBy(value, {a: 42}); - - result = _(list).chain().sortedIndexBy(value, listIterator); - result = _(list).chain().sortedIndexBy(value, ''); - result = _(list).chain().sortedIndexBy(value, {a: 42}); - } -} - -// _.sortedLastIndex -namespace TestSortedLastIndex { - type SampleType = {a: number; b: string; c: boolean;}; - - let array: SampleType[] = []; - let list: _.List = []; - - let value: SampleType = { a: 1, b: "", c: true }; - - let stringIterator: (x: string) => number; - let arrayIterator: (x: SampleType) => number; - let listIterator: (x: SampleType) => number; - - { - let result: number; - - result = _.sortedLastIndex('', ''); - - result = _.sortedLastIndex(array, value); - - result = _.sortedLastIndex(list, value); - - result = _('').sortedLastIndex(''); - - result = _(array).sortedLastIndex(value); - - result = _(list).sortedLastIndex(value); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().sortedLastIndex(''); - - result = _(array).chain().sortedLastIndex(value); - - result = _(list).chain().sortedLastIndex(value); - } -} - // _.sortedLastIndexBy -namespace TestSortedLastIndexBy { - type SampleType = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const value: AbcObject = { a: 1, b: "", c: true }; + const listIterator = (value: AbcObject) => 0; - let array: SampleType[] = []; - let list: _.List = []; + _.sortedIndexBy(list, value, listIterator); // $ExpectType number + _.sortedIndexBy(list, value, ""); // $ExpectType number + _.sortedIndexBy(list, value, { a: 42 }); // $ExpectType number + _(list).sortedIndexBy(value, listIterator); // $ExpectType number + _(list).sortedIndexBy(value, ""); // $ExpectType number + _(list).sortedIndexBy(value, { a: 42 }); // $ExpectType number + _.chain(list).sortedIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexBy(listIterator, value, list); // $ExpectType number + fp.sortedIndexBy(listIterator)(value)(list); // $ExpectType number + fp.sortedIndexBy("a", value, list); // $ExpectType number + fp.sortedIndexBy({ a: 42 }, value, list); // $ExpectType number - let value: SampleType = { a: 1, b: "", c: true }; + _.sortedLastIndexBy(list, value, listIterator); // $ExpectType number + _.sortedLastIndexBy(list, value, ""); // $ExpectType number + _.sortedLastIndexBy(list, value, { a: 42 }); // $ExpectType number + _(list).sortedLastIndexBy(value, listIterator); // $ExpectType number + _(list).sortedLastIndexBy(value, ""); // $ExpectType number + _(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType number + _.chain(list).sortedLastIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexBy(listIterator, value, list); // $ExpectType number + fp.sortedLastIndexBy(listIterator)(value)(list); // $ExpectType number + fp.sortedLastIndexBy("a", value, list); // $ExpectType number + fp.sortedLastIndexBy({ a: 42 }, value, list); // $ExpectType number +} - let stringIterator = (x: string) => 0; - let arrayIterator = (x: SampleType) => 0; - let listIterator = (x: SampleType) => 0; +// _.sortedIndex +// _.sortedLastIndex +{ + const list: _.List | null | undefined = anything; + const value: AbcObject = { a: 1, b: "", c: true }; - { - let result: number; + _.sortedIndex(list, value); // $ExpectType number + _(list).sortedIndex(value); // $ExpectType number + _.chain(list).sortedIndex(value); // $ExpectType LoDashExplicitWrapper + fp.sortedIndex(value, list); // $ExpectType number + fp.sortedIndex(value)(list); // $ExpectType number - result = _.sortedLastIndexBy('', '', stringIterator); - - result = _.sortedLastIndexBy(array, value, arrayIterator); - result = _.sortedLastIndexBy(array, value, ''); - result = _.sortedLastIndexBy(array, value, {a: 42}); - - result = _.sortedLastIndexBy(list, value, listIterator); - result = _.sortedLastIndexBy(list, value, ''); - result = _.sortedLastIndexBy(list, value, {a: 42}); - - result = _('').sortedLastIndexBy('', stringIterator); - - result = _(array).sortedLastIndexBy(value, arrayIterator); - result = _(array).sortedLastIndexBy(value, ''); - result = _(array).sortedLastIndexBy(value, {a: 42}); - - result = _(list).sortedLastIndexBy(value, listIterator); - result = _(list).sortedLastIndexBy(value, ''); - result = _(list).sortedLastIndexBy(value, {a: 42}); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().sortedLastIndexBy('', stringIterator); - - result = _(array).chain().sortedLastIndexBy(value, arrayIterator); - result = _(array).chain().sortedLastIndexBy(value, ''); - result = _(array).chain().sortedLastIndexBy(value, {a: 42}); - - result = _(list).chain().sortedLastIndexBy(value, listIterator); - result = _(list).chain().sortedLastIndexBy(value, ''); - result = _(list).chain().sortedLastIndexBy(value, {a: 42}); - } + _.sortedLastIndex(list, value); // $ExpectType number + _(list).sortedLastIndex(value); // $ExpectType number + _.chain(list).sortedLastIndex(value); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndex(value, list); // $ExpectType number + fp.sortedLastIndex(value)(list); // $ExpectType number } // _.take -namespace TestTake { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - - { - let result: AbcObject[]; - - result = _.take(array); - result = _.take(array, 42); - - result = _.take(list); - result = _.take(list, 42); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).take(); - result = _(array).take(42); - - result = _(list).take(); - result = _(list).take(42); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().take(); - result = _(array).chain().take(42); - - result = _(list).chain().take(); - result = _(list).chain().take(42); - } -} - // _.takeRight -namespace TestTakeRight { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; + _.take(list); // $ExpectType AbcObject[] + _.take(list, 42); // $ExpectType AbcObject[] + _(list).take(); // $ExpectType LoDashImplicitWrapper + _(list).take(42); // $ExpectType LoDashImplicitWrapper + _.chain(list).take(); // $ExpectType LoDashExplicitWrapper + _.chain(list).take(42); // $ExpectType LoDashExplicitWrapper + fp.take(42, list); // $ExpectType AbcObject[] + fp.take(42)(list); // $ExpectType AbcObject[] - result = _.takeRight(array); - result = _.takeRight(array, 42); - - result = _.takeRight(list); - result = _.takeRight(list, 42); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).takeRight(); - result = _(array).takeRight(42); - - result = _(list).takeRight(); - result = _(list).takeRight(42); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().takeRight(); - result = _(array).chain().takeRight(42); - - result = _(list).chain().takeRight(); - result = _(list).chain().takeRight(42); - } -} - -// _.takeRightWhile -namespace TestTakeRightWhile { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - - { - let result: AbcObject[]; - - result = _.takeRightWhile(array); - result = _.takeRightWhile(array, predicateFn); - result = _.takeRightWhile(array, ''); - result = _.takeRightWhile(array, {a: 42}); - - result = _.takeRightWhile(list); - result = _.takeRightWhile(list, predicateFn); - result = _.takeRightWhile(list, ''); - result = _.takeRightWhile(list, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).takeRightWhile(); - result = _(array).takeRightWhile(predicateFn); - result = _(array).takeRightWhile(''); - result = _(array).takeRightWhile({a: 42}); - - result = _(list).takeRightWhile(); - result = _(list).takeRightWhile(predicateFn); - result = _(list).takeRightWhile(''); - result = _(list).takeRightWhile({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().takeRightWhile(); - result = _(array).chain().takeRightWhile(predicateFn); - result = _(array).chain().takeRightWhile(''); - result = _(array).chain().takeRightWhile({a: 42}); - - result = _(list).chain().takeRightWhile(); - result = _(list).chain().takeRightWhile(predicateFn); - result = _(list).chain().takeRightWhile(''); - result = _(list).chain().takeRightWhile({a: 42}); - } + _.takeRight(list); // $ExpectType AbcObject[] + _.takeRight(list, 42); // $ExpectType AbcObject[] + _(list).takeRight(); // $ExpectType LoDashImplicitWrapper + _(list).takeRight(42); // $ExpectType LoDashImplicitWrapper + _.chain(list).takeRight(); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRight(42); // $ExpectType LoDashExplicitWrapper + fp.takeRight(42, list); // $ExpectType AbcObject[] + fp.takeRight(42)(list); // $ExpectType AbcObject[] } // _.takeWhile -namespace TestTakeWhile { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let predicateFn = (value: AbcObject, index: number, collection: _.List) => true; +// _.takeRightWhile +{ + const list: _.List | null | undefined = anything; + const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; + const predicateFn2 = (value: AbcObject) => true; - { - let result: AbcObject[]; + _.takeWhile(list); // $ExpectType AbcObject[] + _.takeWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeWhile(list, ""); // $ExpectType AbcObject[] + _.takeWhile(list, { a: 42 }); // $ExpectType AbcObject[] - result = _.takeWhile(array); - result = _.takeWhile(array, predicateFn); - result = _.takeWhile(array, ''); - result = _.takeWhile(array, {a: 42}); + _(list).takeWhile(); // $ExpectType LoDashImplicitWrapper + _(list).takeWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeWhile(""); // $ExpectType LoDashImplicitWrapper + _(list).takeWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper - result = _.takeWhile(list); - result = _.takeWhile(list, predicateFn); - result = _.takeWhile(list, ''); - result = _.takeWhile(list, {a: 42}); - } + _.chain(list).takeWhile(); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeWhile(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; + fp.takeWhile(predicateFn2, list); // $ExpectType AbcObject[] + fp.takeWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeWhile("a", list); // $ExpectType AbcObject[] + fp.takeWhile({ a: 42 }, list); // $ExpectType AbcObject[] - result = _(array).takeWhile(); - result = _(array).takeWhile(predicateFn); - result = _(array).takeWhile(''); - result = _(array).takeWhile({a: 42}); + _.takeRightWhile(list); // $ExpectType AbcObject[] + _.takeRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeRightWhile(list, ""); // $ExpectType AbcObject[] + _.takeRightWhile(list, { a: 42 }); // $ExpectType AbcObject[] - result = _(list).takeWhile(); - result = _(list).takeWhile(predicateFn); - result = _(list).takeWhile(''); - result = _(list).takeWhile({a: 42}); - } + _(list).takeRightWhile(); // $ExpectType LoDashImplicitWrapper + _(list).takeRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeRightWhile(""); // $ExpectType LoDashImplicitWrapper + _(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper - { - let result: _.LoDashExplicitArrayWrapper; + _.chain(list).takeRightWhile(); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRightWhile(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(array).chain().takeWhile(); - result = _(array).chain().takeWhile(predicateFn); - result = _(array).chain().takeWhile(''); - result = _(array).chain().takeWhile({a: 42}); - - result = _(list).chain().takeWhile(); - result = _(list).chain().takeWhile(predicateFn); - result = _(list).chain().takeWhile(''); - result = _(list).chain().takeWhile({a: 42}); - } + fp.takeRightWhile(predicateFn2, list); // $ExpectType AbcObject[] + fp.takeRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeRightWhile("a", list); // $ExpectType AbcObject[] + fp.takeRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.union -namespace TestUnion { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; + _.union(list); // $ExpectType AbcObject[] + _.union(list, list); // $ExpectType AbcObject[] + _.union(list, list, list); // $ExpectType AbcObject[] - // $ExpectType {}[] - _.union(); + _(list).union(); // $ExpectType LoDashImplicitWrapper + _(list).union(list); // $ExpectType LoDashImplicitWrapper + _(list).union(list, list); // $ExpectType LoDashImplicitWrapper - result = _.union(array); - result = _.union(array, list); - result = _.union(array, list, array); + _.chain(list).union(); // $ExpectType LoDashExplicitWrapper + _.chain(list).union(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).union(list, list); // $ExpectType LoDashExplicitWrapper - result = _.union(list); - result = _.union(list, array); - result = _.union(list, array, list); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).union(); - result = _(array).union(list); - result = _(array).union(list, array); - - result = _(array).union(); - result = _(array).union(list); - result = _(array).union(list, array); - - result = _(list).union(); - result = _(list).union(array); - result = _(list).union(array, list); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().union(); - result = _(array).chain().union(list); - result = _(array).chain().union(list, array); - - result = _(array).chain().union(); - result = _(array).chain().union(list); - result = _(array).chain().union(list, array); - - result = _(list).chain().union(); - result = _(list).chain().union(array); - result = _(list).chain().union(array, list); - } + fp.union(list, list); // $ExpectType AbcObject[] + fp.union(list)(list); // $ExpectType AbcObject[] } // _.unionBy -namespace TestUnionBy { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let iteratee: (value: AbcObject) => any = (value: AbcObject) => 1; +{ + const list: _.List | null | undefined = anything; + const iteratee = (value: AbcObject) => 1; - { - let result: AbcObject[]; + _.unionBy(list, list); // $ExpectType AbcObject[] + _.unionBy(list, list, list, list, list, list); // $ExpectType AbcObject[] + _.unionBy(list, list, iteratee); // $ExpectType AbcObject[] + _.unionBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.unionBy(list, list, "a"); // $ExpectType AbcObject[] + // param needed for TS 2.3 + _.unionBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] + _.unionBy(list, list, {a: 1}); // $ExpectType AbcObject[] + _.unionBy(list, list, list, list, list, list, {a: 1}); // $ExpectType AbcObject[] - result = _.unionBy(array, array); - result = _.unionBy(array, list, array); - result = _.unionBy(array, array, list, array); - result = _.unionBy(array, list, array, list, array); - result = _.unionBy(array, array, list, array, list, array); + _(list).unionBy(list); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, "a"); // $ExpectType LoDashImplicitWrapper + // param needed for TS 2.3 + _(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, {a: 1}); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashImplicitWrapper - result = _.unionBy(array, array, iteratee); - result = _.unionBy(array, list, array, iteratee); - result = _.unionBy(array, array, list, array, iteratee); - result = _.unionBy(array, list, array, list, array, iteratee); - result = _.unionBy(array, array, list, array, list, array, iteratee); + _.chain(list).unionBy(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, "a"); // $ExpectType LoDashExplicitWrapper + // param needed for TS 2.3 + _.chain(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - result = _.unionBy(array, array, 'a'); - result = _.unionBy(array, list, array, 'a'); - // param needed for TS 2.3 - result = _.unionBy(array, array, list, array, 'a'); - result = _.unionBy(array, list, array, list, array, 'a'); - result = _.unionBy(array, array, list, array, list, array, 'a'); - - result = _.unionBy(array, array, {a: 1}); - result = _.unionBy(array, list, array, {a: 1}); - result = _.unionBy(array, array, list, array, {a: 1}); - result = _.unionBy(array, list, array, list, array, {a: 1}); - result = _.unionBy(array, list, array, list, array, list, {a: 1}); - - result = _.unionBy(list, list); - result = _.unionBy(list, array, list); - result = _.unionBy(list, list, array, list); - result = _.unionBy(list, array, list, array, list); - result = _.unionBy(list, list, array, list, array, list); - - result = _.unionBy(list, list, iteratee); - result = _.unionBy(list, array, list, iteratee); - result = _.unionBy(list, list, array, list, iteratee); - result = _.unionBy(list, array, list, array, list, iteratee); - result = _.unionBy(list, list, array, list, array, list, iteratee); - - result = _.unionBy(list, list, 'a'); - result = _.unionBy(list, array, list, 'a'); - // param needed for TS 2.3 - result = _.unionBy(list, list, array, list, 'a'); - result = _.unionBy(list, array, list, array, list, 'a'); - result = _.unionBy(list, list, array, list, array, list, 'a'); - - result = _.unionBy(list, list, {a: 1}); - result = _.unionBy(list, array, list, {a: 1}); - result = _.unionBy(list, list, array, list, {a: 1}); - result = _.unionBy(list, array, list, array, list, {a: 1}); - result = _.unionBy(list, array, list, array, list, array, {a: 1}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).unionBy(array); - result = _(array).unionBy(list, array); - result = _(array).unionBy(array, list, array); - result = _(array).unionBy(list, array, list, array); - result = _(array).unionBy(array, list, array, list, array); - - result = _(array).unionBy(array, iteratee); - result = _(array).unionBy(list, array, iteratee); - result = _(array).unionBy(array, list, array, iteratee); - result = _(array).unionBy(list, array, list, array, iteratee); - result = _(array).unionBy(array, list, array, list, array, iteratee); - - result = _(array).unionBy(array, 'a'); - result = _(array).unionBy(list, array, 'a'); - // param needed for TS 2.3 - result = _(array).unionBy(array, list, array, 'a'); - result = _(array).unionBy(list, array, list, array, 'a'); - result = _(array).unionBy(array, list, array, list, array, 'a'); - - result = _(array).unionBy(array, {a: 1}); - result = _(array).unionBy(list, array, {a: 1}); - result = _(array).unionBy(array, list, array, {a: 1}); - result = _(array).unionBy(list, array, list, array, {a: 1}); - result = _(array).unionBy(list, array, list, array, list, {a: 1}); - - result = _(list).unionBy(list); - result = _(list).unionBy(array, list); - result = _(list).unionBy(list, array, list); - result = _(list).unionBy(array, list, array, list); - result = _(list).unionBy(list, array, list, array, list); - - result = _(list).unionBy(list, iteratee); - result = _(list).unionBy(array, list, iteratee); - result = _(list).unionBy(list, array, list, iteratee); - result = _(list).unionBy(array, list, array, list, iteratee); - result = _(list).unionBy(list, array, list, array, list, iteratee); - - result = _(list).unionBy(list, 'a'); - result = _(list).unionBy(array, list, 'a'); - // param needed for TS 2.3 - result = _(list).unionBy(list, array, list, 'a'); - result = _(list).unionBy(array, list, array, list, 'a'); - result = _(list).unionBy(list, array, list, array, list, 'a'); - - result = _(list).unionBy(list, {a: 1}); - result = _(list).unionBy(array, list, {a: 1}); - result = _(list).unionBy(list, array, list, {a: 1}); - result = _(list).unionBy(array, list, array, list, {a: 1}); - result = _(list).unionBy(array, list, array, list, array, {a: 1}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().unionBy(array); - result = _(array).chain().unionBy(list, array); - result = _(array).chain().unionBy(array, list, array); - result = _(array).chain().unionBy(list, array, list, array); - result = _(array).chain().unionBy(array, list, array, list, array); - - result = _(array).chain().unionBy(array, iteratee); - result = _(array).chain().unionBy(list, array, iteratee); - result = _(array).chain().unionBy(array, list, array, iteratee); - result = _(array).chain().unionBy(list, array, list, array, iteratee); - result = _(array).chain().unionBy(array, list, array, list, array, iteratee); - - result = _(array).chain().unionBy(array, 'a'); - result = _(array).chain().unionBy(list, array, 'a'); - result = _(array).chain().unionBy(array, list, array, 'a'); - // param needed for TS 2.3 - result = _(array).chain().unionBy(list, array, list, array, 'a'); - result = _(array).chain().unionBy(array, list, array, list, array, 'a'); - - result = _(array).chain().unionBy(array, {a: 1}); - result = _(array).chain().unionBy(list, array, {a: 1}); - result = _(array).chain().unionBy(array, list, array, {a: 1}); - result = _(array).chain().unionBy(list, array, list, array, {a: 1}); - result = _(array).chain().unionBy(list, array, list, array, list, {a: 1}); - - result = _(list).chain().unionBy(list); - result = _(list).chain().unionBy(array, list); - result = _(list).chain().unionBy(list, array, list); - result = _(list).chain().unionBy(array, list, array, list); - result = _(list).chain().unionBy(list, array, list, array, list); - - result = _(list).chain().unionBy(list, iteratee); - result = _(list).chain().unionBy(array, list, iteratee); - result = _(list).chain().unionBy(list, array, list, iteratee); - result = _(list).chain().unionBy(array, list, array, list, iteratee); - result = _(list).chain().unionBy(list, array, list, array, list, iteratee); - - result = _(list).chain().unionBy(list, 'a'); - result = _(list).chain().unionBy(array, list, 'a'); - result = _(list).chain().unionBy(list, array, list, 'a'); - // param needed for TS 2.3 - result = _(list).chain().unionBy(array, list, array, list, 'a'); - result = _(list).chain().unionBy(list, array, list, array, list, 'a'); - - result = _(list).chain().unionBy(list, {a: 1}); - result = _(list).chain().unionBy(array, list, {a: 1}); - result = _(list).chain().unionBy(list, array, list, {a: 1}); - result = _(list).chain().unionBy(array, list, array, list, {a: 1}); - result = _(list).chain().unionBy(array, list, array, list, array, {a: 1}); - } + fp.unionBy(iteratee, list, list); // $ExpectType AbcObject[] + fp.unionBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.unionBy("a", list, list); // $ExpectType AbcObject[] + fp.unionBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } // _.uniq -namespace TestUniq { - type SampleObject = {a: number; b: string; c: boolean}; +// _.sortedUniq +{ + const list: _.List | null | undefined = anything; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; + _.uniq("abc"); // $ExpectType string[] + _.uniq(list); // $ExpectType AbcObject[] + _(list).uniq(); // $ExpectType LoDashImplicitWrapper + _.chain(list).uniq(); // $ExpectType LoDashExplicitWrapper + fp.uniq("abc"); // $ExpectType string[] + fp.uniq(list); // $ExpectType AbcObject[] - { - let result: string[]; - result = _.uniq('abc'); - } - - { - let result: SampleObject[]; - - result = _.uniq(array); - result = _.uniq(list); - } - - { - let result: _.LoDashImplicitArrayWrapper; - result = _('abc').uniq(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).uniq(); - result = _(list).uniq(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().uniq(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().uniq(); - result = _(list).chain().uniq(); - } + _.sortedUniq("abc"); // $ExpectType string[] + _.sortedUniq(list); // $ExpectType AbcObject[] + _(list).sortedUniq(); // $ExpectType LoDashImplicitWrapper + _.chain(list).sortedUniq(); // $ExpectType LoDashExplicitWrapper + fp.sortedUniq("abc"); // $ExpectType string[] + fp.sortedUniq(list); // $ExpectType AbcObject[] } // _.uniqBy -namespace TestUniqBy { - type SampleObject = {a: number; b: string; c: boolean}; - - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - - let stringIterator = (value: string, index: number, collection: string) => ""; - let listIterator = (value: SampleObject, index: number, collection: _.List) => 0; - - { - let result: string[]; - - result = _.uniqBy('abc', stringIterator); - } - - { - let result: SampleObject[]; - - result = _.uniqBy(array, listIterator); - result = _.uniqBy(array, 'a'); - result = _.uniqBy(array, {a: 42}); - - result = _.uniqBy(list, listIterator); - result = _.uniqBy(list, 'a'); - result = _.uniqBy(list, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').uniqBy(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).uniqBy(listIterator); - result = _(array).uniqBy('a'); - result = _(array).uniqBy({a: 42}); - - result = _(list).uniqBy(listIterator); - result = _(list).uniqBy('a'); - result = _(list).uniqBy({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().uniqBy(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().uniqBy(listIterator); - result = _(array).chain().uniqBy('a'); - result = _(array).chain().uniqBy({a: 42}); - - result = _(list).chain().uniqBy(listIterator); - result = _(list).chain().uniqBy('a'); - result = _(list).chain().uniqBy({a: 42}); - } -} - -// _.sortedUniq -namespace TestSortedUniq { - type SampleObject = {a: number; b: string; c: boolean}; - - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - - { - let result: string[]; - result = _.sortedUniq('abc'); - } - - { - let result: SampleObject[]; - result = _.sortedUniq(array); - result = _.sortedUniq(list); - } - - { - let result: _.LoDashImplicitArrayWrapper; - result = _('abc').sortedUniq(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - result = _(array).sortedUniq(); - result = _(list).sortedUniq(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - result = _('abc').chain().sortedUniq(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().sortedUniq(); - result = _(list).chain().sortedUniq(); - } -} - // _.sortedUniqBy -namespace TestSortedUniqBy { - type SampleObject = {a: number; b: string; c: boolean}; +{ + const list: _.List | null | undefined = anything; + const stringIterator = (value: string, index: number, collection: string) => ""; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 0; + const stringIterator2 = (value: string) => ""; + const listIterator2 = (value: AbcObject) => 0; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; + _.uniqBy("abc", stringIterator); // $ExpectType string[] + _.uniqBy(list, listIterator); // $ExpectType AbcObject[] + _.uniqBy(list, "a"); // $ExpectType AbcObject[] + _(list).uniqBy(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).uniqBy("a"); // $ExpectType LoDashImplicitWrapper + _.chain(list).uniqBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).uniqBy("a"); // $ExpectType LoDashExplicitWrapper - let stringIterator = (value: string, index: number, collection: string) => ""; - let listIterator = (value: SampleObject, index: number, collection: _.List) => 0; + fp.uniqBy(stringIterator2, "abc"); // $ExpectType string[] + fp.uniqBy(listIterator2, list); // $ExpectType AbcObject[] + fp.uniqBy(listIterator2)(list); // $ExpectType AbcObject[] + fp.uniqBy("a", list); // $ExpectType AbcObject[] - { - let result: string[]; + _.sortedUniqBy("abc", stringIterator); // $ExpectType string[] + _.sortedUniqBy(list, listIterator); // $ExpectType AbcObject[] + _.sortedUniqBy(list, "a"); // $ExpectType AbcObject[] + _(list).sortedUniqBy(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).sortedUniqBy("a"); // $ExpectType LoDashImplicitWrapper + _.chain(list).sortedUniqBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedUniqBy("a"); // $ExpectType LoDashExplicitWrapper - result = _.sortedUniqBy('abc', stringIterator); - } - - { - let result: SampleObject[]; - - result = _.sortedUniqBy(array, listIterator); - result = _.sortedUniqBy(array, 'a'); - result = _.sortedUniqBy(array, {a: 42}); - - result = _.sortedUniqBy(list, listIterator); - result = _.sortedUniqBy(list, 'a'); - result = _.sortedUniqBy(list, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').sortedUniqBy(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).sortedUniqBy(listIterator); - result = _(array).sortedUniqBy('a'); - result = _(array).sortedUniqBy({a: 42}); - - result = _(list).sortedUniqBy(listIterator); - result = _(list).sortedUniqBy('a'); - result = _(list).sortedUniqBy({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().sortedUniqBy(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().sortedUniqBy(listIterator); - result = _(array).chain().sortedUniqBy('a'); - result = _(array).chain().sortedUniqBy({a: 42}); - - result = _(list).chain().sortedUniqBy(listIterator); - result = _(list).chain().sortedUniqBy('a'); - result = _(list).chain().sortedUniqBy({a: 42}); - } + fp.sortedUniqBy(stringIterator2, "abc"); // $ExpectType string[] + fp.sortedUniqBy(listIterator2, list); // $ExpectType AbcObject[] + fp.sortedUniqBy(listIterator2)(list); // $ExpectType AbcObject[] + fp.sortedUniqBy("a", list); // $ExpectType AbcObject[] } // _.unzip -namespace TestUnzip { - let array = [['a', 'b'], [1, 2], [true, false]]; +{ + const list: _.List<_.List> | null | undefined = anything; - let list: _.List<_.List> = { - 0: {0: 'a', 1: 'b', length: 2}, - 1: {0: 1, 1: 2, length: 2}, - 2: {0: true, 1: false, length: 2}, - length: 3 - }; - let nilArray: AbcObject[][] | null | undefined = [] as any; - let nilList: _.List<_.List> | null | undefined = [] as any; - - { - let result: AbcObject[][]; - - result = _.unzip(nilArray); - result = _.unzip(nilList); - } - - { - let result: Array>; - - result = _.unzip(array); - result = _.unzip(list); - } - - { - let result: _.LoDashImplicitArrayWrapper>; - - result = _(array).unzip(); - result = _(list).unzip(); - } - - { - let result: _.LoDashExplicitArrayWrapper>; - - result = _(array).chain().unzip(); - result = _(list).chain().unzip(); - } + _.unzip(list); // $ExpectType AbcObject[][] + _(list).unzip(); // $ExpectType LoDashImplicitWrapper + _.chain(list).unzip(); // $ExpectType LoDashExplicitWrapper + fp.unzip(list); // $ExpectType AbcObject[][] } // _.unzipWith { - let testUnzipWithArray: Array> | null | undefined = [] as any; - let testUnzipWithList: _.List> | null | undefined = [] as any; + const list: _.List<_.List> | null | undefined = anything; - { - _.unzipWith(testUnzipWithArray); // $ExpectType number[][] - _.unzipWith(testUnzipWithList); // $ExpectType number[][] - _(testUnzipWithArray).unzipWith(); // $ExpectType LoDashImplicitWrapper - _(testUnzipWithList).unzipWith(); // $ExpectType LoDashImplicitWrapper - _.chain(testUnzipWithArray).unzipWith(); // $ExpectType LoDashExplicitWrapper - _.chain(testUnzipWithList).unzipWith(); // $ExpectType LoDashExplicitWrapper - } + _.unzipWith(list); // $ExpectType AbcObject[][] + // $ExpectType number[] + _.unzipWith(list, (...group) => { + group; // $ExpectType AbcObject[] + return 1; + }); + // $ExpectType boolean[] + _.unzipWith(list, (value1, value2, value3) => { + value1; // $ExpectType AbcObject + value2; // $ExpectType AbcObject + value3; // $ExpectType AbcObject + return true; + }); + _(list).unzipWith(); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).unzipWith((...group) => { + group; // $ExpectType AbcObject[] + return 1; + }); + _.chain(list).unzipWith(); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).unzipWith((...group) => { + group; // $ExpectType AbcObject[] + return 1; + }); - { - let result: AbcObject[]; - result = _.unzipWith(testUnzipWithArray, (...group) => { - group; // $ExpectType number[] - return anything as AbcObject; - }); - result = _.unzipWith(testUnzipWithArray, (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return anything as AbcObject; - }); - result = _.unzipWith(testUnzipWithList, (...group) => { - group; // $ExpectType number[] - return anything as AbcObject; - }); - result = _.unzipWith(testUnzipWithList, (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return anything as AbcObject; - }); - - result = _(testUnzipWithArray).unzipWith((...group): AbcObject => { - group; // $ExpectType number[] - return anything as AbcObject; - }).value(); - result = _(testUnzipWithArray).unzipWith((value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return anything as AbcObject; - }).value(); - result = _(testUnzipWithList).unzipWith((...group): AbcObject => { - group; // $ExpectType number[] - return anything as AbcObject; - }).value(); - result = _(testUnzipWithList).unzipWith((value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return anything as AbcObject; - }).value(); - } + fp.unzipWith((...group: AbcObject[]) => 1, list); // $ExpectType number[] + fp.unzipWith((...group: AbcObject[]) => 1)(list); // $ExpectType number[] } // _.without -namespace TestWithout { - let array: number[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: number[]; + _.without(list); // $ExpectType number[] + _.without(list, 1); // $ExpectType number[] + _.without(list, 1, 2, 3); // $ExpectType number[] - result = _.without(array); - result = _.without(array, 1); - result = _.without(array, 1, 2); - result = _.without(array, 1, 2, 3); + _(list).without(); // $ExpectType LoDashImplicitWrapper + _(list).without(1); // $ExpectType LoDashImplicitWrapper + _(list).without(1, 2, 3); // $ExpectType LoDashImplicitWrapper - result = _.without(list); - result = _.without(list, 1); - result = _.without(list, 1, 2); - result = _.without(list, 1, 2, 3); - } + _.chain(list).without(); // $ExpectType LoDashExplicitWrapper + _.chain(list).without(1); // $ExpectType LoDashExplicitWrapper + _.chain(list).without(1, 2, 3); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).without(); - result = _(array).without(1); - result = _(array).without(1, 2); - result = _(array).without(1, 2, 3); - result = _(list).without(); - result = _(list).without(1); - result = _(list).without(1, 2); - result = _(list).without(1, 2, 3); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().without(); - result = _(array).chain().without(1); - result = _(array).chain().without(1, 2); - result = _(array).chain().without(1, 2, 3); - - result = _(list).chain().without(); - result = _(list).chain().without(1); - result = _(list).chain().without(1, 2); - result = _(list).chain().without(1, 2, 3); - } + fp.without([1, 2], list); + fp.without([1, 2])(list); } // _.xor -namespace TestXor { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; +{ + const list: _.List | null | undefined = anything; - { - let result: AbcObject[]; + _.xor(list); // $ExpectType AbcObject[] + _.xor(list, list); // $ExpectType AbcObject[] + _.xor(list, list, list); // $ExpectType AbcObject[] - // $ExpectType {}[] - _.xor(); + _(list).xor(); // $ExpectType LoDashImplicitWrapper + _(list).xor(list); // $ExpectType LoDashImplicitWrapper + _(list).xor(list, list); // $ExpectType LoDashImplicitWrapper - result = _.xor(array); - result = _.xor(array, list); - result = _.xor(array, list, array); + _.chain(list).xor(); // $ExpectType LoDashExplicitWrapper + _.chain(list).xor(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).xor(list, list); // $ExpectType LoDashExplicitWrapper - result = _.xor(list); - result = _.xor(list, array); - result = _.xor(list, array, list); - } + fp.xor(list, list); // $ExpectType AbcObject[] + fp.xor(list)(list); // $ExpectType AbcObject[] +} - { - let result: _.LoDashImplicitArrayWrapper; +// _.xorBy +{ + const list: _.List | null | undefined = anything; + const iteratee = (value: AbcObject) => 1; - result = _(array).xor(); - result = _(array).xor(list); - result = _(array).xor(list, array); + _.xorBy(list, list); // $ExpectType AbcObject[] + _.xorBy(list, list, list, list, list, list); // $ExpectType AbcObject[] + _.xorBy(list, list, iteratee); // $ExpectType AbcObject[] + _.xorBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.xorBy(list, list, "a"); // $ExpectType AbcObject[] + // param needed for TS 2.3 + _.xorBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] + _.xorBy(list, list, {a: 1}); // $ExpectType AbcObject[] + _.xorBy(list, list, list, list, list, list, {a: 1}); // $ExpectType AbcObject[] - result = _(list).xor(); - result = _(list).xor(array); - result = _(list).xor(array, list); - } + _(list).xorBy(list); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, "a"); // $ExpectType LoDashImplicitWrapper + // param needed for TS 2.3 + _(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, {a: 1}); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashImplicitWrapper - { - let result: _.LoDashExplicitArrayWrapper; + _.chain(list).xorBy(list); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, "a"); // $ExpectType LoDashExplicitWrapper + // param needed for TS 2.3 + _.chain(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - result = _(array).chain().xor(); - result = _(array).chain().xor(list); - result = _(array).chain().xor(list, array); - - result = _(list).chain().xor(); - result = _(list).chain().xor(array); - result = _(list).chain().xor(array, list); - } + fp.xorBy(iteratee, list, list); // $ExpectType AbcObject[] + fp.xorBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.xorBy("a", list, list); // $ExpectType AbcObject[] + fp.xorBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } // _.zip { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; + const list: _.List | null | undefined = anything; - { - // $ExpectType (AbcObject | undefined)[][] - _.zip(array); - // $ExpectType (AbcObject | undefined)[][] - _.zip(array, list); - // $ExpectType (AbcObject | undefined)[][] - _.zip(array, list, array); + _.zip(list); // $ExpectType (AbcObject | undefined)[][] + _.zip(list, list); // $ExpectType (AbcObject | undefined)[][] + _.zip(list, list, list, list, list, list); // $ExpectType (AbcObject | undefined)[][] + _.zip([1, 2], [3, 4]); // $ExpectType [number | undefined, number | undefined][] + _.zip([1, 2], ["a", "b"]); // $ExpectType [number | undefined, string | undefined][] + _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number | undefined, string | undefined, boolean | undefined][] - // $ExpectType (AbcObject | undefined)[][] - _.zip(list); - // $ExpectType (AbcObject | undefined)[][] - _.zip(list, array); - // $ExpectType (AbcObject | undefined)[][] - _.zip(list, array, list); + _(list).zip(list); // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> + _(list).zip(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - // $ExpectType (AbcObject | undefined)[][] - _.zip(list, array, list, array, list, array); - } + _.chain(list).zip(list); // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> + _.chain(list).zip(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - { - // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - _(array).zip(list); - // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - _(array).zip(list, array); - - // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - _(list).zip(array); - // $ExpectType LoDashImplicitWrapper<(AbcObject | undefined)[][]> - _(list).zip(array, list); - } - - { - // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - _(array).chain().zip(list); - // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - _(array).chain().zip(list, array); - - // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - _(list).chain().zip(array); - // $ExpectType LoDashExplicitWrapper<(AbcObject | undefined)[][]> - _(list).chain().zip(array, list); - } - - { - _.zip([1, 2], [3, 4]); // $ExpectType [number | undefined, number | undefined][] - _.zip([1, 2], ["a", "b"]); // $ExpectType [number | undefined, string | undefined][] - _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number | undefined, string | undefined, boolean | undefined][] - } + const list2: _.List = anything; + fp.zip(list2, list2); // $ExpectType [AbcObject | undefined, AbcObject | undefined][] + fp.zip(list2)(list2); // $ExpectType [AbcObject | undefined, AbcObject | undefined][] + fp.zip(["a", "b"], [1, 2]); // $ExpectType [string | undefined, number | undefined][] + fp.zipAll([list2, list2, list2]); // $ExpectType (AbcObject | undefined)[][] + fp.zipAll([[1, 2], ["a", "b"], [true, false]]); // $ExpectType (string | number | boolean | undefined)[][] } // _.zipObject -namespace TestZipObject { - const zipObjectResult = _.zipObject(['a', 'b'], [1, 2]); - const zipObjectDeepResult = _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); +// _.zipObjectDeep +{ + const listOfKeys: _.List = anything; + const listOfValues: _.List = anything; - let arrayOfKeys: string[] = []; - let arrayOfValues: number[] = []; + _.zipObject(["a", "b"], [1, 2]); // $ExpectType Dictionary + _.zipObject(listOfKeys, listOfValues); // $ExpectType Dictionary + _(listOfKeys).zipObject(listOfValues); // $ExpectType LoDashImplicitWrapper> + _.chain(listOfKeys).zipObject(listOfValues); // $ExpectType LoDashExplicitWrapper> + fp.zipObject(["a", "b"], [1, 2]); // $ExpectType Dictionary + fp.zipObject(listOfKeys)(listOfValues); // $ExpectType Dictionary - let listOfKeys: _.List = []; - let listOfValues: _.List = []; - - { - let result: _.Dictionary; - - result = _.zipObject(arrayOfKeys); - result = _.zipObject(listOfKeys); - } - - { - let result: _.Dictionary; - - result = _.zipObject(arrayOfKeys, arrayOfValues); - result = _.zipObject(arrayOfKeys, listOfValues); - result = _.zipObject(listOfKeys, listOfValues); - result = _.zipObject(listOfKeys, arrayOfValues); - - result = _.zipObject(arrayOfKeys, arrayOfValues); - result = _.zipObject(arrayOfKeys, listOfValues); - result = _.zipObject(listOfKeys, listOfValues); - result = _.zipObject(listOfKeys, arrayOfValues); - } - - { - let result: _.Dictionary; - - result = _.zipObject(arrayOfKeys); - result = _.zipObjectDeep(arrayOfKeys); - result = _.zipObject(arrayOfKeys, arrayOfValues); - result = _.zipObjectDeep(arrayOfKeys, arrayOfValues); - result = _.zipObject(arrayOfKeys, listOfValues); - result = _.zipObjectDeep(arrayOfKeys, listOfValues); - - result = _.zipObject(listOfKeys); - result = _.zipObjectDeep(listOfKeys); - result = _.zipObject(listOfKeys, listOfValues); - result = _.zipObjectDeep(listOfKeys, listOfValues); - result = _.zipObject(listOfKeys, arrayOfValues); - result = _.zipObjectDeep(listOfKeys, arrayOfValues); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).zipObject(); - result = _(listOfKeys).zipObject(); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).zipObject(arrayOfValues); - result = _(arrayOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObject(arrayOfValues); - - result = _(arrayOfKeys).zipObject(arrayOfValues); - result = _(arrayOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObject(arrayOfValues); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).zipObject(); - result = _(arrayOfKeys).zipObjectDeep(); - result = _(arrayOfKeys).zipObject(arrayOfValues); - result = _(arrayOfKeys).zipObjectDeep(arrayOfValues); - result = _(arrayOfKeys).zipObject(listOfValues); - result = _(arrayOfKeys).zipObjectDeep(listOfValues); - - result = _(listOfKeys).zipObject(); - result = _(listOfKeys).zipObjectDeep(); - result = _(listOfKeys).zipObject(listOfValues); - result = _(listOfKeys).zipObjectDeep(listOfValues); - result = _(listOfKeys).zipObject(arrayOfValues); - result = _(listOfKeys).zipObjectDeep(arrayOfValues); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().zipObject(); - result = _(listOfKeys).chain().zipObject(); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().zipObject(arrayOfValues); - result = _(arrayOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObject(arrayOfValues); - - result = _(arrayOfKeys).chain().zipObject(arrayOfValues); - result = _(arrayOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObject(arrayOfValues); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().zipObject(); - result = _(arrayOfKeys).chain().zipObjectDeep(); - result = _(arrayOfKeys).chain().zipObject(arrayOfValues); - result = _(arrayOfKeys).chain().zipObjectDeep(arrayOfValues); - result = _(arrayOfKeys).chain().zipObject(listOfValues); - result = _(arrayOfKeys).chain().zipObjectDeep(listOfValues); - - result = _(listOfKeys).chain().zipObject(); - result = _(listOfKeys).chain().zipObjectDeep(); - result = _(listOfKeys).chain().zipObject(listOfValues); - result = _(listOfKeys).chain().zipObjectDeep(listOfValues); - result = _(listOfKeys).chain().zipObject(arrayOfValues); - result = _(listOfKeys).chain().zipObjectDeep(arrayOfValues); - } + _.zipObjectDeep(["a.b[0].c", "a.b[1].d"], [1, 2]); // $ExpectType object + _.zipObjectDeep(listOfKeys, listOfValues); // $ExpectType object + _(listOfKeys).zipObjectDeep(listOfValues); // $ExpectType LoDashImplicitWrapper + _.chain(listOfKeys).zipObjectDeep(listOfValues); // $ExpectType LoDashExplicitWrapper + fp.zipObjectDeep(["a.b[0].c", "a.b[1].d"], [1, 2]); // $ExpectType object + fp.zipObjectDeep(listOfKeys)(listOfValues); // $ExpectType object } // _.zipWith { - type TestZipWithFn = (a1: number, a2: number) => number; - - { - let result: number[]; - - result = _.zipWith([1, 2], (value1) => { - value1; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], (value1, value2) => { - value1; // $ExpectType number - value2; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5, value6) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - value6; // $ExpectType number - return 1; - }); - result = _.zipWith([1, 2], [1, 2], [1, 2], (...group: number[]) => 1); - result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { - group; // $ExpectType number[] - return 1; - }); - - let mat = [[1, 2], [1, 2], [1, 2]]; - result = _.zipWith(...mat, (...group: number[]) => 1); - - result = _([1, 2]).zipWith((value1) => { - value1; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], (value1, value2) => { - value1; // $ExpectType number - value2; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], (value1, value2, value3, value4) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5, value6) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - value6; // $ExpectType number - return 1; - }).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], (...group: number[]) => 1).value(); - result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { - group; // $ExpectType number[] - return 1; - }).value(); - - result = _.chain([1, 2]).zipWith((value1) => { - value1; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], (value1, value2) => { - value1; // $ExpectType number - value2; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], (value1, value2, value3, value4) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5, value6) => { - value1; // $ExpectType number - value2; // $ExpectType number - value3; // $ExpectType number - value4; // $ExpectType number - value5; // $ExpectType number - value6; // $ExpectType number - return 1; - }).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], (...group: number[]) => 1).value(); - result = _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { - group; // $ExpectType number[] - return 1; - }).value(); - - result = _([1, 2]).zipWith(["a", "b"], (value1, value2) => { - value1; // $ExpectType number - value2; // $ExpectType string - return 1; - }).value(); - - result = _([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => { - value1; // $ExpectType number - value2; // $ExpectType string - value3; // $ExpectType boolean - return 1; - }).value(); - } -} - -/********* - * Chain * - *********/ - -// _.chain -namespace TestChain { - { - let result: _.LoDashExplicitWrapper; - - result = _.chain(''); - result = _('').chain(); - - result = _.chain('').chain(); - result = _('').chain().chain(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _.chain(42); - result = _(42).chain(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _.chain(true); - result = _(true).chain(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _.chain(['']); - result = _(['']).chain(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{a: string}>; - - result = _.chain<{a: string}>({a: ''}); - result = _<{a: string}>({a: ''}).chain(); - } -} - -// _.tap -namespace TestTap { - { - let interceptor = (value: string) => {}; - let result: string; - - _.tap('', interceptor); - } - - { - let interceptor = (value: string[]) => {}; - let result: _.LoDashImplicitArrayWrapper; - - _.tap([''], interceptor); - } - - { - let interceptor = (value: {a: string}) => {}; - let result: _.LoDashImplicitObjectWrapper<{a: string}>; - - _.tap({a: ''}, interceptor); - } - - { - let interceptor = (value: string) => {}; - let result: _.LoDashImplicitWrapper; - - _.chain('').tap(interceptor); - - _('').tap(interceptor); - } - - { - let interceptor = (value: string[]) => {}; - let result: _.LoDashImplicitArrayWrapper; - - _.chain(['']).tap(interceptor); - - _(['']).tap(interceptor); - } - - { - let interceptor = (value: {a: string}) => {}; - let result: _.LoDashImplicitWrapper<{a: string}>; - - _.chain({a: ''}).tap(interceptor); - - _({a: ''}).tap(interceptor); - } - - { - let interceptor = (value: string) => {}; - let result: _.LoDashExplicitWrapper; - - _.chain('').tap(interceptor); - - _('').chain().tap(interceptor); - } - - { - let interceptor = (value: string[]) => {}; - let result: _.LoDashExplicitArrayWrapper; - - _.chain(['']).tap(interceptor); - - _(['']).chain().tap(interceptor); - } - - { - let interceptor = (value: {a: string}) => {}; - let result: _.LoDashExplicitWrapper<{a: string}>; - - _.chain({a: ''}).tap(interceptor); - - _({a: ''}).chain().tap(interceptor); - } -} - -// _.thru -namespace TestThru { - type Interceptor = (value: T) => T; - - { - let interceptor: Interceptor = (x) => x; - let result: number; - - result = _.thru(1, interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashImplicitWrapper; - - result = _(1).thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashImplicitWrapper; - - result = _('').thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashImplicitWrapper; - - result = _(true).thru(interceptor); - } - - { - let interceptor: Interceptor<{a: string}> = (x) => x; - let result: _.LoDashImplicitObjectWrapper<{a: string}>; - - result = _({a: ''}).thru<{a: string}>(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashImplicitArrayWrapper; - - result = _([1, 2, 3]).thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashExplicitWrapper; - - result = _('').chain().thru(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashExplicitWrapper; - - result = _(true).chain().thru(interceptor); - } - - { - let interceptor: Interceptor<{a: string}> = (x) => x; - let result: _.LoDashExplicitObjectWrapper<{a: string}>; - - result = _({a: ''}).chain().thru<{a: string}>(interceptor); - } - - { - let interceptor: Interceptor = (x) => x; - let result: _.LoDashExplicitArrayWrapper; - - result = _([1, 2, 3]).chain().thru(interceptor); - } -} - -// _.prototype.commit -namespace TestCommit { - { - let result: _.LoDashImplicitWrapper; - result = _(42).commit(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - result = _([]).commit(); - } - - { - let result: _.LoDashImplicitObjectWrapper; - result = _({}).commit(); - } - - { - let result: _.LoDashExplicitWrapper; - result = _(42).chain().commit(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - result = _([]).chain().commit(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - result = _({}).chain().commit(); - } -} - -// _.prototype.concat -namespace TestConcat { - const numberROA: number[] = [0]; // TODO: Should be ReadonlyArray, but see comment on type Many - - _.concat(1); // $ExpectType number[] - _.concat([1]); // $ExpectType number[] - _.concat(numberROA); // $ExpectType number[] - _.concat(1, 2); // $ExpectType number[] - _.concat(1, [1]); // $ExpectType number[] - _.concat(1, [1], numberROA); // $ExpectType number[] - - _(1).concat(2); // $ExpectType LoDashImplicitWrapper - _(1).concat([1]); // $ExpectType LoDashImplicitWrapper - _(1).concat([2], numberROA); // $ExpectType LoDashImplicitWrapper - _([1]).concat(2); // $ExpectType LoDashImplicitWrapper - _(numberROA).concat(numberROA); // $ExpectType LoDashImplicitWrapper - _(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashImplicitWrapper - - _.chain(1).concat(2); // $ExpectType LoDashExplicitWrapper - _.chain(1).concat([1]); // $ExpectType LoDashExplicitWrapper - _.chain(1).concat([2], numberROA); // $ExpectType LoDashExplicitWrapper - _.chain([1]).concat(2); // $ExpectType LoDashExplicitWrapper - _.chain(numberROA).concat(numberROA); // $ExpectType LoDashExplicitWrapper - _.chain(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashExplicitWrapper - - const stringROA: string[] = ['']; // TODO: Should be ReadonlyArray, but see comment on type Many - - _.concat('a'); // $ExpectType string[] - _.concat(['a']); // $ExpectType string[] - _.concat(stringROA); // $ExpectType string[] - _.concat('a', 'b'); // $ExpectType string[] - _.concat('a', ['a']); // $ExpectType string[] - _.concat('a', ['a'], stringROA); // $ExpectType string[] - - _('a').concat('b'); // $ExpectType LoDashImplicitWrapper - _('a').concat(['a']); // $ExpectType LoDashImplicitWrapper - _('a').concat(['b'], stringROA); // $ExpectType LoDashImplicitWrapper - _(['a']).concat('b'); // $ExpectType LoDashImplicitWrapper - _(stringROA).concat(stringROA); // $ExpectType LoDashImplicitWrapper - _(stringROA).concat(stringROA, stringROA); // $ExpectType LoDashImplicitWrapper - - _.chain('a').concat('b'); // $ExpectType LoDashExplicitWrapper - _.chain('a').concat(['a']); // $ExpectType LoDashExplicitWrapper - _.chain('a').concat(['b'], stringROA); // $ExpectType LoDashExplicitWrapper - _.chain(['a']).concat('b'); // $ExpectType LoDashExplicitWrapper - _.chain(stringROA).concat(stringROA); // $ExpectType LoDashExplicitWrapper - _.chain(stringROA).concat(stringROA, stringROA); // $ExpectType LoDashExplicitWrapper - - const abcObject: AbcObject = { a: 1, b: 'foo', c: true }; - const objectROA: AbcObject[] = [{ a: 1, b: 'foo', c: true }]; // TODO: Should be ReadonlyArray, but see comment on type Many - - _.concat(abcObject); // $ExpectType AbcObject[] - _.concat([abcObject]); // $ExpectType AbcObject[] - _.concat(objectROA); // $ExpectType AbcObject[] - _.concat(abcObject, abcObject); // $ExpectType AbcObject[] - _.concat(abcObject, [abcObject]); // $ExpectType AbcObject[] - _.concat(abcObject, [abcObject], objectROA); // $ExpectType AbcObject[] - - _(abcObject).concat(abcObject); // $ExpectType LoDashImplicitWrapper - _(abcObject).concat([abcObject]); // $ExpectType LoDashImplicitWrapper - _(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashImplicitWrapper - _([abcObject]).concat(abcObject); // $ExpectType LoDashImplicitWrapper - _(objectROA).concat(objectROA); // $ExpectType LoDashImplicitWrapper - _(objectROA).concat(objectROA, objectROA); // $ExpectType LoDashImplicitWrapper - - _.chain(abcObject).concat(abcObject); // $ExpectType LoDashExplicitWrapper - _.chain(abcObject).concat([abcObject]); // $ExpectType LoDashExplicitWrapper - _.chain(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashExplicitWrapper - _.chain([abcObject]).concat(abcObject); // $ExpectType LoDashExplicitWrapper - _.chain(objectROA).concat(objectROA); // $ExpectType LoDashExplicitWrapper - _.chain(objectROA).concat(objectROA, objectROA); // $ExpectType LoDashExplicitWrapper -} - -// _.prototype.plant -namespace TestPlant { - { - let result: _.LoDashImplicitWrapper; - result = _(anything).plant(42); - } - - { - let result: _.LoDashImplicitStringWrapper; - result = _(anything).plant(''); - } - - { - let result: _.LoDashImplicitWrapper; - result = _(anything).plant(true); - } - - { - let result: _.LoDashImplicitNumberArrayWrapper; - result = _(anything).plant([42]); - } - - { - let result: _.LoDashImplicitArrayWrapper; - result = _(anything).plant([]); - } - - { - let result: _.LoDashImplicitWrapper<{}>; - result = _(anything).plant<{}>({}); - } - - { - let result: _.LoDashExplicitWrapper; - result = _(anything).chain().plant(42); - } - - { - let result: _.LoDashExplicitStringWrapper; - result = _(anything).chain().plant(''); - } - - { - let result: _.LoDashExplicitWrapper; - result = _(anything).chain().plant(true); - } - - { - let result: _.LoDashExplicitNumberArrayWrapper; - result = _(anything).chain().plant([42]); - } - - { - let result: _.LoDashExplicitArrayWrapper; - result = _(anything).chain().plant([]); - } - - { - let result: _.LoDashExplicitWrapper<{}>; - result = _(anything).chain().plant<{}>({}); - } -} - -// _.prototype.reverse -namespace TestReverse { - { - let result: _.LoDashImplicitArrayWrapper; - result = _([42]).reverse(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - result = _([42]).chain().reverse(); - } -} - -// _.prototype.toJSON -namespace TestToJSON { - { - let result: string; - - result = _('').toJSON(); - result = _('').chain().toJSON(); - } - - { - let result: number; - - result = _(42).toJSON(); - result = _(42).chain().toJSON(); - } - - { - let result: boolean; - - result = _(true).toJSON(); - result = _(true).chain().toJSON(); - } - - { - let result: string[]; - - result = _(['']).toJSON(); - result = _(['']).chain().toJSON(); - } - - { - let result: {a: string}; - - result = _({a: ''}).toJSON(); - result = _({a: ''}).chain().toJSON(); - } -} - -// _.prototype.toString -namespace TestToString { - let result: string; - - result = _('').toString(); - result = _(42).toString(); - result = _(true).toString(); - result = _(['']).toString(); - result = _({}).toString(); - - result = _('').chain().toString(); - result = _(42).chain().toString(); - result = _(true).chain().toString(); - result = _(['']).chain().toString(); - result = _({}).chain().toString(); -} - -// _.prototype.value -namespace TestValue { - { - let result: string; - - result = _('').value(); - result = _('').chain().value(); - } - - { - let result: number; - - result = _(42).value(); - result = _(42).chain().value(); - } - - { - let result: boolean; - - result = _(true).value(); - result = _(true).chain().value(); - } - - { - let result: string[]; - - result = _(['']).value(); - result = _(['']).chain().value(); - } - - { - let result: {a: string}; - - result = _({a: ''}).value(); - result = _({a: ''}).chain().value(); - } -} - -// _.prototype.valueOf -namespace TestValueOf { - { - let result: string; - - result = _('').valueOf(); - result = _('').chain().valueOf(); - } - - { - let result: number; - - result = _(42).valueOf(); - result = _(42).chain().valueOf(); - } - - { - let result: boolean; - - result = _(true).valueOf(); - result = _(true).chain().valueOf(); - } - - { - let result: string[]; - - result = _(['']).valueOf(); - result = _(['']).chain().valueOf(); - } - - { - let result: {a: string}; - - result = _({a: ''}).valueOf(); - result = _({a: ''}).chain().valueOf(); - } + // $ExpectType string[] + _.zipWith([1, 2], (value1) => { + value1; // $ExpectType number + return ""; + }); + // $ExpectType string[] + _.zipWith([1, 2], [1, 2], (value1, value2) => { + value1; // $ExpectType number + value2; // $ExpectType number + return ""; + }); + // $ExpectType string[] + _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (value1, value2, value3, value4, value5, value6) => { + value1; // $ExpectType number + value2; // $ExpectType number + value3; // $ExpectType number + value4; // $ExpectType number + value5; // $ExpectType number + value6; // $ExpectType number + return ""; + }); + // $ExpectType string[] + _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { + group; // $ExpectType number[] + return ""; + }); + // $ExpectType string[] + _.zipWith([1, 2], ["a", "b"], [true, false], (value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType string + value3; // $ExpectType boolean + return ""; + }); + + const values = [[1, 2], [1, 2], [1, 2]]; + _.zipWith(...values, (...group: number[]) => ""); // $ExpectType string[] + + // $ExpectType LoDashImplicitWrapper + _([1, 2]).zipWith((value1) => { + value1; // $ExpectType number + return ""; + }); + // $ExpectType LoDashImplicitWrapper + _([1, 2]).zipWith([1, 2], (value1, value2) => { + value1; // $ExpectType number + value2; // $ExpectType number + return ""; + }); + // $ExpectType LoDashImplicitWrapper + _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { + group; // $ExpectType number[] + return ""; + }); + // $ExpectType LoDashImplicitWrapper + _([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType string + value3; // $ExpectType boolean + return ""; + }); + + // $ExpectType LoDashExplicitWrapper + _.chain([1, 2]).zipWith((value1) => { + value1; // $ExpectType number + return ""; + }); + // $ExpectType LoDashExplicitWrapper + _.chain([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], (...group) => { + group; // $ExpectType number[] + return ""; + }); + // $ExpectType LoDashExplicitWrapper + _.chain([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType string + value3; // $ExpectType boolean + return ""; + }); + + fp.zipWith((value1, value2) => "a", [1, 2], [1, 2]); // $ExpectType string[] + fp.zipWith((value1: number, value2: number) => "a")([1, 2])([1, 2]); // $ExpectType string[] } /************** @@ -4066,1233 +1688,599 @@ namespace TestValueOf { **************/ // _.at -namespace TestAt { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let dictionary: _.Dictionary | null | undefined = anything; - let numericDictionary: _.NumericDictionary | null | undefined = anything; - let abcObject: AbcObject | null | undefined = anything; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; + const abcObject: AbcObject | null | undefined = anything; - { - let result: AbcObject[]; + _.at(list, 0, "1", [2], ["3"], [4, "5"]); // $ExpectType AbcObject[] + _.at(numericDictionary, 0, "1", [2], ["3"], [4, "5"]); // $ExpectType AbcObject[] + _.at(dictionary, "a", ["b", "c"]); // $ExpectType AbcObject[] + _.at(abcObject, "a", ["b", "c"]); // $ExpectType (string | number | boolean)[] - result = _.at(array, 0, '1', [2], ['3'], [4, '5']); - result = _.at(list, 0, '1', [2], ['3'], [4, '5']); - result = _.at(dictionary, 0, '1', [2], ['3'], [4, '5']); - result = _.at(numericDictionary, 0, '1', [2], ['3'], [4, '5']); - } + _(list).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashImplicitWrapper + _(dictionary).at("a", ["b", "c"]); // $ExpectType LoDashImplicitWrapper + _(abcObject).at("a", ["b", "c"]); // $ExpectType LoDashImplicitWrapper<(string | number | boolean)[]> - { - let result: Array; + _.chain(list).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).at(0, "1", [2], ["3"], [4, "5"]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).at("a", ["b", "c"]); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).at("a", ["b", "c"]); // $ExpectType LoDashExplicitWrapper<(string | number | boolean)[]> - result = _.at(abcObject, 'a', ['b'], ['a', 'b']); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).at(0, '1', [2], ['3'], [4, '5']); - result = _(list).at(0, '1', [2], ['3'], [4, '5']); - result = _(dictionary).at(0, '1', [2], ['3'], [4, '5']); - result = _(numericDictionary).at(0, '1', [2], ['3'], [4, '5']); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(abcObject).at('a', ['b'], ['a', 'b']); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().at(0, '1', [2], ['3'], [4, '5']); - result = _(list).chain().at(0, '1', [2], ['3'], [4, '5']); - result = _(dictionary).chain().at(0, '1', [2], ['3'], [4, '5']); - result = _(numericDictionary).chain().at(0, '1', [2], ['3'], [4, '5']); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(abcObject).chain().at('a', ['b'], ['a', 'b']); - } + fp.at(0, list); // $ExpectType AbcObject[] + fp.at(0)(list); // $ExpectType AbcObject[] + fp.at([0, "1"], list); // $ExpectType AbcObject[] + fp.at("a", abcObject); // $ExpectType (string | number | boolean)[] } // _.countBy -namespace TestCountBy { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; - - let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1; - let listIterator: (value: AbcObject, index: number, collection: _.List) => any = (value: AbcObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: AbcObject, key: string, collection: _.Dictionary) => any = (value: AbcObject, key: string, collection: _.Dictionary) => 1; - let numericDictionaryIterator: (value: AbcObject, key: string, collection: _.NumericDictionary) => any = (value: AbcObject, key: string, collection: _.NumericDictionary) => 1; - - { - let result: _.Dictionary; - - result = _.countBy(''); - result = _.countBy('', stringIterator); - - result = _.countBy(array); - result = _.countBy(array, listIterator); - result = _.countBy(array, ''); - result = _.countBy(array, {a: 42}); - result = _.countBy(array, {a: 42}); - - result = _.countBy(list); - result = _.countBy(list, listIterator); - result = _.countBy(list, ''); - result = _.countBy(list, {a: 42}); - - result = _.countBy(dictionary); - result = _.countBy(dictionary, dictionaryIterator); - result = _.countBy(dictionary, ''); - result = _.countBy(dictionary, {a: 42}); - - result = _.countBy(numericDictionary); - result = _.countBy(numericDictionary, numericDictionaryIterator); - result = _.countBy(numericDictionary, ''); - result = _.countBy(numericDictionary, {a: 42}); - } - - { - let resutl: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _('').countBy(); - result = _('').countBy(stringIterator); - - result = _(array).countBy(); - result = _(array).countBy(listIterator); - result = _(array).countBy(''); - result = _(array).countBy<{a: number}>({a: 42}); - result = _(array).countBy({a: 42}); - - result = _(list).countBy(); - result = _(list).countBy(listIterator); - result = _(list).countBy(''); - result = _(list).countBy<{a: number}>({a: 42}); - result = _(list).countBy({a: 42}); - - result = _(dictionary).countBy(); - result = _(dictionary).countBy(dictionaryIterator); - result = _(dictionary).countBy(''); - result = _(dictionary).countBy({a: 42}); - - result = _(numericDictionary).countBy(); - result = _(numericDictionary).countBy(numericDictionaryIterator); - result = _(numericDictionary).countBy(''); - result = _(numericDictionary).countBy({a: 42}); - } - - { - let resutl: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _('').chain().countBy(); - result = _('').chain().countBy(stringIterator); - - result = _(array).chain().countBy(); - result = _(array).chain().countBy(listIterator); - result = _(array).chain().countBy(''); - result = _(array).chain().countBy({a: 42}); - - result = _(list).chain().countBy(); - result = _(list).chain().countBy(listIterator); - result = _(list).chain().countBy(''); - result = _(list).chain().countBy({a: 42}); - - result = _(dictionary).chain().countBy(); - result = _(dictionary).chain().countBy(dictionaryIterator); - result = _(dictionary).chain().countBy(''); - result = _(dictionary).chain().countBy({a: 42}); - - result = _(numericDictionary).chain().countBy(); - result = _(numericDictionary).chain().countBy(numericDictionaryIterator); - result = _(numericDictionary).chain().countBy(''); - result = _(numericDictionary).chain().countBy({a: 42}); - } -} - -// _.each -namespace TestEach { - let array: AbcObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let nilArray: AbcObject[] | null | undefined = [] as any; - let nilList: _.List | null | undefined = [] as any; - let nilDictionary: _.Dictionary | null | undefined = anything; - - let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; - let listIterator: (value: AbcObject, index: number, collection: _.List) => any = (value: AbcObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: AbcObject, key: string, collection: _.Dictionary) => any = (value: AbcObject, key: string, collection: _.Dictionary) => 1; - - { - let result: string; - - result = _.each('', stringIterator); - } - - { - let result: string | null | undefined; - - result = _.each('' as (string | null | undefined), stringIterator); - } - - { - let result: AbcObject[]; - - result = _.each(array, listIterator); - } - - { - let result: AbcObject[] | null | undefined; - - result = _.each(nilArray, listIterator); - } - - { - let result: _.List; - - result = _.each(list, listIterator); - } - - { - let result: _.List | null | undefined; - - result = _.each(nilList, listIterator); - } - - { - let result: _.Dictionary; - - result = _.each(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.each(nilDictionary, dictionaryIterator); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _('').each(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).each(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.List>; - - result = _(list).each(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).each(dictionaryIterator); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().each(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().each(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.List>; - - result = _(list).chain().each(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().each(dictionaryIterator); - } -} - -// _.eachRight -namespace TestEachRight { - let array: AbcObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let nilArray: AbcObject[] | null | undefined = [] as any; - let nilList: _.List | null | undefined = [] as any; - let nilDictionary: _.Dictionary | null | undefined = anything; - - let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; - let listIterator: (value: AbcObject, index: number, collection: _.List) => any = (value: AbcObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: AbcObject, key: string, collection: _.Dictionary) => any = (value: AbcObject, key: string, collection: _.Dictionary) => 1; - - { - let result: string; - - result = _.eachRight('', stringIterator); - } - - { - let result: string | null | undefined; - - result = _.eachRight('' as (string | null | undefined), stringIterator); - } - - { - let result: AbcObject[]; - - result = _.eachRight(array, listIterator); - } - - { - let result: AbcObject[] | null | undefined; - - result = _.eachRight(nilArray, listIterator); - } - - { - let result: _.List; - - result = _.eachRight(list, listIterator); - } - - { - let result: _.List | null | undefined; - - result = _.eachRight(nilList, listIterator); - } - - { - let result: _.Dictionary; - - result = _.eachRight(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.eachRight(nilDictionary, dictionaryIterator); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _('').eachRight(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).eachRight(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.List>; - - result = _(list).eachRight(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).eachRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().eachRight(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().eachRight(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.List>; - - result = _(list).chain().eachRight(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().eachRight(dictionaryIterator); - } +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; + + const stringIterator = (value: string, index: number, collection: string) => 1; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 1; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 1; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => 1; + + _.countBy(""); // $ExpectType Dictionary + _.countBy("", stringIterator); // $ExpectType Dictionary + + _.countBy(list); // $ExpectType Dictionary + _.countBy(list, listIterator); // $ExpectType Dictionary + _.countBy(list, ""); // $ExpectType Dictionary + _.countBy(list, { a: 42 }); // $ExpectType Dictionary + + _.countBy(dictionary); // $ExpectType Dictionary + _.countBy(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.countBy(dictionary, ""); // $ExpectType Dictionary + _.countBy(dictionary, { a: 42 }); // $ExpectType Dictionary + + _.countBy(numericDictionary); // $ExpectType Dictionary + _.countBy(numericDictionary, numericDictionaryIterator); // $ExpectType Dictionary + _.countBy(numericDictionary, ""); // $ExpectType Dictionary + _.countBy(numericDictionary, { a: 42 }); // $ExpectType Dictionary + + _("").countBy(); // $ExpectType LoDashImplicitWrapper> + _("").countBy(stringIterator); // $ExpectType LoDashImplicitWrapper> + + _(list).countBy(); // $ExpectType LoDashImplicitWrapper> + _(list).countBy(listIterator); // $ExpectType LoDashImplicitWrapper> + _(list).countBy(""); // $ExpectType LoDashImplicitWrapper> + _(list).countBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + + _(dictionary).countBy(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).countBy(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).countBy(""); // $ExpectType LoDashImplicitWrapper> + _(dictionary).countBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + + _(numericDictionary).countBy(); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).countBy(numericDictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).countBy(""); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).countBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + + _.chain("").countBy(); // $ExpectType LoDashExplicitWrapper> + _.chain("").countBy(stringIterator); // $ExpectType LoDashExplicitWrapper> + + _.chain(list).countBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).countBy(listIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).countBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(list).countBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + + _.chain(dictionary).countBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).countBy(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).countBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).countBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + + _.chain(numericDictionary).countBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).countBy(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).countBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).countBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + + const stringIterator2 = (value: string) => 1; + const listIterator2 = (value: AbcObject) => 1; + fp.countBy(stringIterator2, ""); // $ExpectType Dictionary + fp.countBy(stringIterator2)(""); // $ExpectType Dictionary + fp.countBy(listIterator2, list); // $ExpectType Dictionary + fp.countBy("", list); // $ExpectType Dictionary + fp.countBy({ a: 42 }, list); // $ExpectType Dictionary + fp.countBy(listIterator2, dictionary); // $ExpectType Dictionary + fp.countBy({ a: 42 }, dictionary); // $ExpectType Dictionary + fp.countBy(listIterator2, numericDictionary); // $ExpectType Dictionary + fp.countBy({ a: 42 }, numericDictionary); // $ExpectType Dictionary } // _.every -namespace TestEvery { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; + const valueIterator = (value: AbcObject) => true; - let listIterator = (value: SampleObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => true; - let numericDictionaryIterator = (value: SampleObject, key: string, collection: _.NumericDictionary) => true; + _.every(list); // $ExpectType boolean + _.every(list, listIterator); // $ExpectType boolean + _.every(list, "a"); // $ExpectType boolean + _.every(list, ["a", 42]); // $ExpectType boolean + _.every(list, { a: 42 }); // $ExpectType boolean - { - let result: boolean; + _.every(dictionary); // $ExpectType boolean + _.every(dictionary, dictionaryIterator); // $ExpectType boolean + _.every(dictionary, "a"); // $ExpectType boolean + _.every(dictionary, ["a", 42]); // $ExpectType boolean + _.every(dictionary, { a: 42 }); // $ExpectType boolean - result = _.every(array); - result = _.every(array, listIterator); - result = _.every(array, 'a'); - result = _.every(array, ['a', 42]); - result = _.every(array, {a: 42}); + _.every(numericDictionary); // $ExpectType boolean + _.every(numericDictionary, numericDictionaryIterator); // $ExpectType boolean + _.every(numericDictionary, "a"); // $ExpectType boolean + _.every(numericDictionary, ["a", 42]); // $ExpectType boolean + _.every(numericDictionary, { a: 42 }); // $ExpectType boolean - result = _.every(list); - result = _.every(list, listIterator); - result = _.every(list, 'a'); - result = _.every(list, ['a', 42]); - result = _.every(list, {a: 42}); + _(list).every(); // $ExpectType boolean + _(list).every(listIterator); // $ExpectType boolean + _(list).every("a"); // $ExpectType boolean + _(list).every(["a", 42]); // $ExpectType boolean + _(list).every({ a: 42 }); // $ExpectType boolean - result = _.every(dictionary); - result = _.every(dictionary, dictionaryIterator); - result = _.every(dictionary, 'a'); - result = _.every(dictionary, ['a', 42]); - result = _.every(dictionary, {a: 42}); + _(dictionary).every(); // $ExpectType boolean + _(dictionary).every(dictionaryIterator); // $ExpectType boolean + _(dictionary).every("a"); // $ExpectType boolean + _(dictionary).every(["a", 42]); // $ExpectType boolean + _(dictionary).every({ a: 42 }); // $ExpectType boolean - result = _.every(numericDictionary); - result = _.every(numericDictionary, numericDictionaryIterator); - result = _.every(numericDictionary, 'a'); - result = _.every(numericDictionary, ['a', 42]); - result = _.every(numericDictionary, {a: 42}); + _(numericDictionary).every(); // $ExpectType boolean + _(numericDictionary).every(numericDictionaryIterator); // $ExpectType boolean + _(numericDictionary).every("a"); // $ExpectType boolean + _(numericDictionary).every(["a", 42]); // $ExpectType boolean + _(numericDictionary).every({ a: 42 }); // $ExpectType boolean - result = _(array).every(); - result = _(array).every(listIterator); - result = _(array).every('a'); - result = _(array).every(['a', 42]); - result = _(array).every({a: 42}); + _.chain(list).every(); // $ExpectType LoDashExplicitWrapper + _.chain(list).every(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).every("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).every(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(list).every({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(list).every(); - result = _(list).every(listIterator); - result = _(list).every('a'); - result = _(list).every(['a', 42]); - result = _(list).every({a: 42}); + _.chain(dictionary).every(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).every(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).every("a"); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).every(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).every({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(dictionary).every(); - result = _(dictionary).every(dictionaryIterator); - result = _(dictionary).every('a'); - result = _(dictionary).every(['a', 42]); - result = _(dictionary).every({a: 42}); + _.chain(numericDictionary).every(); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).every(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).every("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).every(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).every({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(numericDictionary).every(); - result = _(numericDictionary).every(numericDictionaryIterator); - result = _(numericDictionary).every('a'); - result = _(numericDictionary).every(['a', 42]); - result = _(numericDictionary).every({a: 42}); - } + fp.every(valueIterator, list); // $ExpectType boolean + fp.every("a")(list); // $ExpectType boolean + fp.every({ a: 42 }, list); // $ExpectType boolean + fp.every(["a", 42], list); // $ExpectType boolean - { - let result: _.LoDashExplicitWrapper; + fp.every(valueIterator, dictionary); // $ExpectType boolean + fp.every("a")(dictionary); // $ExpectType boolean + fp.every({ a: 42 })(dictionary); // $ExpectType boolean + fp.every(["a", 42])(dictionary); // $ExpectType boolean - result = _(array).chain().every(); - result = _(array).chain().every(listIterator); - result = _(array).chain().every('a'); - result = _(array).chain().every(['a', 42]); - result = _(array).chain().every({a: 42}); - - result = _(list).chain().every(); - result = _(list).chain().every(listIterator); - result = _(list).chain().every('a'); - result = _(list).chain().every(['a', 42]); - result = _(list).chain().every({a: 42}); - - result = _(dictionary).chain().every(); - result = _(dictionary).chain().every(dictionaryIterator); - result = _(dictionary).chain().every('a'); - result = _(dictionary).chain().every(['a', 42]); - result = _(dictionary).chain().every({a: 42}); - - result = _(numericDictionary).chain().every(); - result = _(numericDictionary).chain().every(numericDictionaryIterator); - result = _(numericDictionary).chain().every('a'); - result = _(numericDictionary).chain().every(['a', 42]); - result = _(numericDictionary).chain().every({a: 42}); - } + fp.every(valueIterator, numericDictionary); // $ExpectType boolean + fp.every("a")(numericDictionary); // $ExpectType boolean + fp.every({ a: 42 })(numericDictionary); // $ExpectType boolean + fp.every(["a", 42])(numericDictionary); // $ExpectType boolean } // _.filter -namespace TestFilter { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let stringIterator = (char: string, index: number, string: string) => true; - let listIterator = (value: AbcObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const stringIterator = (char: string, index: number, string: string) => true; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const valueIterator = (value: AbcObject) => true; - { - let result: string[]; + _.filter("", stringIterator); // $ExpectType string[] + _.filter(list, listIterator); // $ExpectType AbcObject[] + _.filter(list, ""); // $ExpectType AbcObject[] + _.filter(list, { a: 42 }); // $ExpectType AbcObject[] + _.filter(list, ["a", 42]); // $ExpectType AbcObject[] + _.filter(dictionary, dictionaryIterator); // $ExpectType AbcObject[] + _.filter(dictionary, ""); // $ExpectType AbcObject[] + _.filter(dictionary, { a: 42 }); // $ExpectType AbcObject[] + _.filter(dictionary, ["a", 42]); // $ExpectType AbcObject[] - result = _.filter('', stringIterator); - } + _("").filter(stringIterator); // $ExpectType LoDashImplicitWrapper + _(list).filter(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).filter(""); // $ExpectType LoDashImplicitWrapper + _(list).filter({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(list).filter(["a", 42]); // $ExpectType LoDashImplicitWrapper + _(dictionary).filter(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(dictionary).filter(""); // $ExpectType LoDashImplicitWrapper + _(dictionary).filter({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(dictionary).filter(["a", 42]); // $ExpectType LoDashImplicitWrapper - { - let result: AbcObject[]; + _.chain("").filter(stringIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).filter(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).filter(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).filter({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(list).filter(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).filter(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).filter(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).filter({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).filter(["a", 42]); // $ExpectType LoDashExplicitWrapper - result = _.filter(array, listIterator); - result = _.filter(array, ''); - result = _.filter(array, {a: 42}); - result = _.filter(array, ["a", 42]); + fp.filter(valueIterator, list); // $ExpectType AbcObject[] + fp.filter(valueIterator)(list); // $ExpectType AbcObject[] + fp.filter("", list); // $ExpectType AbcObject[] + fp.filter({ a: 42 }, list); // $ExpectType AbcObject[] + fp.filter(["a", 42], list); // $ExpectType AbcObject[] + fp.filter(valueIterator, dictionary); // $ExpectType AbcObject[] + fp.filter("", dictionary); // $ExpectType AbcObject[] + fp.filter({ a: 42 }, dictionary); // $ExpectType AbcObject[] + fp.filter(["a", 42], dictionary); // $ExpectType AbcObject[] - result = _.filter(list, listIterator); - result = _.filter(list, ''); - result = _.filter(list, {a: 42}); - result = _.filter(list, ["a", 42]); + // Test filtering with type guard + const a2: Array | null | undefined = anything; + const d2: _.Dictionary | null | undefined = anything; - result = _.filter(dictionary, dictionaryIterator); - result = _.filter(dictionary, ''); - result = _.filter(dictionary, {a: 42}); - result = _.filter(dictionary, ["a", 42]); - } + _.filter(a2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] + _.filter(d2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] - { - let result: _.LoDashImplicitArrayWrapper; + _(a2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper + _(d2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper - result = _('').filter(stringIterator); - } + _.chain(a2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper + _.chain(d2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).filter(listIterator); - result = _(array).filter(''); - result = _(array).filter({a: 42}); - result = _(array).filter(["a", 42]); - - result = _(list).filter(listIterator); - result = _(list).filter(''); - result = _(list).filter({a: 42}); - result = _(list).filter(["a", 42]); - - result = _(dictionary).filter(dictionaryIterator); - result = _(dictionary).filter(''); - result = _(dictionary).filter({a: 42}); - result = _(dictionary).filter(["a", 42]); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('').chain().filter(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().filter(listIterator); - result = _(array).chain().filter(''); - result = _(array).chain().filter({a: 42}); - result = _(array).chain().filter(["a", 42]); - - result = _(list).chain().filter(listIterator); - result = _(list).chain().filter(''); - result = _(list).chain().filter({a: 42}); - result = _(list).chain().filter(["a", 42]); - - result = _(dictionary).chain().filter(dictionaryIterator); - result = _(dictionary).chain().filter(''); - result = _(dictionary).chain().filter({a: 42}); - result = _(dictionary).chain().filter(["a", 42]); - } - - { - // Test filtering with type guard - let a2: Array | null | undefined = anything; - let d2: _.Dictionary | null | undefined = anything; - - _.filter(a2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] - _.filter(d2, (item: string | number): item is number => typeof item === "number"); // $ExpectType number[] - _(a2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper - _(d2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitWrapper - _(a2).chain().filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper - _(d2).chain().filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitWrapper - } + fp.filter((item: string | number): item is number => typeof item === "number", a2); // $ExpectType number[] + fp.filter((item: string | number): item is number => typeof item === "number", d2); // $ExpectType number[] } // _.find -namespace TestFind { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - - let listIterator = (value: AbcObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - - let result: AbcObject | undefined; - - result = _.find(array); - result = _.find(array, listIterator); - result = _.find(array, listIterator, 1); - result = _.find(array, ''); - result = _.find(array, '', 1); - result = _.find(array, {a: 42}); - result = _.find(array, {a: 42}, 1); - result = _.find(array, ['a', 5]); - result = _.find(array, ['a', 5], 1); - - result = _.find(list); - result = _.find(list, listIterator); - result = _.find(list, listIterator, 1); - result = _.find(list, ''); - result = _.find(list, '', 1); - result = _.find(list, {a: 42}); - result = _.find(list, {a: 42}, 1); - result = _.find(list, ['a', 5]); - result = _.find(list, ['a', 5], 1); - - result = _.find(dictionary); - result = _.find(dictionary, dictionaryIterator); - result = _.find(dictionary, dictionaryIterator, 1); - result = _.find(dictionary, ''); - result = _.find(dictionary, '', 1); - result = _.find(dictionary, {a: 42}); - result = _.find(dictionary, {a: 42}, 1); - result = _.find(dictionary, ['a', 5]); - result = _.find(dictionary, ['a', 5], 1); - - result = _(array).find(); - result = _(array).find(listIterator); - result = _(array).find(listIterator, 1); - result = _(array).find(''); - result = _(array).find('', 1); - result = _(array).find({a: 42}); - result = _(array).find({a: 42}, 1); - result = _(array).find(['a', 5]); - result = _(array).find(['a', 5], 1); - - result = _(list).find(); - result = _(list).find(listIterator); - result = _(list).find(listIterator, 1); - result = _(list).find(''); - result = _(list).find('', 1); - result = _(list).find({a: 42}); - result = _(list).find({a: 42}, 1); - result = _(list).find(['a', 5]); - result = _(list).find(['a', 5], 1); - - result = _(dictionary).find(); - result = _(dictionary).find(dictionaryIterator); - result = _(dictionary).find(dictionaryIterator, 1); - result = _(dictionary).find(''); - result = _(dictionary).find('', 1); - result = _(dictionary).find({a: 42}); - result = _(dictionary).find({a: 42}, 1); - result = _(dictionary).find(['a', 5]); - result = _(dictionary).find(['a', 5], 1); - - result = _.find([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); - result = _([anything as AbcObject, null, undefined]).find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); -} - // _.findLast -namespace TestFindLast { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let listIterator = (value: AbcObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const valueIterator = (value: AbcObject) => true; - let result: AbcObject | undefined; + _.find(list); // $ExpectType AbcObject | undefined + _.find(list, listIterator); // $ExpectType AbcObject | undefined + _.find(list, listIterator, 1); // $ExpectType AbcObject | undefined + _.find(list, "a"); // $ExpectType AbcObject | undefined + _.find(list, "a", 1); // $ExpectType AbcObject | undefined + _.find(list, { a: 42 }); // $ExpectType AbcObject | undefined + _.find(list, { a: 42 }, 1); // $ExpectType AbcObject | undefined + _.find(list, ["a", 5]); // $ExpectType AbcObject | undefined + _.find(list, ["a", 5], 1); // $ExpectType AbcObject | undefined + _.find(dictionary); // $ExpectType AbcObject | undefined + _.find(dictionary, dictionaryIterator); // $ExpectType AbcObject | undefined + _.find(dictionary, dictionaryIterator, 1); // $ExpectType AbcObject | undefined + _.find(dictionary, "a"); // $ExpectType AbcObject | undefined + _.find(dictionary, { a: 42 }); // $ExpectType AbcObject | undefined + _.find(dictionary, ["a", 5]); // $ExpectType AbcObject | undefined + _.find([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined - result = _.findLast(array); - result = _.findLast(array, listIterator); - result = _.findLast(array, listIterator, 1); - result = _.findLast(array, ''); - result = _.findLast(array, '', 1); - result = _.findLast(array, {a: 42}); - result = _.findLast(array, {a: 42}, 1); - result = _.findLast(array, ['a', 5]); - result = _.findLast(array, ['a', 5], 1); + _(list).find(); // $ExpectType AbcObject | undefined + _(list).find(listIterator); // $ExpectType AbcObject | undefined + _(list).find(listIterator, 1); // $ExpectType AbcObject | undefined + _(list).find("a"); // $ExpectType AbcObject | undefined + _(list).find({ a: 42 }); // $ExpectType AbcObject | undefined + _(list).find(["a", 5]); // $ExpectType AbcObject | undefined + _(dictionary).find(); // $ExpectType AbcObject | undefined + _(dictionary).find(dictionaryIterator); // $ExpectType AbcObject | undefined + _(dictionary).find(dictionaryIterator, 1); // $ExpectType AbcObject | undefined + _(dictionary).find("a"); // $ExpectType AbcObject | undefined + _(dictionary).find({ a: 42 }); // $ExpectType AbcObject | undefined + _(dictionary).find(["a", 5]); // $ExpectType AbcObject | undefined + _([anything as AbcObject, null, undefined]).find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined - result = _.findLast(list); - result = _.findLast(list); - result = _.findLast(list, listIterator); - result = _.findLast(list, listIterator, 1); - result = _.findLast(list, ''); - result = _.findLast(list, '', 1); - result = _.findLast(list, {a: 42}); - result = _.findLast(list, {a: 42}, 1); - result = _.findLast(list, ['a', 5]); - result = _.findLast(list, ['a', 5], 1); + _.chain(list).find(); // $ExpectType LoDashExplicitWrapper + _.chain(list).find(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).find(listIterator, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).find("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).find({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(list).find(["a", 5]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(dictionaryIterator, 1); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).find(["a", 5]); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain([anything as AbcObject, null, undefined]).find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); - result = _.findLast(dictionary); - result = _.findLast(dictionary); - result = _.findLast(dictionary, dictionaryIterator); - result = _.findLast(dictionary, dictionaryIterator, 1); - result = _.findLast(dictionary, ''); - result = _.findLast(dictionary, '', 1); - result = _.findLast(dictionary, {a: 42}); - result = _.findLast(dictionary, {a: 42}, 1); - result = _.findLast(dictionary, ['a', 5]); - result = _.findLast(dictionary, ['a', 5], 1); + fp.find(valueIterator, list); // $ExpectType AbcObject | undefined + fp.find(valueIterator)(list); // $ExpectType AbcObject | undefined + fp.find("a", list); // $ExpectType AbcObject | undefined + fp.find({ a: 42 }, list); // $ExpectType AbcObject | undefined + fp.find(["a", 42], list); // $ExpectType AbcObject | undefined + fp.find(valueIterator, dictionary); // $ExpectType AbcObject | undefined + fp.find(valueIterator)(dictionary); // $ExpectType AbcObject | undefined + fp.find({ a: 42 }, dictionary); // $ExpectType AbcObject | undefined + fp.find(["a", 42], dictionary); // $ExpectType AbcObject | undefined + fp.find((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null, [anything as AbcObject, null, undefined]); // $ExpectType AbcObject | undefined + fp.findFrom(valueIterator, 1, list); // $ExpectType AbcObject | undefined + fp.findFrom(valueIterator)(1)(list); // $ExpectType AbcObject | undefined - result = _(array).findLast(); - result = _(array).findLast(listIterator); - result = _(array).findLast(listIterator, 1); - result = _(array).findLast(''); - result = _(array).findLast('', 1); - result = _(array).findLast({a: 42}); - result = _(array).findLast({a: 42}, 1); - result = _(array).findLast(['a', 5]); - result = _(array).findLast(['a', 5], 1); + _.findLast(list); // $ExpectType AbcObject | undefined + _.findLast(list, listIterator); // $ExpectType AbcObject | undefined + _.findLast(list, listIterator, 1); // $ExpectType AbcObject | undefined + _.findLast(list, "a"); // $ExpectType AbcObject | undefined + _.findLast(list, "a", 1); // $ExpectType AbcObject | undefined + _.findLast(list, { a: 42 }); // $ExpectType AbcObject | undefined + _.findLast(list, { a: 42 }, 1); // $ExpectType AbcObject | undefined + _.findLast(list, ["a", 5]); // $ExpectType AbcObject | undefined + _.findLast(list, ["a", 5], 1); // $ExpectType AbcObject | undefined + _.findLast(dictionary); // $ExpectType AbcObject | undefined + _.findLast(dictionary, dictionaryIterator); // $ExpectType AbcObject | undefined + _.findLast(dictionary, dictionaryIterator, 1); // $ExpectType AbcObject | undefined + _.findLast(dictionary, "a"); // $ExpectType AbcObject | undefined + _.findLast(dictionary, { a: 42 }); // $ExpectType AbcObject | undefined + _.findLast(dictionary, ["a", 5]); // $ExpectType AbcObject | undefined + _.findLast([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined - result = _(list).findLast(); - result = _(list).findLast(listIterator); - result = _(list).findLast(listIterator, 1); - result = _(list).findLast(''); - result = _(list).findLast('', 1); - result = _(list).findLast({a: 42}); - result = _(list).findLast({a: 42}, 1); - result = _(list).findLast(['a', 5]); - result = _(list).findLast(['a', 5], 1); + _(list).findLast(); // $ExpectType AbcObject | undefined + _(list).findLast(listIterator); // $ExpectType AbcObject | undefined + _(list).findLast(listIterator, 1); // $ExpectType AbcObject | undefined + _(list).findLast("a"); // $ExpectType AbcObject | undefined + _(list).findLast({ a: 42 }); // $ExpectType AbcObject | undefined + _(list).findLast(["a", 5]); // $ExpectType AbcObject | undefined + _(dictionary).findLast(); // $ExpectType AbcObject | undefined + _(dictionary).findLast(dictionaryIterator); // $ExpectType AbcObject | undefined + _(dictionary).findLast(dictionaryIterator, 1); // $ExpectType AbcObject | undefined + _(dictionary).findLast("a"); // $ExpectType AbcObject | undefined + _(dictionary).findLast({ a: 42 }); // $ExpectType AbcObject | undefined + _(dictionary).findLast(["a", 5]); // $ExpectType AbcObject | undefined + _([anything as AbcObject, null, undefined]).findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); // $ExpectType AbcObject | undefined - result = _(dictionary).findLast(); - result = _(dictionary).findLast(dictionaryIterator); - result = _(dictionary).findLast(dictionaryIterator, 1); - result = _(dictionary).findLast(''); - result = _(dictionary).findLast('', 1); - result = _(dictionary).findLast({a: 42}); - result = _(dictionary).findLast({a: 42}, 1); - result = _(dictionary).findLast(['a', 5]); - result = _(dictionary).findLast(['a', 5], 1); + _.chain(list).findLast(); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast(listIterator, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLast(["a", 5]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(dictionaryIterator, 1); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).findLast(["a", 5]); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain([anything as AbcObject, null, undefined]).findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); - result = _.findLast([anything as AbcObject, null, undefined], (value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); - result = _([anything as AbcObject, null, undefined]).findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null); + fp.findLast(valueIterator, list); // $ExpectType AbcObject | undefined + fp.findLast(valueIterator)(list); // $ExpectType AbcObject | undefined + fp.findLast("a", list); // $ExpectType AbcObject | undefined + fp.findLast({ a: 42 }, list); // $ExpectType AbcObject | undefined + fp.findLast(["a", 42], list); // $ExpectType AbcObject | undefined + fp.findLast(valueIterator, dictionary); // $ExpectType AbcObject | undefined + fp.findLast(valueIterator)(dictionary); // $ExpectType AbcObject | undefined + fp.findLast({ a: 42 }, dictionary); // $ExpectType AbcObject | undefined + fp.findLast(["a", 42], dictionary); // $ExpectType AbcObject | undefined + fp.findLast((value: AbcObject | null | undefined): value is AbcObject | undefined => value !== null, [anything as AbcObject, null, undefined]); // $ExpectType AbcObject | undefined + fp.findLastFrom(valueIterator, 1, list); // $ExpectType AbcObject | undefined + fp.findLastFrom(valueIterator)(1)(list); // $ExpectType AbcObject | undefined } // _.flatMap -namespace TestFlatMap { - let numArray: Array | null | undefined = [1, [2, 3]] as any; - let objArray: Array<{a: number}|Array<{a: number}>> | null | undefined = [{a: 1}, [{a: 2}, {a: 3}]] as any; +{ + const numList: _.List | null | undefined = anything; + const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numDictionary: _.Dictionary | null | undefined = anything; + const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numNumericDictionary: _.NumericDictionary | null | undefined = anything; + const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - let obj: any = {}; - let numList: _.List | null | undefined = obj; - let objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = obj; + const stringIterator = (value: string, index: number, collection: _.List): string | string[] => ""; + const listIterator = (value: number | number[], index: number, collection: _.List): number | number[] => 1; + const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): number | number[] => 1; + const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): number | number[] => 1; + const valueIterator = (value: number | number[]): number | number[] => 1; - let numDictionary: _.Dictionary | null | undefined = obj; - let objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = obj; + _.flatMap("abc"); // $ExpectType string[] + _.flatMap("abc", stringIterator); // $ExpectType string[] + _.flatMap(numList); // $ExpectType number[] + _.flatMap(numList, listIterator); // $ExpectType number[] + _.flatMap(objList, "a"); // $ExpectType any[] + _.flatMap(objList, ["a", 42]); // $ExpectType boolean[] + _.flatMap(objList, { a: 42 }); // $ExpectType boolean[] + _.flatMap(numDictionary); // $ExpectType number[] + _.flatMap(numDictionary, dictionaryIterator); // $ExpectType number[] + _.flatMap(objDictionary, "a"); // $ExpectType any[] + _.flatMap(objDictionary, ["a", 42]); // $ExpectType boolean[] + _.flatMap(objDictionary, { a: 42 }); // $ExpectType boolean[] + _.flatMap(numNumericDictionary); // $ExpectType number[] + _.flatMap(numNumericDictionary, numericDictionaryIterator); // $ExpectType number[] + _.flatMap(objNumericDictionary, "a"); // $ExpectType any[] + _.flatMap(objNumericDictionary, ["a", 42]); // $ExpectType boolean[] + _.flatMap(objNumericDictionary, { a: 42 }); // $ExpectType boolean[] - let numNumericDictionary: _.NumericDictionary | null | undefined = obj; - let objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = obj; + _("abc").flatMap(stringIterator); // $ExpectType LoDashImplicitWrapper + _(numList).flatMap(); // $ExpectType LoDashImplicitWrapper + _(numList).flatMap(listIterator); // $ExpectType LoDashImplicitWrapper + _(objList).flatMap("a"); // $ExpectType LoDashImplicitWrapper + _(objList).flatMap(["a", 42]); // $ExpectType LoDashImplicitWrapper + _(objList).flatMap({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(numDictionary).flatMap(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(objDictionary).flatMap("a"); // $ExpectType LoDashImplicitWrapper + _(numNumericDictionary).flatMap(numericDictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(objNumericDictionary).flatMap("a"); // $ExpectType LoDashImplicitWrapper - let stringIterator: (value: string, index: number, collection: _.List) => string|string[] = (a, b, c) => ""; + _.chain("abc").flatMap(stringIterator); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMap(); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMap(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMap("a"); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMap(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMap({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(numDictionary).flatMap(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objDictionary).flatMap("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numNumericDictionary).flatMap(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objNumericDictionary).flatMap("a"); // $ExpectType LoDashExplicitWrapper - let listIterator: (value: number|number[], index: number, collection: _.List) => number|number[] = (a, b, c) => 1; - - let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary) => number|number[] = (a, b, c) => 1; - - let numericDictionaryIterator: (value: number|number[], key: string, collection: _.NumericDictionary) => number|number[] = (a, b, c) => 1; - - { - let result: string[]; - - result = _.flatMap('abc'); - result = _.flatMap('abc'); - - result = _.flatMap('abc', stringIterator); - result = _.flatMap('abc', stringIterator); - } - - { - let result: number[]; - - result = _.flatMap(numArray); - result = _.flatMap(numArray); - - result = _.flatMap(numArray, listIterator); - result = _.flatMap(numArray, listIterator); - - result = _.flatMap(objArray, 'a'); - - result = _.flatMap(numList); - result = _.flatMap(numList); - - result = _.flatMap(numList, listIterator); - result = _.flatMap(numList, listIterator); - - result = _.flatMap(objList, 'a'); - - result = _.flatMap(numDictionary); - result = _.flatMap(numDictionary); - - result = _.flatMap(numDictionary, dictionaryIterator); - - result = _.flatMap(objDictionary, 'a'); - - result = _.flatMap(numNumericDictionary); - result = _.flatMap(numNumericDictionary); - - result = _.flatMap(numNumericDictionary, numericDictionaryIterator); - - result = _.flatMap(objNumericDictionary, 'a'); - } - - { - let result: boolean[]; - - result = _.flatMap(objArray, ['a', 42]); - result = _.flatMap(objArray, {'a': 42}); - - result = _.flatMap(objList, ['a', 42]); - result = _.flatMap(objList, {'a': 42}); - - result = _.flatMap(objDictionary, ['a', 42]); - result = _.flatMap(objDictionary, {'a': 42}); - - result = _.flatMap(objNumericDictionary, ['a', 42]); - result = _.flatMap(objNumericDictionary, {'a': 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').flatMap(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(numArray).flatMap(); - result = _(numArray).flatMap(listIterator); - result = _(objArray).flatMap('a'); - - result = _(numList).flatMap(); - result = _(numList).flatMap(listIterator); - result = _(objList).flatMap('a'); - - result = _(numDictionary).flatMap(); - result = _(numDictionary).flatMap(dictionaryIterator); - result = _(objDictionary).flatMap('a'); - - result = _(numNumericDictionary).flatMap(); - result = _(numNumericDictionary).flatMap(numericDictionaryIterator); - result = _(objNumericDictionary).flatMap('a'); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(objArray).flatMap(['a', 42]); - result = _(objArray).flatMap({a: 42}); - - result = _(objList).flatMap(['a', 42]); - result = _(objList).flatMap({a: 42}); - - result = _(objDictionary).flatMap(['a', 42]); - result = _(objDictionary).flatMap({a: 42}); - - result = _(objNumericDictionary).flatMap(['a', 42]); - result = _(objNumericDictionary).flatMap({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().flatMap(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(numArray).chain().flatMap(); - result = _(numArray).chain().flatMap(listIterator); - result = _(objArray).chain().flatMap('a'); - - result = _(numList).chain().flatMap(); - result = _(numList).chain().flatMap(listIterator); - result = _(objList).chain().flatMap('a'); - - result = _(numDictionary).chain().flatMap(); - result = _(numDictionary).chain().flatMap(dictionaryIterator); - result = _(objDictionary).chain().flatMap('a'); - - result = _(numNumericDictionary).chain().flatMap(); - result = _(numNumericDictionary).chain().flatMap(numericDictionaryIterator); - result = _(objNumericDictionary).chain().flatMap('a'); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(objArray).chain().flatMap(['a', 42]); - result = _(objArray).chain().flatMap({a: 42}); - - result = _(objList).chain().flatMap(['a', 42]); - result = _(objList).chain().flatMap({a: 42}); - - result = _(objDictionary).chain().flatMap(['a', 42]); - result = _(objDictionary).chain().flatMap({a: 42}); - - result = _(objNumericDictionary).chain().flatMap(['a', 42]); - result = _(objNumericDictionary).chain().flatMap({a: 42}); - } - - { - interface SampleObject { - bar: number; - foo: string[]; - } - const obj: SampleObject = { - bar: 1, - foo: [''], - }; - - const result1: Array = _.flatMap(obj); - const result2: _.LoDashImplicitWrapper> = _(obj).flatMap(); - const result3: _.LoDashExplicitWrapper> = _.chain(obj).flatMap(); - } + fp.flatMap(valueIterator, numList); // $ExpectType number[] + fp.flatMap(valueIterator)(numList); // $ExpectType number[] + fp.flatMap("a", objList); // $ExpectType any[] + fp.flatMap({ a: 42 }, objList); // $ExpectType boolean[] + fp.flatMap(["a", 42], objList); // $ExpectType boolean[] + fp.flatMap(valueIterator, numDictionary); // $ExpectType number[] + fp.flatMap("a", objDictionary); // $ExpectType any[] + fp.flatMap({ a: 42 }, objDictionary); // $ExpectType boolean[] + fp.flatMap(["a", 42], objDictionary); // $ExpectType boolean[] + fp.flatMap(valueIterator, numNumericDictionary); // $ExpectType number[] + fp.flatMap("a", objNumericDictionary); // $ExpectType any[] + fp.flatMap({ a: 42 }, objNumericDictionary); // $ExpectType boolean[] + fp.flatMap(["a", 42], objNumericDictionary); // $ExpectType boolean[] } // _.flatMapDeep -namespace TestFlatMapDeep { - let numArray: Array | null | undefined = [1, [2, 3]] as any; - let objArray: Array<{a: number}|Array<{a: number}>> | null | undefined = [{a: 1}, [{a: 2}, {a: 3}]] as any; +{ + const numList: _.List | null | undefined = anything; + const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numDictionary: _.Dictionary | null | undefined = anything; + const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numNumericDictionary: _.NumericDictionary | null | undefined = anything; + const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - let numList: _.List | null | undefined = anything; - let objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const stringIterator = (value: string, index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | string => ""; + const listIterator = (value: number | number[], index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | number => 1; + const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): _.ListOfRecursiveArraysOrValues | number => 1; + const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): _.ListOfRecursiveArraysOrValues | number => 1; + const valueIterator = (value: number | number[]): _.ListOfRecursiveArraysOrValues | number => 1; - let numDictionary: _.Dictionary | null | undefined = anything; - let objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + _.flatMapDeep("abc"); // $ExpectType string[] + _.flatMapDeep("abc", stringIterator); // $ExpectType string[] + _.flatMapDeep(numList); // $ExpectType number[] + _.flatMapDeep(numList, listIterator); // $ExpectType number[] + _.flatMapDeep(objList, "a"); // $ExpectType any[] + _.flatMapDeep(objList, ["a", 42]); // $ExpectType boolean[] + _.flatMapDeep(objList, { a: 42 }); // $ExpectType boolean[] + _.flatMapDeep(numDictionary); // $ExpectType number[] + _.flatMapDeep(numDictionary, dictionaryIterator); // $ExpectType number[] + _.flatMapDeep(objDictionary, "a"); // $ExpectType any[] + _.flatMapDeep(objDictionary, ["a", 42]); // $ExpectType boolean[] + _.flatMapDeep(objDictionary, { a: 42 }); // $ExpectType boolean[] + _.flatMapDeep(numNumericDictionary); // $ExpectType number[] + _.flatMapDeep(numNumericDictionary, numericDictionaryIterator); // $ExpectType number[] + _.flatMapDeep(objNumericDictionary, "a"); // $ExpectType any[] + _.flatMapDeep(objNumericDictionary, ["a", 42]); // $ExpectType boolean[] + _.flatMapDeep(objNumericDictionary, { a: 42 }); // $ExpectType boolean[] - let numNumericDictionary: _.NumericDictionary | null | undefined = anything; - let objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + _("abc").flatMapDeep(stringIterator); // $ExpectType LoDashImplicitWrapper + _(numList).flatMapDeep(); // $ExpectType LoDashImplicitWrapper + _(numList).flatMapDeep(listIterator); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDeep("a"); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDeep(["a", 42]); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDeep({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(numDictionary).flatMapDeep(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(objDictionary).flatMapDeep("a"); // $ExpectType LoDashImplicitWrapper + _(numNumericDictionary).flatMapDeep(numericDictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(objNumericDictionary).flatMapDeep("a"); // $ExpectType LoDashImplicitWrapper - let stringIterator: (value: string, index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) => ['a', 'b', 'c']; + _.chain("abc").flatMapDeep(stringIterator); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMapDeep(); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMapDeep(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDeep("a"); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDeep(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDeep({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(numDictionary).flatMapDeep(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objDictionary).flatMapDeep("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numNumericDictionary).flatMapDeep(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(objNumericDictionary).flatMapDeep("a"); // $ExpectType LoDashExplicitWrapper - let listIterator: (value: number|number[], index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary) =>_.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - let numericDictionaryIterator: (value: number|number[], key: string, collection: _.NumericDictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - { - let result: string[]; - - result = _.flatMapDeep('abc'); - - result = _.flatMapDeep('abc', stringIterator); - } - - { - let result: number[]; - - result = _.flatMapDeep(numArray); - - result = _.flatMapDeep(numArray, listIterator); - - result = _.flatMapDeep(objArray, 'a'); - - result = _.flatMapDeep(numList); - - result = _.flatMapDeep(numList, listIterator); - - result = _.flatMapDeep(objList, 'a'); - - result = _.flatMapDeep(numDictionary); - - result = _.flatMapDeep(numDictionary, dictionaryIterator); - - result = _.flatMapDeep(objDictionary, 'a'); - - result = _.flatMapDeep(numNumericDictionary); - - result = _.flatMapDeep(numNumericDictionary, numericDictionaryIterator); - - result = _.flatMapDeep(objNumericDictionary, 'a'); - } - - { - let result: boolean[]; - - result = _.flatMapDeep(objArray, ['a', 42]); - result = _.flatMapDeep(objArray, {'a': 42}); - - result = _.flatMapDeep(objList, ['a', 42]); - result = _.flatMapDeep(objList, {'a': 42}); - - result = _.flatMapDeep(objDictionary, ['a', 42]); - result = _.flatMapDeep(objDictionary, {'a': 42}); - - result = _.flatMapDeep(objNumericDictionary, ['a', 42]); - result = _.flatMapDeep(objNumericDictionary, {'a': 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').flatMapDeep(); - result = _('abc').flatMapDeep(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(numArray).flatMapDeep(); - result = _(numArray).flatMapDeep(listIterator); - result = _(objArray).flatMapDeep('a'); - - result = _(numList).flatMapDeep(); - result = _(numList).flatMapDeep(listIterator); - result = _(objList).flatMapDeep('a'); - - result = _(numDictionary).flatMapDeep(); - result = _(numDictionary).flatMapDeep(dictionaryIterator); - result = _(objDictionary).flatMapDeep('a'); - - result = _(numNumericDictionary).flatMapDeep(); - result = _(numNumericDictionary).flatMapDeep(numericDictionaryIterator); - result = _(objNumericDictionary).flatMapDeep('a'); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(objArray).flatMapDeep(['a', 42]); - result = _(objArray).flatMapDeep({a: 42}); - - result = _(objList).flatMapDeep(['a', 42]); - result = _(objList).flatMapDeep({a: 42}); - - result = _(objDictionary).flatMapDeep(['a', 42]); - result = _(objDictionary).flatMapDeep({a: 42}); - - result = _(objNumericDictionary).flatMapDeep(['a', 42]); - result = _(objNumericDictionary).flatMapDeep({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().flatMapDeep(); - result = _('abc').chain().flatMapDeep(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(numArray).chain().flatMapDeep(); - result = _(numArray).chain().flatMapDeep(listIterator); - result = _(objArray).chain().flatMapDeep('a'); - - result = _(numList).chain().flatMapDeep(); - result = _(numList).chain().flatMapDeep(listIterator); - result = _(objList).chain().flatMapDeep('a'); - - result = _(numDictionary).chain().flatMapDeep(); - result = _(numDictionary).chain().flatMapDeep(dictionaryIterator); - result = _(objDictionary).chain().flatMapDeep('a'); - - result = _(numNumericDictionary).chain().flatMapDeep(); - result = _(numNumericDictionary).chain().flatMapDeep(numericDictionaryIterator); - result = _(objNumericDictionary).chain().flatMapDeep('a'); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(objArray).chain().flatMapDeep(['a', 42]); - result = _(objArray).chain().flatMapDeep({a: 42}); - - result = _(objList).chain().flatMapDeep(['a', 42]); - result = _(objList).chain().flatMapDeep({a: 42}); - - result = _(objDictionary).chain().flatMapDeep(['a', 42]); - result = _(objDictionary).chain().flatMapDeep({a: 42}); - - result = _(objNumericDictionary).chain().flatMapDeep(['a', 42]); - result = _(objNumericDictionary).chain().flatMapDeep({a: 42}); - } + fp.flatMapDeep(valueIterator, numList); // $ExpectType number[] + fp.flatMapDeep(valueIterator)(numList); // $ExpectType number[] + fp.flatMapDeep("a", objList); // $ExpectType any[] + fp.flatMapDeep({ a: 42 }, objList); // $ExpectType boolean[] + fp.flatMapDeep(["a", 42], objList); // $ExpectType boolean[] + fp.flatMapDeep(valueIterator, numDictionary); // $ExpectType number[] + fp.flatMapDeep("a", objDictionary); // $ExpectType any[] + fp.flatMapDeep({ a: 42 }, objDictionary); // $ExpectType boolean[] + fp.flatMapDeep(["a", 42], objDictionary); // $ExpectType boolean[] + fp.flatMapDeep(valueIterator, numNumericDictionary); // $ExpectType number[] + fp.flatMapDeep("a", objNumericDictionary); // $ExpectType any[] + fp.flatMapDeep({ a: 42 }, objNumericDictionary); // $ExpectType boolean[] + fp.flatMapDeep(["a", 42], objNumericDictionary); // $ExpectType boolean[] } // _.flatMapDepth -namespace TestFlatMapDepth { - let numArray: Array | null | undefined = [1, [2, 3]] as any; - let objArray: Array<{a: number}|Array<{a: number}>> | null | undefined = [{a: 1}, [{a: 2}, {a: 3}]] as any; +{ + const numList: _.List | null | undefined = anything; + const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numDictionary: _.Dictionary | null | undefined = anything; + const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + const numNumericDictionary: _.NumericDictionary | null | undefined = anything; + const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - let numList: _.List | null | undefined = anything; - let objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; + const stringIterator = (value: string, index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | string => ""; + const listIterator = (value: number | number[], index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | number => 1; + const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): _.ListOfRecursiveArraysOrValues | number => 1; + const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): _.ListOfRecursiveArraysOrValues | number => 1; + const valueIterator = (value: number | number[]): _.ListOfRecursiveArraysOrValues | number => 1; - let numDictionary: _.Dictionary | null | undefined = anything; - let objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + _.flatMapDepth("abc"); // $ExpectType string[] + _.flatMapDepth("abc", stringIterator); // $ExpectType string[] + _.flatMapDepth("abc", stringIterator, 3); // $ExpectType string[] + _.flatMapDepth(numList, listIterator, 3); // $ExpectType number[] + _.flatMapDepth(objList, "a", 3); // $ExpectType any[] + _.flatMapDepth(objList, ["a", 42], 3); // $ExpectType boolean[] + _.flatMapDepth(objList, { a: 42 }, 3); // $ExpectType boolean[] + _.flatMapDepth(numDictionary, dictionaryIterator, 3); // $ExpectType number[] + _.flatMapDepth(objDictionary, "a", 3); // $ExpectType any[] + _.flatMapDepth(objDictionary, ["a", 42], 3); // $ExpectType boolean[] + _.flatMapDepth(objDictionary, { a: 42 }, 3); // $ExpectType boolean[] + _.flatMapDepth(numNumericDictionary, numericDictionaryIterator, 3); // $ExpectType number[] + _.flatMapDepth(objNumericDictionary, "a", 3); // $ExpectType any[] + _.flatMapDepth(objNumericDictionary, ["a", 42], 3); // $ExpectType boolean[] + _.flatMapDepth(objNumericDictionary, { a: 42 }, 3); // $ExpectType boolean[] - let numNumericDictionary: _.NumericDictionary | null | undefined = anything; - let objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; + _("abc").flatMapDepth(stringIterator, 3); // $ExpectType LoDashImplicitWrapper + _(numList).flatMapDepth(listIterator, 3); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDepth("a", 3); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDepth(["a", 42], 3); // $ExpectType LoDashImplicitWrapper + _(objList).flatMapDepth({ a: 42 }, 3); // $ExpectType LoDashImplicitWrapper + _(numDictionary).flatMapDepth(dictionaryIterator, 3); // $ExpectType LoDashImplicitWrapper + _(objDictionary).flatMapDepth("a", 3); // $ExpectType LoDashImplicitWrapper + _(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 3); // $ExpectType LoDashImplicitWrapper + _(objNumericDictionary).flatMapDepth("a", 3); // $ExpectType LoDashImplicitWrapper - let stringIterator: (value: string, index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) => ""; + _.chain("abc").flatMapDepth(stringIterator, 3); // $ExpectType LoDashExplicitWrapper + _.chain(numList).flatMapDepth(listIterator, 3); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDepth("a", 3); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDepth(["a", 42], 3); // $ExpectType LoDashExplicitWrapper + _.chain(objList).flatMapDepth({ a: 42 }, 3); // $ExpectType LoDashExplicitWrapper + _.chain(numDictionary).flatMapDepth(dictionaryIterator, 3); // $ExpectType LoDashExplicitWrapper + _.chain(objDictionary).flatMapDepth("a", 3); // $ExpectType LoDashExplicitWrapper + _.chain(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 3); // $ExpectType LoDashExplicitWrapper + _.chain(objNumericDictionary).flatMapDepth("a", 3); // $ExpectType LoDashExplicitWrapper - let listIterator: (value: number|number[], index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) =>[ 1]; - - let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - let numericDictionaryIterator: (value: number|number[], key: string, collection: _.NumericDictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; - - { - let result: string[]; - - result = _.flatMapDepth('abc'); - - result = _.flatMapDepth('abc', stringIterator, 1); - } - - { - let result: number[]; - - result = _.flatMapDepth(numArray); - - result = _.flatMapDepth(numArray, listIterator, 1); - - result = _.flatMapDepth(objArray, 'a'); - - result = _.flatMapDepth(numList); - - result = _.flatMapDepth(numList, listIterator, 1); - - result = _.flatMapDepth(objList, 'a', 1); - - result = _.flatMapDepth(numDictionary); - - result = _.flatMapDepth(numDictionary, dictionaryIterator, 1); - - result = _.flatMapDepth(objDictionary, 'a', 1); - - result = _.flatMapDepth(numNumericDictionary); - - result = _.flatMapDepth(numNumericDictionary, numericDictionaryIterator, 1); - - result = _.flatMapDepth(objNumericDictionary, 'a', 1); - } - - { - let result: boolean[]; - - result = _.flatMapDepth(objArray, ['a', 42], 1); - result = _.flatMapDepth(objArray, {'a': 42}, 1); - - result = _.flatMapDepth(objList, ['a', 42], 1); - result = _.flatMapDepth(objList, {'a': 42}, 1); - - result = _.flatMapDepth(objDictionary, ['a', 42], 1); - result = _.flatMapDepth(objDictionary, {'a': 42}, 1); - - result = _.flatMapDepth(objNumericDictionary, ['a', 42], 1); - result = _.flatMapDepth(objNumericDictionary, {'a': 42}, 1); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').flatMapDepth(); - result = _('abc').flatMapDepth(stringIterator, 1); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(numArray).flatMapDepth(); - result = _(numArray).flatMapDepth(listIterator, 1); - result = _(objArray).flatMapDepth('a', 1); - - result = _(numList).flatMapDepth(); - result = _(numList).flatMapDepth(listIterator, 1); - result = _(objList).flatMapDepth('a', 1); - - result = _(numDictionary).flatMapDepth(); - result = _(numDictionary).flatMapDepth(dictionaryIterator, 1); - result = _(objDictionary).flatMapDepth('a', 1); - - result = _(numNumericDictionary).flatMapDepth(); - result = _(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 1); - result = _(objNumericDictionary).flatMapDepth('a', 1); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(objArray).flatMapDepth(['a', 42], 1); - result = _(objArray).flatMapDepth({a: 42}, 1); - - result = _(objList).flatMapDepth(['a', 42], 1); - result = _(objList).flatMapDepth({a: 42}, 1); - - result = _(objDictionary).flatMapDepth(['a', 42], 1); - result = _(objDictionary).flatMapDepth({a: 42}, 1); - - result = _(objNumericDictionary).flatMapDepth(['a', 42], 1); - result = _(objNumericDictionary).flatMapDepth({a: 42}, 1); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().flatMapDepth(); - result = _('abc').chain().flatMapDepth(stringIterator, 1); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(numArray).chain().flatMapDepth(); - result = _(numArray).chain().flatMapDepth(listIterator, 1); - result = _(objArray).chain().flatMapDepth('a', 1); - - result = _(numList).chain().flatMapDepth(); - result = _(numList).chain().flatMapDepth(listIterator, 1); - result = _(objList).chain().flatMapDepth('a', 1); - - result = _(numDictionary).chain().flatMapDepth(); - result = _(numDictionary).chain().flatMapDepth(dictionaryIterator, 1); - result = _(objDictionary).chain().flatMapDepth('a', 1); - - result = _(numNumericDictionary).chain().flatMapDepth(); - result = _(numNumericDictionary).chain().flatMapDepth(numericDictionaryIterator, 1); - result = _(objNumericDictionary).chain().flatMapDepth('a', 1); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(objArray).chain().flatMapDepth(['a', 42], 1); - result = _(objArray).chain().flatMapDepth({a: 42}, 1); - - result = _(objList).chain().flatMapDepth(['a', 42], 1); - result = _(objList).chain().flatMapDepth({a: 42}, 1); - - result = _(objDictionary).chain().flatMapDepth(['a', 42], 1); - result = _(objDictionary).chain().flatMapDepth({a: 42}, 1); - - result = _(objNumericDictionary).chain().flatMapDepth(['a', 42], 1); - result = _(objNumericDictionary).chain().flatMapDepth({a: 42}, 1); - } + fp.flatMapDepth(valueIterator, 3, numList); // $ExpectType number[] + fp.flatMapDepth(valueIterator)(3)(numList); // $ExpectType number[] + fp.flatMapDepth("a", 3, objList); // $ExpectType any[] + fp.flatMapDepth({ a: 42 }, 3, objList); // $ExpectType boolean[] + fp.flatMapDepth(["a", 42], 3, objList); // $ExpectType boolean[] + fp.flatMapDepth(valueIterator, 3, numDictionary); // $ExpectType number[] + fp.flatMapDepth("a", 3, objDictionary); // $ExpectType any[] + fp.flatMapDepth({ a: 42 }, 3, objDictionary); // $ExpectType boolean[] + fp.flatMapDepth(["a", 42], 3, objDictionary); // $ExpectType boolean[] + fp.flatMapDepth(valueIterator, 3, numNumericDictionary); // $ExpectType number[] + fp.flatMapDepth("a", 3, objNumericDictionary); // $ExpectType any[] + fp.flatMapDepth({ a: 42 }, 3, objNumericDictionary); // $ExpectType boolean[] + fp.flatMapDepth(["a", 42], 3, objNumericDictionary); // $ExpectType boolean[] } // _.forEach -namespace TestForEach { +// _.forEachRight +// _.each +// _.eachRight +{ const str: string = anything; const nilStr: string | null | undefined = anything; const array: AbcObject[] = anything; @@ -5448,7 +2436,7 @@ namespace TestForEach { // $ExpectType LoDashImplicitWrapper> _(numericDictionary).forEach((value, index, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ + // Broken in TS 2.4: value; // AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); @@ -5461,2489 +2449,1369 @@ namespace TestForEach { }); // $ExpectType LoDashExplicitWrapper - _(str).chain().forEach((value, index, collection) => { + _.chain(str).forEach((value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType LoDashExplicitWrapper - _(nilStr).chain().forEach((value, index, collection) => { + _.chain(nilStr).forEach((value, index, collection) => { value; // $ExpectType string index; // $ExpectType number collection; // $ExpectType string }); // $ExpectType LoDashExplicitWrapper - _(array).chain().forEach((value, index, collection) => { + _.chain(array).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashExplicitWrapper - _(nilArray).chain().forEach((value, index, collection) => { + _.chain(nilArray).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType AbcObject[] }); // $ExpectType LoDashExplicitWrapper> - _(list).chain().forEach((value, index, collection) => { + _.chain(list).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashExplicitWrapper | null | undefined> - _(nilList).chain().forEach((value, index, collection) => { + _.chain(nilList).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType number collection; // $ExpectType ArrayLike }); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().forEach((value, index, collection) => { + _.chain(dictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType LoDashExplicitWrapper | null | undefined> - _(nilDictionary).chain().forEach((value, index, collection) => { + _.chain(nilDictionary).forEach((value, index, collection) => { value; // $ExpectType AbcObject index; // $ExpectType string collection; // $ExpectType Dictionary }); // $ExpectType LoDashExplicitWrapper> - _(numericDictionary).chain().forEach((value, index, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ + _.chain(numericDictionary).forEach((value, index, collection) => { + // Broken in TS 2.4: value; // AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); // $ExpectType LoDashExplicitWrapper | null | undefined> - _(nilNumericDictionary).chain().forEach((value, index, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ + _.chain(nilNumericDictionary).forEach((value, index, collection) => { + // Broken in TS 2.4: value; // AbcObject index; // $ExpectType string collection; // $ExpectType NumericDictionary }); -} -// _.forEachRight -namespace TestForEachRight { - let array: AbcObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let nilArray: AbcObject[] | null | undefined = [] as any; - let nilList: _.List | null | undefined = [] as any; - let nilDictionary: _.Dictionary | null | undefined = anything; + const stringIterator2 = (char: string) => 1; + const listIterator2 = (value: AbcObject) => 1; + fp.forEach(stringIterator2, ""); // $ExpectType string + fp.forEach(listIterator2, array); // $ExpectType AbcObject[] + fp.forEach(listIterator2)(array); // $ExpectType AbcObject[] + fp.forEach(listIterator2, list); // $ExpectType ArrayLike + fp.forEach(listIterator2, dictionary); // $ExpectType Dictionary + fp.forEach(listIterator2, nilArray); // $ExpectType AbcObject[] | null | undefined + fp.forEach(listIterator2, nilList); // $ExpectType ArrayLike | null | undefined + fp.forEach(listIterator2, nilDictionary); // $ExpectType Dictionary | null | undefined - let listIterator: (value: AbcObject, index: number, collection: _.List) => any = (value: AbcObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: AbcObject, key: string, collection: _.Dictionary) => any = (value: AbcObject, key: string, collection: _.Dictionary) => 1; + // $ExpectType AbcObject[] + _.forEachRight(array, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType ArrayLike | null | undefined + _.forEachRight(nilList, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashImplicitWrapper + _(array).forEachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashImplicitWrapper | null | undefined> + _(nilList).forEachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashExplicitWrapper + _.chain(array).forEachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashExplicitWrapper | null | undefined> + _.chain(nilList).forEachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + fp.forEachRight(listIterator2, array); // $ExpectType AbcObject[] + fp.forEachRight(listIterator2)(array); // $ExpectType AbcObject[] - { - let result: string; + // $ExpectType AbcObject[] + _.each(array, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType ArrayLike | null | undefined + _.each(nilList, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashImplicitWrapper + _(array).each((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashImplicitWrapper | null | undefined> + _(nilList).each((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashExplicitWrapper + _.chain(array).each((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashExplicitWrapper | null | undefined> + _.chain(nilList).each((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + fp.each(listIterator2, array); // $ExpectType AbcObject[] + fp.each(listIterator2)(array); // $ExpectType AbcObject[] - result = _.forEachRight('', (value, index, collection) => { - value; // $ExpectType string - index; // $ExpectType number - collection; // $ExpectType string - }); - } - - { - let result: string | null | undefined; - - result = _.forEachRight('' as (string | null | undefined), (value, index, collection) => { - value; // $ExpectType string - index; // $ExpectType number - collection; // $ExpectType string - }); - } - - { - let result: AbcObject[]; - - result = _.forEachRight(array, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - }); - } - - { - let result: AbcObject[] | null | undefined; - - result = _.forEachRight(nilArray, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - }); - } - - { - let result: _.List; - - result = _.forEachRight(list, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - }); - } - - { - let result: _.List | null | undefined; - - result = _.forEachRight(nilList, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - }); - } - - { - let result: _.Dictionary; - - result = _.forEachRight(dictionary, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType string - collection; // $ExpectType Dictionary - }); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.forEachRight(nilDictionary, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType string - collection; // $ExpectType Dictionary - }); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _('').forEachRight((value, index, collection) => { - value; // $ExpectType string - index; // $ExpectType number - collection; // $ExpectType string - }); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).forEachRight(listIterator); - } - - { - let result: _.LoDashImplicitNillableArrayWrapper; - - result = _(nilArray).forEachRight(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.List>; - - result = _(list).forEachRight(listIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.List>; - - result = _(nilList).forEachRight(listIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forEachRight(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forEachRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().forEachRight((value, index, collection) => { - value; // $ExpectType string - index; // $ExpectType number - collection; // $ExpectType string - }); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().forEachRight((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - }); - } - - { - let result: _.LoDashExplicitNillableArrayWrapper; - - result = _(nilArray).chain().forEachRight((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - }); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.List>; - - result = _(list).chain().forEachRight(listIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.List>; - - result = _(nilList).chain().forEachRight(listIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forEachRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forEachRight(dictionaryIterator); - } + // $ExpectType AbcObject[] + _.eachRight(array, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType ArrayLike | null | undefined + _.eachRight(nilList, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashImplicitWrapper + _(array).eachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashImplicitWrapper | null | undefined> + _(nilList).eachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + // $ExpectType LoDashExplicitWrapper + _.chain(array).eachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType AbcObject[] + }); + // $ExpectType LoDashExplicitWrapper | null | undefined> + _.chain(nilList).eachRight((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + }); + fp.eachRight(listIterator2, array); // $ExpectType AbcObject[] + fp.eachRight(listIterator2)(array); // $ExpectType AbcObject[] } // _.groupBy -namespace TestGroupBy { - type SampleType = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = [] as any; + const dictionary: _.Dictionary | null | undefined = anything; - let array: SampleType[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let dictionary: _.Dictionary | null | undefined = anything; + const stringIterator = (char: string, index: number, string: string) => 0; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 0; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 0; + const valueIterator = (value: AbcObject) => 0; - 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; + _.groupBy(""); // $ExpectType Dictionary + _.groupBy("", stringIterator); // $ExpectType Dictionary + _.groupBy(list); // $ExpectType Dictionary + _.groupBy(list, listIterator); // $ExpectType Dictionary + _.groupBy(list, "a"); // $ExpectType Dictionary + _.groupBy(list, { a: 42 }); // $ExpectType Dictionary + _.groupBy(dictionary); // $ExpectType Dictionary + _.groupBy(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.groupBy(dictionary, ""); // $ExpectType Dictionary + _.groupBy(dictionary, { a: 42 }); // $ExpectType Dictionary - { - let result: _.Dictionary; + _("").groupBy(); // $ExpectType LoDashImplicitWrapper> + _("").groupBy((char: string, index: number, string: ArrayLike) => 0); // $ExpectType LoDashImplicitWrapper> + _(list).groupBy(); // $ExpectType LoDashImplicitWrapper> + _(list).groupBy(listIterator); // $ExpectType LoDashImplicitWrapper> + _(list).groupBy(""); // $ExpectType LoDashImplicitWrapper> + _(list).groupBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + _(dictionary).groupBy(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).groupBy(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).groupBy(""); // $ExpectType LoDashImplicitWrapper> + _(dictionary).groupBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> - result = _.groupBy(''); - result = _.groupBy('', stringIterator); - } + _.chain("").groupBy(); // $ExpectType LoDashExplicitWrapper> + _.chain("").groupBy((char: string, index: number, string: ArrayLike) => 0); // $ExpectType LoDashExplicitWrapper> + _.chain(list).groupBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).groupBy(listIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).groupBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(list).groupBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).groupBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).groupBy(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).groupBy(""); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).groupBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> - { - let result: _.Dictionary; - - result = _.groupBy(array); - result = _.groupBy(array, listIterator); - result = _.groupBy(array, ''); - result = _.groupBy(array, {a: 42}); - - result = _.groupBy(list); - result = _.groupBy(list, listIterator); - result = _.groupBy(list, ''); - result = _.groupBy(list, {a: 42}); - - result = _.groupBy(dictionary); - result = _.groupBy(dictionary, dictionaryIterator); - result = _.groupBy(dictionary, ''); - result = _.groupBy(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _('').groupBy(); - result = _('').groupBy((char: string, index: number, string: ArrayLike) => 0); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(array).groupBy(); - result = _(array).groupBy(listIterator); - result = _(array).groupBy(''); - result = _(array).groupBy({a: 42}); - - result = _(list).groupBy(); - result = _(list).groupBy(listIterator); - result = _(list).groupBy(''); - result = _(list).groupBy({a: 42}); - - result = _(dictionary).groupBy(); - result = _(dictionary).groupBy(dictionaryIterator); - result = _(dictionary).groupBy(''); - result = _(dictionary).groupBy({a: 42}); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _('').chain().groupBy(); - result = _('').chain().groupBy((char: string, index: number, string: ArrayLike) => 0); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(array).chain().groupBy(); - result = _(array).chain().groupBy(listIterator); - result = _(array).chain().groupBy(''); - result = _(array).chain().groupBy({a: 42}); - - result = _(list).chain().groupBy(); - result = _(list).chain().groupBy(listIterator); - result = _(list).chain().groupBy(''); - result = _(list).chain().groupBy({a: 42}); - - result = _(dictionary).chain().groupBy(); - result = _(dictionary).chain().groupBy(dictionaryIterator); - result = _(dictionary).chain().groupBy(''); - result = _(dictionary).chain().groupBy({a: 42}); - } + fp.groupBy(valueIterator, list); // $ExpectType Dictionary + fp.groupBy(valueIterator)(list); // $ExpectType Dictionary + fp.groupBy("a", list); // $ExpectType Dictionary + fp.groupBy({ a: 42 }, list); // $ExpectType Dictionary + fp.groupBy(["a", 42], list); // $ExpectType Dictionary + fp.groupBy(valueIterator, dictionary); // $ExpectType Dictionary + fp.groupBy("a", dictionary); // $ExpectType Dictionary + fp.groupBy({ a: 42 }, dictionary); // $ExpectType Dictionary + fp.groupBy(["a", 42], dictionary); // $ExpectType Dictionary } // _.includes -namespace TestIncludes { - type SampleType = {a: string; b: number; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const target: AbcObject = { a: 42, b: "", c: true }; - let array: SampleType[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; + _.includes(list, target); // $ExpectType boolean + _.includes(list, target, 42); // $ExpectType boolean + _.includes(dictionary, target); // $ExpectType boolean + _.includes(dictionary, target, 42); // $ExpectType boolean - let target: SampleType = { a: "", b: 1, c: true }; + _(list).includes(target); // $ExpectType boolean + _(list).includes(target, 42); // $ExpectType boolean + _(dictionary).includes(target); // $ExpectType boolean + _(dictionary).includes(target, 42); // $ExpectType boolean - { - let result: boolean; + _.chain(list).includes(target); // $ExpectType LoDashExplicitWrapper + _.chain(list).includes(target, 42); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(target); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(target, 42); // $ExpectType LoDashExplicitWrapper - result = _.includes(array, target); - result = _.includes(array, target, 42); + fp.includes(target, list); // $ExpectType boolean + fp.includes(target)(list); // $ExpectType boolean + fp.includes(target, dictionary); // $ExpectType boolean - result = _.includes(list, target); - result = _.includes(list, target, 42); - - result = _.includes(dictionary, target); - result = _.includes(dictionary, target, 42); - - result = _(array).includes(target); - result = _(array).includes(target, 42); - - result = _(list).includes(target); - result = _(list).includes(target, 42); - - result = _(dictionary).includes(target); - result = _(dictionary).includes(target, 42); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().includes(target); - result = _(array).chain().includes(target, 42); - - result = _(list).chain().includes(target); - result = _(list).chain().includes(target, 42); - - result = _(dictionary).chain().includes(target); - result = _(dictionary).chain().includes(target, 42); - } + fp.includesFrom(target, 42, list); // $ExpectType boolean + fp.includesFrom(target)(42)(list); // $ExpectType boolean + fp.includesFrom(target, 42, dictionary); // $ExpectType boolean } // _.keyBy -namespace TestKeyBy { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; + const stringIterator = (value: string, index: number, collection: string) => "a"; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 1; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => Symbol.name; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => "a"; + const valueIterator = (value: AbcObject) => 1; - let stringIterator = (value: string, index: number, collection: string) => "a"; - let listIterator = (value: SampleObject, index: number, collection: _.List) => 1; - let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => Symbol.name; - let numericDictionaryIterator = (value: SampleObject, key: string, collection: _.NumericDictionary) => "a"; + _.keyBy("abcd"); // $ExpectType Dictionary + _.keyBy("abcd", stringIterator); // $ExpectType Dictionary + _.keyBy(list); // $ExpectType Dictionary + _.keyBy(list, listIterator); // $ExpectType Dictionary + _.keyBy(list, "a"); // $ExpectType Dictionary + _.keyBy(list, { a: 42 }); // $ExpectType Dictionary + _.keyBy(dictionary); // $ExpectType Dictionary + _.keyBy(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.keyBy(dictionary, "a"); // $ExpectType Dictionary + _.keyBy(dictionary, { a: 42 }); // $ExpectType Dictionary + // These fail in TS 2.4 + // _.keyBy(numericDictionary); // Dictionary + // _.keyBy(numericDictionary, numericDictionaryIterator); // Dictionary + // _.keyBy(numericDictionary, "a"); // Dictionary + // _.keyBy(numericDictionary, { a: 42 }); // Dictionary - { - let result: _.Dictionary; + _("abcd").keyBy(); // $ExpectType LoDashImplicitWrapper> + _("abcd").keyBy(stringIterator); // $ExpectType LoDashImplicitWrapper> + _(list).keyBy(); // $ExpectType LoDashImplicitWrapper> + _(list).keyBy(listIterator); // $ExpectType LoDashImplicitWrapper> + _(list).keyBy("a"); // $ExpectType LoDashImplicitWrapper> + _(list).keyBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + _(dictionary).keyBy(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).keyBy(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).keyBy("a"); // $ExpectType LoDashImplicitWrapper> + _(dictionary).keyBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper> + // These fail in TS 2.4 + // _(numericDictionary).keyBy(); // LoDashImplicitWrapper> + // _(numericDictionary).keyBy(numericDictionaryIterator); // LoDashImplicitWrapper> + // _(numericDictionary).keyBy("a"); // LoDashImplicitWrapper> + // _(numericDictionary).keyBy({ a: 42 }); // LoDashImplicitWrapper> - result = _.keyBy('abcd'); - result = _.keyBy('abcd', stringIterator); - } + _.chain("abcd").keyBy(); // $ExpectType LoDashExplicitWrapper> + _.chain("abcd").keyBy(stringIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).keyBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).keyBy(listIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).keyBy("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(list).keyBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).keyBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).keyBy(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).keyBy("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).keyBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper> + // These fail in TS 2.4 + // _.chain(numericDictionary).keyBy(); // LoDashExplicitWrapper> + // _.chain(numericDictionary).keyBy(numericDictionaryIterator); // LoDashExplicitWrapper> + // _.chain(numericDictionary).keyBy("a"); // LoDashExplicitWrapper> + // _.chain(numericDictionary).keyBy({ a: 42 }); // LoDashExplicitWrapper> - { - let result: _.Dictionary; - - result = _.keyBy(array); - result = _.keyBy(array, listIterator); - result = _.keyBy(array, 'a'); - result = _.keyBy(array, {a: 42}); - - result = _.keyBy(list); - result = _.keyBy(list, listIterator); - result = _.keyBy(list, 'a'); - result = _.keyBy(list, {a: 42}); - - result = _.keyBy(numericDictionary); - result = _.keyBy(numericDictionary, numericDictionaryIterator); - result = _.keyBy(numericDictionary, 'a'); - result = _.keyBy(numericDictionary, {a: 42}); - - result = _.keyBy(dictionary); - result = _.keyBy(dictionary, dictionaryIterator); - result = _.keyBy(dictionary, 'a'); - result = _.keyBy(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _('abcd').keyBy(); - result = _('abcd').keyBy(stringIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(array).keyBy(); - result = _(array).keyBy(listIterator); - result = _(array).keyBy('a'); - result = _(array).keyBy({a: 42}); - - result = _(list).keyBy(); - result = _(list).keyBy(listIterator); - result = _(list).keyBy('a'); - result = _(list).keyBy({a: 42}); - - result = _(numericDictionary).keyBy(); - result = _(numericDictionary).keyBy(numericDictionaryIterator); - result = _(numericDictionary).keyBy('a'); - result = _(numericDictionary).keyBy({a: 42}); - - result = _(dictionary).keyBy(); - result = _(dictionary).keyBy(dictionaryIterator); - result = _(dictionary).keyBy('a'); - result = _(dictionary).keyBy({a: 42}); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _('abcd').chain().keyBy(); - result = _('abcd').chain().keyBy(stringIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(array).chain().keyBy(); - result = _(array).chain().keyBy(listIterator); - result = _(array).chain().keyBy('a'); - result = _(array).chain().keyBy({a: 42}); - - result = _(list).chain().keyBy(); - result = _(list).chain().keyBy(listIterator); - result = _(list).chain().keyBy('a'); - result = _(list).chain().keyBy({a: 42}); - - result = _(numericDictionary).chain().keyBy(); - result = _(numericDictionary).chain().keyBy(numericDictionaryIterator); - result = _(numericDictionary).chain().keyBy('a'); - result = _(numericDictionary).chain().keyBy({a: 42}); - - result = _(dictionary).chain().keyBy(); - result = _(dictionary).chain().keyBy(dictionaryIterator); - result = _(dictionary).chain().keyBy('a'); - result = _(dictionary).chain().keyBy({a: 42}); - } + fp.keyBy(valueIterator, list); // $ExpectType Dictionary + fp.keyBy(valueIterator)(list); // $ExpectType Dictionary + fp.keyBy("a", list); // $ExpectType Dictionary + fp.keyBy({ a: 42 }, list); // $ExpectType Dictionary + fp.keyBy(["a", 42], list); // $ExpectType Dictionary + fp.keyBy(valueIterator, dictionary); // $ExpectType Dictionary + fp.keyBy("a", dictionary); // $ExpectType Dictionary + fp.keyBy({ a: 42 }, dictionary); // $ExpectType Dictionary + fp.keyBy(["a", 42], dictionary); // $ExpectType Dictionary + // These fail in TS 2.4 + // fp.keyBy(valueIterator, numericDictionary); // Dictionary + // fp.keyBy("a", numericDictionary); // Dictionary + // fp.keyBy({ a: 42 }, numericDictionary); // Dictionary + // fp.keyBy(["a", 42], numericDictionary); // Dictionary } -//_.invoke -namespace TestInvoke { - let boolArray: boolean[] = [true, false]; +// _.invoke +{ + const array = [(n?: number) => {}]; + const nestedDict = { a: [(n?: number) => {}] }; - let nestedDict: _.Dictionary = { - a: [0, 1, 2] - } + _.invoke(array, "[0]"); // $ExpectType any + _.invoke(array, "[0]", 2); // $ExpectType any + _.invoke(array, [0, "call"]); // $ExpectType any + _.invoke(array, [0, "call"], 2); // $ExpectType any - let numDict: _.Dictionary = { - a: 1, - b: 2, - c: 3, - d: 4 - } + _.invoke(nestedDict, ["a[0].toString"]); // $ExpectType any + _.invoke(nestedDict, ["a[0].toString"], 2); // $ExpectType any + _.invoke(nestedDict, ["a", 0, "toString"]); // $ExpectType any + _.invoke(nestedDict, ["a", 0, "toString"], 2); // $ExpectType any - let result: string; + _(array).invoke("[0]"); // $ExpectType any + _(array).invoke("[0]", 2); // $ExpectType any + _(array).invoke([0, "call"]); // $ExpectType any + _(array).invoke([0, "call"], 2); // $ExpectType any - result = _.invoke(boolArray, "[1]"); - result = _.invoke(boolArray, "[1]", 2); - result = _.invoke(boolArray, [1, "toString"]); - result = _.invoke(boolArray, [1, "toString"], 2); + _(nestedDict).invoke(["a[0].toString"]); // $ExpectType any + _(nestedDict).invoke(["a[0].toString"], 2); // $ExpectType any + _(nestedDict).invoke(["a", 0, "toString"]); // $ExpectType any + _(nestedDict).invoke(["a", 0, "toString"], 2); // $ExpectType any - result = _.invoke(boolArray, "[1]"); - result = _.invoke(boolArray, "[1]", 2); - result = _.invoke(boolArray, [1, "toString"]); - result = _.invoke(boolArray, [1, "toString"], 2); + _.chain(array).invoke("[0]"); // $ExpectType LoDashExplicitWrapper + _.chain(array).invoke("[0]", 2); // $ExpectType LoDashExplicitWrapper + _.chain(array).invoke([0, "call"]); // $ExpectType LoDashExplicitWrapper + _.chain(array).invoke([0, "call"], 2); // $ExpectType LoDashExplicitWrapper - result = _.invoke(numDict, "a.toString"); - result = _.invoke(numDict, "a.toString", 2); - result = _.invoke(numDict, ["a", "toString"]); - result = _.invoke(numDict, ["a", "toString"], 2); + _.chain(nestedDict).invoke(["a[0].toString"]); // $ExpectType LoDashExplicitWrapper + _.chain(nestedDict).invoke(["a[0].toString"], 2); // $ExpectType LoDashExplicitWrapper + _.chain(nestedDict).invoke(["a", 0, "toString"]); // $ExpectType LoDashExplicitWrapper + _.chain(nestedDict).invoke(["a", 0, "toString"], 2); // $ExpectType LoDashExplicitWrapper - result = _.invoke(numDict, "a.toString"); - result = _.invoke(numDict, "a.toString", 2); - result = _.invoke(numDict, ["a", "toString"]); - result = _.invoke(numDict, ["a", "toString"], 2); + fp.invoke("[0]", array); // $ExpectType any + fp.invoke("[0]")(array); // $ExpectType any + fp.invoke(["[0]", 2], array); // $ExpectType any - result = _.invoke(nestedDict, ["a[0].toString"]); - result = _.invoke(nestedDict, ["a[0].toString"], 2); - result = _.invoke(nestedDict, ["a", 0, "toString"]); - result = _.invoke(nestedDict, ["a", 0, "toString"], 2); - - result = _.invoke(nestedDict, ["a[0].toString"]); - result = _.invoke(nestedDict, ["a[0].toString"], 2); - result = _.invoke(nestedDict, ["a", 0, "toString"]); - result = _.invoke(nestedDict, ["a", 0, "toString"], 2); - - result = _(boolArray).invoke("[1]"); - result = _(boolArray).invoke("[1]", 2); - result = _(boolArray).invoke([1, "toString"]); - result = _(boolArray).invoke([1, "toString"], 2); - - result = _(numDict).invoke("a.toString"); - result = _(numDict).invoke("a.toString", 2); - result = _(numDict).invoke(["a", "toString"]); - result = _(numDict).invoke(["a", "toString"], 2); - - result = _(nestedDict).invoke("a[0].toString"); - result = _(nestedDict).invoke("a[0].toString", 2); - result = _(nestedDict).invoke(["a", 0, "toString"]); - result = _(nestedDict).invoke(["a", 0, "toString"], 2); - - { - let result: _.LoDashExplicitWrapper; - - result = _(boolArray).chain().invoke("[1]"); - result = _(boolArray).chain().invoke("[1]", 2); - result = _(boolArray).chain().invoke([1, "toString"]); - result = _(boolArray).chain().invoke([1, "toString"], 2); - - result = _(numDict).chain().invoke("a.toString"); - result = _(numDict).chain().invoke("a.toString", 2); - result = _(numDict).chain().invoke(["a", "toString"]); - result = _(numDict).chain().invoke(["a", "toString"], 2); - - result = _(nestedDict).chain().invoke("a[0].toString"); - result = _(nestedDict).chain().invoke("a[0].toString", 2); - result = _(nestedDict).chain().invoke(["a", 0, "toString"]); - result = _(nestedDict).chain().invoke(["a", 0, "toString"], 2); - } + fp.invoke("a[0].toString", nestedDict); // $ExpectType any + fp.invoke(["a", 0, "toString"], nestedDict); // $ExpectType any } -//_.invokeMap -namespace TestInvokeMap { - let numArray: number[] | null | undefined = [4, 2, 1, 3] as any; - let obj: _.Dictionary = { - a: 1, - b: 2, - c: 3, - d: 4 - }; - let numDict: _.Dictionary | null | undefined = obj as any; +// _.invokeMap +{ + const numArray: number[] | null | undefined = anything; + const numDict: _.Dictionary | null | undefined = anything; - let result: string[]; - result = _.invokeMap(numArray, 'toString'); - result = _.invokeMap(numArray, 'toString', 2); - result = _.invokeMap(numArray, 'toString'); - result = _.invokeMap(numArray, 'toString', 2); - result = _(numArray).invokeMap('toString').value(); - result = _(numArray).invokeMap('toString', 2).value(); - result = _(numArray).chain().invokeMap('toString').value(); - result = _(numArray).chain().invokeMap('toString', 2).value(); + _.invokeMap(numArray, "toString"); // $ExpectType any[] + _.invokeMap(numArray, "toString", 2); // $ExpectType any[] + _.invokeMap(numArray, Number.prototype.toString); // $ExpectType string[] + _.invokeMap(numDict, "toString"); // $ExpectType any[] - result = _.invokeMap(numArray, Number.prototype.toString); - result = _.invokeMap(numArray, Number.prototype.toString, 2); - result = _.invokeMap(numArray, Number.prototype.toString); - result = _.invokeMap(numArray, Number.prototype.toString, 2); - result = _(numArray).invokeMap(Number.prototype.toString).value(); - result = _(numArray).invokeMap(Number.prototype.toString, 2).value(); - result = _(numArray).chain().invokeMap(Number.prototype.toString).value(); - result = _(numArray).chain().invokeMap(Number.prototype.toString, 2).value(); + _(numArray).invokeMap("toString"); // $ExpectType LoDashImplicitWrapper + _(numArray).invokeMap("toString", 2); // $ExpectType LoDashImplicitWrapper + _(numArray).invokeMap(Number.prototype.toString); // $ExpectType LoDashImplicitWrapper + _(numDict).invokeMap("toString"); // $ExpectType LoDashImplicitWrapper - result = _.invokeMap(numDict, 'toString'); - result = _.invokeMap(numDict, 'toString', 2); - result = _.invokeMap(numDict, 'toString'); - result = _.invokeMap(numDict, 'toString', 2); - result = _(numDict).invokeMap('toString').value(); - result = _(numDict).invokeMap('toString', 2).value(); - result = _(numDict).chain().invokeMap('toString').value(); - result = _(numDict).chain().invokeMap('toString', 2).value(); + _.chain(numArray).invokeMap("toString"); // $ExpectType LoDashExplicitWrapper + _.chain(numArray).invokeMap("toString", 2); // $ExpectType LoDashExplicitWrapper + _.chain(numArray).invokeMap(Number.prototype.toString); // $ExpectType LoDashExplicitWrapper + _.chain(numDict).invokeMap("toString"); // $ExpectType LoDashExplicitWrapper - result = _.invokeMap(numDict, Number.prototype.toString); - result = _.invokeMap(numDict, Number.prototype.toString, 2); - result = _.invokeMap(numDict, Number.prototype.toString); - result = _.invokeMap(numDict, Number.prototype.toString, 2); - result = _(numDict).invokeMap(Number.prototype.toString).value(); - result = _(numDict).invokeMap(Number.prototype.toString, 2).value(); - result = _(numDict).chain().invokeMap(Number.prototype.toString).value(); - result = _(numDict).chain().invokeMap(Number.prototype.toString, 2).value(); + fp.invokeMap("toString", numArray); // $ExpectType any[] + fp.invokeMap("toString")(numArray); // $ExpectType any[] + fp.invokeMap(Number.prototype.toString, numArray); // $ExpectType string[] + fp.invokeMap("toString", numDict); // $ExpectType any[] + fp.invokeMap(Number.prototype.toString, numDict); // $ExpectType string[] + + fp.invokeArgsMap("toString", [16], numArray); // $ExpectType any[] + fp.invokeArgsMap("toString")([16])(numArray); // $ExpectType any[] + fp.invokeArgsMap(Number.prototype.toString, [16], numArray); // $ExpectType string[] + fp.invokeArgsMap("toString", [16], numDict); // $ExpectType any[] + fp.invokeArgsMap(Number.prototype.toString, [16], numDict); // $ExpectType string[] } // _.map -namespace TestMap { - const array: AbcObject[] | null | undefined = anything; +{ const list: _.List | null | undefined = anything; const dictionary: _.Dictionary | null | undefined = anything; const numericDictionary: _.NumericDictionary | null | undefined = anything; const abcObject: AbcObject = anything; - { - _.map(array); // $ExpectType AbcObject[] - // $ExpectType number[] - _.map(array, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - return 0; - }); + _.map(list); // $ExpectType AbcObject[] + // $ExpectType number[] + _.map(list, (value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + return 0; + }); + _.map(dictionary); // $ExpectType AbcObject[] + // $ExpectType number[] + _.map(dictionary, (value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return 0; + }); + _.map(numericDictionary); // $ExpectType AbcObject[] + // $ExpectType number[] + _.map(numericDictionary, (value, key, collection) => { + /* Broken in TS 2.4: value; // AbcObject */ + key; // $ExpectType string + collection; // $ExpectType NumericDictionary + return 0; + }); + _.map(list, "a"); // $ExpectType number[] + _.map(dictionary, "a"); // $ExpectType number[] + _.map(numericDictionary, "a"); // $ExpectType number[] + _.map(list, "d.0.b"); // $ExpectType any[] + _.map(dictionary, "d.0.b"); // $ExpectType any[] + _.map(numericDictionary, "d.0.b"); // $ExpectType any[] + _.map(list, { a: 42 }); // $ExpectType boolean[] + _.map(dictionary, { a: 42 }); // $ExpectType boolean[] + _.map(numericDictionary, { a: 42 }); // $ExpectType boolean[] - _.map(list); // $ExpectType AbcObject[] - // $ExpectType number[] - _.map(list, (value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - return 0; - }); + _(list).map(); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(list).map((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + return 0; + }); + _(dictionary).map(); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(dictionary).map((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return 0; + }); + _(numericDictionary).map(); // $ExpectType LoDashImplicitWrapper + // $ExpectType LoDashImplicitWrapper + _(numericDictionary).map((value, key, collection) => { + /* Broken in TS 2.4: value; // AbcObject */ + key; // $ExpectType string + collection; // $ExpectType NumericDictionary + return 0; + }); + _(list).map("a"); // $ExpectType LoDashImplicitWrapper + _(dictionary).map("a"); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).map("a"); // $ExpectType LoDashImplicitWrapper + _(list).map("d.0.b"); // $ExpectType LoDashImplicitWrapper + _(dictionary).map("d.0.b"); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).map("d.0.b"); // $ExpectType LoDashImplicitWrapper + _(list).map({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(dictionary).map({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).map({ a: 42 }); // $ExpectType LoDashImplicitWrapper - _.map(dictionary); // $ExpectType AbcObject[] - // $ExpectType number[] - _.map(dictionary, (value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return 0; - }); + _.chain(list).map(); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(list).map((value, index, collection) => { + value; // $ExpectType AbcObject + index; // $ExpectType number + collection; // $ExpectType ArrayLike + return 0; + }); + _.chain(dictionary).map(); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).map((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return 0; + }); + _.chain(numericDictionary).map(); // $ExpectType LoDashExplicitWrapper + // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).map((value, key, collection) => { + /* Broken in TS 2.4: value; // AbcObject */ + key; // $ExpectType string + collection; // $ExpectType NumericDictionary + return 0; + }); + _.chain(list).map("a"); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).map("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).map("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).map("d.0.b"); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).map("d.0.b"); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).map("d.0.b"); // $ExpectType LoDashExplicitWrapper + _.chain(list).map({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).map({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).map({ a: 42 }); // $ExpectType LoDashExplicitWrapper - _.map(numericDictionary); // $ExpectType AbcObject[] - // $ExpectType number[] - _.map(numericDictionary, (value, key, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ - key; // $ExpectType string - collection; // $ExpectType NumericDictionary - return 0; - }); - - _.map(array, 'a'); // $ExpectType number[] - _.map(list, 'a'); // $ExpectType number[] - _.map(dictionary, 'a'); // $ExpectType number[] - _.map(numericDictionary, 'a'); // $ExpectType number[] - - _.map(array, 'd.0.b'); // $ExpectType any[] - _.map(list, 'd.0.b'); // $ExpectType any[] - _.map(dictionary, 'd.0.b'); // $ExpectType any[] - _.map(numericDictionary, 'd.0.b'); // $ExpectType any[] - - // _.matches iteratee shorthand. - _.map(array, {}); // $ExpectType boolean[] - _.map(list, {}); // $ExpectType boolean[] - _.map(dictionary, {}); // $ExpectType boolean[] - _.map(numericDictionary, {}); // $ExpectType boolean[] - } - - { - _(array).map(); // $ExpectType LoDashImplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(array).map((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - return 0; - }); - - _(list).map(); // $ExpectType LoDashImplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(list).map((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - return 0; - }); - - _(dictionary).map(); // $ExpectType LoDashImplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(dictionary).map((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return 0; - }); - - _(numericDictionary).map(); // $ExpectType LoDashImplicitWrapper - // $ExpectType LoDashImplicitWrapper - _(numericDictionary).map((value, key, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ - key; // $ExpectType string - collection; // $ExpectType NumericDictionary - return 0; - }); - - _(array).map('a'); // $ExpectType LoDashImplicitWrapper - _(list).map('a'); // $ExpectType LoDashImplicitWrapper - _(dictionary).map('a'); // $ExpectType LoDashImplicitWrapper - _(numericDictionary).map('a'); // $ExpectType LoDashImplicitWrapper - - _(array).map('d.0.b'); // $ExpectType LoDashImplicitWrapper - _(list).map('d.0.b'); // $ExpectType LoDashImplicitWrapper - _(dictionary).map('d.0.b'); // $ExpectType LoDashImplicitWrapper - _(numericDictionary).map('d.0.b'); // $ExpectType LoDashImplicitWrapper - - _(array).map({}); // $ExpectType LoDashImplicitWrapper - _(list).map({}); // $ExpectType LoDashImplicitWrapper - _(dictionary).map({}); // $ExpectType LoDashImplicitWrapper - _(numericDictionary).map({}); // $ExpectType LoDashImplicitWrapper - } - - { - _(array).chain().map(); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashExplicitWrapper - _(array).chain().map((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType AbcObject[] - return 0; - }); - - _(list).chain().map(); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashExplicitWrapper - _(list).chain().map((value, index, collection) => { - value; // $ExpectType AbcObject - index; // $ExpectType number - collection; // $ExpectType ArrayLike - return 0; - }); - - _(dictionary).chain().map(); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashExplicitWrapper - _(dictionary).chain().map((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return 0; - }); - - _(numericDictionary).chain().map(); // $ExpectType LoDashExplicitWrapper - // $ExpectType LoDashExplicitWrapper - _(numericDictionary).chain().map((value, key, collection) => { - /* Broken in TS 2.4: value; // AbcObject */ - key; // $ExpectType string - collection; // $ExpectType NumericDictionary - return 0; - }); - - _(array).chain().map('a'); // $ExpectType LoDashExplicitWrapper - _(list).chain().map('a'); // $ExpectType LoDashExplicitWrapper - _(dictionary).chain().map('a'); // $ExpectType LoDashExplicitWrapper - _(numericDictionary).chain().map('a'); // $ExpectType LoDashExplicitWrapper - - _(array).chain().map('d.0.b'); // $ExpectType LoDashExplicitWrapper - _(list).chain().map('d.0.b'); // $ExpectType LoDashExplicitWrapper - _(dictionary).chain().map('d.0.b'); // $ExpectType LoDashExplicitWrapper - _(numericDictionary).chain().map('d.0.b'); // $ExpectType LoDashExplicitWrapper - - _(array).chain().map({}); // $ExpectType LoDashExplicitWrapper - _(list).chain().map({}); // $ExpectType LoDashExplicitWrapper - _(dictionary).chain().map({}); // $ExpectType LoDashExplicitWrapper - _(numericDictionary).chain().map({}); // $ExpectType LoDashExplicitWrapper - } - - { - // "pluck"-style map. - _.map([{a: 1}, {a: 2}], 'a'); // $ExpectType number[] - _.map({a: {b: 'str'}, c: {b: 1}}, 'b'); // ExpectType (string | number)[] - - _([{a: 1}, {a: 2}]).map('a').value(); // $ExpectType number[] - _.chain([{a: 1}, {a: 2}]).map('a').value(); // $ExpectType number[] - _([{a: 1}, {a: 2}]).chain().map('a').value(); // $ExpectType number[] - } - - { - // $ExpectType number[] - _.map(['a', 'b', 'c'], ( - v, // $ExpectType string - k // $ExpectType number - ) => k); - } + const valueIterator = (value: AbcObject): number => value.a; + fp.map(valueIterator)(list); // $ExpectType number[] + fp.map(valueIterator, dictionary); // $ExpectType number[] + fp.map("a", list); // $ExpectType number[] + fp.map({ a: 42 }, list); // $ExpectType boolean[] + fp.map(["a", 42], dictionary); // $ExpectType boolean[] } // _.partition -namespace TestPartition { - { - let result: any[][]; +{ + const list: ArrayLike | null | undefined = anything; - result = _.partition(anything, (n) => { - n; // $ExpectType any - return n < 'c'; - }); - } + // $ExpectType [any[], any[]] + _.partition(anything, (value) => { + value; // $ExpectType any + return value < "c"; + }); + // $ExpectType [string[], string[]] + _.partition("abcd", (value) => { + value; // $ExpectType string + return value < "c"; + }); + // $ExpectType [AbcObject[], AbcObject[]] + _.partition(list, (value) => { + value; // $ExpectType AbcObject + return true; + }); - { - let result: string[][]; + // $ExpectType LoDashImplicitWrapper<[any[], any[]]> + _(anything).partition((value) => { + value; // $ExpectType any + return value < "c"; + }); + // $ExpectType LoDashImplicitWrapper<[string[], string[]]> + _("abcd").partition((value) => { + value; // $ExpectType string + return value < "c"; + }); + // $ExpectType LoDashImplicitWrapper<[AbcObject[], AbcObject[]]> + _(list).partition((value) => { + value; // $ExpectType AbcObject + return true; + }); - result = _.partition('abcd', (n) => { - n; // $ExpectType string - return n < 'c'; - }); - result = _.partition(['a', 'b', 'c', 'd'], (n) => { - n; // $ExpectType string - return n < 'c'; - }); - } + // $ExpectType LoDashExplicitWrapper<[any[], any[]]> + _.chain(anything).partition((value) => { + value; // $ExpectType any + return value < "c"; + }); + // $ExpectType LoDashExplicitWrapper<[string[], string[]]> + _.chain("abcd").partition((value) => { + value; // $ExpectType string + return value < "c"; + }); + // $ExpectType LoDashExplicitWrapper<[AbcObject[], AbcObject[]]> + _.chain(list).partition((value) => { + value; // $ExpectType AbcObject + return true; + }); - { - let result: number[][]; - - result = _.partition([1, 2, 3, 4], (n) => n < 3); - result = _.partition({0: 1, 1: 2, 2: 3, 3: 4, length: 4}, (n) => n < 3); - result = _.partition({a: 1, b: 2, c: 3, d: 4}, (n) => { - n; // $ExpectType number - return n < 3; - }); - } - - { - let result: Array>; - - result = _.partition([{a: 1}, {a: 2}], {a: 2}); - result = _.partition({0: {a: 1}, 1: {a: 2}, length: 2}, {a: 2}); - result = _.partition({0: {a: 1}, 1: {a: 2}}, {a: 2}); - result = _.partition([{a: 1}, {a: 2}], 'a'); - result = _.partition([{a: 1}, {a: 2}], ['a', 2]); - result = _.partition({0: {a: 1}, 1: {a: 2}, length: 2}, 'a'); - result = _.partition({0: {a: 1}, 1: {a: 2}, length: 2}, ['a', 2]); - result = _.partition({0: {a: 1}, 1: {a: 2}}, 'a'); - result = _.partition({0: {a: 1}, 1: {a: 2}}, ['a', 2]); - } - - { - _.partition(null, 'a'); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(anything).partition((n) => { - n; // $ExpectType any - return n < 'c'; - }); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _('abcd').partition((n) => { - n; // $ExpectType string - return n < 'c'; - }); - result = _(['a', 'b', 'c', 'd']).partition((n) => { - n; // $ExpectType string - return n < 'c'; - }); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _([1, 2, 3, 4]).partition((n) => n < 3); - result = _({0: 1, 1: 2, 2: 3, 3: 4, length: 4}).partition((n) => n < 3); - result = _({a: 1, b: 2, c: 3, d: 4}).partition((n) => { - n; // $ExpectType number - return n < 3; - }); - } - - { - let result: _.LoDashImplicitWrapper>>; - - result = _([{a: 1}, {a: 2}]).partition({a: 2}); - result = _({0: {a: 1}, 1: {a: 2}, length: 2}).partition({a: 2}); - result = _({0: {a: 1}, 1: {a: 2}}).partition({a: 2}); - result = _([{a: 1}, {a: 2}]).partition('a'); - result = _([{a: 1}, {a: 2}]).partition(['a', 2]); - result = _({0: {a: 1}, 1: {a: 2}}).partition('a'); - result = _({0: {a: 1}, 1: {a: 2}}).partition(['a', 2]); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _.chain(anything).partition((n) => { - n; // $ExpectType any - return n < 'c'; - }); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _.chain('abcd').partition((n) => { - n; // $ExpectType string - return n < 'c'; - }); - result = _.chain(['a', 'b', 'c', 'd']).partition((n) => { - n; // $ExpectType string - return n < 'c'; - }); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _.chain([1, 2, 3, 4]).partition((n) => n < 3); - result = _.chain({0: 1, 1: 2, 2: 3, 3: 4, length: 4}).partition((n) => n < 3); - result = _.chain({a: 1, b: 2, c: 3, d: 4}).partition((n) => { - n; // $ExpectType number - return n < 3; - }); - } - - { - let result: _.LoDashExplicitWrapper>>; - - result = _.chain([{a: 1}, {a: 2}]).partition({a: 2}); - result = _.chain({0: {a: 1}, 1: {a: 2}, length: 2}).partition({a: 2}); - result = _.chain({0: {a: 1}, 1: {a: 2}}).partition({a: 2}); - result = _.chain([{a: 1}, {a: 2}]).partition('a'); - result = _.chain([{a: 1}, {a: 2}]).partition(['a', 2]); - result = _.chain({0: {a: 1}, 1: {a: 2}}).partition('a'); - result = _.chain({0: {a: 1}, 1: {a: 2}}).partition(['a', 2]); - } + // $ExpectType [any[], any[]] + fp.partition((value) => { + value; // $ExpectType any + return value < "c"; + }, anything); + // $ExpectType [any[], any[]] + fp.partition((value: any) => value < "c")(anything); + // $ExpectType [string[], string[]] + fp.partition((value) => { + value; // $ExpectType string + return value < "c"; + }, "abcd"); + // $ExpectType [AbcObject[], AbcObject[]] + fp.partition((value) => { + value; // $ExpectType AbcObject + return true; + }, list); } -namespace TestReduce { +// _.reduce +{ interface ABC { [key: string]: number; a: number; b: number; c: number; } - - // $ExpectType number | undefined - _.reduce([1, 2, 3], (sum: number, num: number) => sum + num); - // $ExpectType number | undefined - _.reduce(null, (sum: number, num: number) => sum + num); - - // chained - _([1, 2 ,3]).reduce((sum: number, num: number) => sum + num); - _.chain([1, 2 ,3]).reduce((sum: number, num: number) => sum + num).value(); - - // $ExpectType ABC - _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, (r: ABC, num: number, key: string) => { - r[key] = num * 3; - return r; - // tslint:disable-next-line:no-object-literal-type-assertion - }, {} as ABC); - - // $ExpectType number | undefined - _([1, 2, 3]).reduce((sum: number, num: number) => sum + num); - const initial: ABC = { a: 1, b: 2, c: 3 }; - // $ExpectType ABC - _({ 'a': 1, 'b': 2, 'c': 3 }).reduce((r: ABC, num: number, key: string) => { - r[key] = num * 3; - return r; - // tslint:disable-next-line:no-object-literal-type-assertion - }, initial); - // $ExpectType number[] - _.reduceRight([[0, 1], [2, 3], [4, 5]], (a: number[], b: number[]) => a.concat(b), []); + _.reduce([1, 2, 3], (sum: number, num: number) => sum + num); // $ExpectType number | undefined + _.reduce(null, (sum: number, num: number) => sum + num); // $ExpectType number | undefined + _.reduce({ a: 1, b: 2, c: 3 }, (r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC + + _([1, 2, 3]).reduce((sum: number, num: number) => sum + num); // $ExpectType number | undefined + _({ a: 1, b: 2, c: 3 }).reduce((r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC + + _.chain([1, 2, 3]).reduce((sum: number, num: number) => sum + num); // $ExpectType LoDashExplicitWrapper + _.chain({ a: 1, b: 2, c: 3 }).reduce((r: ABC, num: number, key: string) => r, initial); // $ExpectType LoDashExplicitWrapper + + fp.reduce((s: string, num: number) => s + num, "", [1, 2, 3]); // $ExpectType string + fp.reduce((s: string, num: number) => s + num)("")([1, 2, 3]); // $ExpectType string + + _.reduceRight([1, 2, 3], (sum: number, num: number) => sum + num); // $ExpectType number | undefined + _.reduceRight(null, (sum: number, num: number) => sum + num); // $ExpectType number | undefined + _.reduceRight({ a: 1, b: 2, c: 3 }, (r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC + + _([1, 2, 3]).reduceRight((sum: number, num: number) => sum + num); // $ExpectType number | undefined + _({ a: 1, b: 2, c: 3 }).reduceRight((r: ABC, num: number, key: string) => r, initial); // $ExpectType ABC + + _.chain([1, 2, 3]).reduceRight((sum: number, num: number) => sum + num); // $ExpectType LoDashExplicitWrapper + _.chain({ a: 1, b: 2, c: 3 }).reduceRight((r: ABC, num: number, key: string) => r, initial); // $ExpectType LoDashExplicitWrapper + + fp.reduceRight((num: number, s: string) => s + num, "", [1, 2, 3]); // $ExpectType string + fp.reduceRight((num: number, s: string) => s + num)("")([1, 2, 3]); // $ExpectType string } // _.reject -namespace TestReject { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let stringIterator = (char: string, index: number, string: string) => true; - let listIterator = (value: AbcObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const stringIterator = (char: string, index: number, string: string) => true; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const valueIterator = (value: AbcObject) => true; - { - let result: string[]; + _.reject("", stringIterator); // $ExpectType string[] + _.reject(list, listIterator); // $ExpectType AbcObject[] + _.reject(list, ""); // $ExpectType AbcObject[] + _.reject(list, { a: 42 }); // $ExpectType AbcObject[] + _.reject(dictionary, dictionaryIterator); // $ExpectType AbcObject[] + _.reject(dictionary, ""); // $ExpectType AbcObject[] + _.reject(dictionary, { a: 42 }); // $ExpectType AbcObject[] - result = _.reject('', stringIterator); - } + _("").reject(stringIterator); // $ExpectType LoDashImplicitWrapper + _(list).reject(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).reject(""); // $ExpectType LoDashImplicitWrapper + _(list).reject({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(dictionary).reject(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(dictionary).reject(""); // $ExpectType LoDashImplicitWrapper + _(dictionary).reject({ a: 42 }); // $ExpectType LoDashImplicitWrapper - { - let result: AbcObject[]; + _.chain("").reject(stringIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).reject(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).reject(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).reject({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).reject(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).reject(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).reject({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _.reject(array, listIterator); - result = _.reject(array, ''); - result = _.reject(array, {a: 42}); - - result = _.reject(list, listIterator); - result = _.reject(list, ''); - result = _.reject(list, {a: 42}); - - result = _.reject(dictionary, dictionaryIterator); - result = _.reject(dictionary, ''); - result = _.reject(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('').reject(stringIterator); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).reject(listIterator); - result = _(array).reject(''); - result = _(array).reject({a: 42}); - - result = _(list).reject(listIterator); - result = _(list).reject(''); - result = _(list).reject({a: 42}); - - result = _(dictionary).reject(dictionaryIterator); - result = _(dictionary).reject(''); - result = _(dictionary).reject({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('').chain().reject(stringIterator); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().reject(listIterator); - result = _(array).chain().reject(''); - result = _(array).chain().reject({a: 42}); - - result = _(list).chain().reject(listIterator); - result = _(list).chain().reject(''); - result = _(list).chain().reject({a: 42}); - - result = _(dictionary).chain().reject(dictionaryIterator); - result = _(dictionary).chain().reject(''); - result = _(dictionary).chain().reject({a: 42}); - } + fp.reject(valueIterator, list); // $ExpectType AbcObject[] + fp.reject(valueIterator)(list); // $ExpectType AbcObject[] + fp.reject(valueIterator, dictionary); // $ExpectType AbcObject[] + fp.reject("a", list); // $ExpectType AbcObject[] + fp.reject({ a: 42 }, list); // $ExpectType AbcObject[] + fp.reject(["a", 42], list); // $ExpectType AbcObject[] } // _.sample -namespace TestSample { - let array: string[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined= obj; - - { - let result: string | undefined; - - result = _.sample('abc'); - result = _.sample(array); - result = _.sample(list); - result = _.sample(dictionary); - result = _.sample(numericDictionary); - result = _.sample({a: 'foo'}); - result = _.sample({a: 'foo'}); - - result = _('abc').sample(); - result = _(array).sample(); - result = _(list).sample(); - result = _(dictionary).sample(); - result = _(numericDictionary).sample(); - result = _({a: 'foo'}).sample(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().sample(); - result = _(array).chain().sample(); - result = _(list).chain().sample(); - result = _(dictionary).chain().sample(); - result = _(numericDictionary).chain().sample(); - result = _({a: 'foo'}).chain().sample(); - } -} - // _.sampleSize -namespace TestSampleSize { - let array: string[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; - { - let result: string[]; + _.sample("abc"); // $ExpectType string | undefined + _.sample(list); // $ExpectType string | undefined + _.sample(dictionary); // $ExpectType string | undefined + _.sample(numericDictionary); // $ExpectType string | undefined + _.sample({ a: "foo" }); // $ExpectType string | undefined - result = _.sampleSize('abc'); - result = _.sampleSize('abc', 42); - result = _.sampleSize(array); - result = _.sampleSize(array, 42); - result = _.sampleSize(list); - result = _.sampleSize(list, 42); - result = _.sampleSize(dictionary); - result = _.sampleSize(dictionary, 42); - result = _.sampleSize(numericDictionary); - result = _.sampleSize(numericDictionary, 42); - result = _.sampleSize({a: 'foo'}); - result = _.sampleSize({a: 'foo'}, 42); - result = _.sampleSize({a: 'foo'}); - result = _.sampleSize({a: 'foo'}, 42); - } + _("abc").sample(); // $ExpectType string | undefined + _(list).sample(); // $ExpectType string | undefined + _(dictionary).sample(); // $ExpectType string | undefined + _(numericDictionary).sample(); // $ExpectType string | undefined + _({ a: "foo" }).sample(); // $ExpectType string | undefined - { - let result: _.LoDashImplicitArrayWrapper; + _.chain("abc").sample(); // $ExpectType LoDashExplicitWrapper + _.chain(list).sample(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sample(); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).sample(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "foo" }).sample(); // $ExpectType LoDashExplicitWrapper - result = _('abc').sampleSize(); - result = _('abc').sampleSize(42); - result = _(array).sampleSize(); - result = _(array).sampleSize(42); - result = _(list).sampleSize(); - result = _(list).sampleSize(42); - result = _(dictionary).sampleSize(); - result = _(dictionary).sampleSize(42); - result = _(numericDictionary).sampleSize(); - result = _(numericDictionary).sampleSize(42); - result = _({a: 'foo'}).sampleSize(); - result = _({a: 'foo'}).sampleSize(42); - } + fp.sample("abc"); // $ExpectType string | undefined + fp.sample(list); // $ExpectType string | undefined + fp.sample({ a: "foo" }); // $ExpectType string | undefined - { - let result: _.LoDashExplicitArrayWrapper; + _.sampleSize("abc"); // $ExpectType string[] + _.sampleSize("abc", 3); // $ExpectType string[] + _.sampleSize(list, 3); // $ExpectType string[] + _.sampleSize(dictionary, 3); // $ExpectType string[] + _.sampleSize(numericDictionary, 3); // $ExpectType string[] + _.sampleSize({ a: "foo" }, 3); // $ExpectType string[] - result = _('abc').chain().sampleSize(); - result = _('abc').chain().sampleSize(42); - result = _(array).chain().sampleSize(); - result = _(array).chain().sampleSize(42); - result = _(list).chain().sampleSize(); - result = _(list).chain().sampleSize(42); - result = _(dictionary).chain().sampleSize(); - result = _(dictionary).chain().sampleSize(42); - result = _(numericDictionary).chain().sampleSize(); - result = _(numericDictionary).chain().sampleSize(42); - result = _({a: 'foo'}).chain().sampleSize(); - result = _({a: 'foo'}).chain().sampleSize(42); - } + _("abc").sampleSize(); // $ExpectType LoDashImplicitWrapper + _("abc").sampleSize(3); // $ExpectType LoDashImplicitWrapper + _(list).sampleSize(3); // $ExpectType LoDashImplicitWrapper + _(dictionary).sampleSize(3); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).sampleSize(3); // $ExpectType LoDashImplicitWrapper + _({ a: "foo" }).sampleSize(3); // $ExpectType LoDashImplicitWrapper + + _.chain("abc").sampleSize(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").sampleSize(3); // $ExpectType LoDashExplicitWrapper + _.chain(list).sampleSize(3); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sampleSize(3); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).sampleSize(3); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "foo" }).sampleSize(3); // $ExpectType LoDashExplicitWrapper + + fp.sampleSize(3, "abc"); // $ExpectType string[] + fp.sampleSize(3)(list); // $ExpectType string[] + fp.sampleSize(3)({ a: "foo" }); // $ExpectType string[] } // _.shuffle -namespace TestShuffle { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - { - let result: string[]; - - result = _.shuffle('abc'); - } - - { - let result: AbcObject[]; - - result = _.shuffle(array); - result = _.shuffle(list); - result = _.shuffle(dictionary); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('abc').shuffle(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).shuffle(); - result = _(list).shuffle(); - result = _(dictionary).shuffle(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('abc').chain().shuffle(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().shuffle(); - result = _(list).chain().shuffle(); - result = _(dictionary).chain().shuffle(); - } + _.shuffle("abc"); // $ExpectType string[] + _.shuffle(list); // $ExpectType AbcObject[] + _.shuffle(dictionary); // $ExpectType AbcObject[] + _("abc").shuffle(); // $ExpectType LoDashImplicitWrapper + _(list).shuffle(); // $ExpectType LoDashImplicitWrapper + _(dictionary).shuffle(); // $ExpectType LoDashImplicitWrapper + _.chain("abc").shuffle(); // $ExpectType LoDashExplicitWrapper + _.chain(list).shuffle(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).shuffle(); // $ExpectType LoDashExplicitWrapper + fp.shuffle("abc"); // $ExpectType string[] + fp.shuffle(list); // $ExpectType AbcObject[] + fp.shuffle(dictionary); // $ExpectType AbcObject[] } // _.size -namespace TestSize { - type SampleType = {a: string; b: number; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let array: SampleType[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - - { - let result: number; - - result = _.size(array); - result = _.size(list); - result = _.size(dictionary); - result = _.size(''); - - result = _(array).size(); - result = _(list).size(); - result = _(dictionary).size(); - result = _('').size(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().size(); - result = _(list).chain().size(); - result = _(dictionary).chain().size(); - result = _('').chain().size(); - } + _.size(list); // $ExpectType number + _.size(dictionary); // $ExpectType number + _.size(""); // $ExpectType number + _(list).size(); // $ExpectType number + _(dictionary).size(); // $ExpectType number + _("").size(); // $ExpectType number + _.chain(list).size(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).size(); // $ExpectType LoDashExplicitWrapper + _.chain("").size(); // $ExpectType LoDashExplicitWrapper + fp.size(list); // $ExpectType number + fp.size(dictionary); // $ExpectType number + fp.size(""); // $ExpectType number } // _.some -namespace TestSome { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; - let array: SampleObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; - let numericDictionary: _.NumericDictionary | null | undefined = obj; - let sampleObject: SampleObject | null | undefined = obj; + const listIterator = (value: AbcObject, index: number, collection: _.List) => true; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; + const valueIterator = (value: AbcObject) => true; - let listIterator = (value: SampleObject, index: number, collection: _.List) => true; - let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => true; - let numericDictionaryIterator = (value: SampleObject, key: string, collection: _.NumericDictionary) => true; - let objectIterator = (value: any, key: string, collection: any) => true; + _.some(list); // $ExpectType boolean + _.some(list, listIterator); // $ExpectType boolean + _.some(list, "a"); // $ExpectType boolean + _.some(list, ["a", 42]); // $ExpectType boolean + _.some(list, { a: 42 }); // $ExpectType boolean - { - let result: boolean; + _.some(dictionary); // $ExpectType boolean + _.some(dictionary, dictionaryIterator); // $ExpectType boolean + _.some(dictionary, "a"); // $ExpectType boolean + _.some(dictionary, ["a", 42]); // $ExpectType boolean + _.some(dictionary, { a: 42 }); // $ExpectType boolean - result = _.some(array); - result = _.some(array, listIterator); - result = _.some(array, 'a'); - result = _.some(array, ['a', 42]); - result = _.some(array, {a: 42}); + _.some(numericDictionary); // $ExpectType boolean + _.some(numericDictionary, numericDictionaryIterator); // $ExpectType boolean + _.some(numericDictionary, "a"); // $ExpectType boolean + _.some(numericDictionary, ["a", 42]); // $ExpectType boolean + _.some(numericDictionary, { a: 42 }); // $ExpectType boolean - result = _.some(list); - result = _.some(list, listIterator); - result = _.some(list, 'a'); - result = _.some(list, ['a', 42]); - result = _.some(list, {a: 42}); + _(list).some(); // $ExpectType boolean + _(list).some(listIterator); // $ExpectType boolean + _(list).some("a"); // $ExpectType boolean + _(list).some(["a", 42]); // $ExpectType boolean + _(list).some({ a: 42 }); // $ExpectType boolean - result = _.some(dictionary); - result = _.some(numericDictionary, numericDictionaryIterator); - result = _.some(dictionary, (value, key, collection) => { - value; // $ExpectType SampleObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return true; - }); - result = _.some(dictionary, 'a'); - result = _.some(dictionary, ['a', 42]); - result = _.some(dictionary, {a: 42}); + _(dictionary).some(); // $ExpectType boolean + _(dictionary).some(dictionaryIterator); // $ExpectType boolean + _(dictionary).some("a"); // $ExpectType boolean + _(dictionary).some(["a", 42]); // $ExpectType boolean + _(dictionary).some({ a: 42 }); // $ExpectType boolean - result = _.some(numericDictionary); - result = _.some(numericDictionary, numericDictionaryIterator); - result = _.some(numericDictionary, 'a'); - result = _.some(numericDictionary, ['a', 42]); - result = _.some(numericDictionary, {a: 42}); + _(numericDictionary).some(); // $ExpectType boolean + _(numericDictionary).some(numericDictionaryIterator); // $ExpectType boolean + _(numericDictionary).some("a"); // $ExpectType boolean + _(numericDictionary).some(["a", 42]); // $ExpectType boolean + _(numericDictionary).some({ a: 42 }); // $ExpectType boolean - result = _.some(sampleObject); - result = _.some(sampleObject, objectIterator); - result = _.some(sampleObject, 'a'); - result = _.some(sampleObject, ['a', 42]); + _.chain(list).some(); // $ExpectType LoDashExplicitWrapper + _.chain(list).some(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).some("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).some(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(list).some({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(array).some(); - result = _(array).some(listIterator); - result = _(array).some('a'); - result = _(array).some(['a', 42]); - result = _(array).some({a: 42}); + _.chain(dictionary).some(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).some(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).some("a"); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).some(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).some({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(list).some(); - result = _(list).some(listIterator); - result = _(list).some('a'); - result = _(list).some(['a', 42]); - result = _(list).some({a: 42}); + _.chain(numericDictionary).some(); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).some(numericDictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).some("a"); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).some(["a", 42]); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).some({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _(dictionary).some(); - result = _(dictionary).some(dictionaryIterator); - result = _(dictionary).some('a'); - result = _(dictionary).some(['a', 42]); - result = _(dictionary).some({a: 42}); + fp.some(valueIterator, list); // $ExpectType boolean + fp.some("a")(list); // $ExpectType boolean + fp.some({ a: 42 }, list); // $ExpectType boolean + fp.some(["a", 42], list); // $ExpectType boolean - result = _(numericDictionary).some(); - result = _(numericDictionary).some(numericDictionaryIterator); - result = _(numericDictionary).some('a'); - result = _(numericDictionary).some(['a', 42]); - result = _(numericDictionary).some({a: 42}); + fp.some(valueIterator, dictionary); // $ExpectType boolean + fp.some("a")(dictionary); // $ExpectType boolean + fp.some({ a: 42 })(dictionary); // $ExpectType boolean + fp.some(["a", 42])(dictionary); // $ExpectType boolean - result = _(sampleObject).some(); - result = _(sampleObject).some(objectIterator); - result = _(sampleObject).some('a'); - result = _(sampleObject).some(['a', 42]); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().some(); - result = _(array).chain().some(listIterator); - result = _(array).chain().some('a'); - result = _(array).chain().some(['a', 42]); - result = _(array).chain().some({a: 42}); - - result = _(list).chain().some(); - result = _(list).chain().some(listIterator); - result = _(list).chain().some('a'); - result = _(list).chain().some(['a', 42]); - result = _(list).chain().some({a: 42}); - - result = _(dictionary).chain().some(); - result = _(dictionary).chain().some(dictionaryIterator); - result = _(dictionary).chain().some('a'); - result = _(dictionary).chain().some(['a', 42]); - result = _(dictionary).chain().some({a: 42}); - - result = _(numericDictionary).chain().some(); - result = _(numericDictionary).chain().some(numericDictionaryIterator); - result = _(numericDictionary).chain().some('a'); - result = _(numericDictionary).chain().some(['a', 42]); - result = _(numericDictionary).chain().some({a: 42}); - - result = _(sampleObject).chain().some(); - result = _(sampleObject).chain().some(objectIterator); - result = _(sampleObject).chain().some('a'); - result = _(sampleObject).chain().some(['a', 42]); - } + fp.some(valueIterator, numericDictionary); // $ExpectType boolean + fp.some("a")(numericDictionary); // $ExpectType boolean + fp.some({ a: 42 })(numericDictionary); // $ExpectType boolean + fp.some(["a", 42])(numericDictionary); // $ExpectType boolean } // _.sortBy -namespace TestSortBy { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: _.List | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - let listIterator = (value: AbcObject, index: number, collection: _.List) => 0; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 0; + const listIterator = (value: AbcObject, index: number, collection: _.List) => 0; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 0; + const valueIterator = (value: AbcObject) => 0; - { - let result: AbcObject[]; + _.sortBy(list); // $ExpectType AbcObject[] + _.sortBy(list, listIterator); // $ExpectType AbcObject[] + _.sortBy(list, listIterator, listIterator); // $ExpectType AbcObject[] + _.sortBy(list, [listIterator, listIterator]); // $ExpectType AbcObject[] + _.sortBy(list, ""); // $ExpectType AbcObject[] + _.sortBy(list, { a: 42 }); // $ExpectType AbcObject[] + _.sortBy(dictionary); // $ExpectType AbcObject[] + _.sortBy(dictionary, dictionaryIterator); // $ExpectType AbcObject[] + _.sortBy(dictionary, ""); // $ExpectType AbcObject[] + _.sortBy(dictionary, { a: 42 }); // $ExpectType AbcObject[] - result = _.sortBy(array); - result = _.sortBy(array, listIterator); - result = _.sortBy(array, ''); - result = _.sortBy(array, {a: 42}); + _(list).sortBy(); // $ExpectType LoDashImplicitWrapper + _(list).sortBy(listIterator); // $ExpectType LoDashImplicitWrapper + _(list).sortBy(listIterator, listIterator); // $ExpectType LoDashImplicitWrapper + _(list).sortBy([listIterator, listIterator]); // $ExpectType LoDashImplicitWrapper + _(list).sortBy(""); // $ExpectType LoDashImplicitWrapper + _(list).sortBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper + _(dictionary).sortBy(); // $ExpectType LoDashImplicitWrapper + _(dictionary).sortBy(dictionaryIterator); // $ExpectType LoDashImplicitWrapper + _(dictionary).sortBy(""); // $ExpectType LoDashImplicitWrapper + _(dictionary).sortBy({ a: 42 }); // $ExpectType LoDashImplicitWrapper - result = _.sortBy(list); - result = _.sortBy(list, listIterator); - result = _.sortBy(list, ''); - result = _.sortBy(list, {a: 42}); + _.chain(list).sortBy(); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy(listIterator, listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy([listIterator, listIterator]); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy(""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sortBy(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sortBy(dictionaryIterator); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sortBy(""); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).sortBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper - result = _.sortBy(dictionary); - result = _.sortBy(dictionary, dictionaryIterator); - result = _.sortBy(dictionary, ''); - result = _.sortBy(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).sortBy(); - result = _(array).sortBy(listIterator); - result = _(array).sortBy(''); - result = _(array).sortBy({a: 42}); - - result = _(list).sortBy(); - result = _(list).sortBy(listIterator); - result = _(list).sortBy(''); - result = _(list).sortBy({a: 42}); - - result = _(dictionary).sortBy(); - result = _(dictionary).sortBy(dictionaryIterator); - result = _(dictionary).sortBy(''); - result = _(dictionary).sortBy({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().sortBy(); - result = _(array).chain().sortBy(listIterator); - result = _(array).chain().sortBy(''); - result = _(array).chain().sortBy({a: 42}); - - result = _(list).chain().sortBy(); - result = _(list).chain().sortBy(listIterator); - result = _(list).chain().sortBy(''); - result = _(list).chain().sortBy({a: 42}); - - result = _(dictionary).chain().sortBy(); - result = _(dictionary).chain().sortBy(dictionaryIterator); - result = _(dictionary).chain().sortBy(''); - result = _(dictionary).chain().sortBy({a: 42}); - } + fp.sortBy(fp.identity, "bca"); // $ExpectType string[] + fp.sortBy(valueIterator, list); // $ExpectType AbcObject[] + fp.sortBy(valueIterator)(list); // $ExpectType AbcObject[] + fp.sortBy([valueIterator, valueIterator])(list); // $ExpectType AbcObject[] + fp.sortBy("a", list); // $ExpectType AbcObject[] + fp.sortBy({ a: 42 }, list); // $ExpectType AbcObject[] + fp.sortBy(fp.identity, dictionary); // $ExpectType AbcObject[] + fp.sortBy(valueIterator, dictionary); // $ExpectType AbcObject[] + fp.sortBy("a", dictionary); // $ExpectType AbcObject[] + fp.sortBy({ a: 42 }, dictionary); // $ExpectType AbcObject[] } -_.sortBy(stoogesAges, stooge => Math.sin(stooge.age), stooge => stooge.name.slice(1)); // $ExpectType StoogesAge[] -_.sortBy(stoogesAges, ['name', 'age']); // $ExpectType StoogesAge[] -_.sortBy(stoogesAges, 'name', stooge => Math.sin(stooge.age)); // $ExpectType StoogesAge[] - -_(foodsOrganic).sortBy('organic', (food) => food.name, { organic: true }).value(); // $ExpectType FoodOrganic[] - // _.orderBy -namespace TestorderBy { - type SampleObject = {a: number; b: string; c: boolean}; +{ + const list: _.List | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; - const array: SampleObject[] | null | undefined = anything; - const list: _.List | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const orders: boolean|string|Array = anything; + _.orderBy("acbd", (value) => 1); // $ExpectType string[] + _.orderBy("acbd", (value) => 1, true); // $ExpectType string[] + _.orderBy("acbd", [(value) => 1, (value) => 2], [true, false]); // $ExpectType string[] + _.orderBy(list, (value) => 1); // $ExpectType AbcObject[] + _.orderBy(list, (value) => 1, true); // $ExpectType AbcObject[] + _.orderBy(list, [(value) => 1, (value) => 2], [true, false]); // $ExpectType AbcObject[] + _.orderBy(dictionary, (value) => 1); // $ExpectType AbcObject[] + _.orderBy(dictionary, (value) => 1, true); // $ExpectType AbcObject[] + // These fail in TS 2.4 + // _.orderBy(numericDictionary, (value) => 1); // AbcObject[] + // _.orderBy(numericDictionary, (value) => 1, true); // AbcObject[] - { - let iteratees: ((value: string) => any)|Array<(value: string) => any> = anything; - let result: string[]; + _(list).orderBy((value) => 1); // $ExpectType LoDashImplicitWrapper + _(list).orderBy((value) => 1, true); // $ExpectType LoDashImplicitWrapper + _(list).orderBy([(value) => 1, (value) => 2], true); // $ExpectType LoDashImplicitWrapper + _(dictionary).orderBy((value) => 1); // $ExpectType LoDashImplicitWrapper + _(dictionary).orderBy((value) => 1, true); // $ExpectType LoDashImplicitWrapper + // These fail in TS 2.4 + // _(numericDictionary).orderBy((value) => 1); // LoDashImplicitWrapper + // _(numericDictionary).orderBy((value) => 1, true); // LoDashImplicitWrapper - result = _.orderBy('acbd', iteratees); - result = _.orderBy('acbd', iteratees, orders); - } + _.chain(list).orderBy((value) => 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).orderBy((value) => 1, true); // $ExpectType LoDashExplicitWrapper + _.chain(list).orderBy([(value) => 1, (value) => 2], true); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).orderBy((value) => 1); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).orderBy((value) => 1, true); // $ExpectType LoDashExplicitWrapper + // These fail in TS 2.4 + // _.chain(numericDictionary).orderBy((value) => 1); // LoDashExplicitWrapper + // _.chain(numericDictionary).orderBy((value) => 1, true); // LoDashExplicitWrapper - { - const iteratees: ((value: SampleObject) => _.NotVoid)|string|_.PartialDeep|Array<((value: SampleObject) => _.NotVoid)|string|_.PartialDeep> = anything; - let result: SampleObject[]; - - result = _.orderBy(array, iteratees); - result = _.orderBy(array, iteratees, orders); - - result = _.orderBy(list, iteratees); - result = _.orderBy(list, iteratees, orders); - - result = _.orderBy(numericDictionary, iteratees); - result = _.orderBy(numericDictionary, iteratees, orders); - - result = _.orderBy(dictionary, iteratees); - result = _.orderBy(dictionary, iteratees, orders); - } - - { - const iteratees: ((value: SampleObject) => _.NotVoid)|string|_.PartialDeep|Array<((value: SampleObject) => _.NotVoid)|string|_.PartialDeep> = anything; - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).orderBy(iteratees); - result = _(array).orderBy(iteratees, orders); - - result = _(list).orderBy(iteratees); - result = _(list).orderBy(iteratees, orders); - - result = _(numericDictionary).orderBy(iteratees); - result = _(numericDictionary).orderBy(iteratees, orders); - - result = _(dictionary).orderBy(iteratees); - result = _(dictionary).orderBy(iteratees, orders); - } - - { - const iteratees: ((value: SampleObject) => _.NotVoid)|string|_.PartialDeep|Array<((value: SampleObject) => _.NotVoid)|string|_.PartialDeep> = anything; - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().orderBy(iteratees); - result = _(array).chain().orderBy(iteratees, orders); - - result = _(list).chain().orderBy(iteratees); - result = _(list).chain().orderBy(iteratees, orders); - - result = _(numericDictionary).chain().orderBy(iteratees); - result = _(numericDictionary).chain().orderBy(iteratees, orders); - - result = _(dictionary).chain().orderBy(iteratees); - result = _(dictionary).chain().orderBy(iteratees, orders); - } + fp.orderBy(fp.identity, "asc", "bca"); // $ExpectType string[] + fp.orderBy(fp.identity, true, "bca"); // $ExpectType string[] + fp.orderBy((value: AbcObject) => 1, true, list); // $ExpectType AbcObject[] + fp.orderBy([(value: AbcObject) => 1, (value: AbcObject) => 1])([true, false])(list); // $ExpectType AbcObject[] + fp.orderBy("a", true, list); // $ExpectType AbcObject[] + fp.orderBy({ a: 42 }, true, list); // $ExpectType AbcObject[] + fp.orderBy((value: AbcObject) => 1, true, dictionary); // $ExpectType AbcObject[] + fp.orderBy("a", true, dictionary); // $ExpectType AbcObject[] + fp.orderBy({ a: 42 }, true, dictionary); // $ExpectType AbcObject[] } /******** * Date * ********/ -namespace TestNow { - { - let result: number; +_.now(); // $ExpectType number +_({}).now(); // $ExpectType number +_.chain({}).now(); // $ExpectType LoDashExplicitWrapper +fp.now(); // $ExpectType number - result = _.now(); - result = _(42).now(); - result = _([]).now(); - result = _({}).now(); - } +/************ + * Function * + ************/ - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().now(); - result = _([]).chain().now(); - result = _({}).chain().now(); - } -} - -/************* - * Functions * - *************/ // _.after -namespace TestAfter { - type Func = (a: string, b: number) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - _.after(42, func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - _(42).after(func); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - _(42).chain().after(func); - } +{ + _.after(42, (a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean + _(42).after((a: string, b: number): boolean => true); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> + _.chain(42).after((a: string, b: number): boolean => true); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> + fp.after((a: string, b: number): boolean => true, 42); // $ExpectType (a: string, b: number) => boolean + fp.after((a: string, b: number): boolean => true)(42); // $ExpectType (a: string, b: number) => boolean } // _.ary -namespace TestAry { - type SampleFunc = (a: number, b: string) => boolean; +{ + const func = (a: string, b: number) => true; - let func: SampleFunc = (a, b) => true; - - { - let result: SampleFunc; - - result = _.ary(func); - result = _.ary(func, 2); - result = _.ary(func); - result = _.ary(func, 2); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).ary(); - result = _(func).ary(2); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().ary(); - result = _(func).chain().ary(2); - } + _.ary(func); // $ExpectType (...args: any[]) => any + _.ary(func, 2); // $ExpectType (...args: any[]) => any + _(func).ary(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(func).ary(2); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(func).ary(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(func).ary(2); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.ary(1, func); // $ExpectType (...args: any[]) => any } // _.before -namespace TestBefore { - type Func = (a: string, b: number) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - _.before(42, func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - _(42).before(func); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - _(42).chain().before(func); - } +{ + _.before(42, (a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean + _(42).before((a: string, b: number): boolean => true); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> + _.chain(42).before((a: string, b: number): boolean => true); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> + fp.before((a: string, b: number): boolean => true, 42); // $ExpectType (a: string, b: number) => boolean + fp.before((a: string, b: number): boolean => true)(42); // $ExpectType (a: string, b: number) => boolean } // _.bind -namespace TestBind { - type SampleFunc = (a: number, b: string) => boolean; +{ + const func = (a: string, b: number) => true; - let func: SampleFunc = (a, b) => true; - - { - type SampleResult = (a: number, b: string) => boolean; - - let result: SampleResult; - - result = _.bind(func, anything); - result = _.bind(func, anything); - } - - { - type SampleResult = (b: string) => boolean; - - let result: SampleResult; - - result = _.bind(func, anything, 42); - result = _.bind(func, anything, 42); - } - - { - type SampleResult = () => boolean; - - let result: SampleResult; - - result = _.bind(func, anything, 42, ''); - result = _.bind(func, anything, 42, ''); - } - - { - type SampleResult = (a: number, b: string) => boolean; - - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).bind(anything); - } - - { - type SampleResult = (b: string) => boolean; - - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).bind(anything, 42); - } - - { - type SampleResult = () => boolean; - - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).bind(anything, 42, ''); - } - - { - type SampleResult = (a: number, b: string) => boolean; - - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().bind(anything); - } - - { - type SampleResult = (b: string) => boolean; - - let result: _.LoDashExplicitWrapper; - - result = _(func).chain().bind(anything, 42); - } - - { - type SampleResult = () => boolean; - - let result: _.LoDashExplicitWrapper; - - result = _(func).chain().bind(anything, 42, ''); - } + _.bind(func, anything); // $ExpectType (...args: any[]) => any + _.bind(func, anything, 42); // $ExpectType (...args: any[]) => any + _.bind(func, anything, 42, ""); // $ExpectType (...args: any[]) => any + _(func).bind(anything); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(func).bind(anything, 42); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(func).bind(anything, 42, ""); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(func).bind(anything); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(func).bind(anything, 42); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(func).bind(anything, 42, ""); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.bind((a: string, b: number) => true, anything); // $ExpectType (...args: any[]) => any + fp.bind((a: string, b: number) => true)(anything); // $ExpectType (...args: any[]) => any } // _.bindAll -namespace TestBindAll { - interface SampleObject { - a(): void; - b(): void; - c(): void; - } +{ + const object = { a: () => {}, b: () => {}, c: () => {} }; - let object: SampleObject = { a: () => {}, b: () => {}, c: () => {} }; - - { - let result: SampleObject; - - result = _.bindAll(object); - result = _.bindAll(object, 'c'); - result = _.bindAll(object, ['b'], 'c'); - result = _.bindAll(object, 'a', ['b'], 'c'); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).bindAll(); - result = _(object).bindAll('c'); - result = _(object).bindAll(['b'], 'c'); - result = _(object).bindAll('a', ['b'], 'c'); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().bindAll(); - result = _(object).chain().bindAll('c'); - result = _(object).chain().bindAll(['b'], 'c'); - result = _(object).chain().bindAll('a', ['b'], 'c'); - } + _.bindAll(object); // $ExpectType { a: () => void; b: () => void; c: () => void; } + _.bindAll(object, "a", ["b", "c"]); // $ExpectType { a: () => void; b: () => void; c: () => void; } + _(object).bindAll(); // $ExpectType LoDashImplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> + _(object).bindAll("a", ["b", "c"]); // $ExpectType LoDashImplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> + _.chain(object).bindAll(); // $ExpectType LoDashExplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> + _.chain(object).bindAll("a", ["b", "c"]); // $ExpectType LoDashExplicitWrapper<{ a: () => void; b: () => void; c: () => void; }> + fp.bindAll("a", object); // $ExpectType { a: () => void; b: () => void; c: () => void; } + fp.bindAll(["b", "c"])(object); // $ExpectType { a: () => void; b: () => void; c: () => void; } } // _.bindKey -namespace TestBindKey { - let object = { +{ + const object = { foo: (a: number, b: string) => true, }; - { - type SampleResult = (a: number, b: string) => boolean; - - let result: SampleResult; - - result = _.bindKey(object, 'foo'); - } - - { - type SampleResult = (b: string) => boolean; - - let result: SampleResult; - - result = _.bindKey(object, 'foo', 42); - } - - { - type SampleResult = () => boolean; - - let result: SampleResult; - - result = _.bindKey(object, 'foo', 42, ''); - } - - { - type SampleResult = (a: number, b: string) => boolean; - - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).bindKey('foo'); - } - - { - type SampleResult = (b: string) => boolean; - - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).bindKey('foo', 42); - } - - { - type SampleResult = () => boolean; - - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).bindKey('foo', 42, ''); - } - - { - type SampleResult = (a: number, b: string) => boolean; - - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().bindKey('foo'); - } - - { - type SampleResult = (b: string) => boolean; - - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().bindKey('foo', 42); - } - - { - type SampleResult = () => boolean; - - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().bindKey('foo', 42, ''); - } + _.bindKey(object, "foo"); // $ExpectType (...args: any[]) => any + _.bindKey(object, "foo", 42, ""); // $ExpectType (...args: any[]) => any + _(object).bindKey("foo"); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(object).bindKey("foo", 42, ""); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(object).bindKey("foo"); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(object).bindKey("foo", 42, ""); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.bindKey(object, "foo"); // $ExpectType (...args: any[]) => any + fp.bindKey(object)("foo"); // $ExpectType (...args: any[]) => any } // _.curry -const testCurryFn = (a: number, b: number, c: number) => [a, b, c]; -let curryResult0: number[] -let curryResult1: _.CurriedFunction1 -let curryResult2: _.CurriedFunction2 +{ + const testCurry = (a: string, b: number, c: boolean): [string, number, boolean] => [a, b, c]; + _.curry(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] + _.curry(testCurry)("1", 2)(true); // $ExpectType [string, number, boolean] + _.curry(testCurry)("1")(2, true); // $ExpectType [string, number, boolean] + _.curry(testCurry)("1")(2)(true); // $ExpectType [string, number, boolean] + _.curry(testCurry)("1", 2); // $ExpectType CurriedFunction1 + _.curry(testCurry)("1")(2); // $ExpectType CurriedFunction1 + _.curry(testCurry)("1"); // $ExpectType CurriedFunction2 + _.curry(testCurry); // $ExpectType CurriedFunction3 + _(testCurry).curry(); // $ExpectType LoDashImplicitWrapper> + _.chain(testCurry).curry(); // $ExpectType LoDashExplicitWrapper> -curryResult0 = _.curry(testCurryFn)(1, 2, 3); -curryResult1 = _.curry(testCurryFn)(1, 2); -curryResult0 = _.curry(testCurryFn)(1, 2)(3); -curryResult0 = _.curry(testCurryFn)(1)(2)(3); -curryResult2 = _.curry(testCurryFn)(1); -curryResult1 = _.curry(testCurryFn)(1)(2); -curryResult0 = _.curry(testCurryFn)(1)(2)(3); -curryResult0 = _.curry(testCurryFn)(1)(2, 3); -curryResult0 = _(testCurryFn).curry().value()(1, 2, 3); -curryResult2 = _(testCurryFn).curry().value()(1); + fp.curry(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] + fp.curry(testCurry)("1", 2)(true); // $ExpectType [string, number, boolean] + fp.curry(testCurry)("1")(2, true); // $ExpectType [string, number, boolean] + fp.curry(testCurry)("1")(2)(true); // $ExpectType [string, number, boolean] + fp.curry(testCurry)("1", 2); // $ExpectType CurriedFunction1 + fp.curry(testCurry)("1")(2); // $ExpectType CurriedFunction1 + fp.curry(testCurry)("1"); // $ExpectType CurriedFunction2 + fp.curry(testCurry); // $ExpectType CurriedFunction3 -declare function testCurry2(a: string, b: number, c: boolean): [string, number, boolean]; -let curryResult3: [string, number, boolean]; -let curryResult4: _.CurriedFunction1; -let curryResult5: _.CurriedFunction2; -let curryResult6: _.CurriedFunction3; -curryResult3 = _.curry(testCurry2)("1", 2, true); -curryResult3 = _.curry(testCurry2)("1", 2)(true); -curryResult3 = _.curry(testCurry2)("1")(2, true); -curryResult3 = _.curry(testCurry2)("1")(2)(true); -curryResult4 = _.curry(testCurry2)("1", 2); -curryResult4 = _.curry(testCurry2)("1")(2); -curryResult5 = _.curry(testCurry2)("1"); -curryResult6 = _.curry(testCurry2); + // _.curryRight + _.curryRight(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] + _.curryRight(testCurry)(2, true)("1"); // $ExpectType [string, number, boolean] + _.curryRight(testCurry)(true)("1", 2); // $ExpectType [string, number, boolean] + _.curryRight(testCurry)(true)(2)("1"); // $ExpectType [string, number, boolean] + _.curryRight(testCurry)(2, true); // $ExpectType RightCurriedFunction1 + _.curryRight(testCurry)(true)(2); // $ExpectType RightCurriedFunction1 + _.curryRight(testCurry)(true); // $ExpectType RightCurriedFunction2 + _.curryRight(testCurry); // $ExpectType RightCurriedFunction3 + _(testCurry).curryRight(); // $ExpectType LoDashImplicitWrapper> + _.chain(testCurry).curryRight(); // $ExpectType LoDashExplicitWrapper> -// _.curryRight -const testCurryRightFn = (a: number, b: number, c: number) => [a, b, c]; -curryResult0 = _.curryRight(testCurryRightFn)(1, 2, 3); -curryResult2 = _.curryRight(testCurryRightFn)(1); -curryResult0 = _(testCurryRightFn).curryRight().value()(1, 2, 3); -curryResult2 = _(testCurryRightFn).curryRight().value()(1); -let curryResult7: _.RightCurriedFunction1; -let curryResult8: _.RightCurriedFunction2; -let curryResult9: _.RightCurriedFunction3; -curryResult3 = _.curryRight(testCurry2)("1", 2, true); -curryResult3 = _.curryRight(testCurry2)( 2,true)("1"); -curryResult3 = _.curryRight(testCurry2)(true)( "1",2); -curryResult3 = _.curryRight(testCurry2)(true)(2)("1"); -curryResult7 = _.curryRight(testCurry2)(2,true); -curryResult7 = _.curryRight(testCurry2)(true)(2); -curryResult8 = _.curryRight(testCurry2)(true); -curryResult9 = _.curryRight(testCurry2); + fp.curryRight(testCurry)("1", 2, true); // $ExpectType [string, number, boolean] + fp.curryRight(testCurry)(true)("1", 2); // $ExpectType [string, number, boolean] + fp.curryRight(testCurry)(2, true)("1"); // $ExpectType [string, number, boolean] + fp.curryRight(testCurry)(true)(2)("1"); // $ExpectType [string, number, boolean] + fp.curryRight(testCurry)(2, true); // $ExpectType RightCurriedFunction1 + fp.curryRight(testCurry)(true)(2); // $ExpectType RightCurriedFunction1 + fp.curryRight(testCurry)(true); // $ExpectType RightCurriedFunction2 + fp.curryRight(testCurry); // $ExpectType RightCurriedFunction3 +} // _.debounce -namespace TestDebounce { - type SampleFunc = (n: number, s: string) => boolean; +{ + const func = (n: number, s: string): boolean => true; + const options: _.DebounceSettings = { + leading: true, + maxWait: 100, + trailing: false, + }; - interface Options { - leading?: boolean; - maxWait?: number; - trailing?: boolean; - } + const result = _.debounce(func); // $ExpectType ((n: number, s: string) => boolean) & Cancelable + result.cancel(); // $ExpectType void + result.flush(); // $ExpectType void + _.debounce(func, 42); // $ExpectType ((n: number, s: string) => boolean) & Cancelable + _.debounce(func, 42, options); // $ExpectType ((n: number, s: string) => boolean) & Cancelable - interface ResultFunc { - (n: number, s: string): boolean; - cancel(): void; - flush(): void; - } - - let func: SampleFunc = (a, b) => true; - let options: Options = {}; - - { - let result: ResultFunc; - - result = _.debounce(func); - result = _.debounce(func, 42); - result = _.debounce(func, 42, options); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).debounce(); - result = _(func).debounce(42); - result = _(func).debounce(42, options); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().debounce(); - result = _(func).chain().debounce(42); - result = _(func).chain().debounce(42, options); - } + _(func).debounce(42, options); // $ExpectType LoDashImplicitWrapper<((n: number, s: string) => boolean) & Cancelable> + _.chain(func).debounce(42, options); // $ExpectType LoDashExplicitWrapper<((n: number, s: string) => boolean) & Cancelable> + fp.debounce(42, func); // $ExpectType ((n: number, s: string) => boolean) & Cancelable + fp.debounce(42)(func); // $ExpectType ((n: number, s: string) => boolean) & Cancelable } // _.defer -namespace TestDefer { - type SampleFunc = (a: number, b: string) => boolean; +{ + const func = (a: number, b: string) => true; - let func: SampleFunc = (a, b) => true; - - { - let result: number; - - result = _.defer(func); - result = _.defer(func, anything); - result = _.defer(func, anything, anything); - result = _.defer(func, anything, anything, anything); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(func).defer(); - result = _(func).defer(anything); - result = _(func).defer(anything, anything); - result = _(func).defer(anything, anything, anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(func).chain().defer(); - result = _(func).chain().defer(anything); - result = _(func).chain().defer(anything, anything); - result = _(func).chain().defer(anything, anything, anything); - } + _.defer(func); // $ExpectType number + _.defer(func, anything, anything, anything); // $ExpectType number + _(func).defer(); // $ExpectType LoDashImplicitWrapper + _(func).defer(anything, anything, anything); // $ExpectType LoDashImplicitWrapper + _.chain(func).defer(); // $ExpectType LoDashExplicitWrapper + _.chain(func).defer(anything, anything, anything); // $ExpectType LoDashExplicitWrapper + fp.defer(func); // $ExpectType number } // _.delay -namespace TestDelay { - type SampleFunc = (a: number, b: string) => boolean; +{ + const func = (a: number, b: string) => true; - let func: SampleFunc = (a, b) => true; - - { - let result: number; - - result = _.delay(func, 1); - result = _.delay(func, 1, 2); - result = _.delay(func, 1, 2, ''); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(func).delay(1); - result = _(func).delay(1, 2); - result = _(func).delay(1, 2, ''); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(func).chain().delay(1); - result = _(func).chain().delay(1, 2); - result = _(func).chain().delay(1, 2, ''); - } + _.delay(func, 500); // $ExpectType number + _.delay(func, 500, anything, anything); // $ExpectType number + _(func).delay(500); // $ExpectType LoDashImplicitWrapper + _(func).delay(500, anything, anything); // $ExpectType LoDashImplicitWrapper + _.chain(func).delay(500); // $ExpectType LoDashExplicitWrapper + _.chain(func).delay(500, anything, anything); // $ExpectType LoDashExplicitWrapper + fp.delay(500, func); // $ExpectType number + fp.delay(500)(func); // $ExpectType number } // _.flip -namespace TestFlip { - type Func = (a: string, b: number) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - result = _.flip(func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).flip(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().flip(); - } +{ + // TODO: fix - output arguments should be reversed + _.flip((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean + _((a: string, b: number): boolean => true).flip(); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> + _.chain((a: string, b: number): boolean => true).flip(); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> + fp.flip((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean } // _.flow -namespace TestFlow { - let Fn1 = (n: number) => 0; - let Fn2 = (m: number, n: number) => 0; - let Fn3 = (a: number) => ""; - let Fn4 = (a: string) => 0; - - { - // type infer test - let result: (m: number, n: number) => number; - - result = _.flow(Fn2, Fn1); - result = _.flow(Fn2, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn3, Fn4); - result = _.flow([Fn2, Fn1, Fn3, Fn4]); - } - - { - let result: (m: number, n: number) => number; - - result = _.flow(Fn2, Fn1); - result = _.flow(Fn2, Fn1, Fn1); - result = _.flow(Fn2, Fn1, Fn1, Fn1); - result = _.flow([Fn1, Fn1, Fn1, Fn2]); - } - - { - let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn2).flow(Fn1); - result = _(Fn2).flow(Fn1, Fn1); - result = _(Fn2).flow(Fn1, Fn1, Fn1); - result = _(Fn2).flow([Fn1, Fn1, Fn1]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn2).chain().flow(Fn1); - result = _(Fn2).chain().flow(Fn1, Fn1); - result = _(Fn2).chain().flow(Fn1, Fn1, Fn1); - result = _(Fn2).chain().flow([Fn1, Fn1, Fn1]); - } -} - // _.flowRight -namespace TestFlowRight { - let Fn1 = (n: number) => 0; - let Fn2 = (m: number, n: number) => 0; +{ + const fn1 = (n: number): number => 0; + const fn2 = (m: number, n: number): number => 0; + const fn3 = (a: number): string => ""; + const fn4 = (a: string): boolean => true; - { - let result: (m: number, n: number) => number; + _.flow(fn2, fn1); // $ExpectType (a1: number, a2: number) => number + _.flow(fn2, fn1, fn1, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + _.flow(fn2, fn1, fn3, fn4); // $ExpectType (a1: number, a2: number) => boolean + _.flow([fn2, fn1, fn3, fn4]); // $ExpectType (...args: any[]) => any - result = _.flowRight(Fn1, Fn2); - result = _.flowRight(Fn1, Fn1, Fn2); - result = _.flowRight(Fn1, Fn1, Fn1, Fn2); - result = _.flowRight([Fn1, Fn1, Fn1, Fn2]); - } + _(fn2).flow(fn1); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn2).flow(fn1, fn1); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn2).flow(fn1, fn1, fn1); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn2).flow([fn1, fn1, fn1]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> - { - let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + _.chain(fn2).flow(fn1); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn2).flow(fn1, fn1); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn2).flow(fn1, fn1, fn1); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn2).flow([fn1, fn1, fn1]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> - result = _(Fn1).flowRight(Fn2); - result = _(Fn1).flowRight(Fn1, Fn2); - result = _(Fn1).flowRight(Fn1, Fn1, Fn2); - result = _(Fn1).flowRight([Fn1, Fn1, Fn2]); - } + fp.flow(fn1, fn1); // $ExpectType (a1: number) => number + fp.flow(fn1, fn3); // $ExpectType (a1: number) => string + fp.flow(fn2, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn1, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn1, fn1, fn1, fn1, fn1, fn1); // $ExpectType (a1: number, a2: number) => number + fp.flow(fn2, fn3); // $ExpectType (a1: number, a2: number) => string + fp.flow(fn2, fn3, fn4); // $ExpectType (a1: number, a2: number) => boolean + fp.flow(fn2, fn1, fn3, fn4); // $ExpectType (a1: number, a2: number) => boolean + fp.flow([fn2, fn1, fn3, fn4]); // $ExpectType (...args: any[]) => any - { - let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + _.flowRight(fn1, fn2); // $ExpectType (a1: number, a2: number) => number + _.flowRight(fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + _.flowRight(fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + _.flowRight([fn1, fn1, fn1, fn2]); // $ExpectType (...args: any[]) => any - result = _(Fn1).chain().flowRight(Fn2); - result = _(Fn1).chain().flowRight(Fn1, Fn2); - result = _(Fn1).chain().flowRight(Fn1, Fn1, Fn2); - result = _(Fn1).chain().flowRight([Fn1, Fn1, Fn2]); - } + _(fn1).flowRight(fn2); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn1).flowRight(fn1, fn2); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn1).flowRight(fn1, fn1, fn2); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => number> + _(fn1).flowRight([fn1, fn1, fn2]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + + _.chain(fn1).flowRight(fn2); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn1).flowRight(fn1, fn2); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn1).flowRight(fn1, fn1, fn2); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => number> + _.chain(fn1).flowRight([fn1, fn1, fn2]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + + fp.flowRight(fn1, fn1); // $ExpectType (a1: number) => number + fp.flowRight(fn3, fn1); // $ExpectType (a1: number) => string + fp.flowRight(fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn1, fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn1, fn1, fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn1, fn1, fn1, fn1, fn1, fn1, fn2); // $ExpectType (a1: number, a2: number) => number + fp.flowRight(fn3, fn2); // $ExpectType (a1: number, a2: number) => string + fp.flowRight(fn4, fn3, fn2); // $ExpectType (a1: number, a2: number) => boolean + fp.flowRight(fn4, fn3, fn1, fn2); // $ExpectType (a1: number, a2: number) => boolean + fp.flowRight([fn4, fn3, fn1, fn2]); // $ExpectType (...args: any[]) => any } // _.memoize -namespace TestMemoize { - { - let fn: any = () => {}; - let memoizedFunction: _.MemoizedFunction = fn; - let cache: _.MapCache = memoizedFunction.cache; - } +{ + const memoizedFunction: _.MemoizedFunction = anything; + memoizedFunction.cache; // $ExpectType MapCache - interface MemoizedResultFn extends _.MemoizedFunction { - (a1: string, a2: number): boolean; - } + const 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 {}; }, + clear() { }, + }; - let memoizeFn = (a1: string, a2: number) => true; - let memoizeResolverFn = (a1: string, a2: number) => ""; + const memoizeFn = (a1: string, a2: number): boolean => true; + const memoizeResolverFn = (a1: string, a2: number) => ""; - { - let result: MemoizedResultFn; + _.memoize(memoizeFn); // $ExpectType ((a1: string, a2: number) => boolean) & MemoizedFunction + _.memoize(memoizeFn, memoizeResolverFn); // $ExpectType ((a1: string, a2: number) => boolean) & MemoizedFunction + _(memoizeFn).memoize(); // $ExpectType LoDashImplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> + _(memoizeFn).memoize(memoizeResolverFn); // $ExpectType LoDashImplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> + _.chain(memoizeFn).memoize(); // $ExpectType LoDashExplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> + _.chain(memoizeFn).memoize(memoizeResolverFn); // $ExpectType LoDashExplicitWrapper<((a1: string, a2: number) => boolean) & MemoizedFunction> + fp.memoize(memoizeFn); // $ExpectType ((a1: string, a2: number) => boolean) & MemoizedFunction - result = _.memoize(memoizeFn); - result = _.memoize(memoizeFn, memoizeResolverFn); - - result('foo', 1); - result.cache.get('foo1'); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(memoizeFn).memoize(); - result = _(memoizeFn).memoize(memoizeResolverFn); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(memoizeFn).chain().memoize(); - result = _(memoizeFn).chain().memoize(memoizeResolverFn); - } - - interface MemoizeCache { - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value: V): this; - clear(): void; - } - class MemoizeCacheClass implements MemoizeCache { - delete: (key: any) => true; - get: (key: any) => 1; - has: (key: any) => true; - set: (key: any, value: any) => this; - clear: () => { }; - } - - _.memoize.Cache = MemoizeCacheClass; + // $ExpectType MapCache + new _.memoize.Cache(); } // _.overArgs -namespace TestOverArgs { - type Func1 = (a: boolean) => boolean; - type Func2 = (a: boolean, b: boolean) => boolean; +{ + const func = (a: number, b: string) => true; - let func1: Func1 = (a) => true; - let func2: Func2 = (a, b) => true; + _.overArgs(func, (a: number) => true, (b: string) => true); // $ExpectType (...args: any[]) => any + _.overArgs(func, [(a: number) => true, (b: string) => true]); // $ExpectType (...args: any[]) => any + _(func).overArgs((a: number) => true, (b: string) => true); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(func).overArgs([(a: number) => true, (b: string) => true]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(func).overArgs((a: number) => true, (b: string) => true); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(func).overArgs([(a: number) => true, (b: string) => true]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> - let transform1 = (a: string) => true; - let transform2 = (b: number) => true; - - { - let result: (a: string) => boolean; - - result = _.overArgs(func1, transform1); - result = _.overArgs(func1, [transform1]); - } - - { - let result: (a: string, b: number) => boolean; - - result = _.overArgs(func2, transform1, transform2); - result = _.overArgs(func2, [transform1, transform2]); - } - - { - let result: _.LoDashImplicitObjectWrapper<(a: string) => boolean>; - - result = _(func1).overArgs(transform1); - result = _(func1).overArgs([transform1]); - } - - { - let result: _.LoDashImplicitObjectWrapper<(a: string, b: number) => boolean>; - - result = _(func2).overArgs(transform1, transform2); - result = _(func2).overArgs([transform1, transform2]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(a: string) => boolean>; - - result = _(func1).chain().overArgs(transform1); - result = _(func1).chain().overArgs([transform1]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(a: string, b: number) => boolean>; - - result = _(func2).chain().overArgs(transform1, transform2); - result = _(func2).chain().overArgs([transform1, transform2]); - } + fp.overArgs(func, [(a: number) => true, (b: string) => true]); // $ExpectType (...args: any[]) => any + fp.overArgs(func)([(a: number) => true, (b: string) => true]); // $ExpectType (...args: any[]) => any } // _.negate -namespace TestNegate { - type PredicateFn = (a1: number, a2: number) => boolean; - - const predicate = (a1: number, a2: number) => a1 > a2; - - { - let result: PredicateFn; - - result = _.negate(predicate); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(predicate).negate(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(predicate).chain().negate(); - } +{ + _.negate((a1: number, a2: number): boolean => true); // $ExpectType (a1: number, a2: number) => boolean + _((a1: number, a2: number): boolean => true).negate(); // $ExpectType LoDashImplicitWrapper<(a1: number, a2: number) => boolean> + _.chain((a1: number, a2: number): boolean => true).negate(); // $ExpectType LoDashExplicitWrapper<(a1: number, a2: number) => boolean> + fp.negate((a1: number, a2: number): boolean => true); // $ExpectType (a1: number, a2: number) => boolean } // _.once -namespace TestOnce { - type Func = (a: string, b: number) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - result = _.once(func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).once(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().once(); - } +{ + _.once((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean + _((a: string, b: number): boolean => true).once(); // $ExpectType LoDashImplicitWrapper<(a: string, b: number) => boolean> + _.chain((a: string, b: number): boolean => true).once(); // $ExpectType LoDashExplicitWrapper<(a: string, b: number) => boolean> + fp.once((a: string, b: number): boolean => true); // $ExpectType (a: string, b: number) => boolean } -const greetPartial = (greeting: string, name: string) => `${greeting} ${name}`; -const hi = _.partial(greetPartial, 'hi'); -hi('moe'); +// _.rearg +{ + const testReargFn = (a: string, b: string, c: string) => [a, b, c]; + _.rearg(testReargFn, 2, 0, 1); // $ExpectType (...args: any[]) => any + _.rearg(testReargFn, [2, 0, 1]); // $ExpectType (...args: any[]) => any + _(testReargFn).rearg(2, 0, 1); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(testReargFn).rearg([2, 0, 1]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(testReargFn).rearg(2, 0, 1); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(testReargFn).rearg([2, 0, 1]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> -const defaultsDeep: (...args: any[]) => any = _.partialRight(_.merge, _.defaults); - -const optionsPartialRight = { - 'variable': 'data', - 'imports': { 'jq': $ } -}; - -defaultsDeep(optionsPartialRight, _.templateSettings); - -//_.rearg -const testReargFn = (a: string, b: string, c: string) => [a, b, c]; -result = (_.rearg(testReargFn, 2, 0, 1))('b', 'c', 'a'); -result = (_.rearg(testReargFn, [2, 0, 1]))('b', 'c', 'a'); -result = (_(testReargFn).rearg(2, 0, 1).value())('b', 'c', 'a'); -result = (_(testReargFn).rearg([2, 0, 1]).value())('b', 'c', 'a'); + fp.rearg([2, 0, 1], testReargFn); // $ExpectType (...args: any[]) => any + fp.rearg([2, 0, 1])(testReargFn); // $ExpectType (...args: any[]) => any +} // _.rest -namespace TestRest { - type Func = (a: string, b: number[]) => boolean; - type ResultFunc = (a: string, ...b: number[]) => boolean; - - let func: Func = (a, b) => true; - - { - let result: ResultFunc; - - result = _.rest(func); - result = _.rest(func, 1); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).rest(); - result = _(func).rest(1); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().rest(); - result = _(func).chain().rest(1); - } +{ + _.rest((a: string, b: number[]) => true); // $ExpectType (...args: any[]) => any + _.rest((a: string, b: number[]) => true, 1); // $ExpectType (...args: any[]) => any + _((a: string, b: number[]) => true).rest(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _((a: string, b: number[]) => true).rest(1); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain((a: string, b: number[]) => true).rest(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain((a: string, b: number[]) => true).rest(1); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.rest((a: string, b: number[]) => true); // $ExpectType (...args: any[]) => any + fp.restFrom(1)((a: string, b: number[]) => true); // $ExpectType (...args: any[]) => any } -//_.spread -namespace TestSpread { - type SampleFunc = (args: Array) => boolean; - type SampleResult = (a: number, b: string) => boolean; - - let func: SampleFunc = (a) => true; - - { - let result: SampleResult; - - result = _.spread(func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).spread(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().spread(); - } +// _.spread +{ + _.spread((a: Array): boolean => true); // $ExpectType (...args: any[]) => boolean + _((a: Array): boolean => true).spread(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => boolean> + _.chain((a: Array): boolean => true).spread(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => boolean> + fp.spread((a: Array): boolean => true); // $ExpectType (...args: any[]) => boolean } // _.throttle -namespace TestThrottle { - type SampleFunc = (n: number, s: string) => boolean; +{ + const options: _.ThrottleSettings = { + leading: true, + trailing: false, + }; - interface Options { - leading?: boolean; - trailing?: boolean; - } + const func = (a: number, b: string): boolean => true; - interface ResultFunc { - (n: number, s: string): boolean; - cancel(): void; - flush(): void; - } + _.throttle(func); // $ExpectType ((a: number, b: string) => boolean) & Cancelable + _.throttle(func, 42); // $ExpectType ((a: number, b: string) => boolean) & Cancelable + _.throttle(func, 42, options); // $ExpectType ((a: number, b: string) => boolean) & Cancelable + _(func).throttle(); // $ExpectType LoDashImplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _(func).throttle(42); // $ExpectType LoDashImplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _(func).throttle(42, options); // $ExpectType LoDashImplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _.chain(func).throttle(); // $ExpectType LoDashExplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _.chain(func).throttle(42); // $ExpectType LoDashExplicitWrapper<((a: number, b: string) => boolean) & Cancelable> + _.chain(func).throttle(42, options); // $ExpectType LoDashExplicitWrapper<((a: number, b: string) => boolean) & Cancelable> - let func: SampleFunc = (a, b) => true; - let options: Options = {}; - - { - let result: ResultFunc; - - result = _.throttle(func); - result = _.throttle(func, 42); - result = _.throttle(func, 42, options); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).throttle(); - result = _(func).throttle(42); - result = _(func).throttle(42, options); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().throttle(); - result = _(func).chain().throttle(42); - result = _(func).chain().throttle(42, options); - } + fp.throttle(42, func); // $ExpectType ((a: number, b: string) => boolean) & Cancelable + fp.throttle(42)(func); // $ExpectType ((a: number, b: string) => boolean) & Cancelable } // _.unary -namespace TestUnary { - type Func = (a: string, b: number[]) => boolean; - - let func: Func = (a, b) => true; - - { - let result: Func; - - result = _.unary(func); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(func).unary(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(func).chain().unary(); - } +{ + _.unary((a: string, b: number): boolean => true); // $ExpectType (arg1: string) => boolean + _((a: string, b: number): boolean => true).unary(); // $ExpectType LoDashImplicitWrapper<(arg1: string) => boolean> + _.chain((a: string, b: number): boolean => true).unary(); // $ExpectType LoDashExplicitWrapper<(arg1: string) => boolean> + fp.unary((a: string, b: number): boolean => true); // $ExpectType (arg1: string) => boolean } // _.wrap -namespace TestWrap { - type SampleValue = {a: number; b: string; c: boolean} - type SampleResult = (arg2: number, arg3: string) => boolean; - - { - type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; - - let value: SampleValue = { a: 1, b: "", c: true }; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: SampleResult; - - result = _.wrap(value, wrapper); - } - - { - type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; - - let value = 0; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashImplicitObjectWrapper; - - result = _(value).wrap(wrapper); - } - - { - type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; - - let value: number[] = []; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashImplicitObjectWrapper; - - result = _(value).wrap(wrapper); - } - - { - type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; - - let value: SampleValue = { a: 1, b: "", c: true }; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashImplicitObjectWrapper; - - result = _(value).wrap(wrapper); - } - - { - type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; - - let value = 0; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashExplicitObjectWrapper; - - result = _(value).chain().wrap(wrapper); - } - - { - type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; - - let value: number[] = []; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashExplicitObjectWrapper; - - result = _(value).chain().wrap(wrapper); - } - - { - type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; - - let value: SampleValue = { a: 1, b: "", c: true }; - let wrapper: SampleWrapper = (a, b, c) => true; - let result: _.LoDashExplicitObjectWrapper; - - result = _(value).chain().wrap(wrapper); - } +{ + _.wrap("a", (arg1: string, ...args: number[]): boolean => true); // $ExpectType (...args: number[]) => boolean + _("a").wrap((arg1: string, ...args: number[]): boolean => true); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _.chain("a").wrap((arg1: string, ...args: number[]): boolean => true); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + fp.wrap((arg1: string, ...args: number[]): boolean => true, "a"); // $ExpectType (...args: number[]) => boolean + fp.wrap((arg1: string, ...args: number[]): boolean => true)("a"); // $ExpectType (...args: number[]) => boolean } /******** @@ -7951,1548 +3819,984 @@ namespace TestWrap { ********/ // _.castArray -namespace TestCastArray { - { - let result: number[]; +{ + _.castArray(42); // $ExpectType number[] + _.castArray([42]); // $ExpectType number[] + _.castArray({ a: 42 }); // $ExpectType { a: number; }[] + _(42).castArray(); // $ExpectType LoDashImplicitWrapper + _([42]).castArray(); // $ExpectType LoDashImplicitWrapper + _.chain(42).castArray(); // $ExpectType LoDashExplicitWrapper + _.chain([42]).castArray(); // $ExpectType LoDashExplicitWrapper - result = _.castArray(42); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(42).castArray(); - result = _([42]).castArray(); - } - - { - let result: _.LoDashImplicitArrayWrapper<{a: number}>; - - result = _({a: 42}).castArray(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(42).chain().castArray(); - result = _([42]).chain().castArray(); - } - - { - let result: _.LoDashExplicitArrayWrapper<{a: number}>; - - result = _({a: 42}).chain().castArray(); - } + fp.castArray(42); // $ExpectType number[] + fp.castArray([42]); // $ExpectType number[] } // _.clone -namespace TestClone { - { - let result: number; - - result = _.clone(42); - result = _(42).clone(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().clone(); - } - - { - let result: string[]; - - result = _.clone(['']); - result = _(['']).clone(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(['']).chain().clone(); - } - - { - let result: {a: {b: number;};}; - - result = _.clone<{a: {b: number;};}>({a: {b: 42}}); - result = _({a: {b: 42}}).clone(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{a: {b: number;};}>; - - result = _({a: {b: 42}}).chain().clone(); - } +{ + _.clone(42); // $ExpectType 42 + _.clone({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } + _(42).clone(); // $ExpectType number + _({ a: { b: 42 } }).clone(); // $ExpectType { a: { b: number; }; } + _.chain(42).clone(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 42 } }).clone(); // $ExpectType LoDashExplicitWrapper<{ a: { b: number; }; }> + fp.clone(42); // $ExpectType 42 + fp.clone({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } } // _.cloneDeep -namespace TestCloneDeep { - { - let result: number; - - result = _.cloneDeep(42); - result = _(42).cloneDeep(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().cloneDeep(); - } - - { - let result: string[]; - - result = _.cloneDeep(['']); - result = _(['']).cloneDeep(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(['']).chain().cloneDeep(); - } - - { - let result: {a: {b: number;};}; - - result = _.cloneDeep<{a: {b: number;};}>({a: {b: 42}}); - result = _({a: {b: 42}}).cloneDeep(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{a: {b: number;};}>; - - result = _({a: {b: 42}}).chain().cloneDeep(); - } +{ + _.cloneDeep(42); // $ExpectType 42 + _.cloneDeep({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } + _(42).cloneDeep(); // $ExpectType number + _({ a: { b: 42 } }).cloneDeep(); // $ExpectType { a: { b: number; }; } + _.chain(42).cloneDeep(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 42 } }).cloneDeep(); // $ExpectType LoDashExplicitWrapper<{ a: { b: number; }; }> + fp.cloneDeep(42); // $ExpectType 42 + fp.cloneDeep({ a: { b: 42 } }); // $ExpectType { a: { b: number; }; } } // _.cloneDeepWith -namespace TestCloneDeepWith { - type CloneDeepWithCustomizer = (value: V) => R; +{ + const customizer = (x: any) => ""; - { - let customizer: CloneDeepWithCustomizer = (x) => ""; - let reslut: string; + _.cloneDeepWith(42, customizer); // $ExpectType any + _(42).cloneDeepWith(customizer); // $ExpectType any + _.chain(42).cloneDeepWith(customizer); // $ExpectType LoDashExplicitWrapper - result = _.cloneDeepWith(42, customizer); - result = _(42).cloneDeepWith(customizer); - } + _.cloneDeepWith({a: {b: 42}}, customizer); // $ExpectType any - { - let customizer: CloneDeepWithCustomizer = (x) => ""; - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().cloneDeepWith(customizer); - } - - { - let customizer: CloneDeepWithCustomizer = (x) => []; - let reslut: string[]; - - result = _.cloneDeepWith([42], customizer); - result = _([42]).cloneDeepWith(customizer); - } - - { - let customizer: CloneDeepWithCustomizer = (x) => []; - let result: _.LoDashExplicitArrayWrapper; - - result = _([42]).chain().cloneDeepWith(customizer); - } - - { - let customizer: CloneDeepWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); - let reslut: {a: {b: string;};}; - - result = _.cloneDeepWith({a: {b: 42}}, customizer); - result = _({a: {b: 42}}).cloneDeepWith(customizer); - } - - { - let customizer: CloneDeepWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); - let result: _.LoDashExplicitObjectWrapper<{a: {b: string;};}>; - - result = _({a: {b: 42}}).chain().cloneDeepWith(customizer); - } + fp.cloneDeepWith((x) => "", 42); // $ExpectType any + fp.cloneDeepWith((x) => "")(42); // $ExpectType any + fp.cloneDeepWith((x) => "", [42]); // $ExpectType any + fp.cloneDeepWith((x) => "", { a: { b: 42 } }); // $ExpectType any } // _.cloneWith -namespace TestCloneWith { - type CloneWithCustomizer = (value: V) => R; - +{ { - let customizer: CloneWithCustomizer = (x) => ""; - let reslut: string; + const customizer = (x: number) => ""; - result = _.cloneWith(42, customizer); - result = _.cloneWith(42, customizer); - result = _(42).cloneWith(customizer); + _.cloneWith(42, customizer); // $ExpectType string + _(42).cloneWith(customizer); // $ExpectType string + _.chain(42).cloneWith(customizer); // $ExpectType LoDashExplicitWrapper + + fp.cloneWith(customizer, 42); // $ExpectType string + fp.cloneWith(customizer)(42); // $ExpectType string } { - let customizer: CloneWithCustomizer = (x) => ""; - let result: _.LoDashExplicitWrapper; + const customizer = (x: number): string | undefined => ""; - result = _(42).chain().cloneWith(customizer); - } + _.cloneWith(42, customizer); // string | 42 + _(42).cloneWith(customizer); // string | 42 + _.chain(42).cloneWith(customizer); // string | 42 - { - let customizer: CloneWithCustomizer = (x) => []; - let reslut: string[]; - - result = _.cloneWith([42], customizer); - result = _.cloneWith([42], customizer); - result = _([42]).cloneWith(customizer); - } - - { - let customizer: CloneWithCustomizer = (x) => []; - let result: _.LoDashExplicitArrayWrapper; - - result = _([42]).chain().cloneWith(customizer); - } - - { - let customizer: CloneWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); - let reslut: {a: {b: string;};}; - - result = _.cloneWith({a: {b: 42}}, customizer); - result = _.cloneWith<{a: {b: number;};}, {a: {b: string;};}>({a: {b: 42}}, customizer); - result = _({a: {b: 42}}).cloneWith<{a: {b: string;};}>(customizer); - } - - { - 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); + // Note: TS 2.5 fails without explicit <42, string> + fp.cloneWith<42, string>(customizer, 42); // $ExpectType string | 42 + fp.cloneWith<42, string>(customizer)(42); // $ExpectType string | 42 } } // _.conforms -namespace TestConforms { - let result: boolean = _.conforms({foo: (v: string) => false})({foo: "foo"}); - let result2: boolean = _.conforms({})({foo: "foo"}); +{ + _.conforms({ foo: (v: string) => false })({ foo: "foo" }); // $ExpectType boolean + fp.conforms({ foo: (v: string) => false })({ foo: "foo" }); // $ExpectType boolean } // _.conformsTo -namespace TestConformsTo { - let result: boolean = _.conformsTo({foo: "foo"}, {foo: (v: string) => false}); - let result2: boolean = _.conformsTo({}, {foo: (v: string) => false}); +{ + _.conformsTo({ foo: "foo" }, { foo: (v: string) => false }); // $ExpectType boolean + _({ foo: "foo" }).conformsTo({ foo: (v: string) => false }); // $ExpectType boolean + _.chain({ foo: "foo" }).conformsTo({ foo: (v: string) => false }); // $ExpectType LoDashExplicitWrapper + + fp.conformsTo({ foo: (v: string) => false }, { foo: "foo" }); // $ExpectType boolean + fp.conformsTo({ foo: (v: string) => false })({ foo: "foo" }); // $ExpectType boolean } // _.eq -namespace TestEq { - let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; +{ + _.eq(anything, anything); // $ExpectType boolean + _(anything).eq(anything); // $ExpectType boolean + _.chain(anything).eq(anything); // $ExpectType LoDashExplicitWrapper - { - let result: boolean; - - result = _.eq(anything, anything); - - result = _(anything).eq(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(anything).chain().eq(anything); - } + fp.eq(anything, anything); // $ExpectType boolean + fp.eq(anything)(anything); // $ExpectType boolean } // _.gt -namespace TestGt { - { - let result: boolean; +{ + _.gt(anything, anything); // $ExpectType boolean + _(anything).gt(anything); // $ExpectType boolean + _.chain(anything).gt(anything); // $ExpectType LoDashExplicitWrapper - result = _.gt(anything, anything); - result = _(1).gt(anything); - result = _([]).gt(anything); - result = _({}).gt(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().gt(anything); - result = _([]).chain().gt(anything); - result = _({}).chain().gt(anything); - } + fp.gt(anything, anything); // $ExpectType boolean + fp.gt(anything)(anything); // $ExpectType boolean } // _.gte -namespace TestGte { - { - let result: boolean; +{ + _.gte(anything, anything); // $ExpectType boolean + _(anything).gte(anything); // $ExpectType boolean + _.chain(anything).gte(anything); // $ExpectType LoDashExplicitWrapper - result = _.gte(anything, anything); - result = _(1).gte(anything); - result = _([]).gte(anything); - result = _({}).gte(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().gte(anything); - result = _([]).chain().gte(anything); - result = _({}).chain().gte(anything); - } + fp.gte(anything, anything); // $ExpectType boolean + fp.gte(anything)(anything); // $ExpectType boolean } // _.isArguments -namespace TestisArguments { - { - let value: number|IArguments = 0; +{ + const value: number | IArguments = 0; - if (_.isArguments(value)) { - let result: IArguments = value; - } - else { - let result: number = value; - } + if (_.isArguments(value)) { + const result: IArguments = value; + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isArguments(anything); - result = _(1).isArguments(); - result = _([]).isArguments(); - result = _({}).isArguments(); + if (fp.isArguments(value)) { + const result: IArguments = value; + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArguments(); - result = _([]).chain().isArguments(); - result = _({}).chain().isArguments(); - } + _.isArguments(""); // $ExpectType boolean + _({}).isArguments(); // $ExpectType boolean + _.chain([]).isArguments(); // $ExpectType LoDashExplicitWrapper + fp.isArguments(anything); // $ExpectType boolean } // _.isArray -namespace TestIsArray { - { - let value: number|string[]|boolean[] = anything; +{ + const value: number | string[] | boolean[] = anything; - if (_.isArray(value)) { - value; // $ExpectType string[] | boolean[] - } - else { - value; // $ExpectType number - } + if (_.isArray(value)) { + const result: string[] | boolean[] = value; + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isArray(anything); - result = _(1).isArray(); - result = _([]).isArray(); - result = _({}).isArray(); + if (fp.isArray(value)) { + const result: string[] | boolean[] = value; + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArray(); - result = _([]).chain().isArray(); - result = _({}).chain().isArray(); - } + _.isArray(anything); // $ExpectType boolean + _({}).isArray(); // $ExpectType boolean + _.chain([]).isArray(); // $ExpectType LoDashExplicitWrapper + fp.isArray(anything); // $ExpectType boolean } // _.isArrayBuffer -namespace TestIsArrayBuffer { - { - let value: ArrayBuffer|number = anything; +{ + const value: ArrayBuffer | number = anything; - if (_.isArrayBuffer(value)) { - value; // $ExpectType ArrayBuffer - } - else { - value; // $ExpectType number - } + if (_.isArrayBuffer(value)) { + value; // $ExpectType ArrayBuffer + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isArrayBuffer(anything); - result = _(1).isArrayBuffer(); - result = _([]).isArrayBuffer(); - result = _({}).isArrayBuffer(); + if (fp.isArrayBuffer(value)) { + value; // $ExpectType ArrayBuffer + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArrayBuffer(); - result = _([]).chain().isArrayBuffer(); - result = _({}).chain().isArrayBuffer(); - } + _.isArrayBuffer(anything); // $ExpectType boolean + _({}).isArrayBuffer(); // $ExpectType boolean + _.chain([]).isArrayBuffer(); // $ExpectType LoDashExplicitWrapper + fp.isArrayBuffer(anything); // $ExpectType boolean } // _.isArrayLike -namespace TestIsArrayLike { +{ { - let value: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] + const value: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] | number | { length: string } | { a: string } | null | undefined = anything; if (_.isArrayLike(value)) { - let result: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; + const result: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; } else { - let result: number | { length: string } | { a: string; } | null | undefined = value; + const result: number | { length: string } | { a: string; } | null | undefined = value; + } + + if (fp.isArrayLike(value)) { + const result: string | string[] | { [index: number]: boolean; length: number; } | [number, boolean] = value; + } else { + const result: number | { length: string; } | { a: string; } | null | undefined = value; } } { - let value: boolean[] = anything; + const value: boolean[] = anything; if (_.isArrayLike(value)) { - let result: boolean[] = value; + const result: boolean[] = value; + } else { + value; // $ExpectType never } - else { + + if (fp.isArrayLike(value)) { + value; // $ExpectType boolean[] + } else { value; // $ExpectType never } } { - let value: () => number = anything; + const value: () => number = anything; if (_.isArrayLike(value)) { value; // $ExpectType never } else { value; // $ExpectType () => number } + + if (fp.isArrayLike(value)) { + value; // $ExpectType never + } else { + value; // $ExpectType () => number + } } { - let value: { a: string } = anything; + const value: { a: string } = anything; if (_.isArrayLike(value)) { - let result: { a: string, length: number } = value; + const result: { a: string, length: number } = value; + } else { + value; // $ExpectType { a: string; } } - else { + + if (fp.isArrayLike(value)) { + const result: { a: string, length: number } = value; + } else { value; // $ExpectType { a: string; } } } { - let value: any = anything; + const value: any = anything; if (_.isArrayLike(value)) { value; // $ExpectType any + } else { + value; // $ExpectType any } - else { + + if (fp.isArrayLike(value)) { + value; // $ExpectType any + } else { value; // $ExpectType any } } - { - let result: boolean; - - result = _.isArrayLike(anything); - result = _(1).isArrayLike(); - result = _([]).isArrayLike(); - result = _({}).isArrayLike(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArrayLike(); - result = _([]).chain().isArrayLike(); - result = _({}).chain().isArrayLike(); - } + _.isArrayLike(anything); // $ExpectType boolean + _({}).isArrayLike(); // $ExpectType boolean + _.chain([]).isArrayLike(); // $ExpectType LoDashExplicitWrapper + fp.isArrayLike(anything); // $ExpectType boolean } // _.isArrayLikeObject -namespace TestIsArrayLikeObject { +{ { - let value: string[] | { [index: number]: boolean, length: number } | [number, boolean] + const value: string[] | { [index: number]: boolean, length: number } | [number, boolean] | number | string | { length: string } | { a: string } | null | undefined = anything; if (_.isArrayLikeObject(value)) { - let result: string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; + const result: string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; } else { - let result: string | number | { length: string; } | { a: string; } | null | undefined = value; + const result: string | number | { length: string; } | { a: string; } | null | undefined = value; + } + + if (fp.isArrayLikeObject(value)) { + const result: string[] | [number, boolean] | { [index: number]: boolean; length: number; } = value; + } else { + const result: string | number | { length: string; } | { a: string; } | null | undefined = value; } } { - let value: boolean[] = anything; + const value: boolean[] = anything; if (_.isArrayLikeObject(value)) { - let result: boolean[] = value; + const result: boolean[] = value; + } else { + value; // $ExpectType never } - else { + + if (fp.isArrayLikeObject(value)) { + const result: boolean[] = value; + } else { value; // $ExpectType never } } { - let value: (a: string) => boolean = anything; + const value: (a: string) => boolean = anything; if (_.isArrayLikeObject(value)) { value; // $ExpectType never } else { value; // $ExpectType (a: string) => boolean } + + if (fp.isArrayLikeObject(value)) { + value; // $ExpectType never + } else { + value; // $ExpectType (a: string) => boolean + } } { - let value: { a: string } = anything; + const value: { a: string } = anything; if (_.isArrayLikeObject(value)) { - let result: { a: string, length: number } = value; + const result: { a: string, length: number } = value; + } else { + value; // $ExpectType { a: string; } } - else { + + if (fp.isArrayLikeObject(value)) { + const result: { a: string, length: number } = value; + } else { value; // $ExpectType { a: string; } } } { - let value: any = anything; + const value: any = anything; if (_.isArrayLikeObject(value)) { value; // $ExpectType any + } else { + value; // $ExpectType any } - else { + + if (fp.isArrayLikeObject(value)) { + value; // $ExpectType any + } else { value; // $ExpectType any } } - { - let result: boolean; - - result = _.isArrayLikeObject(anything); - result = _(1).isArrayLikeObject(); - result = _([]).isArrayLikeObject(); - result = _({}).isArrayLikeObject(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isArrayLikeObject(); - result = _([]).chain().isArrayLikeObject(); - result = _({}).chain().isArrayLikeObject(); - } + _.isArrayLikeObject(anything); // $ExpectType boolean + _({}).isArrayLikeObject(); // $ExpectType boolean + _.chain([]).isArrayLikeObject(); // $ExpectType LoDashExplicitWrapper + fp.isArrayLikeObject(anything); // $ExpectType boolean } // _.isBoolean -namespace TestIsBoolean { - { - let value: number|boolean = 0; +{ + const value: number | boolean = 0; - if (_.isBoolean(value)) { - let result: boolean = value; - } - else { - let result: number = value; - } + if (_.isBoolean(value)) { + const result: boolean = value; + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isBoolean(anything); - result = _(1).isBoolean(); - result = _([]).isBoolean(); - result = _({}).isBoolean(); + if (fp.isBoolean(value)) { + const result: boolean = value; + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isBoolean(); - result = _([]).chain().isBoolean(); - result = _({}).chain().isBoolean(); - } + _.isBoolean(anything); // $ExpectType boolean + _({}).isBoolean(); // $ExpectType boolean + _.chain([]).isBoolean(); // $ExpectType LoDashExplicitWrapper } // _.isBuffer -namespace TestIsBuffer { - { - let result: boolean; - - result = _.isBuffer(anything); - result = _(1).isBuffer(); - result = _([]).isBuffer(); - result = _({}).isBuffer(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isBuffer(); - result = _([]).chain().isBuffer(); - result = _({}).chain().isBuffer(); - } +{ + _.isBuffer(anything); // $ExpectType boolean + _({}).isBuffer(); // $ExpectType boolean + _.chain([]).isBuffer(); // $ExpectType LoDashExplicitWrapper + fp.isBuffer(anything); // $ExpectType boolean } // _.isDate { - { - let value: number|Date = 0; + const value: number | Date = 0; - if (_.isDate(value)) { - let result: Date = value; - } - else { - let result: number = value; - } + if (_.isDate(value)) { + const result: Date = value; + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isDate(anything); - result = _(42).isDate(); - result = _([]).isDate(); - result = _({}).isDate(); + if (fp.isDate(value)) { + const date: Date = value; + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().isDate(); - result = _([]).chain().isDate(); - result = _({}).chain().isDate(); - } + _.isDate(anything); // $ExpectType boolean + _({}).isDate(); // $ExpectType boolean + _.chain([]).isDate(); // $ExpectType LoDashExplicitWrapper + fp.isDate(anything); // $ExpectType boolean } // _.isElement -namespace TestIsElement { - { - let result: boolean; - - result = _.isElement(anything); - - result = _(42).isElement(); - result = _([]).isElement(); - result = _({}).isElement(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().isElement(); - result = _([]).chain().isElement(); - result = _({}).chain().isElement(); - } +{ + _.isElement(anything); // $ExpectType boolean + _({}).isElement(); // $ExpectType boolean + _.chain([]).isElement(); // $ExpectType LoDashExplicitWrapper + fp.isElement(anything); // $ExpectType boolean } // _.isEmpty -namespace TestIsEmpty { - { - let result: boolean; - - result = _.isEmpty(anything); - result = _(1).isEmpty(); - result = _('').isEmpty(); - result = _([]).isEmpty(); - result = _({}).isEmpty(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isEmpty(); - result = _('').chain().isEmpty(); - result = _([]).chain().isEmpty(); - result = _({}).chain().isEmpty(); - } +{ + _.isEmpty(anything); // $ExpectType boolean + _({}).isEmpty(); // $ExpectType boolean + _.chain([]).isEmpty(); // $ExpectType LoDashExplicitWrapper + fp.isEmpty(anything); // $ExpectType boolean } // _.isEqual -namespace TestIsEqual { - let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; +{ + _.isEqual(anything, anything); // $ExpectType boolean + _(anything).isEqual(anything); // $ExpectType boolean + _.chain(anything).isEqual(anything); // $ExpectType LoDashExplicitWrapper - { - let result: boolean; - - result = _.isEqual(anything, anything); - - result = _(anything).isEqual(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(anything).chain().isEqual(anything); - } + fp.isEqual(anything, anything); // $ExpectType boolean + fp.isEqual(anything)(anything); // $ExpectType boolean + fp.equals(anything)(anything); // $ExpectType boolean } // _.isEqualWith -namespace TestIsEqualWith { - let customizer = (value: any, other: any, indexOrKey: number|string|symbol|undefined, parent: any, otherParent: any, stack: any) => true; +{ + const customizer = (value: any, other: any, indexOrKey: number|string|symbol|undefined, parent: any, otherParent: any, stack: any) => true; - { - let result: boolean; + _.isEqualWith(anything, anything, customizer); // $ExpectType boolean + _(anything).isEqualWith(anything, customizer); // $ExpectType boolean + _.chain(anything).isEqualWith(anything, customizer); // $ExpectType LoDashExplicitWrapper - result = _.isEqualWith(anything, anything, customizer); - - result = _(anything).isEqualWith(anything, customizer); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(anything).chain().isEqualWith(anything, customizer); - } + fp.isEqualWith(customizer, anything, anything); // $ExpectType boolean + fp.isEqualWith(customizer)(anything)(anything); // $ExpectType boolean } // _.isError -namespace TestIsError { - let x: any = 1; +{ { - let value: number|Error = x; + const value: number | Error = anything; if (_.isError(value)) { - let result: Error = value; + value; // $ExpectType Error + } else { + value; // $ExpectType number } - else { - let result: number = value; + + if (fp.isError(value)) { + value; // $ExpectType Error + } else { + value; // $ExpectType number } } { class CustomError extends Error { - custom: string + custom: string; } - let value: number|CustomError = x; + const value: number | CustomError = anything; if (_.isError(value)) { - let result: CustomError = value; - } - else { - let result: number = value; - } - } - - { - let result: boolean; - - result = _.isError(anything); - result = _(1).isError(); - result = _([]).isError(); - result = _({}).isError(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isError(); - result = _([]).chain().isError(); - result = _({}).chain().isError(); - } -} - -// _.isFinite -namespace TestIsFinite { - { - let result: boolean; - - result = _.isFinite(anything); - result = _(1).isFinite(); - result = _([]).isFinite(); - result = _({}).isFinite(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isFinite(); - result = _([]).chain().isFinite(); - result = _({}).chain().isFinite(); - } -} - -// _.isFunction -namespace TestIsFunction { - { - let value: number|(() => void) = anything; - - if (_.isFunction(value)) { - value; // $ExpectType () => void - } - else { + value; // $ExpectType CustomError + } else { value; // $ExpectType number } - if (_.isFunction(anything)) { - anything(); + if (fp.isError(value)) { + value; // $ExpectType CustomError + } else { + value; // $ExpectType number } } - { - let result: boolean; + _.isError(anything); // $ExpectType boolean + _({}).isError(); // $ExpectType boolean + _.chain([]).isError(); // $ExpectType LoDashExplicitWrapper + fp.isError(anything); // $ExpectType boolean +} - result = _.isFunction(anything); - result = _(1).isFunction(); - result = _([]).isFunction(); - result = _({}).isFunction(); +// _.isFinite +{ + _.isFinite(NaN); // $ExpectType boolean + _(42).isFinite(); // $ExpectType boolean + _.chain([]).isFinite(); // $ExpectType LoDashExplicitWrapper + fp.isFinite(anything); // $ExpectType boolean +} + +// _.isFunction +{ + const value: number | (() => void) = anything; + + if (_.isFunction(value)) { + value; // $ExpectType () => void + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isFunction(); - result = _([]).chain().isFunction(); - result = _({}).chain().isFunction(); + if (fp.isFunction(value)) { + value; // $ExpectType () => void + } else { + value; // $ExpectType number } + + if (_.isFunction(anything)) { + anything(); + } + + if (fp.isFunction(anything)) { + anything(); + } + + _.isFunction(anything); // $ExpectType boolean + _({}).isFunction(); // $ExpectType boolean + _.chain([]).isFunction(); // $ExpectType LoDashExplicitWrapper + fp.isFunction(anything); // $ExpectType boolean } // _.isInteger -namespace TestIsInteger { - { - let result: boolean; - - result = _.isInteger(anything); - - result = _(1).isInteger(); - result = _([]).isInteger(); - result = _({}).isInteger(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isInteger(); - result = _([]).chain().isInteger(); - result = _({}).chain().isInteger(); - } +{ + _.isInteger(NaN); // $ExpectType boolean + _(42).isInteger(); // $ExpectType boolean + _.chain([]).isInteger(); // $ExpectType LoDashExplicitWrapper + fp.isInteger(anything); // $ExpectType boolean } // _.isLength -namespace TestIsLength { - { - let result: boolean; - - result = _.isLength(anything); - - result = _(1).isLength(); - result = _([]).isLength(); - result = _({}).isLength(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isLength(); - result = _([]).chain().isLength(); - result = _({}).chain().isLength(); - } +{ + _.isLength(NaN); // $ExpectType boolean + _(42).isLength(); // $ExpectType boolean + _.chain([]).isLength(); // $ExpectType LoDashExplicitWrapper + fp.isLength(anything); // $ExpectType boolean } // _.isMap -namespace TestIsMap { - { - let value: number|Map = 0; +{ + const value: number | Map = 0; - if (_.isMap(value)) { - let result: Map = value; - } - else { - let result: number = value; - } + if (_.isMap(value)) { + const result: Map = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isMap(anything); - result = _(1).isMap(); - result = _([]).isMap(); - result = _({}).isMap(); + if (fp.isMap(value)) { + const result: Map = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isMap(); - result = _([]).chain().isMap(); - result = _({}).chain().isMap(); - } + _.isMap(anything); // $ExpectType boolean + _({}).isMap(); // $ExpectType boolean + _.chain([]).isMap(); // $ExpectType LoDashExplicitWrapper + fp.isMap(anything); // $ExpectType boolean } // _.isMatch -namespace TestIsMatch { +{ _.isMatch({}, {}); // $ExpectType boolean _({}).isMatch({}); // $ExpectType boolean _.chain({}).isMatch({}); // $ExpectType LoDashExplicitWrapper + fp.isMatch({}, {}); // $ExpectType boolean + fp.isMatch({})({}); // $ExpectType boolean } // _.isMatchWith -namespace TestIsMatchWith { - let testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string|symbol) => true; +{ + const testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string|symbol) => true; _.isMatchWith({}, {}, testIsMatchCustiomizerFn); // $ExpectType boolean _({}).isMatchWith({}, testIsMatchCustiomizerFn); // $ExpectType boolean _.chain({}).isMatchWith({}, testIsMatchCustiomizerFn); // $ExpectType LoDashExplicitWrapper + + fp.isMatchWith(testIsMatchCustiomizerFn, {}, {}); // $ExpectType boolean + fp.isMatchWith(testIsMatchCustiomizerFn)({})({}); // $ExpectType boolean } // _.isNaN -namespace TestIsNaN { - { - let result: boolean; - - result = _.isNaN(anything); - - result = _(1).isNaN(); - result = _([]).isNaN(); - result = _({}).isNaN(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNaN(); - result = _([]).chain().isNaN(); - result = _({}).chain().isNaN(); - } +{ + _.isNaN(NaN); // $ExpectType boolean + _(42).isNaN(); // $ExpectType boolean + _.chain([]).isNaN(); // $ExpectType LoDashExplicitWrapper + fp.isNaN(anything); // $ExpectType boolean } // _.isNative -namespace TestIsNative { - { - let value: number|(() => void) = anything; +{ + const value: number | (() => void) = anything; - if (_.isNative(value)) { - value; // $ExpectType () => void - } - else { - value; // $ExpectType number - } + if (_.isNative(value)) { + value; // $ExpectType () => void + } else { + value; // $ExpectType number } - { - let result: boolean; - - result = _.isNative(anything); - - result = _(1).isNative(); - result = _([]).isNative(); - result = _({}).isNative(); + if (fp.isNative(value)) { + value; // $ExpectType () => void + } else { + value; // $ExpectType number } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNative(); - result = _([]).chain().isNative(); - result = _({}).chain().isNative(); - } + _.isNative(anything); // $ExpectType boolean + _({}).isNative(); // $ExpectType boolean + _.chain([]).isNative(); // $ExpectType LoDashExplicitWrapper + fp.isNative(anything); // $ExpectType boolean } // _.isNil -namespace TestIsNil { - { - let result: boolean; - - result = _.isNil(anything); - - result = _(1).isNil(); - result = _([]).isNil(); - result = _({}).isNil(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNil(); - result = _([]).chain().isNil(); - result = _({}).chain().isNil(); - } +{ + _.isNil(null); // $ExpectType boolean + _(undefined).isNil(); // $ExpectType boolean + _.chain(NaN).isNil(); // $ExpectType LoDashExplicitWrapper + fp.isNil(undefined); // $ExpectType boolean } // _.isNull -namespace TestIsNull { - { - let result: boolean; - - result = _.isNull(anything); - - result = _(1).isNull(); - result = _([]).isNull(); - result = _({}).isNull(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNull(); - result = _([]).chain().isNull(); - result = _({}).chain().isNull(); - } +{ + _.isNull(null); // $ExpectType boolean + _(undefined).isNull(); // $ExpectType boolean + _.chain(NaN).isNull(); // $ExpectType LoDashExplicitWrapper + fp.isNull(undefined); // $ExpectType boolean } // _.isNumber -namespace TestIsNumber { - { - let value: string|number = 0; +{ + const value: string | number = 0; - if (_.isNumber(value)) { - let result: number = value; - } - else { - let result: string = value; - } + if (_.isNumber(value)) { + const result: number = value; + } else { + const result: string = value; } - { - let result: boolean; - - result = _.isNumber(anything); - - result = _(1).isNumber(); - result = _([]).isNumber(); - result = _({}).isNumber(); + if (fp.isNumber(value)) { + const result: number = value; + } else { + const result: string = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isNumber(); - result = _([]).chain().isNumber(); - result = _({}).chain().isNumber(); - } + _.isNumber(NaN); // $ExpectType boolean + _(42).isNumber(); // $ExpectType boolean + _.chain([]).isNumber(); // $ExpectType LoDashExplicitWrapper + fp.isNumber(anything); // $ExpectType boolean } // _.isObject -namespace TestIsObject { - { - let result: boolean; - - result = _.isObject(anything); - result = _(1).isObject(); - result = _([]).isObject(); - result = _({}).isObject(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isObject(); - result = _([]).chain().isObject(); - result = _({}).chain().isObject(); - } +{ + _.isObject(NaN); // $ExpectType boolean + _(42).isObject(); // $ExpectType boolean + _.chain([]).isObject(); // $ExpectType LoDashExplicitWrapper + fp.isObject(anything); // $ExpectType boolean } // _.isObjectLike -namespace TestIsObjectLike { - { - let result: boolean; - - result = _.isObjectLike(anything); - result = _(1).isObjectLike(); - result = _([]).isObjectLike(); - result = _({}).isObjectLike(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isObjectLike(); - result = _([]).chain().isObjectLike(); - result = _({}).chain().isObjectLike(); - } +{ + _.isObjectLike(NaN); // $ExpectType boolean + _(42).isObjectLike(); // $ExpectType boolean + _.chain([]).isObjectLike(); // $ExpectType LoDashExplicitWrapper + fp.isObjectLike(anything); // $ExpectType boolean } // _.isPlainObject -namespace TestIsPlainObject { - { - let result: boolean; - - result = _.isPlainObject(anything); - result = _(1).isPlainObject(); - result = _([]).isPlainObject(); - result = _({}).isPlainObject(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isPlainObject(); - result = _([]).chain().isPlainObject(); - result = _({}).chain().isPlainObject(); - } +{ + _.isPlainObject(NaN); // $ExpectType boolean + _(42).isPlainObject(); // $ExpectType boolean + _.chain([]).isPlainObject(); // $ExpectType LoDashExplicitWrapper + fp.isPlainObject(anything); // $ExpectType boolean } // _.isRegExp -namespace TestIsRegExp { +{ { - let value: number|RegExp = /./; + const value: number | RegExp = anything; if (_.isRegExp(value)) { - let result: RegExp = value; + const result: RegExp = value; + } else { + const result: number = value; } - else { - let result: number = value; + + if (fp.isRegExp(value)) { + const result: RegExp = value; + } else { + const result: number = value; } } - { - let result: boolean; - - result = _.isRegExp(anything); - result = _(1).isRegExp(); - result = _([]).isRegExp(); - result = _({}).isRegExp(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isRegExp(); - result = _([]).chain().isRegExp(); - result = _({}).chain().isRegExp(); - } + _.isRegExp(/./); // $ExpectType boolean + _(42).isRegExp(); // $ExpectType boolean + _.chain([]).isRegExp(); // $ExpectType LoDashExplicitWrapper + fp.isRegExp(anything); // $ExpectType boolean } // _.isSafeInteger -namespace TestIsSafeInteger { - { - let result: boolean; - - result = _.isSafeInteger(anything); - - result = _(1).isSafeInteger(); - result = _([]).isSafeInteger(); - result = _({}).isSafeInteger(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isSafeInteger(); - result = _([]).chain().isSafeInteger(); - result = _({}).chain().isSafeInteger(); - } +{ + _.isSafeInteger(NaN); // $ExpectType boolean + _(42).isSafeInteger(); // $ExpectType boolean + _.chain([]).isSafeInteger(); // $ExpectType LoDashExplicitWrapper + fp.isSafeInteger(anything); // $ExpectType boolean } // _.isSet -namespace TestIsSet { - { - let value: number|Set = 0; +{ + const value: number | Set = 0; - if (_.isSet(value)) { - let result: Set = value; - } - else { - let result: number = value; - } + if (_.isSet(value)) { + const result: Set = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isSet(anything); - result = _(1).isSet(); - result = _([]).isSet(); - result = _({}).isSet(); + if (fp.isSet(value)) { + const result: Set = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isSet(); - result = _([]).chain().isSet(); - result = _({}).chain().isSet(); - } + _.isSet(NaN); // $ExpectType boolean + _(42).isSet(); // $ExpectType boolean + _.chain([]).isSet(); // $ExpectType LoDashExplicitWrapper + fp.isSet(anything); // $ExpectType boolean } // _.isString -namespace TestIsString { - { - let value: number|string = ''; +{ + const value: number | string = ""; - if (_.isString(value)) { - let result: string = value; - } - else { - let result: number = value; - } + if (_.isString(value)) { + const result: string = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isString(anything); - result = _(1).isString(); - result = _([]).isString(); - result = _({}).isString(); + if (fp.isString(value)) { + const result: string = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isString(); - result = _([]).chain().isString(); - result = _({}).chain().isString(); - } + _.isString(""); // $ExpectType boolean + _(42).isString(); // $ExpectType boolean + _.chain([]).isString(); // $ExpectType LoDashExplicitWrapper + fp.isString(anything); // $ExpectType boolean } // _.isSymbol -namespace TestIsSymbol { - { - let result: boolean; - - result = _.isSymbol(anything); - - result = _(1).isSymbol(); - result = _([]).isSymbol(); - result = _({}).isSymbol(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isSymbol(); - result = _([]).chain().isSymbol(); - result = _({}).chain().isSymbol(); - } +{ + _.isSymbol(NaN); // $ExpectType boolean + _(42).isSymbol(); // $ExpectType boolean + _.chain([]).isSymbol(); // $ExpectType LoDashExplicitWrapper + fp.isSymbol(anything); // $ExpectType boolean } // _.isTypedArray -namespace TestIsTypedArray { - { - let result: boolean; - - result = _.isTypedArray([]); - result = _([]).isTypedArray(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _([]).chain().isTypedArray(); - } +{ + _.isTypedArray(NaN); // $ExpectType boolean + _(42).isTypedArray(); // $ExpectType boolean + _.chain([]).isTypedArray(); // $ExpectType LoDashExplicitWrapper + fp.isTypedArray(anything); // $ExpectType boolean } // _.isUndefined -namespace TestIsUndefined { - { - let result: boolean; - - result = _.isUndefined(anything); - - result = _(1).isUndefined(); - result = _([]).isUndefined(); - result = _({}).isUndefined(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isUndefined(); - result = _([]).chain().isUndefined(); - result = _({}).chain().isUndefined(); - } +{ + _.isUndefined(null); // $ExpectType boolean + _(undefined).isUndefined(); // $ExpectType boolean + _.chain(NaN).isUndefined(); // $ExpectType LoDashExplicitWrapper + fp.isUndefined(undefined); // $ExpectType boolean } // _.isWeakMap -namespace TestIsWeakMap { - { - let value: number | WeakMap = 0; +{ + const value: number | WeakMap = 0; - if (_.isWeakMap(value)) { - let result: WeakMap = value; - } - else { - let result: number = value; - } + if (_.isWeakMap(value)) { + const result: WeakMap = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isWeakMap(anything); - result = _(1).isWeakMap(); - result = _([]).isWeakMap(); - result = _({}).isWeakMap(); + if (fp.isWeakMap(value)) { + const result: WeakMap = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isWeakMap(); - result = _([]).chain().isWeakMap(); - result = _({}).chain().isWeakMap(); - } + _.isWeakMap(NaN); // $ExpectType boolean + _(42).isWeakMap(); // $ExpectType boolean + _.chain([]).isWeakMap(); // $ExpectType LoDashExplicitWrapper + fp.isWeakMap(anything); // $ExpectType boolean } // _.isWeakSet -namespace TestIsWeakSet { - { - let value: number | WeakSet = 0; +{ + const value: number | WeakSet = 0; - if (_.isWeakSet(value)) { - let result: WeakSet = value; - } - else { - let result: number = value; - } + if (_.isWeakSet(value)) { + const result: WeakSet = value; + } else { + const result: number = value; } - { - let result: boolean; - - result = _.isWeakSet(anything); - result = _(1).isWeakSet(); - result = _([]).isWeakSet(); - result = _({}).isWeakSet(); + if (fp.isWeakSet(value)) { + const result: WeakSet = value; + } else { + const result: number = value; } - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().isWeakSet(); - result = _([]).chain().isWeakSet(); - result = _({}).chain().isWeakSet(); - } + _.isWeakSet(NaN); // $ExpectType boolean + _(42).isWeakSet(); // $ExpectType boolean + _.chain([]).isWeakSet(); // $ExpectType LoDashExplicitWrapper + fp.isWeakSet(anything); // $ExpectType boolean } // _.lt -namespace TestLt { - { - let result: boolean; +{ + _.lt(anything, anything); // $ExpectType boolean + _(anything).lt(anything); // $ExpectType boolean + _.chain(anything).lt(anything); // $ExpectType LoDashExplicitWrapper - result = _.lt(anything, anything); - result = _(1).lt(anything); - result = _([]).lt(anything); - result = _({}).lt(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().lt(anything); - result = _([]).chain().lt(anything); - result = _({}).chain().lt(anything); - } + fp.lt(anything, anything); // $ExpectType boolean + fp.lt(anything)(anything); // $ExpectType boolean } // _.lte -namespace TestLte { - { - let result: boolean; +{ + _.lte(anything, anything); // $ExpectType boolean + _(anything).lte(anything); // $ExpectType boolean + _.chain(anything).lte(anything); // $ExpectType LoDashExplicitWrapper - result = _.lte(anything, anything); - result = _(1).lte(anything); - result = _([]).lte(anything); - result = _({}).lte(anything); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().lte(anything); - result = _([]).chain().lte(anything); - result = _({}).chain().lte(anything); - } + fp.lte(anything, anything); // $ExpectType boolean + fp.lte(anything)(anything); // $ExpectType boolean } // _.toArray -namespace TestToArray { - let array: AbcObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; +{ + const array: AbcObject[] = []; + const list: _.List = []; + const dictionary: _.Dictionary = {}; + const numericDictionary: _.NumericDictionary = {}; - { - let result: string[]; + _.toArray(""); // $ExpectType string[] + _.toArray(array); // $ExpectType AbcObject[] + _.toArray(list); // $ExpectType AbcObject[] + _.toArray(dictionary); // $ExpectType AbcObject[] + _.toArray(numericDictionary); // $ExpectType AbcObject[] - result = _.toArray(''); - result = _.toArray(''); - } + _(array).toArray(); // $ExpectType LoDashImplicitWrapper + _(list).toArray(); // $ExpectType LoDashImplicitWrapper + _(dictionary).toArray(); // $ExpectType LoDashImplicitWrapper + _(numericDictionary).toArray(); // $ExpectType LoDashImplicitWrapper - { - let result: AbcObject[]; + _.chain(array).toArray(); // $ExpectType LoDashExplicitWrapper + _.chain(list).toArray(); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).toArray(); // $ExpectType LoDashExplicitWrapper + _.chain(numericDictionary).toArray(); // $ExpectType LoDashExplicitWrapper - result = _.toArray(array); - result = _.toArray(list); - result = _.toArray(dictionary); - result = _.toArray(numericDictionary); - - result = _.toArray(array); - result = _.toArray(list); - result = _.toArray(dictionary); - result = _.toArray(numericDictionary); - } - - { - let result: any[]; - - result = _.toArray(); - result = _.toArray(42); - result = _.toArray(true); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).toArray(); - result = _(list).toArray(); - result = _(dictionary).toArray(); - result = _(numericDictionary).toArray(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().toArray(); - result = _(list).chain().toArray(); - result = _(dictionary).chain().toArray(); - result = _(numericDictionary).chain().toArray(); - } + fp.toArray(""); // $ExpectType string[] + fp.toArray(array); // $ExpectType AbcObject[] + fp.toArray(list); // $ExpectType AbcObject[] + fp.toArray(dictionary); // $ExpectType AbcObject[] + fp.toArray(numericDictionary); // $ExpectType AbcObject[] } // _.toPlainObject -namespace TestToPlainObject { - { - let result: AbcObject; - result = _.toPlainObject(); - result = _.toPlainObject(true); - result = _.toPlainObject(1); - result = _.toPlainObject('a'); - result = _.toPlainObject([]); - result = _.toPlainObject({}); - } +{ + _.toPlainObject(); // $ExpectType any + _.toPlainObject(true); // $ExpectType any + _.toPlainObject(1); // $ExpectType any + _.toPlainObject("a"); // $ExpectType any + _.toPlainObject([]); // $ExpectType any + _.toPlainObject({}); // $ExpectType any - { - let result: _.LoDashImplicitObjectWrapper; + _(true).toPlainObject(); // $ExpectType LoDashImplicitWrapper + _([""]).toPlainObject(); // $ExpectType LoDashImplicitWrapper + _({}).toPlainObject(); // $ExpectType LoDashImplicitWrapper - result = _(true).toPlainObject(); - result = _(1).toPlainObject(); - result = _('a').toPlainObject(); - result = _([1]).toPlainObject(); - result = _(['']).toPlainObject(); - result = _({}).toPlainObject(); - } + _.chain(true).toPlainObject(); // $ExpectType LoDashExplicitWrapper + _.chain([""]).toPlainObject(); // $ExpectType LoDashExplicitWrapper + _.chain({}).toPlainObject(); // $ExpectType LoDashExplicitWrapper + + fp.toPlainObject(true); // $ExpectType any + fp.toPlainObject(["a"]); // $ExpectType any + fp.toPlainObject({}); // $ExpectType any } // _.toFinite -namespace TestToFinite { - { - let result: number; - result = _.toFinite(true); - result = _.toFinite(1); - result = _.toFinite('3.2'); - result = _.toFinite([]); - result = _.toFinite({}); - } - - { - let result: number; - - result = _(true).toFinite(); - result = _(1).toFinite(); - result = _('3.2').toFinite(); - result = _([1]).toFinite(); - result = _([]).toFinite(); - result = _({}).toFinite(); - } +{ + _.toFinite(true); // $ExpectType number + _.toFinite(1); // $ExpectType number + _.toFinite("3.2"); // $ExpectType number + _(1).toFinite(); // $ExpectType number + _("3.2").toFinite(); // $ExpectType number + _.chain(1).toFinite(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toFinite(); // $ExpectType LoDashExplicitWrapper + fp.toFinite(true); // $ExpectType number + fp.toFinite(1); // $ExpectType number + fp.toFinite("3.2"); // $ExpectType number } // _.toInteger -namespace TestToInteger { - { - let result: number; - result = _.toInteger(true); - result = _.toInteger(1); - result = _.toInteger('3.2'); - result = _.toInteger([]); - result = _.toInteger({}); - } - - { - let result: number; - - result = _(true).toInteger(); - result = _(1).toInteger(); - result = _('a').toInteger(); - result = _([1]).toInteger(); - result = _(['']).toInteger(); - result = _({}).toInteger(); - } +{ + _.toInteger(true); // $ExpectType number + _.toInteger(1); // $ExpectType number + _.toInteger("3.2"); // $ExpectType number + _(1).toInteger(); // $ExpectType number + _("3.2").toInteger(); // $ExpectType number + _.chain(1).toInteger(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toInteger(); // $ExpectType LoDashExplicitWrapper + fp.toInteger(true); // $ExpectType number + fp.toInteger(1); // $ExpectType number + fp.toInteger("3.2"); // $ExpectType number } // _.toLength -namespace TestToLength { - { - let result: number; - result = _.toLength(true); - result = _.toLength(1); - result = _.toLength('a'); - result = _.toLength([]); - result = _.toLength({}); - } - - { - let result: number; - - result = _(true).toLength(); - result = _(1).toLength(); - result = _('a').toLength(); - result = _([1]).toLength(); - result = _(['']).toLength(); - result = _({}).toLength(); - } +{ + _.toLength(true); // $ExpectType number + _.toLength(1); // $ExpectType number + _.toLength("3.2"); // $ExpectType number + _(1).toLength(); // $ExpectType number + _("3.2").toLength(); // $ExpectType number + _.chain(1).toLength(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toLength(); // $ExpectType LoDashExplicitWrapper + fp.toLength(true); // $ExpectType number + fp.toLength(1); // $ExpectType number + fp.toLength("3.2"); // $ExpectType number } // _.toNumber -namespace TestToNumber { - { - let result: number; - result = _.toNumber(true); - result = _.toNumber(1); - result = _.toNumber('a'); - result = _.toNumber([]); - result = _.toNumber({}); - } - - { - let result: number; - - result = _(true).toNumber(); - result = _(1).toNumber(); - result = _('a').toNumber(); - result = _([1]).toNumber(); - result = _(['']).toNumber(); - result = _({}).toNumber(); - } +{ + _.toNumber(true); // $ExpectType number + _.toNumber(1); // $ExpectType number + _.toNumber("3.2"); // $ExpectType number + _(1).toNumber(); // $ExpectType number + _("3.2").toNumber(); // $ExpectType number + _.chain(1).toNumber(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toNumber(); // $ExpectType LoDashExplicitWrapper + fp.toNumber(true); // $ExpectType number + fp.toNumber(1); // $ExpectType number + fp.toNumber("3.2"); // $ExpectType number } // _.toSafeInteger -namespace TestToSafeInteger { - { - let result: number; - result = _.toSafeInteger(true); - result = _.toSafeInteger(1); - result = _.toSafeInteger('a'); - result = _.toSafeInteger([]); - result = _.toSafeInteger({}); - } - - { - let result: number; - - result = _(true).toSafeInteger(); - result = _(1).toSafeInteger(); - result = _('a').toSafeInteger(); - result = _([1]).toSafeInteger(); - result = _(['']).toSafeInteger(); - result = _({}).toSafeInteger(); - } +{ + _.toSafeInteger(true); // $ExpectType number + _.toSafeInteger(1); // $ExpectType number + _.toSafeInteger("3.2"); // $ExpectType number + _(1).toSafeInteger(); // $ExpectType number + _("3.2").toSafeInteger(); // $ExpectType number + _.chain(1).toSafeInteger(); // $ExpectType LoDashExplicitWrapper + _.chain("3.2").toSafeInteger(); // $ExpectType LoDashExplicitWrapper + fp.toSafeInteger(true); // $ExpectType number + fp.toSafeInteger(1); // $ExpectType number + fp.toSafeInteger("3.2"); // $ExpectType number } /******** @@ -9500,400 +4804,230 @@ namespace TestToSafeInteger { ********/ // _.add -namespace TestAdd { - { - let result: number; - - result = _.add(1, 1); - result = _(1).add(1); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(1).chain().add(1); - } +{ + _.add(1, 1); // $ExpectType number + _(1).add(1); // $ExpectType number + _(1).chain().add(1); // $ExpectType LoDashExplicitWrapper + fp.add(1, 1); // $ExpectType number + fp.add(1)(1); // $ExpectType number } // _.ceil -namespace TestCeil { - { - let result: number; - - result = _.ceil(6.004); - result = _.ceil(6.004, 2); - - result = _(6.004).ceil(); - result = _(6.004).ceil(2); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(6.004).chain().ceil(); - result = _(6.004).chain().ceil(2); - } +{ + _.ceil(6.004); // $ExpectType number + _.ceil(6.004, 2); // $ExpectType number + _(6.004).ceil(); // $ExpectType number + _(6.004).ceil(2); // $ExpectType number + _(6.004).chain().ceil(); // $ExpectType LoDashExplicitWrapper + _(6.004).chain().ceil(2); // $ExpectType LoDashExplicitWrapper + fp.ceil(6.004); // $ExpectType number } // _.divide -namespace TestDivide { - { - let result: number; - - result = _.divide(6, 4); - - result = _(6).divide(4); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(6).chain().floor(4); - } +{ + _.divide(6, 4); // $ExpectType number + _(6).divide(4); // $ExpectType number + _(6).chain().floor(4); // $ExpectType LoDashExplicitWrapper + fp.divide(6, 4); // $ExpectType number + fp.divide(6)(4); // $ExpectType number } // _.floor -namespace TestFloor { - { - let result: number; - - result = _.floor(4.006); - result = _.floor(0.046, 2); - result = _.floor(4060, -2); - - result = _(4.006).floor(); - result = _(0.046).floor(2); - result = _(4060).floor(-2); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(4.006).chain().floor(); - result = _(0.046).chain().floor(2); - result = _(4060).chain().floor(-2); - } +{ + _.floor(4.006); // $ExpectType number + _.floor(0.046, 2); // $ExpectType number + _.floor(4060, -2); // $ExpectType number + _(4.006).floor(); // $ExpectType number + _(0.046).floor(2); // $ExpectType number + _(4060).floor(-2); // $ExpectType number + _(4.006).chain().floor(); // $ExpectType LoDashExplicitWrapper + _(0.046).chain().floor(2); // $ExpectType LoDashExplicitWrapper + _(4060).chain().floor(-2); // $ExpectType LoDashExplicitWrapper + fp.floor(4.006); // $ExpectType number } // _.max -namespace TestMax { - let array: number[] = []; - let list: _.List = []; +// _.min +{ + const list: ArrayLike = anything; - let result: number | undefined; + _.max(list); // $ExpectType string | undefined + _(list).max(); // $ExpectType string | undefined + _.chain(list).max(); // $ExpectType LoDashExplicitWrapper + fp.max(list); // $ExpectType string | undefined - result = _.max(array); - result = _.max(list); - - result = _(array).max(); - result = _(list).max(); + _.min(list); // $ExpectType string | undefined + _(list).min(); // $ExpectType string | undefined + _.chain(list).min(); // $ExpectType LoDashExplicitWrapper + fp.min(list); // $ExpectType string | undefined } // _.maxBy -namespace TestMaxBy { - let array: number[] = []; - let list: _.List = []; - let array2: AbcObject[] = []; - let list2: _.List = []; +// _.minBy +{ + const list: ArrayLike = anything; - let listIterator = (value: number, index: number, collection: _.List) => 0; + const listIterator = (value: AbcObject, index: number, collection: ArrayLike) => 0; + const valueIterator = (value: AbcObject) => 0; - let result: number | undefined; - let result2: AbcObject | undefined; + _.maxBy(list, listIterator); // $ExpectType AbcObject | undefined + _.maxBy(list, "a"); // $ExpectType AbcObject | undefined + _.maxBy(list, { a: 42 }); // $ExpectType AbcObject | undefined + _(list).maxBy(listIterator); // $ExpectType AbcObject | undefined + _(list).maxBy("a"); // $ExpectType AbcObject | undefined + _(list).maxBy({ a: 42 }); // $ExpectType AbcObject | undefined + _.chain(list).maxBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).maxBy("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).maxBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.maxBy(valueIterator)(list); // $ExpectType AbcObject | undefined + fp.maxBy("a", list); // $ExpectType AbcObject | undefined + fp.maxBy({ a: 42 }, list); // $ExpectType AbcObject | undefined - result = _.maxBy(array); - result = _.maxBy(array, listIterator); - result = _.maxBy(array, ''); - result2 = _.maxBy(array2, {a: 42}); - - result = _.maxBy(list); - result = _.maxBy(list, listIterator); - result = _.maxBy(list, ''); - result2 = _.maxBy(list2, {a: 42}); - - result = _(array).maxBy(); - result = _(array).maxBy(listIterator); - result = _(array).maxBy(''); - result2 = _(array2).maxBy({a: 42}); - - result = _(list).maxBy(); - result = _(list).maxBy(listIterator); - result = _(list).maxBy(''); - result2 = _(list2).maxBy({a: 42}); + _.minBy(list, listIterator); // $ExpectType AbcObject | undefined + _.minBy(list, "a"); // $ExpectType AbcObject | undefined + _.minBy(list, { a: 42 }); // $ExpectType AbcObject | undefined + _(list).minBy(listIterator); // $ExpectType AbcObject | undefined + _(list).minBy("a"); // $ExpectType AbcObject | undefined + _(list).minBy({ a: 42 }); // $ExpectType AbcObject | undefined + _.chain(list).minBy(listIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).minBy("a"); // $ExpectType LoDashExplicitWrapper + _.chain(list).minBy({ a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.minBy(valueIterator)(list); // $ExpectType AbcObject | undefined + fp.minBy("a", list); // $ExpectType AbcObject | undefined + fp.minBy({ a: 42 }, list); // $ExpectType AbcObject | undefined } // _.mean -namespace TestMean { - let array: number[] = []; +{ + const list: ArrayLike = anything; - let result: number; - - result = _.mean(array); - - result = _(array).mean(); + _.mean(list); // $ExpectType number + _(list).mean(); // $ExpectType number + _.chain(list).mean(); // $ExpectType LoDashExplicitWrapper + fp.mean(list); // $ExpectType number } // _.meanBy { - let array: AbcObject[] = []; + const list: ArrayLike = anything; - let result: number; + _.meanBy(list, (x) => x.a); // $ExpectType number + _.meanBy(list, "a"); // $ExpectType number + _(list).meanBy((x) => x.a); // $ExpectType number + _.chain(list).meanBy((x) => x.a); // $ExpectType LoDashExplicitWrapper - result = _.meanBy(array, (x) => x.a); - result = _.meanBy(array, 'a'); - - result = _(array).mean(); -} - -// _.min -namespace TestMin { - let array: number[] = []; - let list: _.List = []; - - let result: number | undefined; - - result = _.min(array); - result = _.min(list); - - result = _(array).min(); - result = _(list).min(); -} - -// _.minBy -namespace TestMinBy { - let array: number[] = []; - let list: _.List = []; - let array2: AbcObject[] = []; - let list2: _.List = []; - - let listIterator = (value: number, index: number, collection: _.List) => 0; - - let result: number | undefined; - let result2: AbcObject | undefined; - - result = _.minBy(array); - result = _.minBy(array, listIterator); - result = _.minBy(array, ''); - result2 = _.minBy(array2, {a: 42}); - - result = _.minBy(list); - result = _.minBy(list, listIterator); - result = _.minBy(list, ''); - result2 = _.minBy(list2, {a: 42}); - - result = _(array).minBy(); - result = _(array).minBy(listIterator); - result = _(array).minBy(''); - result2 = _(array2).minBy({a: 42}); - - result = _(list).minBy(); - result = _(list).minBy(listIterator); - result = _(list).minBy(''); - result2 = _(list2).minBy({a: 42}); + fp.meanBy((x) => x.a, list); // $ExpectType number + fp.meanBy((x: AbcObject) => x.a)(list); // $ExpectType number + fp.meanBy("a", list); // $ExpectType number } // _.multiply -namespace TestMultiply { - { - let result: number; - - result = _.multiply(6, 4); - - result = _(6).multiply(4); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(6).chain().multiply(4); - } +{ + _.multiply(6, 4); // $ExpectType number + _(6).multiply(4); // $ExpectType number + _(6).chain().multiply(4); // $ExpectType LoDashExplicitWrapper + fp.multiply(6, 4); // $ExpectType number + fp.multiply(6)(4); // $ExpectType number } // _.round -namespace TestRound { - { - let result: number; +{ + _.round(4.006); // $ExpectType number + _.round(4.006, 2); // $ExpectType number + _(4.006).round(); // $ExpectType number + _(4.006).round(2); // $ExpectType number + _(4.006).chain().round(); // $ExpectType LoDashExplicitWrapper + _(4.006).chain().round(2); // $ExpectType LoDashExplicitWrapper + fp.round(4.006); // $ExpectType number +} - result = _.round(4.006); - result = _.round(4.006, 2); - - result = _(4.006).round(); - result = _(4.006).round(2); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(4.006).chain().round(); - result = _(4.006).chain().round(2); - } + // _.subtract +{ + _.subtract(3, 2); // $ExpectType number + _(3).subtract(2); // $ExpectType number + _(3).chain().subtract(2); // $ExpectType LoDashExplicitWrapper + fp.subtract(3, 2); // $ExpectType number + fp.subtract(3)(2); // $ExpectType number } // _.sum -namespace TestSum { - let array: number[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; - let obj: any = {}; - let dictionary: _.Dictionary | null | undefined = obj; +{ + const list: ArrayLike | null | undefined = anything; - let listIterator = (value: number, index: number, collection: _.List) => 0; - let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; - - { - let result: number; - - result = _.sum(array); - - result = _.sum(list); - - result = _(array).sum(); - - result = _(list).sum(); - - result = _(dictionary).sum(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().sum(); - - result = _(list).chain().sum(); - - result = _(dictionary).chain().sum(); - } + _.sum(list); // $ExpectType number + _(list).sum(); // $ExpectType number + _(list).chain().sum(); // $ExpectType LoDashExplicitWrapper + fp.sum(list); // $ExpectType number } // _.sumBy -namespace TestSumBy { - let array: number[] | null | undefined = [] as any; - let objectArray: Array<{ 'age': number }> | null | undefined = [] as any; +{ + const list: ArrayLike | null | undefined = anything; + const listIterator = (value: AbcObject) => 0; - let list: _.List | null | undefined = [] as any; - let objectList: _.List<{ 'age': number }> | null | undefined = [] as any; + _.sumBy(list, listIterator); // $ExpectType number + _.sumBy(list, "a"); // $ExpectType number + _(list).sumBy(listIterator); // $ExpectType number + _(list).sumBy("a"); // $ExpectType number + _(list).chain().sumBy(listIterator); // $ExpectType LoDashExplicitWrapper + _(list).chain().sumBy("a"); // $ExpectType LoDashExplicitWrapper - let listIterator = (value: number) => 0; - - { - let result: number; - - result = _.sumBy(array); - result = _.sumBy(array, listIterator); - result = _.sumBy(objectArray, 'age'); - - result = _.sumBy(list); - result = _.sumBy(list, listIterator); - result = _.sumBy(objectList, 'age'); - - result = _(array).sumBy(listIterator); - result = _(objectArray).sumBy('age'); - - result = _(list).sumBy(listIterator); - result = _(objectList).sumBy('age'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().sumBy(listIterator); - result = _(objectArray).chain().sumBy('age'); - - result = _(list).chain().sumBy(listIterator); - result = _(objectList).chain().sumBy('age'); - } + fp.sumBy(listIterator, list); // $ExpectType number + fp.sumBy("a")(list); // $ExpectType number } /********** * Number * **********/ - // _.subtract - namespace subtract { - { - let result: number; - - result = _.subtract(3, 2); - - result = _(3).subtract(2); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(3).chain().subtract(2); - } - } - // _.clamp -namespace TestInClamp { - { - let result: number; - - result = _.clamp(3, 2, 4); - result = _.clamp(3, 4); - - result = _(3).clamp(2, 4); - result = _(3).clamp(4); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(3).chain().clamp(2, 4); - } +{ + _.clamp(3, 2, 4); // $ExpectType number + _.clamp(3, 4); // $ExpectType number + _(3).clamp(2, 4); // $ExpectType number + _(3).clamp(4); // $ExpectType number + _.chain(3).clamp(2, 4); // $ExpectType LoDashExplicitWrapper + fp.clamp(2, 4, 3); // $ExpectType number + fp.clamp(2)(4)(3); // $ExpectType number } // _.inRange -namespace TestInRange { - { - let result: boolean; - - result = _.inRange(3, 2, 4); - result = _.inRange(4, 8); - - result = _(3).inRange(2, 4); - result = _(4).inRange(8); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(3).chain().inRange(2, 4); - result = _(4).chain().inRange(8); - } +{ + _.inRange(3, 2, 4); // $ExpectType boolean + _.inRange(4, 8); // $ExpectType boolean + _(3).inRange(2, 4); // $ExpectType boolean + _(4).inRange(8); // $ExpectType boolean + _.chain(3).inRange(2, 4); // $ExpectType LoDashExplicitWrapper + _.chain(4).inRange(8); // $ExpectType LoDashExplicitWrapper + fp.inRange(2, 4, 3); // $ExpectType boolean + fp.inRange(2)(4)(3); // $ExpectType boolean } // _.random -namespace TestRandom { - { - let result: number; +{ + _.random(); // $ExpectType number + _.random(1); // $ExpectType number + _.random(1, 2); // $ExpectType number + _.random(1, 2, true); // $ExpectType number + _.random(1, true); // $ExpectType number + _.random(true); // $ExpectType number - result = _.random(); - result = _.random(1); - result = _.random(1, 2); - result = _.random(1, 2, true); - result = _.random(1, true); - result = _.random(true); + _(1).random(); // $ExpectType number + _(1).random(2); // $ExpectType number + _(1).random(2, true); // $ExpectType number + _(1).random(true); // $ExpectType number + _(true).random(); // $ExpectType number - result = _(1).random(); - result = _(1).random(2); - result = _(1).random(2, true); - result = _(1).random(true); - result = _(true).random(); - } + _.chain(1).random(); // $ExpectType LoDashExplicitWrapper + _.chain(1).random(2); // $ExpectType LoDashExplicitWrapper + _.chain(1).random(2, true); // $ExpectType LoDashExplicitWrapper + _.chain(1).random(true); // $ExpectType LoDashExplicitWrapper + _.chain(true).random(); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashExplicitWrapper; + fp.random(1, 2); // $ExpectType number + fp.random(1)(2); // $ExpectType number - result = _(1).chain().random(); - result = _(1).chain().random(2); - result = _(1).chain().random(2, true); - result = _(1).chain().random(true); - result = _(true).chain().random(); - } - - // $ExpectType number[] - _.map([5, 5], _.random); + _.map([5, 5], _.random); // $ExpectType number[] } /********** @@ -9901,1813 +5035,558 @@ namespace TestRandom { **********/ // _.assign -namespace TestAssign { - interface Obj { a: string }; - interface S1 { a: number }; - interface S2 { b: number }; - interface S3 { c: number }; - interface S4 { d: number }; - interface S5 { e: number }; - - 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; - - result = _.assign(obj); - } - - { - let result: { a: number }; - - result = _.assign(obj, s1); - } - - { - let result: { a: number, b: number }; - - result = _.assign(obj, s1, s2); - } - - { - let result: { a: number, b: number, c: number }; - - result = _.assign(obj, s1, s2, s3); - } - - { - let result: { a: number, b: number, c: number, d: number }; - - result = _.assign(obj, s1, s2, s3, s4); - } - - { - let result: { a: number, b: number, c: number, d: number, e: number }; - - result = _.assign(obj, s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).assign(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).assign(s1); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).assign(s1, s2); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).assign(s1, s2, s3); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).assign(s1, s2, s3, s4); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).assign(s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().assign(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).chain().assign(s1); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).chain().assign(s1, s2); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).chain().assign(s1, s2, s3); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).chain().assign(s1, s2, s3, s4); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).chain().assign(s1, s2, s3, s4, s5); - } -} - -// _.assignWith -namespace TestAssignWith { - interface Obj { a: string }; - interface S1 { a: number }; - interface S2 { b: number }; - interface S3 { c: number }; - interface S4 { d: number }; - interface S5 { e: number }; - - 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 = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; - - { - let result: Obj; - - result = _.assignWith(obj); - } - - { - let result: { a: number }; - result = _.assignWith(obj, s1, customizer); - } - - { - let result: { a: number, b: number }; - result = _.assignWith(obj, s1, s2, customizer); - } - - { - let result: { a: number, b: number, c: number }; - result = _.assignWith(obj, s1, s2, s3, customizer); - } - - { - let result: { a: number, b: number, c: number, d: number }; - result = _.assignWith(obj, s1, s2, s3, s4, customizer); - } - - { - let result: { a: number, b: number, c: number, d: number, e: number }; - result = _.assignWith<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).assignWith(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - result = _(obj).assignWith(s1, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - result = _(obj).assignWith(s1, s2, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - result = _(obj).assignWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - result = _(obj).assignWith(s1, s2, s3, s4, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).assignWith<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().assignWith(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string }>; - result = _(obj).chain().assignWith(s1, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - result = _(obj).chain().assignWith(s1, s2, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - result = _(obj).chain().assignWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - result = _(obj).chain().assignWith(s1, s2, s3, s4, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).chain().assignWith(s1, s2, s3, s4, s5, customizer); - } -} - // _.assignIn -namespace TestAssignIn { - interface Obj { a: string }; - interface S1 { a: number }; - interface S2 { b: number }; - interface S3 { c: number }; - interface S4 { d: number }; - interface S5 { e: number }; - - 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 = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; - - { - let result: Obj; - - result = _.assignIn(obj); - } - - { - let result: { a: number }; - - result = _.assignIn(obj, s1); - } - - { - let result: { a: number, b: number }; - - result = _.assignIn(obj, s1, s2); - } - - { - let result: { a: number, b: number, c: number }; - - result = _.assignIn(obj, s1, s2, s3); - } - - { - let result: { a: number, b: number, c: number, d: number }; - - result = _.assignIn(obj, s1, s2, s3, s4); - } - - { - let result: { a: number, b: number, c: number, d: number, e: number }; - - result = _.assignIn<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).assignIn(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).assignIn(s1); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).assignIn(s1, s2); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).assignIn(s1, s2, s3); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).assignIn(s1, s2, s3, s4); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).assignIn<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().assignIn(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).chain().assignIn(s1); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).chain().assignIn(s1, s2); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).chain().assignIn(s1, s2, s3); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).chain().assignIn(s1, s2, s3, s4); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).chain().assignIn(s1, s2, s3, s4, s5); - } -} - +// _.assignWith // _.assignInWith -namespace TestAssignInWith { - interface Obj { a: string }; - interface S1 { a: number }; - interface S2 { b: number }; - interface S3 { c: number }; - interface S4 { d: number }; - interface S5 { e: number }; +// _.defaults +// _.extend +// _.extendWith +// _.merge +// _.mergeWith +{ + const obj = { a: "" }; + const s1 = { b: 1 }; + const s2 = { c: 1 }; + const s3 = { d: 1 }; + const s4 = { e: 1 }; + const s5 = { f: 1 }; - 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 }; + const customizer = (objectValue: any, sourceValue: any, key: string | undefined, object: {} | undefined, source: {} | undefined) => 1; - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; + _.assign(obj); // $ExpectType { a: string; } + _.assign(obj, s1); // $ExpectType { a: string; } & { b: number; } + _.assign(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.assign(obj, s1, s2, s3, s4, s5); + _(obj).assign(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).assign(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).assign(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).assign(s1, s2, s3, s4, s5); + _.chain(obj).assign(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).assign(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).assign(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).assign(s1, s2, s3, s4, s5); + fp.assign(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.assign(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: Obj; + _.assignIn(obj); // $ExpectType { a: string; } + _.assignIn(obj, s1); // $ExpectType { a: string; } & { b: number; } + _.assignIn(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.assignIn(obj, s1, s2, s3, s4, s5); + _(obj).assignIn(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).assignIn(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).assignIn(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).assignIn(s1, s2, s3, s4, s5); + _.chain(obj).assignIn(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).assignIn(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).assignIn(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).assignIn(s1, s2, s3, s4, s5); + fp.assignIn(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.assignIn(obj)(s1); // $ExpectType { a: string; } & { b: number; } - result = _.assignInWith(obj); - } + _.assignWith(obj); // $ExpectType { a: string; } + _.assignWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } + _.assignWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.assignWith(obj, s1, s2, s3, s4, s5, customizer); + _(obj).assignWith(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).assignWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).assignWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).assignWith(s1, s2, s3, s4, s5, customizer); + _.chain(obj).assignWith(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).assignWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).assignWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).assignWith(s1, s2, s3, s4, s5, customizer); + fp.assignWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.assignWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number }; - result = _.assignInWith(obj, s1, customizer); - } + _.assignInWith(obj); // $ExpectType { a: string; } + _.assignInWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } + _.assignInWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.assignInWith(obj, s1, s2, s3, s4, s5, customizer); + _(obj).assignInWith(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).assignInWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).assignInWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).assignInWith(s1, s2, s3, s4, s5, customizer); + _.chain(obj).assignInWith(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).assignInWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).assignInWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).assignInWith(s1, s2, s3, s4, s5, customizer); + fp.assignInWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.assignInWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number, b: number }; - result = _.assignInWith(obj, s1, s2, customizer); - } + _.defaults(obj); // $ExpectType { a: string; } + _.defaults(obj, s1); // $ExpectType { b: number; } & { a: string; } + _.defaults(obj, s1, s2, s3, s4); // $ExpectType { e: number; } & { d: number; } & { c: number; } & { b: number; } & { a: string; } + _.defaults(obj, s1, s2, s3, s4, s5); + _(obj).defaults(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).defaults(s1); // $ExpectType LoDashImplicitWrapper<{ b: number; } & { a: string; }> + _(obj).defaults(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ e: number; } & { d: number; } & { c: number; } & { b: number; } & { a: string; }> + _(obj).defaults(s1, s2, s3, s4, s5); + _.chain(obj).defaults(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).defaults(s1); // $ExpectType LoDashExplicitWrapper<{ b: number; } & { a: string; }> + _.chain(obj).defaults(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ e: number; } & { d: number; } & { c: number; } & { b: number; } & { a: string; }> + _.chain(obj).defaults(s1, s2, s3, s4, s5); + fp.defaults(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.defaults(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number, b: number, c: number }; - result = _.assignInWith(obj, s1, s2, s3, customizer); - } + _.extend(obj); // $ExpectType { a: string; } + _.extend(obj, s1); // $ExpectType { a: string; } & { b: number; } + _.extend(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.extend(obj, s1, s2, s3, s4, s5); + _(obj).extend(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).extend(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).extend(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).extend(s1, s2, s3, s4, s5); + _.chain(obj).extend(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).extend(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).extend(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).extend(s1, s2, s3, s4, s5); + fp.extend(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.extend(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number, b: number, c: number, d: number }; - result = _.assignInWith(obj, s1, s2, s3, s4, customizer); - } + _.extendWith(obj); // $ExpectType { a: string; } + _.extendWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } + _.extendWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.extendWith(obj, s1, s2, s3, s4, s5, customizer); + _(obj).extendWith(); // $ExpectType LoDashImplicitWrapper<{ a: string; }> + _(obj).extendWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).extendWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).extendWith(s1, s2, s3, s4, s5, customizer); + _.chain(obj).extendWith(); // $ExpectType LoDashExplicitWrapper<{ a: string; }> + _.chain(obj).extendWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).extendWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).extendWith(s1, s2, s3, s4, s5, customizer); + fp.extendWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.extendWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: { a: number, b: number, c: number, d: number, e: number }; - result = _.assignInWith<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5, customizer); - } + _.merge(obj, s1); // $ExpectType { a: string; } & { b: number; } + _.merge(obj, s1, s2, s3, s4); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.merge(obj, s1, s2, s3, s4, s5); + _(obj).merge(s1); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).merge(s1, s2, s3, s4); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).merge(s1, s2, s3, s4, s5); + _.chain(obj).merge(s1); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).merge(s1, s2, s3, s4); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).merge(s1, s2, s3, s4, s5); + fp.merge(obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.merge(obj)(s1); // $ExpectType { a: string; } & { b: number; } - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).assignInWith(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - result = _(obj).assignInWith(s1, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - result = _(obj).assignInWith(s1, s2, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - result = _(obj).assignInWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - result = _(obj).assignInWith(s1, s2, s3, s4, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).assignInWith<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().assignInWith(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string }>; - result = _(obj).chain().assignInWith(s1, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - result = _(obj).chain().assignInWith(s1, s2, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - result = _(obj).chain().assignInWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - result = _(obj).chain().assignInWith(s1, s2, s3, s4, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).chain().assignInWith(s1, s2, s3, s4, s5, customizer); - } + _.mergeWith(obj, s1, customizer); // $ExpectType { a: string; } & { b: number; } + _.mergeWith(obj, s1, s2, s3, s4, customizer); // $ExpectType { a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; } + _.mergeWith(obj, s1, s2, s3, s4, s5, customizer); + _(obj).mergeWith(s1, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; }> + _(obj).mergeWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashImplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _(obj).mergeWith(s1, s2, s3, s4, s5, customizer); + _.chain(obj).mergeWith(s1, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; }> + _.chain(obj).mergeWith(s1, s2, s3, s4, customizer); // $ExpectType LoDashExplicitWrapper<{ a: string; } & { b: number; } & { c: number; } & { d: number; } & { e: number; }> + _.chain(obj).mergeWith(s1, s2, s3, s4, s5, customizer); + fp.mergeWith(customizer, obj, s1); // $ExpectType { a: string; } & { b: number; } + fp.mergeWith(customizer)(obj)(s1); // $ExpectType { a: string; } & { b: number; } } // _.create -namespace TestCreate { - type SampleProto = {a: number}; - type SampleProps = {b: string}; +{ + const prototype = { a: 1 }; + const properties = { b: "" }; - let prototype: SampleProto = { a: 1 }; - let properties: SampleProps = { b: "" }; - - { - let result: {a: number; b: string}; - - result = _.create(prototype, properties); - result = _.create(prototype, properties); - } - - { - let result: _.LoDashImplicitObjectWrapper<{a: number; b: string}>; - - result = _(prototype).create(properties); - result = _(prototype).create(properties); - } - - { - let result: _.LoDashExplicitObjectWrapper<{a: number; b: string}>; - - result = _(prototype).chain().create(properties); - result = _(prototype).chain().create(properties); - } + _.create(prototype, properties); // $ExpectType { a: number; } & { b: string; } + _(prototype).create(properties); // $ExpectType LoDashImplicitWrapper<{ a: number; } & { b: string; }> + _.chain(prototype).create(properties); // $ExpectType LoDashExplicitWrapper<{ a: number; } & { b: string; }> + // We can't expectType for this line because it fails in TS2.3 + const result: { a: number; } = fp.create(prototype); } -// _.defaults -namespace TestDefaults { - interface Obj { a: string }; - interface S1 { a: number }; - interface S2 { b: number }; - interface S3 { c: number }; - interface S4 { d: number }; - interface S5 { e: number }; - - 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; - - result = _.defaults(obj); - } - - { - let result: { a: string }; - - result = _.defaults(obj, s1); - } - - { - let result: { a: string, b: number }; - - result = _.defaults(obj, s1, s2); - } - - { - let result: { a: string, b: number, c: number }; - - result = _.defaults(obj, s1, s2, s3); - } - - { - let result: { a: string, b: number, c: number, d: number }; - - result = _.defaults(obj, s1, s2, s3, s4); - } - - { - let result: { a: string, b: number, c: number, d: number, e: number }; - - result = _.defaults(obj, s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).defaults(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: string & number }>; - - result = _(obj).defaults(s1); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: string & number, b: number }>; - - result = _(obj).defaults(s1, s2); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: string & number, b: number, c: number }>; - - result = _(obj).defaults(s1, s2, s3); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: string & number, b: number, c: number, d: number }>; - - result = _(obj).defaults(s1, s2, s3, s4); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: string, b: number, c: number, d: number, e: number }>; - - result = _(obj).defaults(s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().defaults(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string & number }>; - - result = _(obj).chain().defaults(s1); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string & number, b: number }>; - - result = _(obj).chain().defaults(s1, s2); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string & number, b: number, c: number }>; - - result = _(obj).chain().defaults(s1, s2, s3); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string & number, b: number, c: number, d: number }>; - - result = _(obj).chain().defaults(s1, s2, s3, s4); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string, b: number, c: number, d: number, e: number }>; - - result = _(obj).chain().defaults(s1, s2, s3, s4, s5); - } +{ + const obj = { a: "" }; + const s1 = { b: 1 }; + const s2 = { c: 1 }; + const s3 = { d: 1 }; + const s4 = { e: 1 }; + const s5 = { f: 1 }; } -//_.defaultsDeep -interface DefaultsDeepResult { - user: { - name: string; - age: number; - } +// _.defaultsDeep +{ + const testDefaultsDeepObject = { user: { name: "barney" } }; + const testDefaultsDeepSource = { user: { name: "fred", age: 36 } }; + _.defaultsDeep(testDefaultsDeepObject, testDefaultsDeepSource); // $ExpectType any + _(testDefaultsDeepObject).defaultsDeep(testDefaultsDeepSource); // $ExpectType LoDashImplicitWrapper + _.chain(testDefaultsDeepObject).defaultsDeep(testDefaultsDeepSource); // $ExpectType LoDashExplicitWrapper + + fp.defaultsDeep(testDefaultsDeepSource, testDefaultsDeepObject); // $ExpectType any + fp.defaultsDeep(testDefaultsDeepSource)(testDefaultsDeepObject); // $ExpectType any } -const TestDefaultsDeepObject = { 'user': { 'name': 'barney' } }; -const TestDefaultsDeepSource = { 'user': { 'name': 'fred', 'age': 36 } }; -result = _.defaultsDeep(TestDefaultsDeepObject, TestDefaultsDeepSource); -result = _(TestDefaultsDeepObject).defaultsDeep(TestDefaultsDeepSource).value(); // _.entries -namespace TestEntries { - const dictionary: _.Dictionary = anything; - const numericDictionary: _.NumericDictionary = anything; - const abcObject: AbcObject = anything; - - { - _.entries(dictionary); // $ExpectType [string, number][] - _.entries(numericDictionary); // $ExpectType [string, number][] - _.entries(abcObject); // $ExpectType [string, any][] - } - - { - _(dictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(numericDictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(abcObject).entries(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - } - - { - _(dictionary).chain().entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(numericDictionary).chain().entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(abcObject).chain().entries(); // $ExpectType LoDashExplicitWrapper<[string, any][]> - } -} - // _.entriesIn -namespace TestEntriesIn { +{ const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; const abcObject: AbcObject = anything; - { - _.entriesIn(dictionary); // $ExpectType [string, number][] - _.entriesIn(numericDictionary); // $ExpectType [string, number][] - _.entriesIn(abcObject); // $ExpectType [string, any][] - } - - { - _(dictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(numericDictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(abcObject).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - } - - { - _(dictionary).chain().entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(numericDictionary).chain().entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(abcObject).chain().entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> - } -} - -// _.extend -namespace TestExtend { - type Obj = { a: string }; - type S1 = { a: number }; - type S2 = { b: number }; - type S3 = { c: number }; - type S4 = { d: number }; - type S5 = { e: number }; - - 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 = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; - - { - let result: Obj; - - result = _.extend(obj); - } - - { - let result: { a: number }; - - result = _.extend(obj, s1); - } - - { - let result: { a: number, b: number }; - - result = _.extend(obj, s1, s2); - } - - { - let result: { a: number, b: number, c: number }; - - result = _.extend(obj, s1, s2, s3); - } - - { - let result: { a: number, b: number, c: number, d: number }; - - result = _.extend(obj, s1, s2, s3, s4); - } - - { - let result: { a: number, b: number, c: number, d: number, e: number }; - - result = _.extend<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).extend(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).extend(s1); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).extend(s1, s2); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).extend(s1, s2, s3); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).extend(s1, s2, s3, s4); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).extend(s1, s2, s3, s4, s5); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().extend(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).chain().extend(s1); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).chain().extend(s1, s2); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).chain().extend(s1, s2, s3); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).chain().extend(s1, s2, s3, s4); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).chain().extend(s1, s2, s3, s4, s5); - } -} - -// _.extendWith -namespace TestExtendWith { - type Obj = { a: string }; - type S1 = { a: number }; - type S2 = { b: number }; - type S3 = { c: number }; - type S4 = { d: number }; - type S5 = { e: number }; - - 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 = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; - - { - let result: Obj; - - result = _.extendWith(obj); - } - - { - let result: { a: number }; - - result = _.extendWith(obj, s1, customizer); - } - - { - let result: { a: number, b: number }; - - result = _.extendWith(obj, s1, s2, customizer); - } - - { - let result: { a: number, b: number, c: number }; - - result = _.extendWith(obj, s1, s2, s3, customizer); - } - - { - let result: { a: number, b: number, c: number, d: number }; - - result = _.extendWith(obj, s1, s2, s3, s4, customizer); - } - - { - let result: { a: number, b: number, c: number, d: number, e: number }; - - result = _.extendWith<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(obj).extendWith(); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).extendWith(s1, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).extendWith(s1, s2, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).extendWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).extendWith(s1, s2, s3, s4, customizer); - } - - { - let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).extendWith(s1, s2, s3, s4, s5, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(obj).chain().extendWith(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string }>; - - result = _(obj).chain().extendWith(s1, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number }>; - - result = _(obj).chain().extendWith(s1, s2, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number }>; - - result = _(obj).chain().extendWith(s1, s2, s3, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number & string, b: number, c: number, d: number }>; - - result = _(obj).chain().extendWith(s1, s2, s3, s4, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - - result = _(obj).chain().extendWith(s1, s2, s3, s4, s5, customizer); - } + _.entries(dictionary); // $ExpectType [string, number][] + _.entries(numericDictionary); // $ExpectType [string, number][] + _.entries(abcObject); // $ExpectType [string, any][] + _(dictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(numericDictionary).entries(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _.chain(dictionary).entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(numericDictionary).entries(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(abcObject).entries(); // $ExpectType LoDashExplicitWrapper<[string, any][]> + fp.entries(dictionary); // $ExpectType [string, number][] + + _.entriesIn(dictionary); // $ExpectType [string, number][] + _.entriesIn(numericDictionary); // $ExpectType [string, number][] + _.entriesIn(abcObject); // $ExpectType [string, any][] + _(dictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(numericDictionary).entriesIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _.chain(dictionary).entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(numericDictionary).entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(abcObject).entriesIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> + fp.entriesIn(dictionary); // $ExpectType [string, number][] } // _.findKey -namespace TestFindKey { - { - let a: keyof undefined; - let predicateFn = (value: any, key: string, object: {}) => true; - let result: string | undefined; - - result = _.findKey<{a: string;}>({a: ''}); - - result = _.findKey<{a: string;}>({a: ''}, predicateFn); - - result = _.findKey<{a: string;}>({a: ''}, ''); - - result = _.findKey({a: { b: 5 }}, {b: 42}); - - result = _.findKey({a: { b: 5 }}, ['b', 5]); - - result = _<{a: string;}>({a: ''}).findKey(); - - result = _<{a: string;}>({a: ''}).findKey(predicateFn); - - result = _<{a: string;}>({a: ''}).findKey(''); - - result = _({a: { b: 5 }}).findKey({b: 42}); - } - - { - let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: string | undefined; - - result = _.findKey({a: ''}, predicateFn); - - result = _({a: ''}).findKey(predicateFn); - } - - { - let predicateFn = (value: any, key: string, object: {}) => true; - let result: _.LoDashExplicitWrapper; - - result = _<{a: string;}>({a: ''}).chain().findKey(); - - result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); - - result = _<{a: string;}>({a: ''}).chain().findKey(''); - - result = _({a: { b: 5 }}).chain().findKey({b: 42}); - } - - { - let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: _.LoDashExplicitWrapper; - - result = _({a: ''}).chain().findKey(predicateFn); - } -} - // _.findLastKey -namespace TestFindLastKey { - { - let predicateFn = (value: any, key: string, object: {}) => true; - let result: string | undefined; +{ + const predicateFn = (value: string, key: string, object: { a: string }) => true; + const predicateFn2 = (value: number) => true; - result = _.findLastKey<{a: string;}>({a: ''}); + _.findKey({ a: "" }); // $ExpectType string | undefined + _.findKey({ a: "" }, predicateFn); // $ExpectType string | undefined + _.findKey({ a: "" }, ""); // $ExpectType string | undefined + _.findKey({ a: { b: 5 } }, { b: 42 }); // $ExpectType string | undefined + _.findKey({ a: { b: 5 } }, ["b", 5]); // $ExpectType string | undefined + _({ a: "" }).findKey(); // $ExpectType string | undefined + _({ a: "" }).findKey(predicateFn); // $ExpectType string | undefined + _({ a: "" }).findKey(""); // $ExpectType string | undefined + _({ a: { b: 5 } }).findKey({ b: 42 }); // $ExpectType string | undefined + _({ a: { b: 5 } }).findKey(["b", 5]); // $ExpectType string | undefined + _.chain({ a: "" }).findKey(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "" }).findKey(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "" }).findKey(""); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 5 } }).findKey({ b: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 5 } }).findKey(["b", 5]); // $ExpectType LoDashExplicitWrapper + fp.findKey(predicateFn2, { a: 1 }); // $ExpectType string | undefined + fp.findKey(predicateFn2)({ a: 1 }); // $ExpectType string | undefined - result = _.findLastKey<{a: string;}>({a: ''}, predicateFn); - - result = _.findLastKey<{a: string;}>({a: ''}, ''); - - result = _.findLastKey({a: { b: 5 }}, {b: 42}); - - result = _.findLastKey({a: { b: 5 }}, ['b', 5]); - - result = _<{a: string;}>({a: ''}).findLastKey(); - - result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); - - result = _<{a: string;}>({a: ''}).findLastKey(''); - - result = _({a: { b: 5 }}).findLastKey({b: 42}); - } - - { - let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: string | undefined; - - result = _.findLastKey({a: ''}, predicateFn); - - result = _({a: ''}).findLastKey(predicateFn); - } - - { - let predicateFn = (value: any, key: string, object: {}) => true; - let result: _.LoDashExplicitWrapper; - - result = _<{a: string;}>({a: ''}).chain().findLastKey(); - - result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); - - result = _<{a: string;}>({a: ''}).chain().findLastKey(''); - - result = _({a: { b: 5 }}).chain().findLastKey({b: 42}); - } - - { - let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: _.LoDashExplicitWrapper; - - result = _({a: ''}).chain().findLastKey(predicateFn); - } + _.findLastKey({ a: "" }); // $ExpectType string | undefined + _.findLastKey({ a: "" }, predicateFn); // $ExpectType string | undefined + _.findLastKey({ a: "" }, ""); // $ExpectType string | undefined + _.findLastKey({ a: { b: 5 } }, { b: 42 }); // $ExpectType string | undefined + _.findLastKey({ a: { b: 5 } }, ["b", 5]); // $ExpectType string | undefined + _({ a: "" }).findLastKey(); // $ExpectType string | undefined + _({ a: "" }).findLastKey(predicateFn); // $ExpectType string | undefined + _({ a: "" }).findLastKey(""); // $ExpectType string | undefined + _({ a: { b: 5 } }).findLastKey({ b: 42 }); // $ExpectType string | undefined + _({ a: { b: 5 } }).findLastKey(["b", 5]); // $ExpectType string | undefined + _.chain({ a: "" }).findLastKey(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "" }).findLastKey(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain({ a: "" }).findLastKey(""); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 5 } }).findLastKey({ b: 42 }); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: 5 } }).findLastKey(["b", 5]); // $ExpectType LoDashExplicitWrapper + fp.findLastKey(predicateFn2, { a: 1 }); // $ExpectType string | undefined + fp.findLastKey(predicateFn2)({ a: 1 }); // $ExpectType string | undefined } // _.forIn -namespace TestForIn { - type SampleObject = {a: number; b: string; c: boolean;}; - - let dictionary: _.Dictionary = {}; - let nilDictionary: _.Dictionary | null | undefined = anything; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - - let object: SampleObject = { a: 1, b: "", c: true }; - let nilObject: SampleObject | null | undefined = anything; - let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; - - { - let result: _.Dictionary; - - result = _.forIn(dictionary); - result = _.forIn(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.forIn(nilDictionary); - result = _.forIn(nilDictionary, dictionaryIterator); - } - - { - let result: SampleObject; - - result = _.forIn(object); - result = _.forIn(object, objectIterator); - } - - { - let result: SampleObject | null | undefined; - - result = _.forIn(nilObject); - result = _.forIn(nilObject, objectIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forIn(); - result = _(dictionary).forIn(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forIn(); - result = _(nilDictionary).forIn(dictionaryIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forIn(); - result = _(dictionary).chain().forIn(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forIn(); - result = _(nilDictionary).chain().forIn(dictionaryIterator); - } -} - // _.forInRight -namespace TestForInRight { - type SampleObject = {a: number; b: string; c: boolean;}; - - let dictionary: _.Dictionary = {}; - let nilDictionary: _.Dictionary | null | undefined = anything; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - - let object: SampleObject = { a: 1, b: "", c: true }; - let nilObject: SampleObject | null | undefined = anything; - let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; - - { - let result: _.Dictionary; - - result = _.forInRight(dictionary); - result = _.forInRight(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.forInRight(nilDictionary); - result = _.forInRight(nilDictionary, dictionaryIterator); - } - - { - let result: SampleObject; - - result = _.forInRight(object); - result = _.forInRight(object, objectIterator); - } - - { - let result: SampleObject | null | undefined; - - result = _.forInRight(nilObject); - result = _.forInRight(nilObject, objectIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forInRight(); - result = _(dictionary).forInRight(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forInRight(); - result = _(nilDictionary).forInRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forInRight(); - result = _(dictionary).chain().forInRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forInRight(); - result = _(nilDictionary).chain().forInRight(dictionaryIterator); - } -} - // _.forOwn -namespace TestForOwn { - type SampleObject = {a: number; b: string; c: boolean;}; - - let dictionary: _.Dictionary = {}; - let nilDictionary: _.Dictionary | null | undefined = anything; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - - let object: SampleObject = { a: 1, b: "", c: true }; - let nilObject: SampleObject | null | undefined = anything; - let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; - - { - let result: _.Dictionary; - - result = _.forOwn(dictionary); - result = _.forOwn(dictionary, dictionaryIterator); - } - - { - let result: _.Dictionary | null | undefined; - - result = _.forOwn(nilDictionary); - result = _.forOwn(nilDictionary, dictionaryIterator); - } - - { - let result: SampleObject; - - result = _.forOwn(object); - result = _.forOwn(object, objectIterator); - } - - { - let result: SampleObject | null | undefined; - - result = _.forOwn(nilObject); - result = _.forOwn(nilObject, objectIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forOwn(); - result = _(dictionary).forOwn(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forOwn(); - result = _(nilDictionary).forOwn(dictionaryIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forOwn(); - result = _(dictionary).chain().forOwn(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forOwn(); - result = _(nilDictionary).chain().forOwn(dictionaryIterator); - } -} - // _.forOwnRight -namespace TestForOwnRight { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const dictionary: _.Dictionary = {}; + const dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => {}; + const dictionaryIterator2 = (value: number) => {}; - let dictionary: _.Dictionary = {}; - let nilDictionary: _.Dictionary | null | undefined = anything; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; + const object: AbcObject | null | undefined = anything; + const objectIterator = (element: string | number | boolean, key: string, collection: AbcObject) => {}; + const objectIterator2 = (element: number | string | boolean) => {}; - let object: SampleObject = { a: 1, b: "", c: true }; - let nilObject: SampleObject | null | undefined = anything; - let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; + _.forIn(dictionary); // $ExpectType Dictionary + _.forIn(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.forIn(object); // $ExpectType AbcObject | null | undefined + _.forIn(object, objectIterator); // $ExpectType AbcObject | null | undefined + _(object).forIn(); // $ExpectType LoDashImplicitWrapper + _(object).forIn(objectIterator); // $ExpectType LoDashImplicitWrapper + _.chain(object).forIn(); // $ExpectType LoDashExplicitWrapper + _.chain(object).forIn(objectIterator); // $ExpectType LoDashExplicitWrapper + fp.forIn(dictionaryIterator2, dictionary); // $ExpectType Dictionary + fp.forIn(objectIterator2)(object); // $ExpectType AbcObject | null | undefined - { - let result: _.Dictionary; + _.forInRight(dictionary); // $ExpectType Dictionary + _.forInRight(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.forInRight(object); // $ExpectType AbcObject | null | undefined + _.forInRight(object, objectIterator); // $ExpectType AbcObject | null | undefined + _(object).forInRight(); // $ExpectType LoDashImplicitWrapper + _(object).forInRight(objectIterator); // $ExpectType LoDashImplicitWrapper + _.chain(object).forInRight(); // $ExpectType LoDashExplicitWrapper + _.chain(object).forInRight(objectIterator); // $ExpectType LoDashExplicitWrapper + fp.forInRight(dictionaryIterator2, dictionary); // $ExpectType Dictionary + fp.forInRight(objectIterator2)(object); // $ExpectType AbcObject | null | undefined - result = _.forOwnRight(dictionary); - result = _.forOwnRight(dictionary, dictionaryIterator); - } + _.forOwn(dictionary); // $ExpectType Dictionary + _.forOwn(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.forOwn(object); // $ExpectType AbcObject | null | undefined + _.forOwn(object, objectIterator); // $ExpectType AbcObject | null | undefined + _(object).forOwn(); // $ExpectType LoDashImplicitWrapper + _(object).forOwn(objectIterator); // $ExpectType LoDashImplicitWrapper + _.chain(object).forOwn(); // $ExpectType LoDashExplicitWrapper + _.chain(object).forOwn(objectIterator); // $ExpectType LoDashExplicitWrapper + fp.forOwn(dictionaryIterator2, dictionary); // $ExpectType Dictionary + fp.forOwn(objectIterator2)(object); // $ExpectType AbcObject | null | undefined - { - let result: _.Dictionary | null | undefined; - - result = _.forOwnRight(nilDictionary); - result = _.forOwnRight(nilDictionary, dictionaryIterator); - } - - { - let result: SampleObject; - - result = _.forOwnRight(object); - result = _.forOwnRight(object, objectIterator); - } - - { - let result: SampleObject | null | undefined; - - result = _.forOwnRight(nilObject); - result = _.forOwnRight(nilObject, objectIterator); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).forOwnRight(); - result = _(dictionary).forOwnRight(dictionaryIterator); - } - - { - let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).forOwnRight(); - result = _(nilDictionary).forOwnRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(dictionary).chain().forOwnRight(); - result = _(dictionary).chain().forOwnRight(dictionaryIterator); - } - - { - let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - - result = _(nilDictionary).chain().forOwnRight(); - result = _(nilDictionary).chain().forOwnRight(dictionaryIterator); - } + _.forOwnRight(dictionary); // $ExpectType Dictionary + _.forOwnRight(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.forOwnRight(object); // $ExpectType AbcObject | null | undefined + _.forOwnRight(object, objectIterator); // $ExpectType AbcObject | null | undefined + _(object).forOwnRight(); // $ExpectType LoDashImplicitWrapper + _(object).forOwnRight(objectIterator); // $ExpectType LoDashImplicitWrapper + _.chain(object).forOwnRight(); // $ExpectType LoDashExplicitWrapper + _.chain(object).forOwnRight(objectIterator); // $ExpectType LoDashExplicitWrapper + fp.forOwnRight(dictionaryIterator2, dictionary); // $ExpectType Dictionary + fp.forOwnRight(objectIterator2)(object); // $ExpectType AbcObject | null | undefined } // _.functions -namespace TestFunctions { - type SampleObject = {a: number; b: string; c: boolean;}; - - let object: SampleObject = { a: 1, b: "", c: true }; - - { - let result: string[]; - - result = _.functions(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).functions(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().functions(); - } -} - // _.functionsIn -namespace TestFunctionsIn { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const object: AbcObject = anything; - let object: SampleObject = { a: 1, b: "", c: true }; + _.functions(object); // $ExpectType string[] + _(object).functions(); // $ExpectType LoDashImplicitWrapper + _.chain(object).functions(); // $ExpectType LoDashExplicitWrapper + fp.functions(object); // $ExpectType string[] - { - let result: string[]; - - result = _.functionsIn(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).functionsIn(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().functionsIn(); - } + _.functionsIn(object); // $ExpectType string[] + _(object).functionsIn(); // $ExpectType LoDashImplicitWrapper + _.chain(object).functionsIn(); // $ExpectType LoDashExplicitWrapper + fp.functionsIn(object); // $ExpectType string[] } // _.get -namespace TestGet { +{ _.get([], Symbol.iterator); _.get([], [Symbol.iterator]); - _.get('abc', 1); // $ExpectType string - _('abc').get(1); // $ExpectType string - _.chain('abc').get(1); // $ExpectType LoDashExplicitWrapper - + _.get("abc", 1); // $ExpectType string + _.get("abc", ["0"], "_"); + _.get([42], 0, -1); // $ExpectType number _.get({ a: { b: true } }, "a"); // $ExpectType { b: boolean; } - _({ a: { b: true } }).get("a"); // $ExpectType { b: boolean; } - _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> - _.get({ a: { b: true } }, ["a"]); // $ExpectType { b: boolean; } - _({ a: { b: true } }).get(["a"]); // $ExpectType { b: boolean; } - _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> - _.get({ a: { b: true } }, ["a", "b"]); // $ExpectType any + + _("abc").get(1); // $ExpectType string + _("abc").get(["0"], "_"); + _([42]).get(0, -1); // $ExpectType number + _({ a: { b: true } }).get("a"); // $ExpectType { b: boolean; } + _({ a: { b: true } }).get(["a"]); // $ExpectType { b: boolean; } _({ a: { b: true } }).get(["a", "b"]); // $ExpectType any + + _.chain("abc").get(1); // $ExpectType LoDashExplicitWrapper + _.chain("abc").get(["0"], "_"); + _.chain([42]).get(0, -1); // $ExpectType LoDashExplicitWrapper + _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> + _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a", "b"]); // $ExpectType LoDashExplicitWrapper - { - let result: string; + fp.get(Symbol.iterator, []); // $ExpectType any + fp.get(Symbol.iterator)([]); // $ExpectType any + fp.get([Symbol.iterator], []); // $ExpectType any + fp.get(1)("abc"); // $ExpectType string + fp.get("1")("abc"); // $ExpectType any + fp.get("a", { a: { b: true } }); // $ExpectType { b: boolean; } + fp.get<{ a: { b: boolean } }, "a">("a")({ a: { b: true } }); // $ExpectType { b: boolean; } + fp.get(["a", "b"])({ a: { b: true } }); // $ExpectType any + fp.get(0)([42]); // $ExpectType number - result = _.get('abc', '0'); - result = _.get('abc', '0', '_'); - result = _.get('abc', ['0']); - result = _.get('abc', ['0'], '_'); - - result = _.get('abc', '0'); - result = _.get('abc', '0', '_'); - result = _.get('abc', ['0']); - result = _.get('abc', ['0'], '_'); - - result = _('abc').get('0'); - result = _('abc').get('0', '_'); - result = _('abc').get(['0']); - result = _('abc').get(['0'], '_'); - } - - { - let result: number; - - result = _.get([42], '0'); - result = _.get([42], '0', -1); - result = _.get([42], ['0']); - result = _.get([42], ['0'], -1); - - result = _.get([42], '0'); - result = _.get([42], '0', -1); - result = _.get([42], ['0']); - result = _.get([42], ['0'], -1); - - result = _([42]).get('0'); - result = _([42]).get('0', -1); - result = _([42]).get(['0']); - result = _([42]).get(['0'], -1); - } - - { - let result: boolean; - - result = _.get({a: true}, 'a'); - result = _.get({a: true}, 'a', false); - result = _.get({a: true}, ['a']); - result = _.get({a: true}, ['a'], false); - - result = _.get({a: true}, 'a'); - result = _.get({a: true}, 'a', false); - result = _.get({a: true}, ['a']); - result = _.get({a: true}, ['a'], false); - - result = _({a: true}).get('a'); - result = _({a: true}).get('a', false); - result = _({a: true}).get(['a']); - result = _({a: true}).get(['a'], false); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().get('0'); - result = _('abc').chain().get('0', '_'); - result = _('abc').chain().get(['0']); - result = _('abc').chain().get(['0'], '_'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _([42]).chain().get('0'); - result = _([42]).chain().get('0', -1); - result = _([42]).chain().get(['0']); - result = _([42]).chain().get(['0'], -1); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _({a: true}).chain().get('a'); - result = _({a: true}).chain().get('a', false); - result = _({a: true}).chain().get(['a']); - result = _({a: true}).chain().get(['a'], false); - } + fp.getOr(-1, 0, [42]); // $ExpectType number + fp.getOr(-1)(0)([42]); // $ExpectType number + fp.getOr("empty" as "empty")(0)([42]); // $ExpectType number | "empty" } // _.has -namespace TestHas { - type SampleObject = {a: number; b: string; c: boolean;}; - - let object: SampleObject = { a: 1, b: "", c: true }; - - { - let result: boolean; - - result = _.has(object, ''); - result = _.has(object, 42); - result = _.has(object, ['', 42]); - - result = _(object).has(''); - result = _(object).has(42); - result = _(object).has(['', 42]); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(object).chain().has(''); - result = _(object).chain().has(42); - result = _(object).chain().has(['', 42]); - } -} - // _.hasIn -namespace TestHasIn { - type SampleObject = {a: number; b: string; c: boolean;}; +{ + const object: AbcObject = anything; - let object: SampleObject = { a: 1, b: "", c: true }; + _.has(object, ""); // $ExpectType boolean + _.has(object, 42); // $ExpectType boolean + _.has(object, ["", 42]); // $ExpectType boolean + _(object).has(""); // $ExpectType boolean + _(object).has(42); // $ExpectType boolean + _(object).has(["", 42]); // $ExpectType boolean + _.chain(object).has(""); // $ExpectType LoDashExplicitWrapper + _.chain(object).has(42); // $ExpectType LoDashExplicitWrapper + _.chain(object).has(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.has("a", object); // $ExpectType boolean + fp.has("a")(object); // $ExpectType boolean + fp.has(["a", 42])(object); // $ExpectType boolean - { - let result: boolean; - - result = _.hasIn(object, ''); - result = _.hasIn(object, 42); - result = _.hasIn(object, ['', 42]); - - result = _(object).hasIn(''); - result = _(object).hasIn(42); - result = _(object).hasIn(['', 42]); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(object).chain().hasIn(''); - result = _(object).chain().hasIn(42); - result = _(object).chain().hasIn(['', 42]); - } + _.hasIn(object, ""); // $ExpectType boolean + _.hasIn(object, 42); // $ExpectType boolean + _.hasIn(object, ["", 42]); // $ExpectType boolean + _(object).hasIn(""); // $ExpectType boolean + _(object).hasIn(42); // $ExpectType boolean + _(object).hasIn(["", 42]); // $ExpectType boolean + _.chain(object).hasIn(""); // $ExpectType LoDashExplicitWrapper + _.chain(object).hasIn(42); // $ExpectType LoDashExplicitWrapper + _.chain(object).hasIn(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.hasIn("a", object); // $ExpectType boolean + fp.hasIn("a")(object); // $ExpectType boolean + fp.hasIn(["a", 42])(object); // $ExpectType boolean } // _.invert -namespace TestInvert { - { - let result: _.Dictionary; - - result = _.invert({}); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _({}).invert(); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _({}).chain().invert(); - } +{ + _.invert({}); // $ExpectType Dictionary + _({}).invert(); // $ExpectType LoDashImplicitWrapper> + _.chain({}).invert(); // $ExpectType LoDashExplicitWrapper> + fp.invert({}); // $ExpectType Dictionary } // _.invertBy -namespace TestInvertBy { - let array: Array<{a: number;}> = []; - let list: _.List<{a: number;}> = []; - let dictionary: _.Dictionary<{a: number;}> = {}; - let numericDictionary: _.NumericDictionary<{a: number;}> = {}; +{ + const list: ArrayLike<{ a: number }> = anything; + const dictionary: _.Dictionary<{ a: number }> = {}; + const numericDictionary: _.NumericDictionary<{ a: number }> = {}; - 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; + const stringIterator = (value: string) => 1; + const valueIterator = (value: {a: number }) => 1; - { - let result: _.Dictionary; + _.invertBy("foo"); // $ExpectType Dictionary + _.invertBy("foo", stringIterator); // $ExpectType Dictionary + _.invertBy(list); // $ExpectType Dictionary + _.invertBy(list, "a"); // $ExpectType Dictionary + _.invertBy(list, valueIterator); // $ExpectType Dictionary + _.invertBy(list, {a: 1}); // $ExpectType Dictionary + _.invertBy(dictionary); // $ExpectType Dictionary + _.invertBy(dictionary, "a"); // $ExpectType Dictionary + _.invertBy(dictionary, valueIterator); // $ExpectType Dictionary + _.invertBy(dictionary, {a: 1}); // $ExpectType Dictionary + _.invertBy(numericDictionary); // $ExpectType Dictionary + _.invertBy(numericDictionary, "a"); // $ExpectType Dictionary + _.invertBy(numericDictionary, valueIterator); // $ExpectType Dictionary + _.invertBy(numericDictionary, {a: 1}); // $ExpectType Dictionary - result = _.invertBy('foo'); - result = _.invertBy('foo', stringIterator); + _("foo").invertBy(stringIterator); // $ExpectType LoDashImplicitWrapper> + _(list).invertBy(); // $ExpectType LoDashImplicitWrapper> + _(list).invertBy("a"); // $ExpectType LoDashImplicitWrapper> + _(dictionary).invertBy(valueIterator); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).invertBy({a: 1}); // $ExpectType LoDashImplicitWrapper> - result = _.invertBy(array); - result = _.invertBy<{a: number;}>(array, 'a'); - result = _.invertBy<{a: number;}>(array, arrayIterator); - result = _.invertBy<{a: number;}>(array, {a: 1}); + _.chain("foo").invertBy(stringIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).invertBy(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).invertBy("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).invertBy(valueIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).invertBy({a: 1}); // $ExpectType LoDashExplicitWrapper> - result = _.invertBy(list); - result = _.invertBy<{a: number;}>(list, 'a'); - result = _.invertBy<{a: number;}>(list, listIterator); - result = _.invertBy<{a: number;}>(list, {a: 1}); - - result = _.invertBy(dictionary); - result = _.invertBy<{a: number;}>(dictionary, 'a'); - result = _.invertBy<{a: number;}>(dictionary, dictionaryIterator); - result = _.invertBy<{a: number;}>(dictionary, {a: 1}); - - result = _.invertBy(numericDictionary); - result = _.invertBy<{a: number;}>(numericDictionary, 'a'); - result = _.invertBy<{a: number;}>(numericDictionary, numericDictionaryIterator); - result = _.invertBy<{a: number;}>(numericDictionary, {a: 1}); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _('foo').invertBy(); - result = _('foo').invertBy(stringIterator); - - result = _(array).invertBy(); - result = _(array).invertBy('a'); - result = _(array).invertBy(arrayIterator); - result = _(array).invertBy({a: 1}); - - result = _(list).invertBy(); - result = _(list).invertBy('a'); - result = _(list).invertBy(listIterator); - result = _(list).invertBy<{a: number;}>({a: 1}); - - result = _(dictionary).invertBy(); - result = _(dictionary).invertBy('a'); - result = _(dictionary).invertBy(dictionaryIterator); - result = _(dictionary).invertBy<{a: number;}>({a: 1}); - - result = _(numericDictionary).invertBy(); - result = _(numericDictionary).invertBy('a'); - result = _(numericDictionary).invertBy(numericDictionaryIterator); - result = _(numericDictionary).invertBy<{a: number;}>({a: 1}); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _('foo').chain().invertBy(); - result = _('foo').chain().invertBy(stringIterator); - - result = _(array).chain().invertBy(); - result = _(array).chain().invertBy('a'); - result = _(array).chain().invertBy(arrayIterator); - result = _(array).chain().invertBy({a: 1}); - - result = _(list).chain().invertBy(); - result = _(list).chain().invertBy('a'); - result = _(list).chain().invertBy(listIterator); - result = _(list).chain().invertBy<{a: number;}>({a: 1}); - - result = _(dictionary).chain().invertBy(); - result = _(dictionary).chain().invertBy('a'); - result = _(dictionary).chain().invertBy(dictionaryIterator); - result = _(dictionary).chain().invertBy<{a: number;}>({a: 1}); - - result = _(numericDictionary).chain().invertBy(); - result = _(numericDictionary).chain().invertBy('a'); - result = _(numericDictionary).chain().invertBy(numericDictionaryIterator); - result = _(numericDictionary).chain().invertBy<{a: number;}>({a: 1}); - } + fp.invertBy(stringIterator, "foo"); // $ExpectType Dictionary + fp.invertBy(stringIterator)("foo"); // $ExpectType Dictionary + fp.invertBy(valueIterator)(list); // $ExpectType Dictionary + fp.invertBy("a")(list); // $ExpectType Dictionary + fp.invertBy({ a: 1 })(list); // $ExpectType Dictionary + fp.invertBy(valueIterator)(dictionary); // $ExpectType Dictionary + fp.invertBy("a")(dictionary); // $ExpectType Dictionary + fp.invertBy({ a: 1 })(dictionary); // $ExpectType Dictionary + fp.invertBy(valueIterator)(numericDictionary); // $ExpectType Dictionary + fp.invertBy("a")(numericDictionary); // $ExpectType Dictionary + fp.invertBy({ a: 1 })(numericDictionary); // $ExpectType Dictionary } // _.keys -namespace TestKeys { - let object: _.Dictionary | null | undefined = anything; - - { - let result: string[]; - - result = _.keys(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).keys(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().keys(); - } -} - // _.keysIn -namespace TestKeysIn { - let object: _.Dictionary | null | undefined = anything; +{ + const object: AbcObject | null | undefined = anything; - { - let result: string[]; + _.keys(object); // $ExpectType string[] + _(object).keys(); // $ExpectType LoDashImplicitWrapper + _.chain(object).keys(); // $ExpectType LoDashExplicitWrapper + fp.keys({}); // $ExpectType string[] - result = _.keysIn(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).keysIn(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().keysIn(); - } + _.keysIn(object); // $ExpectType string[] + _(object).keysIn(); // $ExpectType LoDashImplicitWrapper + _.chain(object).keysIn(); // $ExpectType LoDashExplicitWrapper + fp.keysIn({}); // $ExpectType string[] } // _.mapKeys -namespace TestMapKeys { - let array: AbcObject[] | null | undefined = [] as any; - let list: _.List| null | undefined = [] as any; - let dictionary: _.Dictionary | null | undefined = anything; - let numericDictionary: _.NumericDictionary | null | undefined = anything; - let abcObject: AbcObject = anything; +{ + const list: _.List| null | undefined = [] as any; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; + const abcObject: AbcObject = anything; - let listIterator = (value: AbcObject, index: number, collection: _.List) => ""; - let dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => ""; - let numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => ""; - let abcObjectIterator = (value: AbcObject[keyof AbcObject], key: string, collection: AbcObject) => ""; + const listIterator = (value: AbcObject, index: number, collection: _.List) => ""; + const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => ""; + const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => ""; + const abcObjectIterator = (value: AbcObject[keyof AbcObject], key: string, collection: AbcObject) => ""; - { - _.mapKeys(array); // $ExpectType Dictionary - _.mapKeys(array, listIterator); // $ExpectType Dictionary - _.mapKeys(array, ''); // $ExpectType Dictionary - _.mapKeys(array, {}); // $ExpectType Dictionary + _.mapKeys(list); // $ExpectType Dictionary + _.mapKeys(list, listIterator); // $ExpectType Dictionary + _.mapKeys(list, ""); // $ExpectType Dictionary + _.mapKeys(list, {}); // $ExpectType Dictionary - _.mapKeys(list); // $ExpectType Dictionary - _.mapKeys(list, listIterator); // $ExpectType Dictionary - _.mapKeys(list, ''); // $ExpectType Dictionary - _.mapKeys(list, {}); // $ExpectType Dictionary + _.mapKeys(dictionary); // $ExpectType Dictionary + _.mapKeys(dictionary, dictionaryIterator); // $ExpectType Dictionary + _.mapKeys(dictionary, ""); // $ExpectType Dictionary + _.mapKeys(dictionary, {}); // $ExpectType Dictionary - _.mapKeys(dictionary); // $ExpectType Dictionary - _.mapKeys(dictionary, dictionaryIterator); // $ExpectType Dictionary - _.mapKeys(dictionary, ''); // $ExpectType Dictionary - _.mapKeys(dictionary, {}); // $ExpectType Dictionary + /* Broken in TS 2.4 + _.mapKeys(numericDictionary); // Dictionary + _.mapKeys(numericDictionary, numericDictionaryIterator); // Dictionary + _.mapKeys(numericDictionary, ""); // Dictionary + _.mapKeys(numericDictionary, {}); // Dictionary + */ - /* Broken in TS 2.4 - _.mapKeys(numericDictionary); // Dictionary - _.mapKeys(numericDictionary, numericDictionaryIterator); // Dictionary - _.mapKeys(numericDictionary, ''); // Dictionary - _.mapKeys(numericDictionary, {}); // Dictionary - */ - } + _.mapKeys(abcObject); // $ExpectType Dictionary + _.mapKeys(abcObject, abcObjectIterator); // $ExpectType Dictionary + _.mapKeys(abcObject, ""); // $ExpectType Dictionary - { - _.mapKeys(abcObject); // $ExpectType Dictionary - _.mapKeys(abcObject, abcObjectIterator); // $ExpectType Dictionary - _.mapKeys(abcObject, ''); // $ExpectType Dictionary - } + _(list).mapKeys(); // $ExpectType LoDashImplicitWrapper> + _(list).mapKeys(listIterator); // $ExpectType LoDashImplicitWrapper> + _(list).mapKeys(""); // $ExpectType LoDashImplicitWrapper> + _(list).mapKeys({}); // $ExpectType LoDashImplicitWrapper> - { - _(array).mapKeys(); // $ExpectType LoDashImplicitWrapper> - _(array).mapKeys(listIterator); // $ExpectType LoDashImplicitWrapper> - _(array).mapKeys(''); // $ExpectType LoDashImplicitWrapper> - _(array).mapKeys({}); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapKeys(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapKeys(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapKeys(""); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapKeys({}); // $ExpectType LoDashImplicitWrapper> - _(list).mapKeys(); // $ExpectType LoDashImplicitWrapper> - _(list).mapKeys(listIterator); // $ExpectType LoDashImplicitWrapper> - _(list).mapKeys(''); // $ExpectType LoDashImplicitWrapper> - _(list).mapKeys({}); // $ExpectType LoDashImplicitWrapper> + /* Broken in TS 2.4 + _(numericDictionary).mapKeys(); // LoDashImplicitWrapper> + _(numericDictionary).mapKeys(numericDictionaryIterator); // LoDashImplicitWrapper> + _(numericDictionary).mapKeys(""); // LoDashImplicitWrapper> + _(numericDictionary).mapKeys({}); // LoDashImplicitWrapper> + */ - _(dictionary).mapKeys(); // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapKeys(dictionaryIterator); // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapKeys(''); // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapKeys({}); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapKeys(); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapKeys(abcObjectIterator); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapKeys(""); // $ExpectType LoDashImplicitWrapper> - /* Broken in TS 2.4 - _(numericDictionary).mapKeys(); // LoDashImplicitWrapper> - _(numericDictionary).mapKeys(numericDictionaryIterator); // LoDashImplicitWrapper> - _(numericDictionary).mapKeys(''); // LoDashImplicitWrapper> - _(numericDictionary).mapKeys({}); // LoDashImplicitWrapper> - */ - } + _.chain(list).mapKeys(); // $ExpectType LoDashExplicitWrapper> + _.chain(list).mapKeys(listIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(list).mapKeys(""); // $ExpectType LoDashExplicitWrapper> + _.chain(list).mapKeys({}); // $ExpectType LoDashExplicitWrapper> - { - _(abcObject).mapKeys(); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapKeys(abcObjectIterator); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapKeys(''); // $ExpectType LoDashImplicitWrapper> - } + _.chain(dictionary).mapKeys(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapKeys(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapKeys(""); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapKeys({}); // $ExpectType LoDashExplicitWrapper> - { - _(array).chain().mapKeys(); // $ExpectType LoDashExplicitWrapper> - _(array).chain().mapKeys(listIterator); // $ExpectType LoDashExplicitWrapper> - _(array).chain().mapKeys(''); // $ExpectType LoDashExplicitWrapper> - _(array).chain().mapKeys({}); // $ExpectType LoDashExplicitWrapper> + /* Broken in TS 2.4 + _.chain(numericDictionary).mapKeys(); // LoDashExplicitWrapper> + _.chain(numericDictionary).mapKeys(numericDictionaryIterator); // LoDashExplicitWrapper> + _.chain(numericDictionary).mapKeys(""); // LoDashExplicitWrapper> + _.chain(numericDictionary).mapKeys({}); // LoDashExplicitWrapper> + */ - _(list).chain().mapKeys(); // $ExpectType LoDashExplicitWrapper> - _(list).chain().mapKeys(listIterator); // $ExpectType LoDashExplicitWrapper> - _(list).chain().mapKeys(''); // $ExpectType LoDashExplicitWrapper> - _(list).chain().mapKeys({}); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapKeys(); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapKeys(abcObjectIterator); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapKeys(""); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapKeys(); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapKeys(dictionaryIterator); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapKeys(''); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapKeys({}); // $ExpectType LoDashExplicitWrapper> - - /* Broken in TS 2.4 - _(numericDictionary).chain().mapKeys(); // LoDashExplicitWrapper> - _(numericDictionary).chain().mapKeys(numericDictionaryIterator); // LoDashExplicitWrapper> - _(numericDictionary).chain().mapKeys(''); // LoDashExplicitWrapper> - _(numericDictionary).chain().mapKeys({}); // LoDashExplicitWrapper> - */ - } - - { - _(abcObject).chain().mapKeys(); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapKeys(abcObjectIterator); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapKeys(''); // $ExpectType LoDashExplicitWrapper> - } + const indexIterator = (index: number) => index + 1; + const keyIterator = (key: string) => "_" + key; + fp.mapKeys(indexIterator, list); // $ExpectType Dictionary + fp.mapKeys(keyIterator)(dictionary); // $ExpectType Dictionary + fp.mapKeys(keyIterator)(abcObject); // $ExpectType Dictionary } // _.mapValues @@ -11718,956 +5597,773 @@ namespace TestMapKeys { const abcObjectOrNull: AbcObject | null = anything; const key: string = anything; - { - // $ExpectType NumericDictionary - _.mapValues("foo", (char, index, str) => { - char; // $ExpectType string - index; // $ExpectType number - str; // $ExpectType string - return abcObject; - }); + // $ExpectType NumericDictionary + _.mapValues("foo", (char, index, str) => { + char; // $ExpectType string + index; // $ExpectType number + str; // $ExpectType string + return abcObject; + }); - // $ExpectType Dictionary - _.mapValues(dictionary, (value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // $ExpectType Dictionary + _.mapValues(dictionary, (value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - // $ExpectType Dictionary - _.mapValues(numericDictionary, (value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + // $ExpectType Dictionary + _.mapValues(numericDictionary, (value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // $ExpectType { a: string; b: string; c: string; } - _.mapValues(abcObject, (value, key, collection) => { - value; // $ExpectType string | number | boolean - key; // $ExpectType string - collection; // $ExpectType AbcObject - return ""; - }); + // $ExpectType { a: string; b: string; c: string; } + _.mapValues(abcObject, (value, key, collection) => { + value; // $ExpectType string | number | boolean + key; // $ExpectType string + collection; // $ExpectType AbcObject + return ""; + }); - _.mapValues(dictionary, {}); // $ExpectType Dictionary - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _.mapValues(numericDictionary, {}); // $ExpectType Dictionary - _.mapValues(abcObject, {}); // $ExpectType { a: boolean; b: boolean; c: boolean; } + _.mapValues(dictionary, {}); // $ExpectType Dictionary + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.mapValues(numericDictionary, {}); // $ExpectType Dictionary + _.mapValues(abcObject, {}); // $ExpectType { a: boolean; b: boolean; c: boolean; } - _.mapValues(dictionary, "a"); // $ExpectType Dictionary - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _.mapValues(numericDictionary, "a"); // $ExpectType Dictionary + _.mapValues(dictionary, "a"); // $ExpectType Dictionary + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.mapValues(numericDictionary, "a"); // $ExpectType Dictionary - _.mapValues(abcObject, key); // $ExpectType { a: any; b: any; c: any; } - _.mapValues(dictionary, key); // $ExpectType Dictionary - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _.mapValues(numericDictionary, key); // $ExpectType Dictionary + _.mapValues(abcObject, key); // $ExpectType { a: any; b: any; c: any; } + _.mapValues(dictionary, key); // $ExpectType Dictionary + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.mapValues(numericDictionary, key); // $ExpectType Dictionary - _.mapValues("a"); // $ExpectType NumericDictionary - _.mapValues(dictionary); // $ExpectType Dictionary - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _.mapValues(numericDictionary); // $ExpectType Dictionary - _.mapValues(abcObject); // $ExpectType AbcObject - _.mapValues(abcObjectOrNull); // $ExpectType Partial - } + _.mapValues("a"); // $ExpectType NumericDictionary + _.mapValues(dictionary); // $ExpectType Dictionary + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.mapValues(numericDictionary); // $ExpectType Dictionary + _.mapValues(abcObject); // $ExpectType AbcObject + _.mapValues(abcObjectOrNull); // $ExpectType Partial - { - // $ExpectType LoDashImplicitWrapper> - _("foo").mapValues((char, index, str) => { - char; // $ExpectType string - index; // $ExpectType number - str; // $ExpectType string - return abcObject; - }); + // $ExpectType LoDashImplicitWrapper> + _("foo").mapValues((char, index, str) => { + char; // $ExpectType string + index; // $ExpectType number + str; // $ExpectType string + return abcObject; + }); - // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapValues((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapValues((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - // $ExpectType LoDashImplicitWrapper> - _(numericDictionary).mapValues((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).mapValues((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // $ExpectType LoDashImplicitWrapper<{ a: string; b: string; c: string; }> - _(abcObject).mapValues((value, key, collection) => { - value; // $ExpectType string | number | boolean - key; // $ExpectType string - collection; // $ExpectType AbcObject - return ""; - }); + // $ExpectType LoDashImplicitWrapper<{ a: string; b: string; c: string; }> + _(abcObject).mapValues((value, key, collection) => { + value; // $ExpectType string | number | boolean + key; // $ExpectType string + collection; // $ExpectType AbcObject + return ""; + }); - _(dictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapValues({}); // $ExpectType LoDashImplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> + _(dictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _(numericDictionary).mapValues({}); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapValues({}); // $ExpectType LoDashImplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> - _(dictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _(numericDictionary).mapValues("a"); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapValues(key); // $ExpectType LoDashImplicitWrapper<{ a: any; b: any; c: any; }> - _(dictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapValues(key); // $ExpectType LoDashImplicitWrapper<{ a: any; b: any; c: any; }> + _(dictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _(numericDictionary).mapValues(key); // $ExpectType LoDashImplicitWrapper> - _("a").mapValues(); // $ExpectType LoDashImplicitWrapper> - _(dictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> - _(abcObject).mapValues(); // $ExpectType LoDashImplicitWrapper - _(abcObjectOrNull).mapValues(); // $ExpectType LoDashImplicitWrapper> - } + _("a").mapValues(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _(numericDictionary).mapValues(); // $ExpectType LoDashImplicitWrapper> + _(abcObject).mapValues(); // $ExpectType LoDashImplicitWrapper + _(abcObjectOrNull).mapValues(); // $ExpectType LoDashImplicitWrapper> - { - // $ExpectType LoDashExplicitWrapper> - _("foo").chain().mapValues((char, index, str) => { - char; // $ExpectType string - index; // $ExpectType number - str; // $ExpectType string - return abcObject; - }); + // $ExpectType LoDashExplicitWrapper> + _.chain("foo").mapValues((char, index, str) => { + char; // $ExpectType string + index; // $ExpectType number + str; // $ExpectType string + return abcObject; + }); - // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapValues((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapValues((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - // $ExpectType LoDashExplicitWrapper> - _(numericDictionary).chain().mapValues((value, key, collection) => { - value; // $ExpectType AbcObject - key; // $ExpectType string - collection; // $ExpectType Dictionary - return ""; - }); + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).mapValues((value, key, collection) => { + value; // $ExpectType AbcObject + key; // $ExpectType string + collection; // $ExpectType Dictionary + return ""; + }); - // $ExpectType LoDashExplicitWrapper<{ a: string; b: string; c: string; }> - _(abcObject).chain().mapValues((value, key, collection) => { - value; // $ExpectType string | number | boolean - key; // $ExpectType string - collection; // $ExpectType AbcObject - return ""; - }); + // $ExpectType LoDashExplicitWrapper<{ a: string; b: string; c: string; }> + _.chain(abcObject).mapValues((value, key, collection) => { + value; // $ExpectType string | number | boolean + key; // $ExpectType string + collection; // $ExpectType AbcObject + return ""; + }); - _(dictionary).chain().mapValues({}); // $ExpectType LoDashExplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).chain().mapValues({}); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapValues({}); // $ExpectType LoDashExplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> + _.chain(dictionary).mapValues({}); // $ExpectType LoDashExplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.chain(numericDictionary).mapValues({}); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapValues({}); // $ExpectType LoDashExplicitWrapper<{ a: boolean; b: boolean; c: boolean; }> - _(dictionary).chain().mapValues("a"); // $ExpectType LoDashExplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).chain().mapValues("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapValues("a"); // $ExpectType LoDashExplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.chain(numericDictionary).mapValues("a"); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapValues(key); // $ExpectType LoDashExplicitWrapper<{ a: any; b: any; c: any; }> - _(dictionary).chain().mapValues(key); // $ExpectType LoDashExplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).chain().mapValues(key); // $ExpectType LoDashExplicitWrapper> + _.chain(abcObject).mapValues(key); // $ExpectType LoDashExplicitWrapper<{ a: any; b: any; c: any; }> + _.chain(dictionary).mapValues(key); // $ExpectType LoDashExplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.chain(numericDictionary).mapValues(key); // $ExpectType LoDashExplicitWrapper> - _("a").chain().mapValues(); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().mapValues(); // $ExpectType LoDashExplicitWrapper> - // Can't really support NumericDictionary fully, but it at least gets treated like a Dictionary - _(numericDictionary).chain().mapValues(); // $ExpectType LoDashExplicitWrapper> + _.chain("a").mapValues(); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).mapValues(); // $ExpectType LoDashExplicitWrapper> + // Can"t really support NumericDictionary fully, but it at least gets treated like a Dictionary + _.chain(numericDictionary).mapValues(); // $ExpectType LoDashExplicitWrapper> - _(abcObject).chain().mapValues(); // $ExpectType LoDashExplicitWrapper - _(abcObjectOrNull).chain().mapValues(); // $ExpectType LoDashExplicitWrapper> - } -} + _.chain(abcObject).mapValues(); // $ExpectType LoDashExplicitWrapper + _.chain(abcObjectOrNull).mapValues(); // $ExpectType LoDashExplicitWrapper> -// _.merge -namespace TestMerge { - type InitialValue = { a : number }; - type MergingValue = { b : string }; - - const initialValue = { a : 1 }; - const mergingValue = { b : "hi" }; - - type ExpectedResult = { a: number, b: string }; - let result: ExpectedResult; - - // Test for basic merging - - result = _.merge(initialValue, mergingValue); - - result = _.merge(initialValue, {}, mergingValue); - - result = _.merge(initialValue, {}, {}, mergingValue); - - result = _.merge(initialValue, {}, {}, {}, mergingValue); - - // Once we get to the varargs version, you have to specify the result explicitly - result = _.merge(initialValue, {}, {}, {}, {}, mergingValue); - - type ComplicatedExpectedType = { a: number, b: string, c: {}, d: number[], e: boolean }; - - let complicatedResult: ComplicatedExpectedType = _.merge({ a: 1 }, - { b: "string" }, - { c: {} }, - { d: [1] }, - { e: true }); - // Test for type overriding - - type ExpectedTypeAfterOverriding = { a: boolean }; - - let overriddenResult: ExpectedTypeAfterOverriding = _.merge({ a: 1 }, - { a: "string" }, - { a: {} }, - { a: [1] }, - { a: true }); - - // Tests for basic chaining with merge - - result = _(initialValue).merge(mergingValue).value(); - - result = _(initialValue).merge({}, mergingValue).value(); - - result = _(initialValue).merge({}, {}, mergingValue).value(); - - result = _(initialValue).merge({}, {}, {}, mergingValue).value(); - - // Once we get to the varargs version, you have to specify the result explicitly - result = _(initialValue).merge({}, {}, {}, {}, mergingValue).value(); - - // Test complex multiple combinations with chaining - - complicatedResult = _({ a: 1 }).merge({ b: "string" }, - { c: {} }, - { d: [1] }, - { e: true }).value(); - - // Test for type overriding with chaining - - overriddenResult = _({ a: 1 }).merge({ a: "string" }, - { a: {} }, - { a: [1] }, - { a: true }).value(); - - { - let result: _.LoDashExplicitObjectWrapper; - // result = _(initialValue).chain().merge(mergingValue); - // result = _(initialValue).chain().merge({}, mergingValue); - // result = _(initialValue).chain().merge({}, {}, mergingValue); - // result = _(initialValue).chain().merge({}, {}, {}, mergingValue); - // result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - //result = _({ a: 1 }).chain().merge({ b: "string" }, { c: {} }, { d: [1] }, { e: true }); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - //result = _({ a: 1 }).chain().merge({ a: "string" }, { a: {} }, { a: [1] }, { a: true }); - } -} - -// _.mergeWith -namespace TestMergeWith { - type InitialValue = { a : number }; - type MergingValue = { b : string }; - - const initialValue = { a : 1 }; - const mergingValue = { b : "hi" }; - - type ExpectedResult = { a: number, b: string }; - let result: ExpectedResult; - - 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); - result = _.mergeWith(initialValue, {}, mergingValue, customizer); - result = _.mergeWith(initialValue, {}, {}, mergingValue, customizer); - result = _.mergeWith(initialValue, {}, {}, {}, mergingValue, customizer); - - // Once we get to the varargs version, you have to specify the result explicitl - result = _.mergeWith(initialValue, {}, {}, {}, {}, mergingValue, customizer); - - // Tests for basic chaining with mergeWith - result = _(initialValue).mergeWith(mergingValue, customizer).value(); - result = _(initialValue).mergeWith({}, mergingValue, customizer).value(); - result = _(initialValue).mergeWith({}, {}, mergingValue, customizer).value(); - result = _(initialValue).mergeWith({}, {}, {}, mergingValue, customizer).value(); - result = _(initialValue).mergeWith({}, {}, {}, {}, mergingValue, customizer).value(); + const valueIterator = (value: AbcObject) => ""; + fp.mapValues(valueIterator)(dictionary); // $ExpectType Dictionary + fp.mapValues("a", dictionary); // $ExpectType Dictionary + fp.mapValues(valueIterator)(numericDictionary); // $ExpectType Dictionary + fp.mapValues({ a: 42 })(numericDictionary); // $ExpectType Dictionary + fp.mapValues(value => "", abcObjectOrNull); // $ExpectType { a: string; b: string; c: string; } } // _.omit -namespace TestOmit { - let obj: AbcObject | null | undefined = anything; - let dictionary:_.Dictionary = anything; - let numericDictionary:_.NumericDictionary = anything; - let dictionaryWithNull:_.Dictionary = anything; - let numericDictionaryWithNull:_.NumericDictionary = anything; - let dictionaryWithUndefined:_.Dictionary = anything; - let numericDictionaryWithUndefined:_.NumericDictionary = anything; - let dictionaryWithNullAndUndefined:_.Dictionary = anything; - let numericDictionaryWithNullAndUndefined:_.NumericDictionary = anything; +{ + const obj: AbcObject | null | undefined = anything; + const dictionary: _.Dictionary = anything; + const numericDictionary: _.NumericDictionary = anything; - { - _.omit(obj, 'a'); // $ExpectType Partial - _.omit(obj, 0, 'a'); // $ExpectType Partial - _.omit(obj, ['b', 1], 0, 'a'); // $ExpectType Partial - _.omit(dictionary, 'a'); // $ExpectType Dictionary - _.omit(numericDictionary, 'a'); // $ExpectType NumericDictionary - _.omit(dictionaryWithNull, 'a'); // $ExpectType Dictionary - _.omit(numericDictionaryWithNull, 'a'); // $ExpectType NumericDictionary - _.omit(dictionaryWithUndefined, 'a'); // $ExpectType Dictionary - _.omit(numericDictionaryWithUndefined, 'a'); // $ExpectType NumericDictionary - _.omit(dictionaryWithNullAndUndefined, 'a'); // $ExpectType Dictionary - _.omit(numericDictionaryWithNullAndUndefined, 'a'); // $ExpectType NumericDictionary - } + _.omit(obj, "a"); // $ExpectType Partial + _.omit(obj, ["b", 1], 0, "a"); // $ExpectType Partial + _.omit(dictionary, "a"); // $ExpectType Dictionary + _.omit(numericDictionary, "a"); // $ExpectType NumericDictionary - { - _(obj).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(obj).omit(0, 'a'); // $ExpectType LoDashImplicitWrapper> - _(obj).omit(['b', 1], 0, 'a'); // $ExpectType LoDashImplicitWrapper> - _(dictionary).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(numericDictionary).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(dictionaryWithNull).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(numericDictionaryWithNull).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(dictionaryWithUndefined).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(numericDictionaryWithUndefined).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(dictionaryWithNullAndUndefined).omit('a'); // $ExpectType LoDashImplicitWrapper> - _(numericDictionaryWithNullAndUndefined).omit('a'); // $ExpectType LoDashImplicitWrapper> - } + _(obj).omit("a"); // $ExpectType LoDashImplicitWrapper> + _(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> + _(dictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> - { - _(obj).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(obj).chain().omit(0, 'a'); // $ExpectType LoDashExplicitWrapper> - _(obj).chain().omit(['b', 1], 0, 'a'); // $ExpectType LoDashExplicitWrapper> - _(dictionary).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(numericDictionary).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(dictionaryWithNull).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(numericDictionaryWithNull).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(dictionaryWithUndefined).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(numericDictionaryWithUndefined).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(dictionaryWithNullAndUndefined).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - _(numericDictionaryWithNullAndUndefined).chain().omit('a'); // $ExpectType LoDashExplicitWrapper> - } + _.chain(obj).omit("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> + + fp.omit("a", obj); // $ExpectType Partial + fp.omit("a")(obj); // $ExpectType Partial + fp.omit(["a", "b"])(obj); // $ExpectType Partial } // _.omitBy -namespace TestOmitBy { - let obj: AbcObject | null | undefined = anything; - let predicate = (element: any, key: string) => true; +{ + const obj: AbcObject | null | undefined = anything; + const predicate = (element: string | number | boolean, key: string) => true; - { - let result: Partial; - - result = _.omitBy(obj, predicate); - } - - { - let result: _.LoDashImplicitWrapper>; - - result = _(obj).omitBy(predicate); - } - - { - let result: _.LoDashExplicitWrapper>; - - result = _(obj).chain().omitBy(predicate); - } + _.omitBy(obj, predicate); // $ExpectType Partial + _(obj).omitBy(predicate); // $ExpectType LoDashImplicitWrapper> + _.chain(obj).omitBy(predicate); // $ExpectType LoDashExplicitWrapper> + fp.omitBy(predicate, obj); // $ExpectType Partial + fp.omitBy(predicate)(obj); // $ExpectType Partial } // _.pick -namespace TestPick { +{ const obj1: AbcObject | null | undefined = anything; const obj2: AbcObject = anything; - const readonlyArray: string[] = ['a', 'b']; // TODO: Should be ReadonlyArray, but see comment on type Many - const literalsArray = ['a' as 'a', 'b' as 'b']; - const roLiteralsArray: Array<'a' | 'b'> = literalsArray; // TODO: Should be ReadonlyArray, but see comment on type Many + const readonlyArray: string[] = ["a", "b"]; // TODO: Should be ReadonlyArray, but see comment on type Many + const literalsArray = ["a" as "a", "b" as "b"]; + const roLiteralsArray: Array<"a" | "b"> = literalsArray; // TODO: Should be ReadonlyArray, but see comment on type Many - _.pick(obj1, 'a'); // $ExpectType PartialDeep - _.pick(obj1, 0, 'a'); // $ExpectType PartialDeep - _.pick(obj1, ['b', 1], 0, 'a'); // $ExpectType PartialDeep + _.pick(obj1, "a"); // $ExpectType PartialDeep + _.pick(obj1, 0, "a"); // $ExpectType PartialDeep + _.pick(obj1, ["b", 1], 0, "a"); // $ExpectType PartialDeep _.pick(obj1, readonlyArray); // $ExpectType PartialDeep // Broken in TS 2.4 - // _.pick(obj2, 'a', 'b'); // Pick + // _.pick(obj2, "a", "b"); // Pick _.pick(obj2, literalsArray); // $ExpectType Pick _.pick(obj2, roLiteralsArray); // $ExpectType Pick - _(obj1).pick('a'); // $ExpectType LoDashImplicitWrapper> - _(obj1).pick(0, 'a'); // $ExpectType LoDashImplicitWrapper> - _(obj1).pick(['b', 1], 0, 'a'); // $ExpectType LoDashImplicitWrapper> + _(obj1).pick("a"); // $ExpectType LoDashImplicitWrapper> + _(obj1).pick(0, "a"); // $ExpectType LoDashImplicitWrapper> + _(obj1).pick(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> _(obj1).pick(readonlyArray); // $ExpectType LoDashImplicitWrapper> // Broken in TS 2.4 - // _(obj2).pick('a', 'b'); // LoDashImplicitWrapper> + // _(obj2).pick("a", "b"); // LoDashImplicitWrapper> _(obj2).pick(literalsArray); // $ExpectType LoDashImplicitWrapper> _(obj2).pick(roLiteralsArray); // $ExpectType LoDashImplicitWrapper> - _.chain(obj1).pick('a'); // $ExpectType LoDashExplicitWrapper> - _.chain(obj1).pick(0, 'a'); // $ExpectType LoDashExplicitWrapper> - _.chain(obj1).pick(['b', 1], 0, 'a'); // $ExpectType LoDashExplicitWrapper> + _.chain(obj1).pick("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(obj1).pick(0, "a"); // $ExpectType LoDashExplicitWrapper> + _.chain(obj1).pick(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> _.chain(obj1).pick(readonlyArray); // $ExpectType LoDashExplicitWrapper> // Broken in TS 2.4 - // _.chain(obj2).pick('a', 'b'); // LoDashExplicitWrapper> + // _.chain(obj2).pick("a", "b"); // LoDashExplicitWrapper> _.chain(obj2).pick(literalsArray); // $ExpectType LoDashExplicitWrapper> _.chain(obj2).pick(roLiteralsArray); // $ExpectType LoDashExplicitWrapper> + + fp.pick("a", obj2); // $ExpectType Pick + fp.pick("a")(obj2); // $ExpectType Pick + fp.pick(["a" as "a", "b" as "b"])(obj2); // $ExpectType Pick } // _.pickBy -namespace TestPickBy { - let obj: AbcObject | null | undefined = anything; - let predicate = (element: any, key: string) => true; +{ + const obj: AbcObject | null | undefined = anything; + const predicate = (element: string | number | boolean, key: string) => true; - { - let result: Partial; - - result = _.pickBy(obj, predicate); - } - - { - let result: _.LoDashImplicitWrapper>; - - result = _(obj).pickBy(predicate); - } - - { - let result: _.LoDashExplicitWrapper>; - - result = _(obj).chain().pickBy(predicate); - } + _.pickBy(obj, predicate); // $ExpectType Partial + _(obj).pickBy(predicate); // $ExpectType LoDashImplicitWrapper> + _.chain(obj).pickBy(predicate); // $ExpectType LoDashExplicitWrapper> + fp.pickBy(predicate, obj); // $ExpectType Partial + fp.pickBy(predicate)(obj); // $ExpectType Partial } // _.result -namespace TestResult { - { - let result: string; +{ + _.result("abc", "0"); // $ExpectType string + _.result("abc", 0, "_"); // $ExpectType string + _.result("abc", "0", () => "_"); // $ExpectType string + _.result("abc", ["0"]); // $ExpectType string + _.result("abc", [0], () => "_"); // $ExpectType string + _.result({ a: () => true }, "a"); // $ExpectType boolean + _("abc").result("0"); // $ExpectType string + _("abc").result(0, "_"); // $ExpectType string + _("abc").result("0", () => "_"); // $ExpectType string + _("abc").result(["0"]); // $ExpectType string + _("abc").result([0], () => "_"); // $ExpectType string + _({ a: () => true }).result("a"); // $ExpectType boolean + _.chain("abc").result("0"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").result(0, "_"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").result("0", () => "_"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").result(["0"]); // $ExpectType LoDashExplicitWrapper + _.chain("abc").result([0], () => "_"); // $ExpectType LoDashExplicitWrapper + _.chain({ a: () => true }).result("a"); // $ExpectType LoDashExplicitWrapper - result = _.result('abc', '0'); - result = _.result('abc', '0', '_'); - result = _.result('abc', '0', () => '_'); - result = _.result('abc', ['0']); - result = _.result('abc', ['0'], '_'); - result = _.result('abc', ['0'], () => '_'); - - result = _('abc').result('0'); - result = _('abc').result('0', '_'); - result = _('abc').result('0', () => '_'); - result = _('abc').result(['0']); - result = _('abc').result(['0'], '_'); - result = _('abc').result(['0'], () => '_'); - } - - { - let result: number; - - result = _.result([42], '0'); - result = _.result([42], '0', -1); - result = _.result([42], '0', () => -1); - result = _.result([42], ['0']); - result = _.result([42], ['0'], -1); - result = _.result([42], ['0'], () => -1); - - result = _([42]).result('0'); - result = _([42]).result('0', -1); - result = _([42]).result('0', () => -1); - result = _([42]).result(['0']); - result = _([42]).result(['0'], -1); - result = _([42]).result(['0'], () => -1); - } - - { - let result: boolean; - - result = _.result({a: true}, 'a'); - result = _.result({a: true}, 'a', false); - result = _.result({a: true}, 'a', () => false); - result = _.result({a: true}, ['a']); - result = _.result({a: true}, ['a'], false); - result = _.result({a: true}, ['a'], () => false); - - result = _({a: true}).result('a'); - result = _({a: true}).result('a', false); - result = _({a: true}).result('a', () => false); - result = _({a: true}).result(['a']); - result = _({a: true}).result(['a'], false); - result = _({a: true}).result(['a'], () => false); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().result('0'); - result = _('abc').chain().result('0', '_'); - result = _('abc').chain().result('0', '_'); - result = _('abc').chain().result(['0']); - result = _('abc').chain().result(['0'], () => '_'); - result = _('abc').chain().result(['0'], () => '_'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _([42]).chain().result('0'); - result = _([42]).chain().result('0', -1); - result = _([42]).chain().result('0', () => -1); - result = _([42]).chain().result(['0']); - result = _([42]).chain().result(['0'], -1); - result = _([42]).chain().result(['0'], () => -1); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _({a: true}).chain().result('a'); - result = _({a: true}).chain().result('a', false); - result = _({a: true}).chain().result('a', () => false); - result = _({a: true}).chain().result(['a']); - result = _({a: true}).chain().result(['a'], false); - result = _({a: true}).chain().result(['a'], () => false); - } + fp.result("0", "abc"); // $ExpectType string + fp.result("0")("abc"); // $ExpectType string } // _.set -namespace TestSet { - type SampleObject = {a: {}}; - type SampleResult = {a: {b: number[]}}; - - let object: SampleObject = { a: {} }; - let value = 0; - - { - let result: SampleResult; - - result = _.set(object, 'a.b[1]', value); - result = _.set(object, ['a', 'b', 1], value); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).set('a.b[1]', value); - result = _(object).set(['a', 'b', 1], value); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().set('a.b[1]', value); - result = _(object).chain().set(['a', 'b', 1], value); - } -} - // _.setWith -namespace TestSetWith { - type SampleResult = {a: {b: number[]}}; - - let object: SampleResult = { a: { b: [] } }; - let value = 0; - let customizer = (value: any, key: string, object: SampleResult) => 0; - - { - let result: SampleResult; - - result = _.setWith(object, 'a.b[1]', value); - result = _.setWith(object, 'a.b[1]', value, customizer); - result = _.setWith(object, ['a', 'b', 1], value); - result = _.setWith(object, ['a', 'b', 1], value, customizer); +{ + interface SampleResult { + a: { + b: number[]; + }; } - { - let result: _.LoDashImplicitObjectWrapper; + const object = { a: {} }; - result = _(object).setWith('a.b[1]', value); - result = _(object).setWith('a.b[1]', value, customizer); - result = _(object).setWith(['a', 'b', 1], value); - result = _(object).setWith(['a', 'b', 1], value, customizer); + _.set(object, "a.b[1]", 42); // $ExpectType SampleResult + _.set(object, ["a", "b", 1], 42); // $ExpectType SampleResult + + _(object).set("a.b[1]", 42); // $ExpectType LoDashImplicitWrapper + _(object).set(["a", "b", 1], 42); // $ExpectType LoDashImplicitWrapper + + _.chain(object).set("a.b[1]", 42); // $ExpectType LoDashExplicitWrapper + _.chain(object).set(["a", "b", 1], 42); // $ExpectType LoDashExplicitWrapper + + fp.set("a", 42, object); // $ExpectType { a: {}; } + fp.set("a.b[1]")(42)(object); // $ExpectType { a: {}; } + fp.set(["a", "b", 1])(42)(object); // $ExpectType { a: {}; } +} +{ + interface SampleResult { + a: { + b: number[]; + }; } - { - let result: _.LoDashExplicitObjectWrapper; + const object: SampleResult = { a: { b: [0, 1] } }; + const customizer = (value: any, key: string, object: SampleResult) => 0; - result = _(object).chain().setWith('a.b[1]', value); - result = _(object).chain().setWith('a.b[1]', value, customizer); - result = _(object).chain().setWith(['a', 'b', 1], value); - result = _(object).chain().setWith(['a', 'b', 1], value, customizer); - } + _.setWith(object, "a.b[1]", 42); // $ExpectType SampleResult + _.setWith(object, "a.b[1]", 42, customizer); // $ExpectType SampleResult + _.setWith(object, ["a", "b", 1], 42, customizer); // $ExpectType SampleResult + + _(object).setWith("a.b[1]", 42); // $ExpectType LoDashImplicitWrapper + _(object).setWith("a.b[1]", 42, customizer); // $ExpectType LoDashImplicitWrapper + _(object).setWith(["a", "b", 1], 42, customizer); // $ExpectType LoDashImplicitWrapper + + _.chain(object).setWith("a.b[1]", 42); // $ExpectType LoDashExplicitWrapper + _.chain(object).setWith("a.b[1]", 42, customizer); // $ExpectType LoDashExplicitWrapper + _.chain(object).setWith(["a", "b", 1], 42, customizer); // $ExpectType LoDashExplicitWrapper + + fp.setWith(customizer, "a", 42, object); // $ExpectType SampleResult + fp.setWith(customizer)("a.b[1]")(42)(object); // $ExpectType SampleResult + fp.setWith(customizer)(["a", "b", 1])(42)(object); // $ExpectType SampleResult } // _.toPairs -namespace TestToPairs { - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; - let abcObject: AbcObject = anything; - - { - _.toPairs(dictionary); // $ExpectType [string, number][] - _.toPairs(numericDictionary); // $ExpectType [string, number][] - _.toPairs(abcObject); // $ExpectType [string, any][] - } - - { - _(dictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(numericDictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(abcObject).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - } - - { - _(dictionary).chain().toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(numericDictionary).chain().toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(abcObject).chain().toPairs(); // $ExpectType LoDashExplicitWrapper<[string, any][]> - } -} - // _.toPairsIn -namespace TestToPairsIn { - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; - let abcObject: AbcObject = anything; +{ + const dictionary: _.Dictionary = {}; + const numericDictionary: _.NumericDictionary = {}; + const abcObject: AbcObject = anything; - { - _.toPairsIn(dictionary); // $ExpectType [string, number][] - _.toPairsIn(numericDictionary); // $ExpectType [string, number][] - _.toPairsIn(abcObject); // $ExpectType [string, any][] - } + _.toPairs(dictionary); // $ExpectType [string, number][] + _.toPairs(numericDictionary); // $ExpectType [string, number][] + _.toPairs(abcObject); // $ExpectType [string, any][] - { - _(dictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(numericDictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> - _(abcObject).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - } + _(dictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(numericDictionary).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(abcObject).toPairs(); // $ExpectType LoDashImplicitWrapper<[string, any][]> - { - _(dictionary).chain().toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(numericDictionary).chain().toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> - _(abcObject).chain().toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> - } + _.chain(dictionary).toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(numericDictionary).toPairs(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(abcObject).toPairs(); // $ExpectType LoDashExplicitWrapper<[string, any][]> + + fp.toPairs(dictionary); // $ExpectType [string, number][] + + _.toPairsIn(dictionary); // $ExpectType [string, number][] + _.toPairsIn(numericDictionary); // $ExpectType [string, number][] + _.toPairsIn(abcObject); // $ExpectType [string, any][] + + _(dictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(numericDictionary).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, number][]> + _(abcObject).toPairsIn(); // $ExpectType LoDashImplicitWrapper<[string, any][]> + + _.chain(dictionary).toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(numericDictionary).toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, number][]> + _.chain(abcObject).toPairsIn(); // $ExpectType LoDashExplicitWrapper<[string, any][]> + + fp.toPairsIn(dictionary); // $ExpectType [string, number][] } // _.transform -namespace TestTransform { - let array: number[] = []; - let dictionary: _.Dictionary = {}; +{ + const array: number[] = []; + const dictionary: _.Dictionary = {}; { - let iterator = (acc: AbcObject[], curr: number, index?: number, arr?: number[]) => {}; - let accumulator: AbcObject[] = []; - let result: AbcObject[]; + const iterator = (acc: AbcObject[], curr: number, index?: number, arr?: number[]) => {}; + const accumulator: AbcObject[] = []; - result = _.transform(array); - result = _.transform(array, iterator); - result = _.transform(array, iterator, accumulator); - - result = _(array).transform().value(); - result = _(array).transform(iterator).value(); - result = _(array).transform(iterator, accumulator).value(); + _.transform(array); // $ExpectType any[] + _.transform(array, iterator); // $ExpectType AbcObject[] + _.transform(array, iterator, accumulator); // $ExpectType AbcObject[] + _(array).transform(); // $ExpectType LoDashImplicitWrapper + _(array).transform(iterator); // $ExpectType LoDashImplicitWrapper + _(array).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper + _.chain(array).transform(iterator, accumulator); // $ExpectType LoDashExplicitWrapper } { - let iterator = (acc: _.Dictionary, curr: number, index?: number, arr?: number[]) => {}; - let accumulator: _.Dictionary = {}; - let result: _.Dictionary; + const iterator = (acc: _.Dictionary, curr: number, index?: number, arr?: number[]) => {}; + const accumulator: _.Dictionary = {}; - result = _.transform(array, iterator, accumulator); - - result = _(array).transform(iterator, accumulator).value(); + _.transform(array, iterator, accumulator); // $ExpectType Dictionary + _(array).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper> + _.chain(array).transform(iterator, accumulator); // $ExpectType LoDashExplicitWrapper> } { - let iterator = (acc: _.Dictionary, curr: number, key?: string, dict?: _.Dictionary) => {}; - let accumulator: _.Dictionary = {}; - let result: _.Dictionary; + const iterator = (acc: _.Dictionary, curr: number, key?: string, dict?: _.Dictionary) => {}; + const accumulator: _.Dictionary = {}; - result = _.transform(dictionary); - result = _.transform(dictionary, iterator); - result = _.transform(dictionary, iterator, accumulator); - - result = _(dictionary).transform().value(); - result = _(dictionary).transform(iterator).value(); - result = _(dictionary).transform(iterator, accumulator).value(); + _.transform(dictionary); // $ExpectType Dictionary + _.transform(dictionary, iterator); // $ExpectType Dictionary + _.transform(dictionary, iterator, accumulator); // $ExpectType Dictionary + _(dictionary).transform(); // $ExpectType LoDashImplicitWrapper> + _(dictionary).transform(iterator); // $ExpectType LoDashImplicitWrapper> + _(dictionary).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper> } { - let iterator = (acc: AbcObject[], curr: number, key?: string, dict?: _.Dictionary) => {}; - let accumulator: AbcObject[] = []; - let result: AbcObject[]; + const iterator = (acc: AbcObject[], curr: number, key?: string, dict?: _.Dictionary) => {}; + const accumulator: AbcObject[] = []; - result = _.transform(dictionary, iterator, accumulator); + _.transform(dictionary, iterator, accumulator); // $ExpectType AbcObject[] + _(dictionary).transform(iterator, accumulator); // $ExpectType LoDashImplicitWrapper + _.chain(dictionary).transform(iterator, accumulator); // $ExpectType LoDashExplicitWrapper + } - result = _(dictionary).transform(iterator, accumulator).value(); + { + const iterator = (acc: AbcObject[], curr: number): AbcObject => anything; + const accumulator: AbcObject[] = []; + + fp.transform(iterator, accumulator, array); // $ExpectType AbcObject[] + fp.transform(iterator)(accumulator)(array); // $ExpectType AbcObject[] + fp.transform(iterator)(accumulator)(dictionary); // $ExpectType AbcObject[] + } + + { + const iterator = (acc: _.Dictionary, curr: number): AbcObject => anything; + const accumulator: _.Dictionary = {}; + + fp.transform(iterator)(accumulator)(array); // $ExpectType Dictionary + fp.transform(iterator)(accumulator)(dictionary); // $ExpectType Dictionary } } // _.unset -namespace TestUnset { - type SampleObject = {a: {b: string; c: boolean}}; +{ + const object = { a: { b: "", c: true } }; - let object: SampleObject = { a: { b: "", c: true } }; - - { - let result: boolean; - - result = _.unset(object, 'a.b'); - result = _.unset(object, ['a', 'b']); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(object).unset('a.b'); - result = _(object).unset(['a', 'b']); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(object).chain().unset('a.b'); - result = _(object).chain().unset(['a', 'b']); - } + _.unset(object, "a.b"); // $ExpectType boolean + _.unset(object, ["a", "b"]); // $ExpectType boolean + _(object).unset("a.b"); // $ExpectType LoDashImplicitWrapper + _(object).unset(["a", "b"]); // $ExpectType LoDashImplicitWrapper + _.chain(object).unset("a.b"); // $ExpectType LoDashExplicitWrapper + _.chain(object).unset(["a", "b"]); // $ExpectType LoDashExplicitWrapper + fp.unset("a.b", object); // $ExpectType boolean + fp.unset("a.b")(object); // $ExpectType boolean + fp.unset(["a", "b"])(object); // $ExpectType boolean } // _.update -namespace TestUpdate { - type SampleResult = {a: {b: number[]}}; +{ + const object = { a: { b: [0] } }; + const updater = (value: any) => 0; - let object: SampleResult = { a: { b: [] } }; - let updater = (value: any) => 0; - - { - let result: SampleResult; - - result = _.update(object, 'a.b[1]', updater); - result = _.update(object, ['a', 'b', 1], updater); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).update('a.b[1]', updater); - result = _(object).update(['a', 'b', 1], updater); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().update('a.b[1]', updater); - result = _(object).chain().update(['a', 'b', 1], updater); - } + _.update(object, "a.b[1]", updater); // $ExpectType any + _.update(object, ["a", "b", 1], updater); // $ExpectType any + _(object).update("a.b[1]", updater); // $ExpectType LoDashImplicitWrapper + _(object).update(["a", "b", 1], updater); // $ExpectType LoDashImplicitWrapper + _.chain(object).update("a.b[1]", updater); // $ExpectType LoDashExplicitWrapper + _.chain(object).update(["a", "b", 1], updater); // $ExpectType LoDashExplicitWrapper + fp.update("a.b[1]", updater, object); // $ExpectType any + fp.update(["a", "b", 1])(updater)(object); // $ExpectType any } // _.updateWith -namespace TestUpdateWith { - type SampleResult = {a: {b: number[]}}; - - let object: SampleResult = { a: { b: [] } }; - let updater = (value: any) => 0; - let customizer = (value: any, key: string, object: SampleResult) => 0; - - { - let result: SampleResult; - - result = _.updateWith(object, 'a.b[1]', updater); - result = _.updateWith(object, 'a.b[1]', updater, customizer); - result = _.updateWith(object, ['a', 'b', 1], updater); - result = _.updateWith(object, ['a', 'b', 1], updater, customizer); - - result = _.updateWith(object, 'a.b[1]', updater); - result = _.updateWith(object, 'a.b[1]', updater, customizer); - result = _.updateWith(object, ['a', 'b', 1], updater); - result = _.updateWith(object, ['a', 'b', 1], updater, customizer); +{ + interface SampleResult { + a: { + b: number[]; + }; } + const object: SampleResult = { a: { b: [] } }; + const updater = (value: any) => 0; + const customizer = (value: any, key: string, object: SampleResult) => 0; - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).updateWith('a.b[1]', updater); - result = _(object).updateWith('a.b[1]', updater, customizer); - result = _(object).updateWith(['a', 'b', 1], updater); - result = _(object).updateWith(['a', 'b', 1], updater, customizer); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().updateWith('a.b[1]', updater); - result = _(object).chain().updateWith('a.b[1]', updater, customizer); - result = _(object).chain().updateWith(['a', 'b', 1], updater); - result = _(object).chain().updateWith(['a', 'b', 1], updater, customizer); - } + _.updateWith(object, "a.b[1]", updater); // $ExpectType SampleResult + _.updateWith(object, "a.b[1]", updater, customizer); // $ExpectType SampleResult + _.updateWith(object, ["a", "b", 1], updater, customizer); // $ExpectType SampleResult + _(object).updateWith("a.b[1]", updater); // $ExpectType LoDashImplicitWrapper + _(object).updateWith("a.b[1]", updater, customizer); // $ExpectType LoDashImplicitWrapper + _(object).updateWith(["a", "b", 1], updater, customizer); // $ExpectType LoDashImplicitWrapper + _.chain(object).updateWith("a.b[1]", updater, customizer); // $ExpectType LoDashExplicitWrapper + fp.updateWith(customizer, "a.b[1]", updater, object); // $ExpectType SampleResult + fp.updateWith(customizer)(["a", "b", 1])(updater)(object); // $ExpectType SampleResult } // _.values -namespace TestValues { - type SampleObject = {a: {}}; +// _.valuesIn +{ + const dict: _.Dictionary = {}; + const numDict: _.NumericDictionary = {}; + const list: _.List | null | undefined = anything; + const object: AbcObject = anything; + + _.values(123); // $ExpectType any[] + _.values(true); // $ExpectType any[] + _.values("hi"); // $ExpectType string[] + _.values(["h", "i"]); // $ExpectType string[] + _.values([true, false]); // $ExpectType boolean[] + _.values(dict); // $ExpectType AbcObject[] + _.values(numDict); // $ExpectType AbcObject[] + _.values(list); // $ExpectType AbcObject[] + _.values(object); // $ExpectType (string | number | boolean)[] + + _(true).values(); // $ExpectType LoDashImplicitWrapper + _("hi").values(); // $ExpectType LoDashImplicitWrapper + _(dict).values(); // $ExpectType LoDashImplicitWrapper + + _.chain(true).values(); // $ExpectType LoDashExplicitWrapper + _.chain("hi").values(); // $ExpectType LoDashExplicitWrapper + _.chain(dict).values(); // $ExpectType LoDashExplicitWrapper + + fp.values("hi"); // $ExpectType string[] + fp.values(["h", "i"]); // $ExpectType string[] + fp.values([true, false]); // $ExpectType boolean[] + fp.values(dict); // $ExpectType AbcObject[] + fp.values(numDict); // $ExpectType AbcObject[] + fp.values(list); // $ExpectType AbcObject[] + fp.values(object); // $ExpectType (string | number | boolean)[] + + _.valuesIn([true, false]); // $ExpectType boolean[] + _.valuesIn(dict); // $ExpectType AbcObject[] + _.valuesIn(numDict); // $ExpectType AbcObject[] + _.valuesIn(list); // $ExpectType AbcObject[] + _.valuesIn(object); // $ExpectType (string | number | boolean)[] + + _(dict).valuesIn(); // $ExpectType LoDashImplicitWrapper + _.chain(dict).valuesIn(); // $ExpectType LoDashExplicitWrapper + + fp.valuesIn(dict); // $ExpectType AbcObject[] + fp.valuesIn(numDict); // $ExpectType AbcObject[] + fp.valuesIn(list); // $ExpectType AbcObject[] + fp.valuesIn(object); // $ExpectType (string | number | boolean)[] +} + +/******* + * Seq * + *******/ + +// _ +{ + _(""); // $ExpectType LoDashImplicitWrapper + _(42); // $ExpectType LoDashImplicitWrapper + _(true); // $ExpectType LoDashImplicitWrapper + _([""]); // $ExpectType LoDashImplicitWrapper + _({ a: "" }); // $ExpectType LoDashImplicitWrapper<{ a: string; }> { - let result: any[]; - - result = _.values(123); - result = _.values(true); - result = _.values(null); + const a: AbcObject[] = []; + _(a); // $ExpectType LoDashImplicitWrapper } { - let result: string[]; - - result = _.values('hi'); - result = _.values(['h', 'i']); - } - - { - let result: number[]; - - result = _.values([1, 2]); - } - - { - let result: boolean[]; - - result = _.values([true, false]); - } - - { - let dict: _.Dictionary = {}; - let numDict: _.NumericDictionary = {}; - let list: _.List = []; - let object: {a: SampleObject} = { a: { a: {} } }; - let result: SampleObject[]; - - result = _.values(dict); - result = _.values(numDict); - result = _.values(list); - result = _.values(object); - } - - // Implicit wrapper - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(123).values(); - result = _(true).values(); - result = _(null).values(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('hi').values(); - result = _(['h', 'i']).values(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _([1, 2]).values(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _([true, false]).values(); - } - - { - let dict: _.Dictionary = {}; - let numDict: _.NumericDictionary = {}; - let list: _.List = []; - let object: {a: SampleObject} = { a: { a: {} } }; - let result: _.LoDashImplicitArrayWrapper; - - result = _(dict).values(); - result = _(numDict).values(); - result = _(list).values(); - result = _(object).values(); - } - - // Explicit wrapper - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(123).chain().values(); - result = _(true).chain().values(); - result = _(null).chain().values(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('hi').chain().values(); - result = _(['h', 'i']).chain().values(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([1, 2]).chain().values(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([true, false]).chain().values(); - } - - { - let dict: _.Dictionary = {}; - let numDict: _.NumericDictionary = {}; - let list: _.List = []; - let object: {a: SampleObject} = { a: { a: {} } }; - let result: _.LoDashExplicitArrayWrapper; - - result = _(dict).chain().values(); - result = _(numDict).chain().values(); - result = _(list).chain().values(); - result = _(object).chain().values(); + const a: AbcObject[] | null | undefined = anything; + _(a); // $ExpectType LoDashImplicitWrapper } } -// _.valuesIn -namespace TestValuesIn { - let object: _.Dictionary = {}; +// _.chain +{ + _.chain(""); // $ExpectType LoDashExplicitWrapper + _("").chain(); // $ExpectType LoDashExplicitWrapper + _.chain("").chain(); // $ExpectType LoDashExplicitWrapper + _.chain(42); // $ExpectType LoDashExplicitWrapper + _.chain([""]); // $ExpectType LoDashExplicitWrapper + _.chain({ a: 42 }); // $ExpectType LoDashExplicitWrapper<{ a: number; }> +} - { - let result: AbcObject[]; +// _.tap +{ + // $ExpectType string + _.tap("a", (value) => { + value; // $ExpectType string + }); + // $ExpectType boolean[] + _.tap([true], (value) => { + value; // $ExpectType boolean[] + }); + // $ExpectType { a: number; } + _.tap({ a: 42 }, (value) => { + value; // $ExpectType { a: number; } + }); - result = _.valuesIn(object); - } + // $ExpectType LoDashImplicitWrapper + _("a").tap((value) => { + value; // $ExpectType string + }); + // $ExpectType LoDashImplicitWrapper + _([true]).tap((value) => { + value; // $ExpectType boolean[] + }); + // $ExpectType LoDashImplicitWrapper<{ a: number; }> + _({ a: 42 }).tap((value) => { + value; // $ExpectType { a: number; } + }); - { - let result: AbcObject[]; + // $ExpectType LoDashExplicitWrapper + _.chain("a").tap((value) => { + value; // $ExpectType string + }); + // $ExpectType LoDashExplicitWrapper + _.chain([true]).tap((value) => { + value; // $ExpectType boolean[] + }); + // $ExpectType LoDashExplicitWrapper<{ a: number; }> + _.chain({ a: 42 }).tap((value) => { + value; // $ExpectType { a: number; } + }); - // Without this type hint, this will fail to compile, as expected. - result = _.valuesIn({}); - } + fp.tap((value: string) => {}, "a" as string); // $ExpectType string + fp.tap((value: string) => {})("a"); // $ExpectType string + fp.tap((value: string[]) => {}, ["a"]); // $ExpectType string[] +} - { - let result: AbcObject[]; +// _.thru +{ + // $ExpectType number + _.thru("a", (value) => { + value; // $ExpectType string + return 1; + }); + // $ExpectType number + _.thru([true], (value) => { + value; // $ExpectType boolean[] + return 1; + }); + // $ExpectType number + _.thru({ a: 42 }, (value) => { + value; // $ExpectType { a: number; } + return 1; + }); - result = _.valuesIn(object); - } + // $ExpectType LoDashImplicitWrapper + _("a").thru((value) => { + value; // $ExpectType string + return 1; + }); + // $ExpectType LoDashImplicitWrapper + _([true]).thru((value) => { + value; // $ExpectType boolean[] + return 1; + }); + // $ExpectType LoDashImplicitWrapper + _({ a: 42 }).thru((value) => { + value; // $ExpectType { a: number; } + return 1; + }); - { - let result: _.LoDashImplicitArrayWrapper; + // $ExpectType LoDashExplicitWrapper + _.chain("a").thru((value) => { + value; // $ExpectType string + return 1; + }); + // $ExpectType LoDashExplicitWrapper + _.chain([true]).thru((value) => { + value; // $ExpectType boolean[] + return 1; + }); + // $ExpectType LoDashExplicitWrapper + _.chain({ a: 42 }).thru((value) => { + value; // $ExpectType { a: number; } + return 1; + }); - result = _(object).valuesIn(); - } + fp.thru((x: number) => x.toString(), 1); // $ExpectType string + fp.thru((x: number) => x.toString())(1); // $ExpectType string + fp.thru((x: number[]) => x.toString())([1]); // $ExpectType string +} - { - let result: _.LoDashExplicitArrayWrapper; +// _.prototype.commit +{ + _(42).commit(); // $ExpectType LoDashImplicitWrapper + _({ a: 42 }).commit(); // $ExpectType LoDashImplicitWrapper<{ a: number; }> + _.chain(42).commit(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: 42 }).commit(); // $ExpectType LoDashExplicitWrapper<{ a: number; }> +} - result = _(object).chain().valuesIn(); - } +// _.prototype.concat +{ + const numberROA: number[] = [0]; // TODO: Should be ReadonlyArray, but see comment on type Many + + _.concat(1); // $ExpectType number[] + _.concat([1]); // $ExpectType number[] + _.concat(numberROA); // $ExpectType number[] + _.concat(1, 2); // $ExpectType number[] + _.concat(1, [1]); // $ExpectType number[] + _.concat(1, [1], numberROA); // $ExpectType number[] + + _(1).concat(2); // $ExpectType LoDashImplicitWrapper + _(1).concat([1]); // $ExpectType LoDashImplicitWrapper + _(1).concat([2], numberROA); // $ExpectType LoDashImplicitWrapper + _([1]).concat(2); // $ExpectType LoDashImplicitWrapper + _(numberROA).concat(numberROA); // $ExpectType LoDashImplicitWrapper + _(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashImplicitWrapper + + _.chain(1).concat(2); // $ExpectType LoDashExplicitWrapper + _.chain(1).concat([1]); // $ExpectType LoDashExplicitWrapper + _.chain(1).concat([2], numberROA); // $ExpectType LoDashExplicitWrapper + _.chain([1]).concat(2); // $ExpectType LoDashExplicitWrapper + _.chain(numberROA).concat(numberROA); // $ExpectType LoDashExplicitWrapper + _.chain(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashExplicitWrapper + + const abcObject: AbcObject = { a: 1, b: 'foo', c: true }; + const objectROA: AbcObject[] = [{ a: 1, b: 'foo', c: true }]; // TODO: Should be ReadonlyArray, but see comment on type Many + + _.concat(abcObject, abcObject); // $ExpectType AbcObject[] + _.concat(abcObject, [abcObject], objectROA); // $ExpectType AbcObject[] + + _(abcObject).concat(abcObject); // $ExpectType LoDashImplicitWrapper + _(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashImplicitWrapper + + _.chain(abcObject).concat(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).concat([abcObject], objectROA); // $ExpectType LoDashExplicitWrapper +} + +// _.prototype.plant +{ + _(anything).plant(""); // $ExpectType LoDashImplicitWrapper + _(anything).plant(42); // $ExpectType LoDashImplicitWrapper + _(anything).plant([""]); // $ExpectType LoDashImplicitWrapper + _(anything).plant({ a: 42 }); // $ExpectType LoDashImplicitWrapper<{ a: number; }> + + _.chain(anything).plant(""); // $ExpectType LoDashExplicitWrapper + _.chain(anything).plant(42); // $ExpectType LoDashExplicitWrapper + _.chain(anything).plant([""]); // $ExpectType LoDashExplicitWrapper + _.chain(anything).plant({ a: 42 }); // $ExpectType LoDashExplicitWrapper<{ a: number; }> +} + +// _.prototype.reverse +{ + _([42]).reverse(); // $ExpectType LoDashImplicitWrapper + _.chain([42]).reverse(); // $ExpectType LoDashExplicitWrapper +} + +// _.prototype.toString +{ + _('').toString(); // $ExpectType string + _(42).toString(); // $ExpectType string + _([true]).toString(); // $ExpectType string + _({}).toString(); // $ExpectType string + + _.chain('').toString(); // $ExpectType string + _.chain(42).toString(); // $ExpectType string + _.chain([true]).toString(); // $ExpectType string + _.chain({}).toString(); // $ExpectType string +} + +// _.prototype.value +// _.prototype.valueOf +// _.prototype.toJSON +{ + _("").value(); // $ExpectType string + _([true]).value(); // $ExpectType boolean[] + _({ a: 42 }).value(); // $ExpectType { a: number; } + _({ a: 42 }).valueOf(); // $ExpectType { a: number; } + _({ a: 42 }).toJSON(); // $ExpectType { a: number; } + + _.chain("").value(); // $ExpectType string + _.chain([true]).value(); // $ExpectType boolean[] + _.chain({ a: 42 }).value(); // $ExpectType { a: number; } + _.chain({ a: 42 }).valueOf(); // $ExpectType { a: number; } + _.chain({ a: 42 }).toJSON(); // $ExpectType { a: number; } } /********** @@ -12675,1650 +6371,824 @@ namespace TestValuesIn { **********/ // _.camelCase -namespace TestCamelCase { - { - let result: string; - - result = _.camelCase('Foo Bar'); - result = _('Foo Bar').camelCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().camelCase(); - } +{ + _.camelCase("Foo Bar"); // $ExpectType string + _("Foo Bar").camelCase(); // $ExpectType string + _.chain("Foo Bar").camelCase(); // $ExpectType LoDashExplicitWrapper + fp.camelCase("Foo Bar"); // $ExpectType string } // _.capitalize -namespace TestCapitalize { - { - let result: string; - - result = _.capitalize('fred'); - result = _('fred').capitalize(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred').chain().capitalize(); - } +{ + _.capitalize("fred"); // $ExpectType string + _("fred").capitalize(); // $ExpectType string + _.chain("fred").capitalize(); // $ExpectType LoDashExplicitWrapper + fp.capitalize("fred"); // $ExpectType string } // _.deburr -namespace TestDeburr { - { - let result: string; - - result = _.deburr('déjà vu'); - result = _('déjà vu').deburr(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('déjà vu').chain().deburr(); - } +{ + _.deburr("déjà vu"); // $ExpectType string + _("déjà vu").deburr(); // $ExpectType string + _.chain("déjà vu").deburr(); // $ExpectType LoDashExplicitWrapper + fp.deburr("déjà vu"); // $ExpectType string } // _.endsWith -namespace TestEndsWith { - { - let result: boolean; - - result = _.endsWith('abc', 'c'); - result = _.endsWith('abc', 'c', 1); - - result = _('abc').endsWith('c'); - result = _('abc').endsWith('c', 1); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().endsWith('c'); - result = _('abc').chain().endsWith('c', 1); - } +{ + _.endsWith("abc", "c"); // $ExpectType boolean + _.endsWith("abc", "c", 1); // $ExpectType boolean + _("abc").endsWith("c"); // $ExpectType boolean + _("abc").endsWith("c", 1); // $ExpectType boolean + _.chain("abc").endsWith("c"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").endsWith("c", 1); // $ExpectType LoDashExplicitWrapper + fp.endsWith("c", "abc"); // $ExpectType boolean + fp.endsWith("c")("abc"); // $ExpectType boolean } // _.escape -namespace TestEscape { - { - let result: string; - - result = _.escape('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').escape(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().escape(); - } +{ + _.escape("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").escape(); // $ExpectType string + _.chain("fred, barney, & pebbles").escape(); // $ExpectType LoDashExplicitWrapper + fp.escape("fred, barney, & pebbles"); // $ExpectType string } // _.escapeRegExp -namespace TestEscapeRegExp { - { - let result: string; - - result = _.escapeRegExp('[lodash](https://lodash.com/)'); - result = _('[lodash](https://lodash.com/)').escapeRegExp(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('[lodash](https://lodash.com/)').chain().escapeRegExp(); - } +{ + _.escapeRegExp("[lodash](https://lodash.com/)"); // $ExpectType string + _("[lodash](https://lodash.com/)").escapeRegExp(); // $ExpectType string + _.chain("[lodash](https://lodash.com/)").escapeRegExp(); // $ExpectType LoDashExplicitWrapper + fp.escapeRegExp("[lodash](https://lodash.com/)"); // $ExpectType string } // _.kebabCase -namespace TestKebabCase { - { - let result: string; - - result = _.kebabCase('Foo Bar'); - result = _('Foo Bar').kebabCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().kebabCase(); - } +{ + _.kebabCase("Foo Bar"); // $ExpectType string + _("Foo Bar").kebabCase(); // $ExpectType string + _.chain("Foo Bar").kebabCase(); // $ExpectType LoDashExplicitWrapper + fp.kebabCase("Foo Bar"); // $ExpectType string } // _.lowerCase -namespace TestLowerCase { - { - let result: string; - - result = _.lowerCase('Foo Bar'); - result = _('Foo Bar').lowerCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().lowerCase(); - } +{ + _.lowerCase("Foo Bar"); // $ExpectType string + _("Foo Bar").lowerCase(); // $ExpectType string + _.chain("Foo Bar").lowerCase(); // $ExpectType LoDashExplicitWrapper + fp.lowerCase("Foo Bar"); // $ExpectType string } // _.lowerFirst -namespace TestLowerFirst { - { - let result: string; - - result = _.lowerFirst('Foo Bar'); - result = _('Foo Bar').lowerFirst(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().lowerFirst(); - } +{ + _.lowerFirst("Foo Bar"); // $ExpectType string + _("Foo Bar").lowerFirst(); // $ExpectType string + _.chain("Foo Bar").lowerFirst(); // $ExpectType LoDashExplicitWrapper + fp.lowerFirst("Foo Bar"); // $ExpectType string } // _.pad -namespace TestPad { - { - let result: string; - - result = _.pad('abc'); - result = _.pad('abc', 8); - result = _.pad('abc', 8, '_-'); - - result = _('abc').pad(); - result = _('abc').pad(8); - result = _('abc').pad(8, '_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().pad(); - result = _('abc').chain().pad(8); - result = _('abc').chain().pad(8, '_-'); - } +{ + _.pad("abc"); // $ExpectType string + _.pad("abc", 8); // $ExpectType string + _.pad("abc", 8, "_-"); // $ExpectType string + _("abc").pad(); // $ExpectType string + _("abc").pad(8); // $ExpectType string + _("abc").pad(8, "_-"); // $ExpectType string + _.chain("abc").pad(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").pad(8); // $ExpectType LoDashExplicitWrapper + _.chain("abc").pad(8, "_-"); // $ExpectType LoDashExplicitWrapper + fp.pad(8, "abc"); // $ExpectType string + fp.pad(8)("abc"); // $ExpectType string + fp.padChars("_", 8, "abc"); // $ExpectType string + fp.padChars("_")(8)("abc"); // $ExpectType string } // _.padEnd -namespace TestPadEnd { - { - let result: string; - - result = _.padEnd('abc'); - result = _.padEnd('abc', 6); - result = _.padEnd('abc', 6, '_-'); - - result = _('abc').padEnd(); - result = _('abc').padEnd(6); - result = _('abc').padEnd(6, '_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().padEnd(); - result = _('abc').chain().padEnd(6); - result = _('abc').chain().padEnd(6, '_-'); - } +{ + _.padEnd("abc"); // $ExpectType string + _.padEnd("abc", 6); // $ExpectType string + _.padEnd("abc", 6, "_-"); // $ExpectType string + _("abc").padEnd(); // $ExpectType string + _("abc").padEnd(6); // $ExpectType string + _("abc").padEnd(6, "_-"); // $ExpectType string + _.chain("abc").padEnd(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").padEnd(6); // $ExpectType LoDashExplicitWrapper + _.chain("abc").padEnd(6, "_-"); // $ExpectType LoDashExplicitWrapper + fp.padEnd(8, "abc"); // $ExpectType string + fp.padEnd(8)("abc"); // $ExpectType string + fp.padCharsEnd("_", 8, "abc"); // $ExpectType string + fp.padCharsEnd("_")(8)("abc"); // $ExpectType string } // _.padStart -namespace TestPadStart { - { - let result: string; - - result = _.padStart('abc'); - result = _.padStart('abc', 6); - result = _.padStart('abc', 6, '_-'); - - result = _('abc').padStart(); - result = _('abc').padStart(6); - result = _('abc').padStart(6, '_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().padStart(); - result = _('abc').chain().padStart(6); - result = _('abc').chain().padStart(6, '_-'); - } +{ + _.padStart("abc"); // $ExpectType string + _.padStart("abc", 6); // $ExpectType string + _.padStart("abc", 6, "_-"); // $ExpectType string + _("abc").padStart(); // $ExpectType string + _("abc").padStart(6); // $ExpectType string + _("abc").padStart(6, "_-"); // $ExpectType string + _.chain("abc").padStart(); // $ExpectType LoDashExplicitWrapper + _.chain("abc").padStart(6); // $ExpectType LoDashExplicitWrapper + _.chain("abc").padStart(6, "_-"); // $ExpectType LoDashExplicitWrapper + fp.padStart(8, "abc"); // $ExpectType string + fp.padStart(8)("abc"); // $ExpectType string + fp.padCharsStart("_", 8, "abc"); // $ExpectType string + fp.padCharsStart("_")(8)("abc"); // $ExpectType string } // _.parseInt -namespace TestParseInt { - { - let result: number; - - result = _.parseInt('08'); - result = _.parseInt('08', 10); - - result = _('08').parseInt(); - result = _('08').parseInt(10); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('08').chain().parseInt(); - result = _('08').chain().parseInt(10); - } +{ + _.parseInt("08"); // $ExpectType number + _.parseInt("08", 10); // $ExpectType number + _("08").parseInt(); // $ExpectType number + _("08").parseInt(10); // $ExpectType number + _.chain("08").parseInt(); // $ExpectType LoDashExplicitWrapper + _.chain("08").parseInt(10); // $ExpectType LoDashExplicitWrapper + fp.parseInt(10, "08"); // $ExpectType number + fp.parseInt(10)("08"); // $ExpectType number } // _.repeat -namespace TestRepeat { - { - let result: string; - result = _.repeat('*'); - result = _.repeat('*', 3); - - result = _('*').repeat(); - result = _('*').repeat(3); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('*').chain().repeat(); - result = _('*').chain().repeat(3); - } +{ + _.repeat("*"); // $ExpectType string + _.repeat("*", 3); // $ExpectType string + _("*").repeat(); // $ExpectType string + _("*").repeat(3); // $ExpectType string + _.chain("*").repeat(); // $ExpectType LoDashExplicitWrapper + _.chain("*").repeat(3); // $ExpectType LoDashExplicitWrapper + fp.repeat(3, "*"); // $ExpectType string } // _.replace -namespace TestReplace { - let replacer = (match: string, offset: number, string: string) => 'Barney'; +{ + const replacer = (match: string, offset: number, string: string) => "Barney"; - { - let result: string; + _.replace("Hi Fred", "Fred", "Barney"); // $ExpectType string + _.replace("Hi Fred", "Fred", replacer); // $ExpectType string + _.replace("Hi Fred", /fred/i, "Barney"); // $ExpectType string + _.replace("Hi Fred", /fred/i, replacer); // $ExpectType string - result = _.replace('Hi Fred', 'Fred', 'Barney'); - result = _.replace('Hi Fred', 'Fred', replacer); + _("Hi Fred").replace("Fred", "Barney"); // $ExpectType string + _("Hi Fred").replace("Fred", replacer); // $ExpectType string + _("Hi Fred").replace(/fred/i, "Barney"); // $ExpectType string + _("Hi Fred").replace(/fred/i, replacer); // $ExpectType string - result = _.replace('Hi Fred', /fred/i, 'Barney'); - result = _.replace('Hi Fred', /fred/i, replacer); + _.chain("Hi Fred").replace("Fred", "Barney"); // $ExpectType LoDashExplicitWrapper + _.chain("Hi Fred").replace("Fred", replacer); // $ExpectType LoDashExplicitWrapper + _.chain("Hi Fred").replace(/fred/i, "Barney"); // $ExpectType LoDashExplicitWrapper + _.chain("Hi Fred").replace(/fred/i, replacer); // $ExpectType LoDashExplicitWrapper - result = _.replace('Fred', 'Barney'); - result = _.replace('Fred', replacer); - - result = _.replace(/fred/i, 'Barney'); - result = _.replace(/fred/i, replacer); - - result = _('Hi Fred').replace('Fred', 'Barney'); - result = _('Hi Fred').replace('Fred', replacer); - - result = _('Hi Fred').replace(/fred/i, 'Barney'); - result = _('Hi Fred').replace(/fred/i, replacer); - - result = _('Fred').replace('Barney'); - result = _('Fred').replace(replacer); - - result = _(/fred/i).replace('Barney'); - result = _(/fred/i).replace(replacer); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Hi Fred').chain().replace('Fred', 'Barney'); - result = _('Hi Fred').chain().replace('Fred', replacer); - - result = _('Hi Fred').chain().replace(/fred/i, 'Barney'); - result = _('Hi Fred').chain().replace(/fred/i, replacer); - - result = _('Fred').chain().replace('Barney'); - result = _('Fred').chain().replace(replacer); - - result = _(/fred/i).chain().replace('Barney'); - result = _(/fred/i).chain().replace(replacer); - } + fp.replace("Fred", "Barney", "Hi Fred"); // $ExpectType string + fp.replace("Fred")("Barney")("Hi Fred"); // $ExpectType string + fp.replace("Fred")(replacer)("Hi Fred"); // $ExpectType string + fp.replace(/fred/i)("Barney")("Hi Fred"); // $ExpectType string + fp.replace(/fred/i)(replacer)("Hi Fred"); // $ExpectType string } // _.snakeCase -namespace TestSnakeCase { - { - let result: string; - - result = _.snakeCase('Foo Bar'); - result = _('Foo Bar').snakeCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('Foo Bar').chain().snakeCase(); - } +{ + _.snakeCase("Foo Bar"); // $ExpectType string + _("Foo Bar").snakeCase(); // $ExpectType string + _.chain("Foo Bar").snakeCase(); // $ExpectType LoDashExplicitWrapper + fp.snakeCase("Foo Bar"); // $ExpectType string } // _.split -namespace TestSplit { - { - let result: string[]; +{ + _.split("a-b-c"); // $ExpectType string[] + _.split("a-b-c", "-"); // $ExpectType string[] + _.split("a-b-c", "-", 2); // $ExpectType string[] + _("a-b-c").split(); // $ExpectType LoDashImplicitWrapper + _("a-b-c").split("-"); // $ExpectType LoDashImplicitWrapper + _("a-b-c").split("-", 2); // $ExpectType LoDashImplicitWrapper + _.chain("a-b-c").split(); // $ExpectType LoDashExplicitWrapper + _.chain("a-b-c").split("-"); // $ExpectType LoDashExplicitWrapper + _.chain("a-b-c").split("-", 2); // $ExpectType LoDashExplicitWrapper + fp.split("-", "a-b-c"); // $ExpectType string[] + fp.split("-")("a-b-c"); // $ExpectType string[] - result = _.split('a-b-c'); - result = _.split('a-b-c', '-'); - result = _.split('a-b-c', '-', 2); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('a-b-c').split(); - result = _('a-b-c').split('-'); - result = _('a-b-c').split('-', 2); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('a-b-c').chain().split(); - result = _('a-b-c').chain().split('-'); - result = _('a-b-c').chain().split('-', 2); - } - - // $ExpectType string[][] - _.map(['abc', 'def'], _.split); + _.map(["abc", "def"], _.split); // $ExpectType string[][] } // _.startCase -namespace TestStartCase { - { - let result: string; - - result = _.startCase('--foo-bar'); - result = _('--foo-bar').startCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('--foo-bar').chain().startCase(); - } +{ + _.startCase("--foo-bar"); // $ExpectType string + _("--foo-bar").startCase(); // $ExpectType string + _.chain("--foo-bar").startCase(); // $ExpectType LoDashExplicitWrapper + fp.startCase("--foo-bar"); // $ExpectType string } // _.startsWith -namespace TestStartsWith { - { - let result: boolean; - - result = _.startsWith('abc', 'a'); - result = _.startsWith('abc', 'a', 1); - - result = _('abc').startsWith('a'); - result = _('abc').startsWith('a', 1); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().startsWith('a'); - result = _('abc').chain().startsWith('a', 1); - } +{ + _.startsWith("abc", "a"); // $ExpectType boolean + _.startsWith("abc", "a", 1); // $ExpectType boolean + _("abc").startsWith("a"); // $ExpectType boolean + _("abc").startsWith("a", 1); // $ExpectType boolean + _.chain("abc").startsWith("a"); // $ExpectType LoDashExplicitWrapper + _.chain("abc").startsWith("a", 1); // $ExpectType LoDashExplicitWrapper + fp.startsWith("a", "abc"); // $ExpectType boolean + fp.startsWith("a")("abc"); // $ExpectType boolean } // _.template -namespace TestTemplate { - interface TemplateExecutor { - (obj?: object): string; - source: string; - } +{ + const options: _.TemplateOptions = { + escape: / /, + evaluate: / /, + imports: {}, + interpolate: / /, + sourceURL: "", + variable: "a", + }; - let options: { - escape?: RegExp; - evaluate?: RegExp; - imports?: _.Dictionary; - interpolate?: RegExp; - sourceURL?: string; - variable?: string; - } = {}; + const result = _.template(""); + result.source; // $ExpectType string + result({}); // $ExpectType string - { - let result: TemplateExecutor; + _.template(""); // $ExpectType TemplateExecutor + _.template("", options); // $ExpectType TemplateExecutor + _("").template(); // $ExpectType TemplateExecutor + _("").template(options); // $ExpectType TemplateExecutor + _.chain("").template(); // $ExpectType LoDashExplicitWrapper + _.chain("").template(options); // $ExpectType LoDashExplicitWrapper - result = _.template(''); - result = _.template('', options); - - result = _('').template(); - result = _('').template(options); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _('').chain().template(); - result = _('').chain().template(options); - } + const result2 = fp.template(""); + result2(); // $ExpectType string + result2.source; // $ExpectType string } // _.toLower -namespace TestToLower { - { - let result: string; - - result = _.toLower('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').toLower(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().toLower(); - } +{ + _.toLower("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").toLower(); // $ExpectType string + _.chain("fred, barney, & pebbles").toLower(); // $ExpectType LoDashExplicitWrapper + fp.toLower("fred, barney, & pebbles"); // $ExpectType string } // _.toUpper -namespace TestToUpper { - { - let result: string; - - result = _.toUpper('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').toUpper(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().toUpper(); - } +{ + _.toUpper("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").toUpper(); // $ExpectType string + _.chain("fred, barney, & pebbles").toUpper(); // $ExpectType LoDashExplicitWrapper + fp.toUpper("fred, barney, & pebbles"); // $ExpectType string } // _.trim -namespace TestTrim { - { - let result: string; +{ + _.trim(); // $ExpectType string + _.trim(" abc "); // $ExpectType string + _.trim("-_-abc-_-", "_-"); // $ExpectType string + _("-_-abc-_-").trim(); // $ExpectType string + _("-_-abc-_-").trim("_-"); // $ExpectType string + _.chain("-_-abc-_-").trim(); // $ExpectType LoDashExplicitWrapper + _.chain("-_-abc-_-").trim("_-"); // $ExpectType LoDashExplicitWrapper + fp.trim(" abc "); // $ExpectType string + fp.trimChars(" ", " abc "); // $ExpectType string + fp.trimChars(" ")(" abc "); // $ExpectType string - result = _.trim(); - result = _.trim(' abc '); - result = _.trim('-_-abc-_-', '_-'); - - result = _('-_-abc-_-').trim(); - result = _('-_-abc-_-').trim('_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('-_-abc-_-').chain().trim(); - result = _('-_-abc-_-').chain().trim('_-'); - } - - // $ExpectType string[] - _.map([' foo ', ' bar '], _.trim); + _.map([" foo ", " bar "], _.trim); // $ExpectType string[] } // _.trimEnd -namespace TestTrimEnd { - { - let result: string; - - result = _.trimEnd(); - result = _.trimEnd(' abc '); - result = _.trimEnd('-_-abc-_-', '_-'); - - result = _('-_-abc-_-').trimEnd(); - result = _('-_-abc-_-').trimEnd('_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('-_-abc-_-').chain().trimEnd(); - result = _('-_-abc-_-').chain().trimEnd('_-'); - } +{ + _.trimEnd(); // $ExpectType string + _.trimEnd(" abc "); // $ExpectType string + _.trimEnd("-_-abc-_-", "_-"); // $ExpectType string + _("-_-abc-_-").trimEnd(); // $ExpectType string + _("-_-abc-_-").trimEnd("_-"); // $ExpectType string + _.chain("-_-abc-_-").trimEnd(); // $ExpectType LoDashExplicitWrapper + _.chain("-_-abc-_-").trimEnd("_-"); // $ExpectType LoDashExplicitWrapper + fp.trimEnd(" abc "); // $ExpectType string + fp.trimCharsEnd(" ", " abc "); // $ExpectType string + fp.trimCharsEnd(" ")(" abc "); // $ExpectType string } // _.trimStart -namespace TestTrimStart { - { - let result: string; - - result = _.trimStart(); - result = _.trimStart(' abc '); - result = _.trimStart('-_-abc-_-', '_-'); - - result = _('-_-abc-_-').trimStart(); - result = _('-_-abc-_-').trimStart('_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('-_-abc-_-').chain().trimStart(); - result = _('-_-abc-_-').chain().trimStart('_-'); - } +{ + _.trimStart(); // $ExpectType string + _.trimStart(" abc "); // $ExpectType string + _.trimStart("-_-abc-_-", "_-"); // $ExpectType string + _("-_-abc-_-").trimStart(); // $ExpectType string + _("-_-abc-_-").trimStart("_-"); // $ExpectType string + _.chain("-_-abc-_-").trimStart(); // $ExpectType LoDashExplicitWrapper + _.chain("-_-abc-_-").trimStart("_-"); // $ExpectType LoDashExplicitWrapper + fp.trimStart(" abc "); // $ExpectType string + fp.trimCharsStart(" ", " abc "); // $ExpectType string + fp.trimCharsStart(" ")(" abc "); // $ExpectType string } // _.truncate -namespace TestTruncate { - { - let result: string; +{ + _.truncate("hi-diddly-ho there, neighborino"); // $ExpectType string + _.truncate("hi-diddly-ho there, neighborino", { length: 24, separator: " " }); // $ExpectType string + _.truncate("hi-diddly-ho there, neighborino", { length: 24, separator: /,? +/ }); // $ExpectType string + _.truncate("hi-diddly-ho there, neighborino", { omission: " […]" }); // $ExpectType string - result = _.truncate('hi-diddly-ho there, neighborino'); - result = _.truncate('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); - result = _.truncate('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); - result = _.truncate('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); + _("hi-diddly-ho there, neighborino").truncate(); // $ExpectType string + _("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: " " }); // $ExpectType string + _("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: /,? +/ }); // $ExpectType string + _("hi-diddly-ho there, neighborino").truncate({ omission: " […]" }); // $ExpectType string - result = _('hi-diddly-ho there, neighborino').truncate(); - result = _('hi-diddly-ho there, neighborino').truncate({ 'length': 24, 'separator': ' ' }); - result = _('hi-diddly-ho there, neighborino').truncate({ 'length': 24, 'separator': /,? +/ }); - result = _('hi-diddly-ho there, neighborino').truncate({ 'omission': ' […]' }); - } + _.chain("hi-diddly-ho there, neighborino").truncate(); // $ExpectType LoDashExplicitWrapper + _.chain("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: " " }); // $ExpectType LoDashExplicitWrapper + _.chain("hi-diddly-ho there, neighborino").truncate({ length: 24, separator: /,? +/ }); // $ExpectType LoDashExplicitWrapper + _.chain("hi-diddly-ho there, neighborino").truncate({ omission: " […]" }); // $ExpectType LoDashExplicitWrapper - { - let result: _.LoDashExplicitWrapper; - - result = _('hi-diddly-ho there, neighborino').chain().truncate(); - result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'length': 24, 'separator': ' ' }); - result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'length': 24, 'separator': /,? +/ }); - result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'omission': ' […]' }); - } + fp.truncate({ length: 24, separator: " " }, "hi-diddly-ho there, neighborino"); // $ExpectType string + fp.truncate({ length: 24, separator: " " })("hi-diddly-ho there, neighborino"); // $ExpectType string + fp.truncate({ length: 24, separator: /,? +/ }, "hi-diddly-ho there, neighborino"); // $ExpectType string + fp.truncate({ omission: " […]" }, "hi-diddly-ho there, neighborino"); // $ExpectType string } // _.unescape -namespace TestUnescape { - { - let result: string; - - result = _.unescape('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').unescape(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().unescape(); - } +{ + _.unescape("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").unescape(); // $ExpectType string + _.chain("fred, barney, & pebbles").unescape(); // $ExpectType LoDashExplicitWrapper + fp.unescape("fred, barney, & pebbles"); // $ExpectType string } // _.upperCase -namespace TestUpperCase { - { - let result: string; - - result = _.upperCase('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').upperCase(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().upperCase(); - } +{ + _.upperCase("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").upperCase(); // $ExpectType string + _.chain("fred, barney, & pebbles").upperCase(); // $ExpectType LoDashExplicitWrapper + fp.upperCase("fred, barney, & pebbles"); // $ExpectType string } // _.upperFirst -namespace TestUpperFirst { - { - let result: string; - - result = _.upperFirst('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').upperFirst(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().upperFirst(); - } +{ + _.upperFirst("fred, barney, & pebbles"); // $ExpectType string + _("fred, barney, & pebbles").upperFirst(); // $ExpectType string + _.chain("fred, barney, & pebbles").upperFirst(); // $ExpectType LoDashExplicitWrapper + fp.upperFirst("fred, barney, & pebbles"); // $ExpectType string } // _.words -namespace TestWords { - { - let result: string[]; +{ + _.words("fred, barney, & pebbles"); // $ExpectType string[] + _.words("fred, barney, & pebbles", /[^, ]+/g); // $ExpectType string[] + _("fred, barney, & pebbles").words(); // $ExpectType string[] + _("fred, barney, & pebbles").words(/[^, ]+/g); // $ExpectType string[] + _.chain("fred, barney, & pebbles").words(); // $ExpectType LoDashExplicitWrapper + _.chain("fred, barney, & pebbles").words(/[^, ]+/g); // $ExpectType LoDashExplicitWrapper + fp.words("fred, barney, & pebbles"); // $ExpectType string[] - result = _.words('fred, barney, & pebbles'); - result = _.words('fred, barney, & pebbles', /[^, ]+/g); - - result = _('fred, barney, & pebbles').words(); - result = _('fred, barney, & pebbles').words(/[^, ]+/g); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('fred, barney, & pebbles').chain().words(); - result = _('fred, barney, & pebbles').chain().words(/[^, ]+/g); - } - - // $ExpectType string[][] - _.map(['fred, barney', 'pebbles'], _.words); + _.map(["fred, barney", "pebbles"], _.words); // $ExpectType string[][] } -/*********** - * Utility * - ***********/ +/******** + * Util * + ********/ // _.attempt -namespace TestAttempt { - let func: (...args: any[]) => {a: string} = (...args) => ({ a: "" }); +{ + const func = (...args: any[]): AbcObject => anything; - { - let result: {a: string}|Error; + // We can't use ExpectType here because typescript keeps changing what order the types appear. + let result: Error | AbcObject; + result = _.attempt(func); + result = _.attempt(func, "foo", "bar", "baz"); + result = _(func).attempt(); + result = _(func).attempt("foo", "bar", "baz"); - result = _.attempt<{a: string}>(func); - result = _.attempt<{a: string}>(func, 'foo', 'bar', 'baz'); - result = _(func).attempt<{a: string}>(); - result = _(func).attempt<{a: string}>('foo', 'bar', 'baz'); - } + let explicitResult: _.LoDashExplicitWrapper; + explicitResult = _.chain(func).attempt(); + explicitResult = _.chain(func).attempt("foo", "bar", "baz"); - { - let result: _.LoDashExplicitObjectWrapper<{a: string}|Error>; - - result = _(func).chain().attempt<{a: string}>(); - result = _(func).chain().attempt<{a: string}>('foo', 'bar', 'baz'); - } + result = fp.attempt(func); } // _.cond -namespace TestCond { - let pairPred1: (val: string) => boolean = (val) => true; - let pairPred2: (val: string) => boolean = (val) => false; - let pairRes1: (val: string) => number = (val) => 1; - let pairRes2: (val: string) => number = (val) => 2; +{ + const pairPred1 = (val: string) => true; + const pairPred2 = (val: string) => false; + const pairRes1 = (val: string) => 1; + const pairRes2 = (val: string) => 2; - { - let result: number; - - result = _.cond([[pairPred1, pairRes1],[pairPred2, pairRes2]])('hello'); - } + _.cond([[pairPred1, pairRes1], [pairPred2, pairRes2]])("hello"); // $ExpectType number + fp.cond([[pairPred1, pairRes1], [pairPred2, pairRes2]])("hello"); // $ExpectType number } // _.constant -namespace TestConstant { - { - let result: () => number; - result = _.constant(42); - } +{ + _.constant(42); // $ExpectType () => number + _.constant("a"); // $ExpectType () => string + _.constant([true]); // $ExpectType () => boolean[] + _.constant({ a: "" }); // $ExpectType () => { a: string; } - { - let result: () => string; - result = _.constant('a'); - } + _(42).constant(); // $ExpectType LoDashImplicitWrapper<() => number> + _("a").constant(); // $ExpectType LoDashImplicitWrapper<() => string> + _([true]).constant(); // $ExpectType LoDashImplicitWrapper<() => boolean[]> + _({ a: "" }).constant(); // $ExpectType LoDashImplicitWrapper<() => { a: string; }> - { - let result: () => boolean; - result = _.constant(true); - } + _.chain(42).constant(); // $ExpectType LoDashExplicitWrapper<() => number> + _.chain("a").constant(); // $ExpectType LoDashExplicitWrapper<() => string> + _.chain([true]).constant(); // $ExpectType LoDashExplicitWrapper<() => boolean[]> + _.chain({ a: "" }).constant(); // $ExpectType LoDashExplicitWrapper<() => { a: string; }> - { - let result: () => string[]; - result = _.constant(['a']); - } - - { - let result: () => {a: string}; - result = _.constant<{a: string}>({a: 'a'}); - } - - { - let result: _.LoDashImplicitObjectWrapper<() => number>; - result = _(42).constant(); - } - - { - let result: _.LoDashImplicitObjectWrapper<() => string>; - result = _('a').constant(); - } - - { - let result: _.LoDashImplicitObjectWrapper<() => boolean>; - result = _(true).constant(); - } - - { - let result: _.LoDashImplicitObjectWrapper<() => string[]>; - result = _(['a']).constant(); - } - - { - let result: _.LoDashImplicitObjectWrapper<() => {a: string}>; - result = _({a: 'a'}).constant(); - } - - { - let result: _.LoDashExplicitObjectWrapper<() => number>; - result = _(42).chain().constant(); - } - - { - let result: _.LoDashExplicitObjectWrapper<() => string>; - result = _('a').chain().constant(); - } - - { - let result: _.LoDashExplicitObjectWrapper<() => boolean>; - result = _(true).chain().constant(); - } - - { - let result: _.LoDashExplicitObjectWrapper<() => string[]>; - result = _(['a']).chain().constant(); - } - - { - let result: _.LoDashExplicitObjectWrapper<() => {a: string}>; - result = _({a: 'a'}).chain().constant(); - } + fp.constant(42); // $ExpectType () => number + fp.constant("a"); // $ExpectType () => string + fp.constant([true]); // $ExpectType () => boolean[] + fp.constant({ a: "" }); // $ExpectType () => { a: string; } } // _.defaultTo -namespace TestDefaultTo { - { - let result: number; - result = _.defaultTo(42, 42); - result = _.defaultTo(undefined, 42); - result = _.defaultTo(null, 42); - result = _.defaultTo(NaN, 42); - } +{ + _.defaultTo(42, 42); // $ExpectType 42 + _.defaultTo(undefined, 42); // $ExpectType 42 + _.defaultTo(null, 42); // $ExpectType 42 + _.defaultTo(NaN, 42); // $ExpectType number + _.defaultTo(undefined, "default"); // $ExpectType "default" + _.defaultTo(undefined, [true]); // $ExpectType boolean[] + _.defaultTo(undefined, { a: "" }); // $ExpectType { a: string; } - { - let result: string; - result = _.defaultTo('a', 'default'); - result = _.defaultTo(undefined, 'default'); - result = _.defaultTo(null, 'default'); - } + _(42).defaultTo(42); // $ExpectType number + _(undefined).defaultTo(42); // $ExpectType 42 + _(null).defaultTo(42); // $ExpectType 42 + _(NaN).defaultTo(42); // $ExpectType number + _(undefined).defaultTo("default"); // $ExpectType "default" + _(undefined).defaultTo([true]); // $ExpectType boolean[] + _(undefined).defaultTo({ a: "" }); // $ExpectType { a: string; } - { - let result: boolean; - result = _.defaultTo(true, true); - result = _.defaultTo(undefined, true); - result = _.defaultTo(null, true); - } + _.chain(42).defaultTo(42); // $ExpectType LoDashExplicitWrapper + _.chain(undefined).defaultTo(42); // $ExpectType LoDashExplicitWrapper<42> + _.chain(null).defaultTo(42); // $ExpectType LoDashExplicitWrapper<42> + _.chain(NaN).defaultTo(42); // $ExpectType LoDashExplicitWrapper + _.chain(undefined).defaultTo("default"); // $ExpectType LoDashExplicitWrapper<"default"> + _.chain(undefined).defaultTo([true]); // $ExpectType LoDashExplicitWrapper + _.chain(undefined).defaultTo({ a: "" }); // $ExpectType LoDashExplicitWrapper<{ a: string; }> - { - let result: string[]; - result = _.defaultTo(['a'], ['default']); - result = _.defaultTo(undefined, ['default']); - result = _.defaultTo(null, ['default']); - } + const n: number = anything; + fp.defaultTo(42, n); // $ExpectType number + fp.defaultTo(42)(n); // $ExpectType number + fp.defaultTo(42)(undefined); // $ExpectType number + fp.defaultTo(42)(null); // $ExpectType number + fp.defaultTo(42)(NaN); // $ExpectType number - { - let result: {a: string}; - result = _.defaultTo<{a: string}>({a: 'a'}, {a: 'a'}); - result = _.defaultTo<{a: string}>(undefined, {a: 'a'}); - result = _.defaultTo<{a: string}>(null, {a: 'a'}); - } - - { - let result: number; - result = _(42).defaultTo(42); - result = _(undefined).defaultTo(42); - result = _(null).defaultTo(42); - result = _(NaN).defaultTo(42); - } - - { - let result: string; - result = _('a').defaultTo('default'); - result = _(null).defaultTo('default'); - } - - { - let result: boolean; - result = _(true).defaultTo(true); - result = _(undefined).defaultTo(true); - result = _(null).defaultTo(true); - } - - { - let result: string[]; - result = _(['a']).defaultTo(['default']); - result = _(undefined).defaultTo(['default']); - result = _(null).defaultTo(['default']); - } - - { - let result: { a: string }; - result = _({ a: 'a' }).defaultTo({a : 'a'}); - result = _(undefined).defaultTo({a : 'a'}); - result = _(null).defaultTo({a : 'a'}); - } - - { - let result: _.LoDashExplicitObjectWrapper; - result = _(42).chain().defaultTo(42); - result = _(undefined).chain().defaultTo(42); - result = _(null).chain().defaultTo(42); - result = _(NaN).chain().defaultTo(42); - } - - { - let result: _.LoDashExplicitObjectWrapper; - result = _('a').chain().defaultTo('default'); - result = _(undefined).chain().defaultTo('default'); - result = _(null).chain().defaultTo('default'); - } - - { - let result: _.LoDashExplicitObjectWrapper; - result = _(true).chain().defaultTo(true); - result = _(undefined).chain().defaultTo(true); - result = _(null).chain().defaultTo(true); - } - - { - let result: _.LoDashExplicitObjectWrapper; - result = _(['a']).chain().defaultTo(['default']); - result = _(undefined).chain().defaultTo(['default']); - result = _(null).chain().defaultTo(['default']); - } - - { - let result: _.LoDashExplicitObjectWrapper<{ a: string }>; - result = _({ a: 'a' }).chain().defaultTo({a : 'a'}); - result = _(undefined).chain().defaultTo({a : 'a'}); - result = _(null).chain().defaultTo({a : 'a'}); - } + const arr: boolean[] | undefined = anything; + const result: boolean[] | "a" = fp.defaultTo("a", arr); } // _.identity -namespace TestIdentity { - { - let result: number; - - result = _.identity(42); - result = _(42).identity(); - } - - { - let result: number[]; - - result = _.identity([42]); - result = _([42]).identity(); - } - - { - let result: {a: number}; - - result = _.identity({a: 42}); - result = _({a: 42}).identity(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(42).chain().identity(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _([42]).chain().identity(); - } - - { - let result: _.LoDashExplicitObjectWrapper<{a: number}>; - - result = _({a: 42}).chain().identity(); - } - - { - let input: { a: number; } | null | undefined = anything; - _.identity(input); // $ExpectType { a: number; } | null | undefined - _.identity(); // $ExpectType undefined - } +{ + _.identity(42); // $ExpectType 42 + _.identity([""]); // $ExpectType string[] + _.identity({ a: true }); // $ExpectType { a: boolean; } + _(42).identity(); // $ExpectType number + _([""]).identity(); // $ExpectType string[] + _({ a: true }).identity(); // $ExpectType { a: boolean; } + _.chain(42).identity(); // $ExpectType LoDashExplicitWrapper + _.chain([""]).identity(); // $ExpectType LoDashExplicitWrapper + _.chain({ a: true }).identity(); // $ExpectType LoDashExplicitWrapper<{ a: boolean; }> + fp.identity(42); // $ExpectType 42 + fp.identity([""]); // $ExpectType string[] + fp.identity({ a: true }); // $ExpectType { a: boolean; } } // _.iteratee -namespace TestIteratee { - { - _.iteratee((...args: any[]): AbcObject => anything); // $ExpectType (...args: any[]) => AbcObject - _.iteratee((a: AbcObject): boolean => anything); // $ExpectType (a: AbcObject) => boolean - _.iteratee((a: AbcObject | undefined): a is undefined => anything); // $ExpectType (a: AbcObject | undefined) => a is undefined - } +{ + _.iteratee((a: AbcObject): boolean => anything); // $ExpectType (a: AbcObject) => boolean + _.iteratee((...args: any[]): AbcObject => anything); // $ExpectType (...args: any[]) => AbcObject + _.iteratee("a"); // $ExpectType (...args: any[]) => any + _.iteratee({ a: 42 }); // $ExpectType (...args: any[]) => any + _.iteratee(["a", 42]); // $ExpectType (...args: any[]) => any - { - let result: (object: any) => AbcObject; + _((a: AbcObject): boolean => anything).iteratee(); // $ExpectType LoDashImplicitWrapper<(a: AbcObject) => boolean> + _("a").iteratee(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _({ a: 42 }).iteratee(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _(["a", 42]).iteratee(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> - result = _.iteratee(''); - } + _.chain((a: AbcObject): boolean => anything).iteratee(); // $ExpectType LoDashExplicitWrapper<(a: AbcObject) => boolean> + _.chain("a").iteratee(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain({ a: 42 }).iteratee(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + _.chain(["a", 42]).iteratee(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> - { - let result: (object: any) => boolean; - - result = _.iteratee({}); - } - - { - let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => AbcObject>; - - let func: (...args: any[]) => AbcObject = anything; - result = _(func).iteratee(); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => AbcObject>; - - result = _('').iteratee(); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => boolean>; - - result = _({}).iteratee(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => AbcObject>; - - let func: (...args: any[]) => AbcObject = anything; - result = _(func).chain().iteratee(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => AbcObject>; - - result = _('').chain().iteratee(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => boolean>; - - result = _({}).chain().iteratee(); - } + fp.iteratee((a: AbcObject): boolean => anything); // $ExpectType (a: AbcObject) => boolean + fp.iteratee((...args: any[]): AbcObject => anything); // $ExpectType (...args: any[]) => AbcObject + fp.iteratee(""); // $ExpectType (...args: any[]) => any + fp.iteratee({ a: 42 }); // $ExpectType (...args: any[]) => any + fp.iteratee(["a", 42]); // $ExpectType (...args: any[]) => any } // _.matches -namespace TestMatches { - let source: AbcObject = { a: 1, b: "", c: true }; +{ + const source: AbcObject = { a: 1, b: "", c: true }; - { - let result: (value: any) => boolean; - result = _.matches(source); - } + _.matches(source); // $ExpectType (value: any) => boolean + _.matches(source); // $ExpectType (value: AbcObject) => boolean + _(source).matches(); // $ExpectType LoDashImplicitWrapper<(value: AbcObject) => boolean> + _.chain(source).matches(); // $ExpectType LoDashExplicitWrapper<(value: AbcObject) => boolean> - { - let result: (value: AbcObject) => boolean; - result = _.matches(source); - } - - { - let result: _.LoDashImplicitObjectWrapper<(value: AbcObject) => boolean>; - result = _(source).matches(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(value: AbcObject) => boolean>; - result = _(source).chain().matches(); - } + fp.matches(source, {}); // $ExpectType boolean + fp.matches(source)({}); // $ExpectType boolean } // _.matchesProperty { - let path: string | string[] = []; - let source: AbcObject = { a: 1, b: "", c: true }; + const path: string | string[] = anything; + const source: AbcObject = { a: 1, b: "", c: true }; - { - let result: (value: any) => boolean; - - result = _.matchesProperty(path, source); - } - - { - let result: (value: AbcObject) => boolean; - - result = _.matchesProperty(path, source); - } - - { - let result: _.LoDashImplicitObjectWrapper<(value: any) => boolean>; - - result = _(path).matchesProperty(source); - } - - { - let result: _.LoDashImplicitObjectWrapper<(value: AbcObject) => boolean>; - - result = _(path).matchesProperty(source); - } - - { - let result: _.LoDashExplicitObjectWrapper<(value: any) => boolean>; - - result = _(path).chain().matchesProperty(source); - } - - { - let result: _.LoDashExplicitObjectWrapper<(value: AbcObject) => boolean>; - - result = _(path).chain().matchesProperty(source); - } + _.matchesProperty(path, source); // $ExpectType (value: any) => boolean + _.matchesProperty(path, source); // $ExpectType (value: AbcObject) => boolean + _(path).matchesProperty(source); // $ExpectType LoDashImplicitWrapper<(value: any) => boolean> + _(path).matchesProperty(source); + _.chain(path).matchesProperty(source); // $ExpectType LoDashExplicitWrapper<(value: any) => boolean> + fp.matchesProperty(path, source); // $ExpectType (value: any) => boolean } // _.method -namespace TestMethod { - { - let result: (object: any) => {a: string}; +{ + _.method("a.0"); // $ExpectType (object: any) => any + _.method("a.0", anything, anything, anything); // $ExpectType (object: any) => any + _.method(["a", 0]); // $ExpectType (object: any) => any + _.method(["a", 0], anything, anything, anything); // $ExpectType (object: any) => any - result = _.method('a.0'); - result = _.method('a.0', anything, anything); - result = _.method('a.0', anything, anything, anything); + _("a.0").method(); // $ExpectType LoDashImplicitWrapper<(object: any) => any> + _("a.0").method(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(object: any) => any> + _(["a", 0]).method(); // $ExpectType LoDashImplicitWrapper<(object: any) => any> + _(["a", 0]).method(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(object: any) => any> - result = _.method(['a', 0]); - result = _.method(['a', 0], anything); - result = _.method(['a', 0], anything, anything); - result = _.method(['a', 0], anything, anything, anything); - } + _.chain("a.0").method(); // $ExpectType LoDashExplicitWrapper<(object: any) => any> + _.chain("a.0").method(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(object: any) => any> + _.chain(["a", 0]).method(); // $ExpectType LoDashExplicitWrapper<(object: any) => any> + _.chain(["a", 0]).method(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(object: any) => any> - { - let result: (object: {a: string}) => {b: string}; - - result = _.method('a.0'); - result = _.method('a.0', anything, anything); - result = _.method('a.0', anything, anything, anything); - - result = _.method(['a', 0]); - result = _.method(['a', 0], anything); - result = _.method(['a', 0], anything, anything); - result = _.method(['a', 0], anything, anything, anything); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => {a: string}>; - - result = _('a.0').method(); - result = _('a.0').method(anything); - result = _('a.0').method(anything, anything); - result = _('a.0').method(anything, anything, anything); - - result = _(['a', 0]).method(); - result = _(['a', 0]).method(anything); - result = _(['a', 0]).method(anything, anything); - result = _(['a', 0]).method(anything, anything, anything); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: {a: string}) => {b: string}>; - - result = _('a.0').method(); - result = _('a.0').method(anything); - result = _('a.0').method(anything, anything); - result = _('a.0').method(anything, anything, anything); - - result = _(['a', 0]).method(); - result = _(['a', 0]).method(anything); - result = _(['a', 0]).method(anything, anything); - result = _(['a', 0]).method(anything, anything, anything); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => {a: string}>; - - result = _('a.0').chain().method(); - result = _('a.0').chain().method(anything); - result = _('a.0').chain().method(anything, anything); - result = _('a.0').chain().method(anything, anything, anything); - - result = _(['a', 0]).chain().method(); - result = _(['a', 0]).chain().method(anything); - result = _(['a', 0]).chain().method(anything, anything); - result = _(['a', 0]).chain().method(anything, anything, anything); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: {a: string}) => {b: string}>; - - result = _('a.0').chain().method(); - result = _('a.0').chain().method(anything); - result = _('a.0').chain().method(anything, anything); - result = _('a.0').chain().method(anything, anything, anything); - - result = _(['a', 0]).chain().method(); - result = _(['a', 0]).chain().method(anything); - result = _(['a', 0]).chain().method(anything, anything); - result = _(['a', 0]).chain().method(anything, anything, anything); - } + fp.method("a.0"); // $ExpectType (object: any) => any + fp.method(["a", 0]); // $ExpectType (object: any) => any + fp.method(Symbol.replace); // $ExpectType (object: any) => any } // _.methodOf -namespace TestMethodOf { - type SampleObject = { a: Array<{ b(): AbcObject }> }; - type ResultFn = (path: string | string[]) => AbcObject; +{ + const object: AbcObject = anything; - let object: SampleObject = { a: [] }; - - { - let result: ResultFn; - - result = _.methodOf(object); - result = _.methodOf(object, anything); - result = _.methodOf(object, anything, anything); - result = _.methodOf(object, anything, anything, anything); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(object).methodOf(); - result = _(object).methodOf(anything); - result = _(object).methodOf(anything, anything); - result = _(object).methodOf(anything, anything, anything); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(object).chain().methodOf(); - result = _(object).chain().methodOf(anything); - result = _(object).chain().methodOf(anything, anything); - result = _(object).chain().methodOf(anything, anything, anything); - } + _.methodOf(object); // $ExpectType (path: Many) => any + _.methodOf(object, anything, anything, anything); // $ExpectType (path: Many) => any + _(object).methodOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> + _(object).methodOf(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> + _.chain(object).methodOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> + _.chain(object).methodOf(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> + fp.methodOf(object); // $ExpectType (path: Many) => any } // _.mixin -namespace TestMixin { - let source: _.Dictionary<(...args: any[]) => any> = {}; - let dest: AbcObject = anything; - let options: {chain?: boolean} = {}; +{ + const source: _.Dictionary<(...args: any[]) => any> = {}; + const dest: AbcObject = anything; + const options: {chain?: boolean} = {}; - { - let result: _.LoDashStatic; + _.mixin(source); // $ExpectType LoDashStatic + _.mixin(source, options); // $ExpectType LoDashStatic + _.mixin(dest, source); // $ExpectType AbcObject + _.mixin(dest, source, options); // $ExpectType AbcObject - result = _.mixin(source); - result = _.mixin(source, options); - } + _(source).mixin(); // $ExpectType LoDashImplicitWrapper + _(source).mixin(options); // $ExpectType LoDashImplicitWrapper + _(dest).mixin(source); // $ExpectType LoDashImplicitWrapper + _(dest).mixin(source, options); // $ExpectType LoDashImplicitWrapper - { - let result: AbcObject; - - result = _.mixin(dest, source); - result = _.mixin(dest, source, options); - } - - { - let result: _.LoDashImplicitWrapper<_.LoDashStatic>; - - result = _(source).mixin(); - result = _(source).mixin(options); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(dest).mixin(source); - result = _(dest).mixin(source, options); - } - - { - let result: _.LoDashExplicitWrapper<_.LoDashStatic>; - - result = _(source).chain().mixin(); - result = _(source).chain().mixin(options); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(dest).chain().mixin(source); - result = _(dest).chain().mixin(source, options); - } + _.chain(source).mixin(); // $ExpectType LoDashExplicitWrapper + _.chain(source).mixin(options); // $ExpectType LoDashExplicitWrapper + _.chain(dest).mixin(source); // $ExpectType LoDashExplicitWrapper + _.chain(dest).mixin(source, options); // $ExpectType LoDashExplicitWrapper } // _.noConflict -namespace TestNoConflict { - { - let result: typeof _; - - result = _.noConflict(); - result = _(42).noConflict(); - result = _([]).noConflict(); - result = _({}).noConflict(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(42).chain().noConflict(); - result = _([]).chain().noConflict(); - result = _({}).chain().noConflict(); - } +{ + _.noConflict(); // $ExpectType LoDashStatic + _(42).noConflict(); // $ExpectType LoDashStatic + _.chain(42).noConflict(); // $ExpectType LoDashExplicitWrapper + fp.noConflict(); // $ExpectType LoDashStatic } // _.noop -namespace TestNoop { - { - let result: void; // tslint:disable-line:void-return +{ + _.noop(); // $ExpectType void + _.noop(1); // $ExpectType void + _.noop(true, "a", 1); // $ExpectType void + _("a").noop(true, "a", 1); // $ExpectType void + _.chain("a").noop(true, "a", 1); // $ExpectType LoDashExplicitWrapper - result = _.noop(); - result = _.noop(1); - result = _.noop('a', 1); - result = _.noop(true, 'a', 1); - - result = _('a').noop(true, 'a', 1); - result = _([1]).noop(true, 'a', 1); - result = _(['']).noop(true, 'a', 1); - result = _({}).noop(true, 'a', 1); - result = _(anything).noop(true, 'a', 1); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('a').chain().noop(true, 'a', 1); - result = _([1]).chain().noop(true, 'a', 1); - result = _(['']).chain().noop(true, 'a', 1); - result = _({}).chain().noop(true, 'a', 1); - result = _(anything).chain().noop(true, 'a', 1); - } + fp.noop(); // $ExpectType void + fp.noop(1); // $ExpectType void + fp.noop(true, "a", 1); // $ExpectType void } -namespace TestNthArg { - type SampleFunc = (...args: any[]) => any; - - { - let result: SampleFunc; - - result = _.nthArg(); - result = _.nthArg(1); - } - - { - let result: _.LoDashImplicitObjectWrapper; - - result = _(1).nthArg(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _(1).chain().nthArg(); - } +{ + _.nthArg(); // $ExpectType (...args: any[]) => any + _.nthArg(1); // $ExpectType (...args: any[]) => any + _(1).nthArg(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => any> + _.chain(1).nthArg(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => any> + fp.nthArg(1); // $ExpectType (...args: any[]) => any } // _.over -namespace TestOver { - { - let result: (...args: any[]) => number[]; +{ + _.over(Math.max); // $ExpectType (...args: any[]) => number[] + _.over(Math.max, Math.min); // $ExpectType (...args: any[]) => number[] + _.over([Math.max]); // $ExpectType (...args: any[]) => number[] + _.over([Math.max], [Math.min]); // $ExpectType (...args: any[]) => number[] - result = _.over(Math.max); - result = _.over(Math.max, Math.min); - result = _.over([Math.max]); - result = _.over([Math.max], [Math.min]); - } + _(Math.max).over(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> + _(Math.max).over(Math.min); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> + _([Math.max]).over(); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> + _([Math.max]).over([Math.min]); // $ExpectType LoDashImplicitWrapper<(...args: any[]) => number[]> - { - let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => number[]>; + _.chain(Math.max).over(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> + _.chain(Math.max).over(Math.min); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> + _.chain([Math.max]).over(); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> + _.chain([Math.max]).over([Math.min]); // $ExpectType LoDashExplicitWrapper<(...args: any[]) => number[]> - result = _(Math.max).over(); - result = _(Math.max).over(Math.min); - result = _([Math.max]).over(); - result = _([Math.max]).over([Math.min]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => number[]>; - - result = _(Math.max).chain().over(); - result = _(Math.max).chain().over(Math.min); - result = _([Math.max]).chain().over(); - result = _([Math.max]).chain().over([Math.min]); - } + fp.over(Math.max); // $ExpectType (...args: any[]) => number[] + fp.over([Math.max, Math.min]); // $ExpectType (...args: any[]) => number[] } // _.overEvery -namespace TestOverEvery { - { - let result: (...args: number[]) => boolean; - - result = _.overEvery((number) => true); - result = _.overEvery((number) => true, (number) => true); - result = _.overEvery([(number) => true]); - result = _.overEvery([(number) => true], [(number) => true]); - } - - { - let result: _.LoDashImplicitObjectWrapper<(...args: number[]) => boolean>; - - result = _(Math.max).overEvery(); - result = _(Math.max).overEvery((number) => true); - result = _([Math.max]).overEvery(); - result = _([Math.max]).overEvery([(number) => true]); - } - - { - let result: _.LoDashExplicitObjectWrapper<(...args: number[]) => boolean>; - - result = _(Math.max).chain().overEvery(); - result = _(Math.max).chain().overEvery((number) => true); - result = _([Math.max]).chain().overEvery(); - result = _([Math.max]).chain().overEvery([(number) => true]); - } -} - // _.overSome -namespace TestOverSome { - { - let result: (...args: number[]) => boolean; +{ + _.overEvery((number: number) => true); // $ExpectType (...args: number[]) => boolean + _.overEvery((number: number) => true, (number: number) => true); // $ExpectType (...args: number[]) => boolean + _.overEvery([(number: number) => true]); // $ExpectType (...args: number[]) => boolean + _.overEvery([(number: number) => true], [(number: number) => true]); // $ExpectType (...args: number[]) => boolean - result = _.overSome((n: number) => true); - result = _.overSome((n: number) => true, (n: number) => true); - result = _.overSome([(n: number) => true]); - result = _.overSome([(n: number) => true], [(n: number) => true]); - } + _(Math.max).overEvery(); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _(Math.max).overEvery((number: number) => true); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _([Math.max]).overEvery([(number: number) => true]); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> - { - let result: _.LoDashImplicitObjectWrapper<(...args: number[]) => boolean>; + _.chain(Math.max).overEvery(); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + _.chain(Math.max).overEvery((number: number) => true); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + _.chain([Math.max]).overEvery([(number: number) => true]); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> - result = _(Math.max).overSome(); - result = _(Math.max).overSome((n: number) => true); - result = _([Math.max]).overSome(); - result = _([Math.max]).overSome([(n: number) => true]); - } + fp.overEvery((number: number) => true); // $ExpectType (...args: number[]) => boolean + fp.overEvery([(number: number) => true, (number: number) => true]); // $ExpectType (...args: number[]) => boolean - { - let result: _.LoDashExplicitObjectWrapper<(...args: number[]) => boolean>; + _.overSome((number: number) => true); // $ExpectType (...args: number[]) => boolean + _.overSome((number: number) => true, (number: number) => true); // $ExpectType (...args: number[]) => boolean + _.overSome([(number: number) => true]); // $ExpectType (...args: number[]) => boolean + _.overSome([(number: number) => true], [(number: number) => true]); // $ExpectType (...args: number[]) => boolean - result = _(Math.max).chain().overSome(); - result = _(Math.max).chain().overSome((n: number) => true); - result = _([Math.max]).chain().overSome(); - result = _([Math.max]).chain().overSome([(n: number) => true]); - } + _(Math.max).overSome(); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _(Math.max).overSome((number: number) => true); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + _([Math.max]).overSome([(number: number) => true]); // $ExpectType LoDashImplicitWrapper<(...args: number[]) => boolean> + + _.chain(Math.max).overSome(); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + _.chain(Math.max).overSome((number: number) => true); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + _.chain([Math.max]).overSome([(number: number) => true]); // $ExpectType LoDashExplicitWrapper<(...args: number[]) => boolean> + + fp.overSome((number: number) => true); // $ExpectType (...args: number[]) => boolean + fp.overSome([(number: number) => true, (number: number) => true]); // $ExpectType (...args: number[]) => boolean } // _.property -namespace TestProperty { +{ interface SampleObject { a: { b: number[]; - } + }; } - { - let result: (object: SampleObject) => number; - - result = _.property('a.b[0]'); - result = _.property(['a', 'b', 0]); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: SampleObject) => number>; - - result = _('a.b[0]').property(); - result = _(['a', 'b', 0]).property(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: SampleObject) => number>; - - result = _('a.b[0]').chain().property(); - result = _(['a', 'b', 0]).chain().property(); - } + _.property("a.b[0]"); // $ExpectType (obj: SampleObject) => number + _.property(["a", "b", 0]); // $ExpectType (obj: SampleObject) => number + _("a.b[0]").property(); // $ExpectType LoDashImplicitWrapper<(obj: SampleObject) => number> + _(["a", "b", 0]).property(); // $ExpectType LoDashImplicitWrapper<(obj: SampleObject) => number> + _.chain("a.b[0]").property(); // $ExpectType LoDashExplicitWrapper<(obj: SampleObject) => number> + _.chain(["a", "b", 0]).property(); // $ExpectType LoDashExplicitWrapper<(obj: SampleObject) => number> + fp.property(Symbol.iterator)([]); // $ExpectType any + fp.property([Symbol.iterator], []); // $ExpectType any + fp.property(1)("abc"); // $ExpectType string } // _.propertyOf -namespace TestPropertyOf { - interface SampleObject { - a: { - b: number[]; - } - } +{ + _.propertyOf({}); // $ExpectType (path: Many) => any + _({}).propertyOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> + _.chain({}).propertyOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> - let object: SampleObject = { a: { b: [] } }; - - { - let result: (path: string|string[]) => any; - - result = _.propertyOf({}); - result = _.propertyOf(object); - } - - { - let result: _.LoDashImplicitObjectWrapper<(path: string|string[]) => any>; - - result = _({}).propertyOf(); - } - - { - let result: _.LoDashExplicitObjectWrapper<(path: string|string[]) => any>; - - result = _({}).chain().propertyOf(); - } + fp.propertyOf(Symbol.iterator)([]); // $ExpectType any + fp.propertyOf([Symbol.iterator], []); // $ExpectType any + fp.propertyOf(1)("abc"); // $ExpectType string } // _.range -namespace TestRange { - { - let result: number[]; - - result = _.range(10); - result = _.range(1, 11); - result = _.range(0, 30, 5); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(10).range(); - result = _(1).range(11); - result = _(0).range(30, 5); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(10).chain().range(); - result = _(1).chain().range(11); - result = _(0).chain().range(30, 5); - } - - // $ExpectType number[][] - _.map([5, 5], _.range); -} - // _.rangeRight -namespace TestRangeRight { - { - let result: number[]; +{ + _.range(10); // $ExpectType number[] + _.range(1, 11); // $ExpectType number[] + _.range(0, 30, 5); // $ExpectType number[] + _(10).range(); // $ExpectType LoDashImplicitWrapper + _(1).range(11); // $ExpectType LoDashImplicitWrapper + _(0).range(30, 5); // $ExpectType LoDashImplicitWrapper + _.chain(10).range(); // $ExpectType LoDashExplicitWrapper + _.chain(1).range(11); // $ExpectType LoDashExplicitWrapper + _.chain(0).range(30, 5); // $ExpectType LoDashExplicitWrapper + fp.range(1, 11); // $ExpectType number[] + fp.range(1)(11); // $ExpectType number[] - result = _.rangeRight(10); - result = _.rangeRight(1, 11); - result = _.rangeRight(0, 30, 5); - } + _.rangeRight(10); // $ExpectType number[] + _.rangeRight(1, 11); // $ExpectType number[] + _.rangeRight(0, 30, 5); // $ExpectType number[] + _(10).rangeRight(); // $ExpectType LoDashImplicitWrapper + _(1).rangeRight(11); // $ExpectType LoDashImplicitWrapper + _(0).rangeRight(30, 5); // $ExpectType LoDashImplicitWrapper + _.chain(10).rangeRight(); // $ExpectType LoDashExplicitWrapper + _.chain(1).rangeRight(11); // $ExpectType LoDashExplicitWrapper + _.chain(0).rangeRight(30, 5); // $ExpectType LoDashExplicitWrapper + fp.rangeRight(1, 11); // $ExpectType number[] + fp.rangeRight(1)(11); // $ExpectType number[] - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(10).rangeRight(); - result = _(1).rangeRight(11); - result = _(0).rangeRight(30, 5); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(10).chain().rangeRight(); - result = _(1).chain().rangeRight(11); - result = _(0).chain().rangeRight(30, 5); - } - - // $ExpectType number[][] - _.map([5, 5], _.rangeRight); + _.map([5, 5], _.range); // $ExpectType number[][] + _.map([5, 5], _.rangeRight); // $ExpectType number[][] } // _.runInContext { - let result: typeof _; - result = _.runInContext(); - result = _.runInContext({}); - result = _({}).runInContext(); + _.runInContext(); // $ExpectType LoDashStatic + _.runInContext({}); // $ExpectType LoDashStatic + _({}).runInContext(); // $ExpectType LoDashStatic + fp.runInContext({}); // $ExpectType LoDashStatic } // _.stubArray { - { - let result: any[]; - - result = _.stubArray(); - result = _(anything).stubArray(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('a').chain().stubArray(); - result = _([1]).chain().stubArray(); - result = _(['']).chain().stubArray(); - result = _({}).chain().stubArray(); - result = _(anything).chain().stubArray(); - } + _.stubArray(); // $ExpectType any[] + _(anything).stubArray(); // $ExpectType any[] + _.chain(anything).stubArray(); // $ExpectType LoDashExplicitWrapper + fp.stubArray(); // $ExpectType any[] } // _.stubFalse { - { - let result: boolean; - - result = _.stubFalse(); - result = _(anything).stubFalse(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('a').chain().stubFalse(); - result = _([1]).chain().stubFalse(); - result = _(['']).chain().stubFalse(); - result = _({}).chain().stubFalse(); - result = _(anything).chain().stubFalse(); - } + _.stubFalse(); // $ExpectType boolean + _(anything).stubFalse(); // $ExpectType boolean + _.chain(anything).stubFalse(); // $ExpectType LoDashExplicitWrapper + fp.stubFalse(); // $ExpectType boolean } // _.stubObject { - { - let result: object; - - result = _.stubObject(); - result = _(anything).stubObject(); - } - - { - let result: _.LoDashExplicitObjectWrapper; - - result = _('a').chain().stubObject(); - result = _([1]).chain().stubObject(); - result = _(['']).chain().stubObject(); - result = _({}).chain().stubObject(); - result = _(anything).chain().stubObject(); - } + _.stubObject(); // $ExpectType any + _(anything).stubObject(); // $ExpectType any + _.chain(anything).stubObject(); // $ExpectType LoDashExplicitWrapper + fp.stubObject(); // $ExpectType any } // _.stubString { - { - let result: string; - - result = _.stubString(); - result = _(anything).stubString(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('a').chain().stubString(); - result = _([1]).chain().stubString(); - result = _(['']).chain().stubString(); - result = _({}).chain().stubString(); - result = _(anything).chain().stubString(); - } + _.stubString(); // $ExpectType string + _(anything).stubString(); // $ExpectType string + _.chain(anything).stubString(); // $ExpectType LoDashExplicitWrapper + fp.stubString(); // $ExpectType string } // _.stubTrue { - { - let result: boolean; - - result = _.stubTrue(); - result = _(anything).stubTrue(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('a').chain().stubTrue(); - result = _([1]).chain().stubTrue(); - result = _(['']).chain().stubTrue(); - result = _({}).chain().stubTrue(); - result = _(anything).chain().stubTrue(); - } + _.stubTrue(); // $ExpectType boolean + _(anything).stubTrue(); // $ExpectType boolean + _.chain(anything).stubTrue(); // $ExpectType LoDashExplicitWrapper + fp.stubTrue(); // $ExpectType boolean } // _.times -namespace TestTimes { - let iteratee: (num: number) => AbcObject = (num: number) => ({ a: 1, b: "", c: true }); +{ + const iteratee = (num: number): AbcObject => ({ a: 1, b: "", c: true }); - { - let result: number[]; - - result = _.times(42); - result = _(42).times(); - } - - { - let result: AbcObject[]; - - result = _.times(42, iteratee); - result = _(42).times(iteratee); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(42).chain().times(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(42).chain().times(iteratee); - } + _.times(42); // $ExpectType number[] + _.times(42, iteratee); // $ExpectType AbcObject[] + _(42).times(); // $ExpectType number[] + _(42).times(iteratee); // $ExpectType AbcObject[] + _.chain(42).times(); // $ExpectType LoDashExplicitWrapper + _.chain(42).times(iteratee); // $ExpectType LoDashExplicitWrapper + fp.times(iteratee, 42); // $ExpectType AbcObject[] + fp.times(iteratee)(42); // $ExpectType AbcObject[] } // _.toPath -namespace TestToPath { - { - let result: string[]; - result = _.toPath(true); - result = _.toPath(1); - result = _.toPath('a'); - result = _.toPath(["a"]); - result = _.toPath({}); - } - - { - let result: _.LoDashImplicitWrapper; - - result = _(true).toPath(); - result = _(1).toPath(); - result = _('a').toPath(); - result = _([1]).toPath(); - result = _(["a"]).toPath(); - result = _({}).toPath(); - } +{ + _.toPath(1); // $ExpectType string[] + _.toPath("a[0].b.c"); // $ExpectType string[] + _.toPath(["a", 1]); // $ExpectType string[] + _(1).toPath(); // $ExpectType LoDashImplicitWrapper + _("a[0].b.c").toPath(); // $ExpectType LoDashImplicitWrapper + _(["a", 1]).toPath(); // $ExpectType LoDashImplicitWrapper + _.chain(1).toPath(); // $ExpectType LoDashExplicitWrapper + _.chain("a[0].b.c").toPath(); // $ExpectType LoDashExplicitWrapper + _.chain(["a", 1]).toPath(); // $ExpectType LoDashExplicitWrapper + fp.toPath(true); // $ExpectType string[] + fp.toPath(1); // $ExpectType string[] + fp.toPath("a"); // $ExpectType string[] + fp.toPath(["a"]); // $ExpectType string[] + fp.toPath({}); // $ExpectType string[] } // _.uniqueId -namespace TestUniqueId { - { - let result: string; - - result = _.uniqueId(); - result = _.uniqueId(''); - - result = _('').uniqueId(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('').chain().uniqueId(); - } +{ + _.uniqueId(); // $ExpectType string + _.uniqueId(""); // $ExpectType string + _("").uniqueId(); // $ExpectType string + _.chain("").uniqueId(); // $ExpectType LoDashExplicitWrapper + fp.uniqueId(""); // $ExpectType string } _.VERSION; // $ExpectType string @@ -14326,115 +7196,48 @@ _.templateSettings; // $ExpectType TemplateSettings // _.partial & _.partialRight { - function func0(): number { + const func0 = (): number => { return 42; - } - function func1(arg1: number): number { + }; + const func1 = (arg1: number): number => { return arg1 * 2; - } - function func2(arg1: number, arg2: string): number { + }; + const func2 = (arg1: number, arg2: string): number => { return arg1 * arg2.length; - } - function func3(arg1: number, arg2: string, arg3: boolean): number { + }; + const func3 = (arg1: number, arg2: string, arg3: boolean): number => { return arg1 * arg2.length + (arg3 ? 1 : 0); - } - function func4(arg1: number, arg2: string, arg3: boolean, arg4: number): number { - return arg1 * arg2.length + (arg3 ? 1 : 0) - arg4; - } - let res____: () => number; - let res1___: (arg1: number ) => number; - let res_2__: ( arg2: string ) => number; - let res__3_: ( arg3: boolean ) => number; - let res___4: ( arg4: number) => number; - let res12__: (arg1: number, arg2: string ) => number; - let res1_3_: (arg1: number, arg3: boolean ) => number; - let res1__4: (arg1: number, arg4: number) => number; - let res_23_: ( arg2: string, arg3: boolean ) => number; - let res_2_4: ( arg2: string, arg4: number) => number; - let res__34: ( arg3: boolean, arg4: number) => number; - let res123_: (arg1: number, arg2: string, arg3: boolean ) => number; - let res12_4: (arg1: number, arg2: string, arg4: number) => number; - let res1_34: (arg1: number, arg3: boolean, arg4: number) => number; - let res_234: ( arg2: string, arg3: boolean, arg4: number) => number; - let res1234: (arg1: number, arg2: string, arg3: boolean, arg4: number) => number; + }; - // - // _.partial - // // with arity 0 function - res____ = _.partial(func0); + _.partial(func0); // $ExpectType Function0 // with arity 1 function - res____ = _.partial(func1, 42 ); - res1___ = _.partial(func1 ); + _.partial(func1, 42); // $ExpectType Function0 + _.partial(func1); // $ExpectType Function1 // with arity 2 function - res12__ = _.partial(func2 ); - res_2__ = _.partial(func2, 42 ); - res1___ = _.partial(func2, _, "foo"); - res____ = _.partial(func2, 42, "foo"); + _.partial(func2); // $ExpectType Function2 + _.partial(func2, 42); // $ExpectType Function1 + _.partial(func2, _, "foo"); // $ExpectType Function1 + _.partial(func2, 42, "foo"); // $ExpectType Function0 // with arity 3 function - res123_ = _.partial(func3 ); - res_23_ = _.partial(func3, 42 ); - res1_3_ = _.partial(func3, _, "foo" ); - res__3_ = _.partial(func3, 42, "foo" ); - res12__ = _.partial(func3, _, _, true); - res_2__ = _.partial(func3, 42, _, true); - res1___ = _.partial(func3, _, "foo", true); - res____ = _.partial(func3, 42, "foo", true); - // with arity 4 function - res1234 = _.partial(func4 ); - res_234 = _.partial(func4, 42 ); - res1_34 = _.partial(func4, _, "foo" ); - res__34 = _.partial(func4, 42, "foo" ); - res12_4 = _.partial(func4, _, _, true ); - res_2_4 = _.partial(func4, 42, _, true ); - res1__4 = _.partial(func4, _, "foo", true ); - res___4 = _.partial(func4, 42, "foo", true ); - res123_ = _.partial(func4, _, _, _, 100); - res_23_ = _.partial(func4, 42, _, _, 100); - res1_3_ = _.partial(func4, _, "foo", _, 100); - res__3_ = _.partial(func4, 42, "foo", _, 100); - res12__ = _.partial(func4, _, _, true, 100); - res_2__ = _.partial(func4, 42, _, true, 100); - res1___ = _.partial(func4, _, "foo", true, 100); - res____ = _.partial(func4, 42, "foo", true, 100); + _.partial(func3, 42, _, true); - // - // _.partialRight - // // with arity 0 function - res____ = _.partialRight(func0); + _.partialRight(func0); // $ExpectType Function0 // with arity 1 function - res____ = _.partialRight(func1, 42 ); - res1___ = _.partialRight(func1 ); + _.partialRight(func1, 42); // $ExpectType Function0 + _.partialRight(func1); // $ExpectType Function1 // with arity 2 function - res12__ = _.partialRight(func2 ); - res_2__ = _.partialRight(func2, 42, _); - res1___ = _.partialRight(func2, "foo"); - res____ = _.partialRight(func2, 42, "foo"); + _.partialRight(func2); // $ExpectType Function2 + _.partialRight(func2, 42, _); // $ExpectType Function1 + _.partialRight(func2, "foo"); // $ExpectType Function1 + _.partialRight(func2, 42, "foo"); // $ExpectType Function0 // with arity 3 function - res123_ = _.partialRight(func3 ); - res_23_ = _.partialRight(func3, 42, _, _); - res1_3_ = _.partialRight(func3, "foo", _); - res__3_ = _.partialRight(func3, 42, "foo", _); - res12__ = _.partialRight(func3, true); - res_2__ = _.partialRight(func3, 42, _, true); - res1___ = _.partialRight(func3, "foo", true); - res____ = _.partialRight(func3, 42, "foo", true); - // with arity 4 function - res1234 = _.partialRight(func4 ); - res_234 = _.partialRight(func4, 42, _, _, _); - res1_34 = _.partialRight(func4, "foo", _, _); - res__34 = _.partialRight(func4, 42, "foo", _, _); - res12_4 = _.partialRight(func4, true, _); - res_2_4 = _.partialRight(func4, 42, _, true, _); - res1__4 = _.partialRight(func4, "foo", true, _); - res___4 = _.partialRight(func4, 42, "foo", true, _); - res123_ = _.partialRight(func4, 100); - res_23_ = _.partialRight(func4, 42, _, _, 100); - res1_3_ = _.partialRight(func4, "foo", _, 100); - res__3_ = _.partialRight(func4, 42, "foo", _, 100); - res12__ = _.partialRight(func4, true, 100); - res_2__ = _.partialRight(func4, 42, _, true, 100); - res1___ = _.partialRight(func4, "foo", true, 100); - res____ = _.partialRight(func4, 42, "foo", true, 100); + _.partialRight(func3, 42, _, true); + + fp.partial([], func0); // $ExpectType (...args: any[]) => any + fp.partial([])(func0); // $ExpectType (...args: any[]) => any + fp.partial([42])(func1); // $ExpectType (...args: any[]) => any + fp.partialRight([])(func0); // $ExpectType (...args: any[]) => any + fp.partialRight([42])(func1); // $ExpectType (...args: any[]) => any } diff --git a/types/lodash/readme.md b/types/lodash/readme.md new file mode 100644 index 0000000000..d65d7f878f --- /dev/null +++ b/types/lodash/readme.md @@ -0,0 +1,62 @@ +# Notes for lodash developers + +## Folder Structure + +- Root + - `index.d.ts`: this is the main file that will be imported when people do `import _ from "lodash"`. + It references files for the lodash types. + - `fp.d.ts`: like `index.d.ts`, but for the functional programming variant of lodash. + See https://github.com/lodash/lodash/wiki/FP-Guide. + - `lodash-tests.ts`: contains test cases. Update these as necessary when you make a change. + - `tsconfig.json`: usually you shouldn't modify this file. However, if you add a new file, you should + probably add it to the `files` list in `tsconfig.json`. + - `tslint.json`: contains lint rules. The goal is to remove all of the rule overrides and match only the `dtslint/dt.json` rules. + - All other files: these exist so people can import individual functions, e.g. `import * as flatMap from "lodash/flatMap"` +- `common` directory: contains the main lodash types, split into multiple files for maintainability reasons. + These files are NOT meant to be imported directly - they should only be referenced by `index.d.ts`. +- `fp` directory: contains individual functions for `lodash/fp`. These files may be imported. + You should not modify these scripts directly - you should use a script to re-generate them (see below). +- `scripts` directory: contains code generation scripts. + - Before running any scripts, run `npm install` in this directory (it contains its own `package.json`). + - Most notable script is `npm run fp`, which re-generates all of the `fp` files. +- `v3` directory: contains types for lodash v3. + +## Different ways people might use lodash + +- Importing + - `import * as _ from "lodash"` + - `import * as _ from "lodash/fp"` + - `import { flatMap } from "lodash"` + - `import { flatMap } from "lodash/fp"` + - `import * as flatMap from "lodash/flatMap"` + - `import * as flatMap from "lodash/fp/flatMap"` + - `import * as flatMap from "lodash.flatmap"` (requires `npm install lodash.flatmap`) + - `import _ = require("lodash")` + - `import _ from "lodash"` (only if `esModuleInterop` is enabled) +- Global namespace + +## Before creating a PR + +- For every function you modify, don't forget to update the corresponding wrapper functions. +- Re-generate the `fp` types by opening a terminal in the `scripts` directory and running `npm run fp`. + - Note that this directory has its own `package.json`, so you'll need to run `npm install` first if you haven't already. +- Back at the root directory, do `npm run lint lodash` and make sure there are no errors. + +## FAQ +- I'm fixing a bug in v4. Should I also update the v3 types? + - In general, no. +- If the wrapper functions are almost copies of the original functions, shouldn't we auto-generate them like we do for `lodash/fp`? + - Good idea! If you have time, submit a PR. +- When I ran `npm run lint lodash`, I got an error that loks like `<--- Last few GCs --->`. + - Yeah, this error is really annoying. It means that node.js ran out of memory before it could run all of your tests. + - If you see somthing like `Test with 2.6` before that error, it means that there's an error in an older version of typescript. + The hard part is figuring out what the error is. + - The general procedure for diagnosing these errors is: + 1. Delete half of the tests in `lodash-tests.ts` (either the top half or the bottom half). + - If you delete the top half, don't delete the important stuff like `interface AbcObject`. + 2. Run `npm run lint lodash`. + 3. If it succeeds, add that half back and delete the other half. + 4. If it fails with a GC error, delete half of the remaining tests. + - Note: If both halfs succeed on their own, then the tests are probably just consuming too much memory. Try simplifying them until they pass. + 5. Repeat steps 1-4 until it gives you the real error message. Usually it's something obscure that only happens in TS 2.3/T.4, + so commenting/modifying the test is usually the best solution. diff --git a/types/lodash/scripts/generate-all.sh b/types/lodash/scripts/generate-all.sh index 2f79589533..a07bf37932 100644 --- a/types/lodash/scripts/generate-all.sh +++ b/types/lodash/scripts/generate-all.sh @@ -5,6 +5,7 @@ npm i ts-node -g ts-node ./generate-modules.ts +ts-node ./generate-fp.ts cd ../../../ diff --git a/types/lodash/scripts/generate-fp.ts b/types/lodash/scripts/generate-fp.ts new file mode 100644 index 0000000000..bbe648c6cd --- /dev/null +++ b/types/lodash/scripts/generate-fp.ts @@ -0,0 +1,841 @@ +// Script for converting the lodash types into unctional programming (FP) format. +// The convertion is done based on this guide: https://github.com/lodash/lodash/wiki/FP-Guide + +// Assumptions: +// - All functions are defined in one of the files in the "common" subfolder +// - All functions are defined inside of the LoDashStatic interface (although functions like _.partial may refer to another interface in the same file) +// - Consistent indentation is used for the start and end of the above interface +// - Consistent spacing is used for interface definitions: interface MyInterface { +// - Consistent line breaks (\n, \r, or \r\n) are used in all files +// - All overloads of a given function are defined in the same file + +import fs from "fs"; +import _ from "lodash"; +import convert from "lodash/fp/convert"; +import path from "path"; + +interface Definition { + name: string; + overloads: Overload[]; + jsdoc: string; +} +interface Interface { + name: string; + typeParams: TypeParam[]; + overloads: Overload[]; +} +interface Overload { + typeParams: TypeParam[]; + params: string[]; + returnType: string; + jsdoc: string; + tslintDisable?: string; +} +interface TypeParam { + name: string; + extends?: string; + equals?: string; +} + +let lineBreak = "\n"; +async function main() { + const commonTypes: string[] = []; + const tsconfigPath = path.join("..", "tsconfig.json"); + const tsconfigFile = await readFile(tsconfigPath); + lineBreak = _.find(["\r\n", "\n", "\r"], x => tsconfigFile.includes(x)) || "\n"; + + // Read each function definition and fp-ify it + const subfolders = ["common"]; + const promises: Array> = []; + for (const subfolder of subfolders) { + promises.push(new Promise((resolve, reject) => { + fs.readdir(path.join("..", subfolder), (err, files) => { + if (err) { + console.error(`failed to list directory contents for '${subfolder}': `, err); + reject(err); + return; + } + const filePaths = files.map(f => path.join("..", subfolder, f)); + try { + resolve(processDefinitions(filePaths, commonTypes)); + } catch (e) { + console.error(`failed to process files in '${subfolder}': `, e); + reject(e); + } + }); + })); + } + + let functionNames: string[]; + try { + functionNames = _.flatten(await Promise.all(promises)); + } catch (err) { + console.error("Failed to parse all functions: ", err); + return; + } + functionNames = _.sortedUniq(_.sortBy(functionNames, _.toLower)); + const fpFile = [ + "// AUTO-GENERATED: do not modify this file directly.", + "// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do:", + "// npm run fp", + "", + ...functionNames.map(f => `import ${f} = require("./fp/${f}");`), + "", + "export = _;", + "", + "declare const _: _.LoDashFp;", + "declare namespace _ {", + " interface LoDashFp {", + ...functionNames.map(f => ` ${f}: typeof ${f};`), + " }", + "}", + "", + "// Backward compatibility with --target es5", + "declare global {", + " // tslint:disable-next-line:no-empty-interface", + " interface Set { }", + " // tslint:disable-next-line:no-empty-interface", + " interface Map { }", + " // tslint:disable-next-line:no-empty-interface", + " interface WeakSet { }", + " // tslint:disable-next-line:no-empty-interface", + " interface WeakMap { }", + "}", + "", + ].join(lineBreak); + fs.writeFile(path.join("..", "fp.d.ts"), fpFile, (err) => { + if (err) + console.error("Failed to write fp.d.ts: ", err); + }); + + // Make sure the generated files are listed in tsconfig.json, so they are included in the lint checks + const tsconfig = tsconfigFile.split(lineBreak).filter(row => !row.includes("fp/") || row.includes("fp/convert.d.ts")); + const newRows = functionNames.map(f => ` "fp/${f}.d.ts",`); + newRows[newRows.length - 1] = newRows[newRows.length - 1].replace(",", ""); + + const insertIndex = _.findLastIndex(tsconfig, row => row.trim() === "]"); // Assume "files" is the last array + if (!tsconfig[insertIndex - 1].endsWith(",")) + tsconfig[insertIndex - 1] += ","; + tsconfig.splice(insertIndex, 0, ...newRows); + + fs.writeFile(tsconfigPath, tsconfig.join(lineBreak), (err) => { + if (err) + console.error(`Failed to write ${tsconfigPath}: `, err); + }); +} + +function readFile(filePath: string): Promise { + return new Promise((resolve, reject) => { + fs.readFile(filePath, "utf8", (err, data) => { + if (err) { + reject(err); + return; + } + try { + resolve(data); + } catch (e) { + reject(e); + } + }); + }); +} + +async function processDefinitions(filePaths: string[], commonTypes: string[]): Promise { + const builder: { [name: string]: (...args: number[][]) => () => Interface[] } = {}; + const unconvertedBuilder: { [name: string]: (...args: number[][]) => () => Interface[] } = {}; + for (const filePath of filePaths) { + const definitions = await parseFile(filePath, commonTypes); + for (const definition of definitions) { + if (definition.overloads.every(o => o.params.length <= 1 && o.returnType === "typeof _")) { + // Our convert technique doesn't work well on "typeof _" functions (or at least runInContext) + // Plus, if there are 0-1 parameters, there's nothing to curry anyways. + unconvertedBuilder[definition.name] = (...args: number[][]) => { + return () => curryOverloads(definition.overloads, definition.name, args[0] || [], -1, false); + }; + } else { + builder[definition.name] = (...args: Array) => { + // args were originally passed in as [0], [1], [2], [3], [4]. If they changed order, that indicates how the functoin was re-arged + // Return a function because some definitons (like rearg) expect to have a function return value + + // If any argument is a number instead of an array, then the argument at that index is being spread (e.g. assignAll, invokeArgs, partial, without) + const spreadIndex = args.findIndex(a => typeof a === "number"); + let isFixed = true; + if (spreadIndex !== -1) { + // If there's a spread parameter, convert() won't cap the number of arguments, so we need to do it manually + const arity = Math.max(spreadIndex, args[spreadIndex] as number) + 1; + args = args.slice(0, arity); + } else if (args.length > 4 || definition.name === "flow" || definition.name === "flowRight") { + // Arity wasn't fixed by convert() + isFixed = false; + } else { + // For some reason, convert() doesn't seems to tell us which functions have unchanged argument order. + // So we have to hard-code it. + const unchangedOrders = ["add", "assign", "assignIn", "bind", "bindKey", "concat", "difference", "divide", "eq", + "gt", "gte", "isEqual", "lt", "lte", "matchesProperty", "merge", "multiply", "overArgs", "partial", "partialRight", + "propertyOf", "random", "range", "rangeRight", "subtract", "zip", "zipObject", "zipObjectDeep"]; + if (unchangedOrders.includes(definition.name)) + args = _.sortBy(args as number[][], (a: number[]) => a[0]); + } + + return () => curryOverloads(definition.overloads, definition.name, _.flatten(args), spreadIndex, isFixed); + }; + } + } + } + + // Use convert() to tell us how functions will be rearged and aliased + const builderFp = convert(builder, { rearg: true, fixed: true, immutable: false, curry: false, cap: false }); + _.defaults(builderFp, unconvertedBuilder); + + const functionNames = Object.keys(builderFp).filter(key => key !== "convert" && typeof builderFp[key] === "function"); + for (const functionName of functionNames) { + // Assuming the maximum arity is 4. Pass one more arg than the max arity so we can detect if arguments weren't fixed. + const outputFn: (...args: any[]) => Interface[] = builderFp[functionName]([0], [1], [2], [3], [4]); + const commonTypeSearch = new RegExp(`\\b(${commonTypes.join("|")})\\b`, "g"); + commonTypeSearch.lastIndex; + let importCommon = false; + let output = outputFn([0], [1], [2], [3], [4]) + .map(interfaceToString) + .join(lineBreak) + .replace(commonTypeSearch, match => { + importCommon = true; + return `_.${match}`; + }); + if (!importCommon && output.includes("typeof _")) + importCommon = true; + const interfaceNameMatch = output.match(/(?:interface|type) ([A-Za-z0-9]+)/); + const interfaceName = (interfaceNameMatch ? interfaceNameMatch[1] : undefined) || _.upperFirst(functionName); + output = [ + "// AUTO-GENERATED: do not modify this file directly.", + "// If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do:", + "// npm run fp", + importCommon ? `${lineBreak}import _ = require("../index");${lineBreak}` : '', + output, + "", + `declare const ${functionName}: ${interfaceName};`, + `export = ${functionName};`, + "", + ].join(lineBreak); + const targetFile = `../fp/${functionName}.d.ts`; + fs.writeFile(targetFile, output, (err) => { + if (err) + console.error(`failed to write file: ${targetFile}`, err); + }); + } + return functionNames; +} + +async function parseFile(filePath: string, commonTypes: string[]): Promise { + const definitionString = await readFile(filePath); + const newCommonTypeRegExp = / (?:type|interface) ([A-Za-z0-9]+)/g; + let newCommonType = newCommonTypeRegExp.exec(definitionString); + while (newCommonType) { + if (!commonTypes.includes(newCommonType[1])) + commonTypes.push(newCommonType[1]); + newCommonType = newCommonTypeRegExp.exec(definitionString); + } + + const definitons: Definition[] = []; + const lodashStaticRegExp = /( *)interface LoDashStatic {/g; + let lodashStaticMatch = lodashStaticRegExp.exec(definitionString); + while (lodashStaticMatch) { + const startIndex = lodashStaticMatch.index; + const endIndex = definitionString.indexOf(`${lineBreak}${lodashStaticMatch[1]}}`, startIndex); + if (endIndex === -1) { + const lineNumber = getLineNumber(definitionString, startIndex); + console.warn(`Failed to find end of interface 'LoDashStatic' (starting at ${filePath} line ${lineNumber}).`); + break; + } + const definitions = parseDefinitions(definitionString, startIndex + lodashStaticMatch[0].length, endIndex, filePath, commonTypes); + definitons.push(...definitions); + lodashStaticMatch = lodashStaticRegExp.exec(definitionString); + } + return definitons; +} + +function parseDefinitions(definitionString: string, startIndex: number, endIndex: number, filePath: string, commonTypes: string[], name?: string): Definition[] { + const overloadRegExp = name ? / [<(]/g : / (\w+)[<(:]/g; + overloadRegExp.lastIndex = startIndex; + let overloadMatch = overloadRegExp.exec(definitionString); + if (!overloadMatch) { + const lineNumber = getLineNumber(definitionString, startIndex); + console.warn(`No function definitions were found in interface at ${filePath} line ${lineNumber}.`); + return []; + } + const definitons: Definition[] = []; + let currentDefinition: Definition | undefined; + for (; overloadMatch && overloadMatch.index < endIndex; overloadMatch = overloadRegExp.exec(definitionString)) { + name = overloadMatch[1] || name!; + + const overloadStartIndex = overloadMatch.index; + if (!currentDefinition || name !== currentDefinition.name) { + if (currentDefinition && !_.isEmpty(currentDefinition.overloads)) + definitons.push(currentDefinition); + currentDefinition = { name, overloads: [], jsdoc: "" }; + const jsdocStartIndex = definitionString.lastIndexOf("/**", overloadStartIndex); + const jsdocEndIndex = definitionString.indexOf("*/", jsdocStartIndex); + if (jsdocStartIndex !== -1 && jsdocStartIndex > startIndex && jsdocEndIndex !== -1 && jsdocEndIndex < overloadStartIndex) { + // Verify that the comment is for this overload + const overloadTestIndex = definitionString.indexOf(" " + name, jsdocEndIndex); + if (overloadTestIndex === overloadStartIndex) + currentDefinition.jsdoc = definitionString.substring(jsdocStartIndex, jsdocEndIndex + 2).replace(/ /g, ""); + } + } + let overloadEndIndex = definitionString.indexOf(";", overloadStartIndex); + if (overloadEndIndex === -1 || overloadEndIndex > endIndex) { + const lineNumber = getLineNumber(definitionString, overloadStartIndex); + console.warn(`Overload does not end with semicolon! ${filePath} line ${lineNumber}`); + break; + } + overloadRegExp.lastIndex = overloadEndIndex; + if (name === "chain" || name === "mixin" || name.startsWith("prototype.")) + continue; + + const overloadString = definitionString.substring(overloadStartIndex, overloadEndIndex); + let paramStartIndex = overloadString.indexOf("("); + if (paramStartIndex !== -1) { + const overload: Overload = { typeParams: [], params: [], returnType: "", jsdoc: currentDefinition.jsdoc }; + + const previousLine = getPreviousLine(definitionString, overloadStartIndex).trim(); + if (previousLine.startsWith("// tslint:disable")) + overload.tslintDisable = previousLine; + + const typeParamStartIndex = overloadString.indexOf("<"); + if (typeParamStartIndex !== -1 && typeParamStartIndex < paramStartIndex) { + const typeParamEndIndex = overloadString.indexOf(">(", typeParamStartIndex); + if (typeParamEndIndex !== -1) { + paramStartIndex = typeParamEndIndex + 1; + overload.typeParams = overloadString + .substring(typeParamStartIndex + 1, typeParamEndIndex) + .split(",") + .map((tpString): TypeParam => { + const typeParam: TypeParam = { name: tpString }; + let parts = tpString.split(/=[^>]/); + if (parts[1]) + typeParam.equals = parts[1].trim(); + parts = tpString.split(" extends "); + if (parts[1]) + typeParam.extends = parts[1].trim(); + typeParam.name = parts[0].trim(); + return typeParam; + }); + } + } + const paramEndIndex = overloadString.indexOf("):", paramStartIndex); + if (paramEndIndex === -1) { + console.warn(`Failed to find parameter end position in overload for '${name}' (${filePath}).`); + continue; + } + overload.params = overloadString + .substring(paramStartIndex + 1, paramEndIndex) + .split(/,(?=[^,]+:)(?=(?:[^()]*|.*\(.*\).*)$)/m) // split on commas, but ignore Generic and (a, b) => c + .map(_.trim) + .map(o => _.trim(o, ",")) + .filter(o => !!o); + overload.returnType = overloadString.substring(paramEndIndex + 2).trim(); + currentDefinition.overloads.push(overload); + } else { + // This overload actually points to an interface. Try to find said interface and get the overloads from there. + const overloadParts = overloadString.split(":"); + const interfaceName = overloadParts[1].trim(); + if (interfaceName.startsWith("typeof ") || interfaceName.startsWith("LoDashStatic[")) { + // This is an alias (e.g. first: typeof _.head, or first: LoDashStatic['head']). + // Ignore it since convert() will create this alias based on the original function. + continue; + } + let interfaceStartIndex: number; + let interfaceEndIndex: number; + if (!interfaceName.startsWith("{")) { + const ignoreInterfaceNames = ["string", "TemplateSettings", "MapCacheConstructor"]; + if (ignoreInterfaceNames.includes(interfaceName)) + continue; + const interfaceRegExp = new RegExp(`( *)interface ${interfaceName} {`); + const interfaceMatch = interfaceRegExp.exec(definitionString); + if (!interfaceMatch) { + const lineNumber = getLineNumber(definitionString, overloadStartIndex); + console.warn(`Failed to parse function '${name}': interface '${interfaceName}' not found. (${filePath} line ${lineNumber})`); + continue; + } + interfaceStartIndex = interfaceMatch.index + interfaceMatch[0].length; + interfaceEndIndex = definitionString.indexOf(`${lineBreak}${interfaceMatch[1]}}`, interfaceStartIndex); + if (interfaceEndIndex === -1) { + const lineNumber = getLineNumber(definitionString, interfaceStartIndex); + console.warn(`Failed to find end of interface '${interfaceName}' (starting at ${filePath} line ${lineNumber}).`); + continue; + } + _.pull(commonTypes, interfaceName); + } else { + // This is an inline type definition + interfaceStartIndex = definitionString.indexOf("{", overloadStartIndex + overloadParts[0].length) + 1; + interfaceEndIndex = definitionString.indexOf("}", interfaceStartIndex); + if (interfaceEndIndex === -1 || interfaceEndIndex >= endIndex) { + console.warn(`Failed to find closing '}' character for property '${name}' (${filePath}).`); + continue; + } + overloadEndIndex = definitionString.indexOf(";", interfaceEndIndex); + if (overloadEndIndex === -1 || overloadEndIndex >= endIndex) { + const lineNumber = getLineNumber(definitionString, overloadStartIndex); + console.warn(`Overload does not end with semicolon! ${filePath} line ${lineNumber}`); + continue; + } + overloadRegExp.lastIndex = overloadEndIndex; + } + const [definition] = parseDefinitions(definitionString, interfaceStartIndex, interfaceEndIndex, filePath, commonTypes, name); + if (definition) { + for (const overload of definition.overloads) + overload.jsdoc = currentDefinition.jsdoc; + currentDefinition.overloads.push(...definition.overloads); + } + } + } + if (currentDefinition && !_.isEmpty(currentDefinition.overloads)) + definitons.push(currentDefinition); + return definitons; +} + +function curryOverloads(overloads: Overload[], functionName: string, paramOrder: number[], spreadIndex: number, isFixed: boolean): Interface[] { + overloads = _.cloneDeep(overloads); + + // Remove unused type parameters + for (const overload of overloads) { + for (let i = 0; i < overload.typeParams.length; ++i) { + const search = new RegExp(`\\b${overload.typeParams[i].name}\\b`); + if (overload.params.every(p => !search.test(p)) && !search.test(overload.returnType)) { + overload.typeParams.splice(i, 1); + --i; + } + } + if (overloads.some(o => o !== overload && _.isEqual(o, overload))) + _.pull(overloads, overload); + } + + if (!isFixed) { + // Non-fixed arity functions cannot be curried. + for (const overload of overloads) + overload.params = overload.params.map(p => p.replace(/\?:/g, ":")); // No optional parameters + return [{ + name: _.upperFirst(functionName), + typeParams: [], + overloads, + }]; + } + paramOrder = paramOrder.filter(p => typeof p === "number"); + const arity = paramOrder.length; + + if (spreadIndex !== -1) { + // The parameter at this index is an array that will be spread when passed down to the actual function (e.g. assignAll, invokeArgs, partial, without). + // For these parameters, we expect the input to be an array (so remove the "...") + + // Spread/rest parameters could be in any of the following formats: + // 1. The rest parameter is at spreadIndex, and it is the last parameter. + // 2. The rest parameter is immediately after spreadIndex, e.g. assign(object, ...sources[]). In this case, convert it to assignAll(...object[]) + // 3. The rest parameter is not the last parameter, e.g. assignWith(object, ...sources[], customizer) + if (spreadIndex === arity - 1) { + // cases 1-2 + for (let i = 0; i < overloads.length; ++i) { + const overload = overloads[i]; + if (overload.params.length === arity && overload.params[spreadIndex] && overload.params[spreadIndex].startsWith("...")) { + overload.params[spreadIndex] = overload.params[spreadIndex].replace("...", ""); + } else if (overload.params.length === arity + 1 && overload.params[spreadIndex + 1] && overload.params[spreadIndex + 1].startsWith("...")) { + overload.params.splice(spreadIndex + 1, 1); + const parts = overload.params[spreadIndex].split(":").map(_.trim); + parts[1] = `ReadonlyArray<${parts[1]}>`; + overload.params[spreadIndex] = `${parts[0]}: ${parts[1]}`; + } else { + _.pull(overloads, overload); + --i; + } + } + } else { + // case 3 + const overload = overloads[0]; + overloads = [{ + jsdoc: overload.jsdoc, + typeParams: [], + params: [ + ...overload.params.slice(0, spreadIndex), + "args: ReadonlyArray", + ...overload.params.slice(overload.params.length - (arity - spreadIndex - 1)), + ], + returnType: "any", + }]; + } + } + + let filteredOverloads = overloads.filter(o => o.params.length >= arity && o.params.slice(arity).every(p => p.includes("?") && !p.startsWith("iteratee")) + && o.params.every(p => !p.startsWith("...") && !p.startsWith("guard:"))); + if (filteredOverloads.length === 0) + filteredOverloads = overloads.filter(o => o.params.length >= arity && o.params.slice(arity).every(p => p.includes("?") || p.startsWith("...")) + && o.params.every(p => !p.startsWith("guard:"))); + if (filteredOverloads.length === 0) + filteredOverloads = overloads.filter(o => o.params.length > 0 && o.params.length <= arity + 1 && o.params[o.params.length - 1].startsWith("...")); + if (filteredOverloads.length === 0) + console.warn(`No matching overloads found for ${functionName} with arity ${arity}`); + + const restOverloads = overloads.filter(o => o.params.length > 0 && o.params[o.params.length - 1].startsWith("...")); + for (const restOverload of restOverloads) { + restOverload.params[restOverload.params.length - 1] = restOverload.params[restOverload.params.length - 1] + .substring(3) + .replace(/\[\]$/, "") + .replace(/: Array<(.+)>$/, ": $1"); + if (restOverload.params.length < arity) { + const paramToCopy = restOverload.params[restOverload.params.length - 1]; + const copiedParams = _.range(2, arity - restOverload.params.length + 2).map(i => paramToCopy.replace(/(^.+?):/, `$1${i}:`)); + restOverload.params.push(...copiedParams); + } + } + + for (const overload of filteredOverloads) + preProcessOverload(overload, functionName, arity); + + const interfaces = _.flatMap(filteredOverloads, (o, i) => { + const reargParams = o.params.map((p, i) => o.params[paramOrder.indexOf(i)]); + return curryOverload({ + typeParams: o.typeParams, + params: reargParams, + returnType: o.returnType, + jsdoc: o.jsdoc, + }, functionName, i + 1); + }); + if (interfaces.length === 0) + return []; + // Merge interfaces with the same name + const mainInterface = interfaces[0]; + const interfacesToMerge = interfaces.filter(i => i.name === mainInterface.name); + mergeInterfaces(interfacesToMerge); + _.remove(interfaces, i => i !== mainInterface && interfacesToMerge.includes(i)); + // Check for any non-main interfaces that should now be merged + for (const overload of mainInterface.overloads) { + const others = mainInterface.overloads.filter(o2 => o2 !== overload + && _.isEqual(overload.typeParams, o2.typeParams) + && _.isEqual(overload.params.map(getParamType), o2.params.map(getParamType))); + const returnInterface = interfaces.find(i => new RegExp(`\\b${i.name}\\b`).test(overload.returnType)); + for (const otherOverload of others) { + for (let i = 0; i < overload.params.length; ++i) { + const paramNames = _.uniq([overload].concat(others).map(o => getParamName(o.params[i]))); + if (paramNames.length > 1) { + // Some param names are different. Merge them. + const paramType = getParamType(overload.params[i]); + overload.params[i] = `${paramNames[0]}Or${paramNames.slice(1).map(_.upperFirst).join("Or")}: ${paramType}`; + } + } + if (otherOverload.returnType === overload.returnType) { + // Exact duplicate - remove the second overload + _.pull(mainInterface.overloads, otherOverload); + } else { + // Duplicate except for the return type. If the return types are both known interfaces, + // merge the interfaces so we can remove the second overload + const otherReturnInterface = interfaces.find(i => new RegExp(`\\b${i.name}\\b`).test(otherOverload.returnType)); + if (returnInterface && otherReturnInterface) { + _.remove(otherReturnInterface.overloads, o => new RegExp(`\\b${otherReturnInterface.name}\\b`).test(o.returnType)); + mergeInterfaces([returnInterface, otherReturnInterface]); + _.pull(interfaces, otherReturnInterface); + // Rename any other references to the removed interface(s) + for (const overload of _.flatMap(interfaces, i => i.overloads)) + overload.returnType = overload.returnType.replace(new RegExp(`\\b${otherReturnInterface.name}\\b`), returnInterface.name); + } + } + } + _.pull(mainInterface.overloads, ...others); + } + for (const interfaceDef of interfaces) + interfaceDef.overloads = mergeSimilarOverloads(interfaceDef.overloads); + return interfaces; +} + +function getParamName(param: string) { + return param.split(":", 1)[0]; +} + +function getParamType(param: string) { + const index = param.indexOf(":"); + return index !== -1 ? param.substring(index + 1).trim() : "any"; +} + +function preProcessOverload(overload: Overload, functionName: string, arity: number): void { + overload.params = overload.params + .slice(0, arity) + .map(p => p + .replace(/\?:/g, ":") // No optional parameters + .replace(/: *(?:Array<(.+)>|([^ |]+)\[\]|\((.+)\)\[\])$/, ": ReadonlyArray<$1$2$3>")); // Convert Array to ReadonlyArray because lodash/fp treats everything as immutable + // Cap the number of callback arguments + for (let i = 0; i < overload.params.length; ++i) + overload.params[i] = capCallback(overload.params[i], functionName); +} + +function capCallback(parameter: string, functionName: string): string { + // We don't support capping these callbacks yet, so flag them if detected + if (functionName !== "zipWith" && functionName !== "unzipWith" && /(?:iteratee|predicate|callback): *\((?:[^,)]+,[^)]+| *\.\.\..+)\) ?=>/.test(parameter)) + console.warn(`${functionName}: Failed to cap callback: ${parameter}`); + + // Special case for mapKeys: callback is capped to the key parameter only + if (functionName === "mapKeys") { + parameter = parameter + .replace(/(iteratee|predicate|callback): *(?:Array|List|NumericDictionary|String)Iteratee<(.+)>$/g, "$1: ValueIteratee") + .replace(/(iteratee|predicate|callback): *(?:Dictionary|Object)Iteratee<(.+)>$/g, "$1: ValueIteratee") + .replace(/(iteratee|predicate|callback): *(?:Array|List|NumericDictionary|String)Iteratee(?:Custom)?<(.+?),(.+)>$/g, "$1: ValueIterateeCustom") + .replace(/(iteratee|predicate|callback): *(?:Dictionary|Object)Iteratee(?:Custom)?<(.+?),(.+)>$/g, "$1: ValueIterateeCustom"); + } + + // Special case for reduceRight: callback argument order of (b, a) + if (functionName === "reduceRight") { + parameter = parameter + .replace(/(iteratee|predicate|callback): *Memo(Void)?(?:List|Object|Dictionary)Iterator<([^,>]+),([^,>]+)(?:,[^,>]+?()?)?>/g, "$1: Memo$2IteratorCappedRight<$3,$4>"); + } + + return parameter + .replace(/(iteratee|predicate|callback): *(?:Array|List|Dictionary|NumericDictionary|String)Iteratee<(.+)>$/g, "$1: ValueIteratee<$2>") + .replace(/(iteratee|predicate|callback): *(?:Array|List|Dictionary|NumericDictionary|String)Iteratee(?:Custom)?<(.+?),(.+)>$/g, "$1: ValueIterateeCustom<$2,$3>") + .replace(/(iteratee|predicate|callback): *(?:Array|List|Dictionary|NumericDictionary|String)IteratorTypeGuard<(.+?),(.+)>$/g, "$1: ValueIteratorTypeGuard<$2,$3>") + .replace(/(iteratee|predicate|callback): *ObjectIteratee<(.+)>$/g, "$1: ValueIteratee<$2[keyof $2]>") + .replace(/(iteratee|predicate|callback): *ObjectIterateeCustom<(.+?),(.+)>$/g, "$1: ValueIterateeCustom<$2[keyof $2],$3>") + .replace(/(iteratee|predicate|callback): *ObjectIteratorTypeGuard<(.+?),(.+)>$/g, "$1: ValueIteratorTypeGuard<$2[keyof $2],$3>") + .replace(/(iteratee|predicate|callback): *(?:Array|List|Dictionary|NumericDictionary)Iterator<(.+?), *(.+)>$/g, "$1: (value: $2) => $3") + .replace(/(iteratee|predicate|callback): *StringIterator<(.+)>$/g, "$1: (value: string) => $2") + .replace(/(iteratee|predicate|callback): *ObjectIterator<(.+?), *(.+?)>$/g, "$1: (value: $2[keyof $2]) => $3") + .replace(/(iteratee|predicate|callback): *Memo(Void)?(?:Array|List|Object|Dictionary)Iterator<([^,>]+),([^,>]+)(?:,[^,>]+?()?)?>/g, "$1: Memo$2IteratorCapped<$3,$4>") + .replace(/(iteratees|predicates|callbacks): *Many<(?:Array|List|Dictionary|NumericDictionary|String)Iteratee<(.+?)>>/g, "$1: Many>") + .replace(/(iteratees|predicates|callbacks): *Many>/g, "$1: Many>") + .replace(/(iteratees|predicates|callbacks): *Many<(?:Array|List|Dictionary|NumericDictionary)Iterator<(.+?), *(.+?)>>/g, "$1: Many<(value: $2) => $3>") + .replace(/(iteratees|predicates|callbacks): *Many>/g, "$1: Many<(value: $2[keyof $2]) => $3>"); +} + +function curryOverload(overload: Overload, functionName: string, overloadId: number): Interface[] { + let baseName = _.upperFirst(functionName); + if (baseName === "Pick") // A type called "Pick" already exists, so rename to avoid conflicts + baseName = "Lodash" + baseName; + if (overload.params.length <= 1) { + // Functions with 0 or 1 arguments are not curried. Just use a basic function type. + return [{ + name: baseName, + overloads: [overload], + typeParams: [], + }]; + } + + const interfaces: Interface[] = []; + let passTypeParams: TypeParam[] = []; + for (let i = 0; i < overload.params.length; ++i) { + const interfaceDef = { + name: getInterfaceName(baseName, overloadId, i, []), + typeParams: _.cloneDeep(passTypeParams), + overloads: curryParams( + overload.params.slice(i), + _.without(overload.typeParams, ...passTypeParams), + overload.returnType, + baseName, + passTypeParams, + overloadId, + i, + overload.jsdoc, + ), + }; + interfaces.push(interfaceDef); + const currentParams = overload.params.slice(0, i + 1); + const usedTypeParams = overload.typeParams.filter(tp => currentParams.some(p => new RegExp(`\\b${tp.name}\\b`).test(p))); + usedTypeParams.unshift(...overload.typeParams.filter(tp => !usedTypeParams.includes(tp) && usedTypeParams.some(tp2 => !!tp2.extends && new RegExp(`\\b${tp.name}\\b`).test(tp2.extends)))); + const unusedParams = overload.params.slice(i + 1).concat(overload.returnType); + passTypeParams = usedTypeParams.filter(tp => unusedParams.some(p => new RegExp(`\\b${tp.name}\\b`).test(p))); + } + // The T[keyof T] constraint doesn't work so well if it's the only constraint. Convert to a plain old T constraint so it can be merged with + // other ValueIteratee overloads + for (const interfaceDef of interfaces) { + for (const overload of interfaceDef.overloads) { + const objectTypeParam = overload.typeParams.find(tp => tp.name === "T" && (tp.extends === "object" || !tp.extends)); + if (objectTypeParam && overload.params.some(p => p.includes("T[keyof T]")) && !overload.params.some(p => /T(?!]|\[keyof T])/.test(p))) { + delete objectTypeParam.extends; + overload.params = overload.params.map(p => p.replace(/\bArray/g, " T[]").replace(/\bT\[keyof T]/g, "T")); + const fixInterfaceName = overload.returnType.split("<")[0]; + const fixInterface = interfaces.find(i => i.name === fixInterfaceName); + if (fixInterface) { + const fixTypeParam = fixInterface.typeParams.find(tp => tp.name === objectTypeParam.name && (tp.extends === "object" || !tp.extends)); + if (fixTypeParam) { + delete fixTypeParam.extends; + for (const fixOverload of fixInterface.overloads) { + // This overload has T referring to a whole object. But now T refers to a single element, so fix it. + // If there's only 1 usage, replace it with 'object'. If there are multiple, create a new type constraint. + const typeParamSearch = new RegExp(`\\b${fixTypeParam.name}\\b(?:(?!(?:\\[keyof ${fixTypeParam.name})?\\])|$)`); + const matches = fixOverload.params.concat(fixOverload.returnType).filter(value => typeParamSearch.test(value)); + let replacement = "object"; + if (matches.length >= 2) { + let i = 1; + const newTypeParam: TypeParam = { name: "T" + i, extends: replacement }; + while (fixInterface.typeParams.some(t => t.name === newTypeParam.name) || fixOverload.typeParams.some(t => t.name === newTypeParam.name)) + newTypeParam.name = "T" + (++i); + fixOverload.typeParams.push(newTypeParam); + replacement = newTypeParam.name; + } + fixOverload.params = fixOverload.params + .map(p => p.replace(new RegExp(typeParamSearch, "g"), replacement) + .replace(new RegExp(`\\bArray<${fixTypeParam.name}\\[keyof ${fixTypeParam.name}]>`, "g"), fixTypeParam.name + "[]") + .replace(new RegExp(`\\b${fixTypeParam.name}\\[keyof ${fixTypeParam.name}]`, "g"), fixTypeParam.name)); + if (!new RegExp(`\\b${baseName}[0-9]+x[0-9]+\\b`).test(fixOverload.returnType)) { + fixOverload.returnType = fixOverload.returnType + .replace(new RegExp(typeParamSearch, "g"), replacement) + .replace(new RegExp(`\\bArray<${fixTypeParam.name}\\[keyof ${fixTypeParam.name}]>`, "g"), fixTypeParam.name + "[]") + .replace(new RegExp(`\\b${fixTypeParam.name}\\[keyof ${fixTypeParam.name}]`, "g"), fixTypeParam.name); + } + } + } + } else { + console.warn(`Fixed T[keyof T] overload, but could not find corresponding interface '${fixInterfaceName}'.`); + } + } + } + } + return interfaces; +} + +function curryParams( + params: string[], + typeParams: TypeParam[], + returnType: string, + baseName: string, + interfaceTypeParams: TypeParam[], + overloadId: number, + index: number, + jsdoc: string, +): Overload[] { + // Assume params.length >= 1 + const overloads: Overload[] = [{ + typeParams: [], + params: [], + returnType: getInterfaceName(baseName, overloadId, index, interfaceTypeParams), + jsdoc, + }]; + for (let i = 1; i <= params.length; ++i) { + const currentParams = params.slice(0, i); + const usedTypeParams = i < params.length ? typeParams.filter(tp => currentParams.some(p => new RegExp(`\\b${tp.name}\\b`).test(p))) : typeParams; + usedTypeParams.unshift(...typeParams.filter(tp => !usedTypeParams.includes(tp) && usedTypeParams.some(tp2 => !!tp2.extends && new RegExp(`\\b${tp.name}\\b`).test(tp2.extends)))); + const unusedParams = params.slice(i).concat(returnType); + const passTypeParams = usedTypeParams.concat(interfaceTypeParams).filter(tp => unusedParams.some(p => new RegExp(`\\b${tp.name}\\b`).test(p))); + const currentReturnType = i < params.length ? getInterfaceName(baseName, overloadId, index + i, passTypeParams) : returnType; + + overloads.push({ + typeParams: _.cloneDeep(usedTypeParams), + params: currentParams, + returnType: currentReturnType, + jsdoc, + }); + } + return overloads; +} + +function mergeInterfaces(interfaces: Interface[]): void { + const mainInterface = interfaces[0]; + if (!mainInterface) + return; + mainInterface.overloads = _.uniqWith(_.flatMap(interfaces, i => i.overloads), _.isEqual); +} + +function mergeSimilarOverloads(overloads: Overload[]): Overload[] { + const newOverloads = _.cloneDeep(overloads); + for (const overload of newOverloads) { + // We can merge if all param types are the same except one, and the return types are the same. + const others = newOverloads.filter(o2 => o2 !== overload + && _.isEqual(overload.typeParams, o2.typeParams) + && overload.params.length === o2.params.length + && overload.params.length >= 1 + && overload.params.filter((p, i) => getParamType(p) !== getParamType(o2.params[i])).length <= 1 + && overload.returnType === o2.returnType); + if (_.isEmpty(others)) + continue; + + const differingParamIndexes = _(others) + .map(o2 => overload.params.findIndex((p, i) => getParamType(p) !== getParamType(o2.params[i]))) + .filter(i => i !== -1) + .uniq() + .value(); + if (differingParamIndexes.length > 1) + continue; // Only one param is different, but it's a different param for some overloads, so we can't merge + for (let i = 0; i < overload.params.length; ++i) { + const similarOverloads = [overload].concat(others); + const paramNames = _.uniq(similarOverloads.map(o => getParamName(o.params[i]))); + const newParamName = (paramNames.length > 1) ? `${paramNames[0]}Or${paramNames.slice(1).map(_.upperFirst).join("Or")}` : paramNames[0]; + + const newParamType = _(similarOverloads) + .map(o => o.params[i]) + .flatMap(p => getParamType(p).split("|")) + .map(_.trim) + .uniq() + .sortBy(type => type === "undefined" ? 2 : (type === "null" ? 1 : 0)) + .join(" | "); + overload.params[i] = `${newParamName}: ${newParamType}`; + } + _.pull(newOverloads, ...others); + } + return newOverloads; +} + +function getInterfaceName(baseName: string, overloadId: number, index: number, typeParams: TypeParam[]): string { + let interfaceName = baseName; + if (index > 0) + interfaceName += `${overloadId}x${index}${typeParamsToString(typeParams, false)}`; + return interfaceName; +} + +function interfaceToString(interfaceDef: Interface): string { + if (interfaceDef.overloads.length === 0) { + // No point in creating an empty interface + return ""; + } else if (interfaceDef.overloads.length === 1) { + // Don't create an interface for a single type. Instead use a basic type def. + let jsdoc = interfaceDef.overloads[0].jsdoc; + if (jsdoc) + jsdoc += lineBreak; + interfaceDef.overloads[0].jsdoc = ""; + return `type ${interfaceDef.name}${typeParamsToString(interfaceDef.typeParams)} =${lineBreak}${tab(jsdoc + overloadToString(interfaceDef.overloads[0], true), 1)}`; + } else { + const overloadStrings = interfaceDef.overloads.map(o => lineBreak + tab(overloadToString(o), 1)).join(""); + return `interface ${interfaceDef.name}${typeParamsToString(interfaceDef.typeParams)} {${overloadStrings}${lineBreak}}`; + } +} + +function overloadToString(overload: Overload, arrowSyntax = false): string { + const joinedParams = overload.params.join(", "); + let jsdoc = overload.jsdoc; + if (jsdoc) + jsdoc += lineBreak; + if (overload.tslintDisable) + jsdoc += overload.tslintDisable + lineBreak; + return `${jsdoc}${typeParamsToString(overload.typeParams)}(${joinedParams})${arrowSyntax ? " =>" : ":"} ${overload.returnType};`; +} + +function typeParamsToString(typeParams: TypeParam[], includeConstraints = true): string { + return typeParams.length > 0 ? `<${typeParams.map(tp => + tp.name + + (includeConstraints && tp.extends ? " extends " + tp.extends : "") + + (includeConstraints && tp.equals ? " = " + tp.equals : "") + ).join(", ")}>` : ""; +} + +function getPreviousLine(s: string, index: number): string { + const eol = s.lastIndexOf(lineBreak, index); + if (eol === -1) + return ""; + const bol = s.lastIndexOf(lineBreak, eol - 1); + if (bol === -1) + return ""; + return s.substring(bol + 1, eol); +} + +function getLineNumber(fileContents: string, index: number) { + return fileContents.substring(0, index).split(lineBreak).length + 1; +} + +function tab(s: string, count: number) { + const prepend: string = " ".repeat(count * 4); + return prepend + s.replace(/(?:\r\n|\n|\r)(.)/g, `${lineBreak}${prepend}$1`); +} + +function indexOfAny(source: string, values: string[], position?: number): number { + const indexes: number[] = []; + for (const value of values) { + const index = source.indexOf(value, position); + if (index !== -1) + indexes.push(index); + } + return indexes.length > 0 ? _.min(indexes)! : -1; +} + +main(); diff --git a/types/lodash/scripts/package.json b/types/lodash/scripts/package.json new file mode 100644 index 0000000000..f98c233642 --- /dev/null +++ b/types/lodash/scripts/package.json @@ -0,0 +1,14 @@ +{ + "private": true, + "name": "lodash-scripts", + "version": "0.0.1", + "scripts": { + "fp": "ts-node generate-fp" + }, + "devDependencies": { + "lodash": "^4.17.4", + "ts-node": "^4.1.0", + "typescript": "^2.7.1" + }, + "dependencies": {} +} diff --git a/types/lodash/scripts/tsconfig.json b/types/lodash/scripts/tsconfig.json index a06b8ed24f..023cb6a0cb 100644 --- a/types/lodash/scripts/tsconfig.json +++ b/types/lodash/scripts/tsconfig.json @@ -1,10 +1,18 @@ { "compilerOptions": { - "target": "es6", + "target": "es2017", + "module": "commonjs", "baseUrl": "../..", + "esModuleInterop": true, + "noEmit": true, + "noImplicitAny": true, + "pretty": true, + "strict": true, "typeRoots": [ "../../" ], - "types": [] + "types": [ + "lodash" + ] } -} \ No newline at end of file +} diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 7ab3d8db99..926c4217d7 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -14,10 +14,12 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true }, "files": [ "index.d.ts", + "common/common.d.ts", "lodash-tests.ts", "add.d.ts", "after.d.ts", @@ -103,6 +105,7 @@ "forInRight.d.ts", "forOwn.d.ts", "forOwnRight.d.ts", + "fp.d.ts", "fromPairs.d.ts", "functions.d.ts", "functionsIn.d.ts", @@ -316,6 +319,402 @@ "zip.d.ts", "zipObject.d.ts", "zipObjectDeep.d.ts", - "zipWith.d.ts" + "zipWith.d.ts", + "common/array.d.ts", + "common/collection.d.ts", + "common/common.d.ts", + "common/date.d.ts", + "common/function.d.ts", + "common/lang.d.ts", + "common/math.d.ts", + "common/number.d.ts", + "common/object.d.ts", + "common/seq.d.ts", + "common/string.d.ts", + "common/util.d.ts", + "fp/convert.d.ts", + "fp/add.d.ts", + "fp/after.d.ts", + "fp/all.d.ts", + "fp/allPass.d.ts", + "fp/always.d.ts", + "fp/any.d.ts", + "fp/anyPass.d.ts", + "fp/apply.d.ts", + "fp/ary.d.ts", + "fp/assign.d.ts", + "fp/assignAll.d.ts", + "fp/assignAllWith.d.ts", + "fp/assignIn.d.ts", + "fp/assignInAll.d.ts", + "fp/assignInAllWith.d.ts", + "fp/assignInWith.d.ts", + "fp/assignWith.d.ts", + "fp/assoc.d.ts", + "fp/assocPath.d.ts", + "fp/at.d.ts", + "fp/attempt.d.ts", + "fp/before.d.ts", + "fp/bind.d.ts", + "fp/bindAll.d.ts", + "fp/bindKey.d.ts", + "fp/camelCase.d.ts", + "fp/capitalize.d.ts", + "fp/castArray.d.ts", + "fp/ceil.d.ts", + "fp/chunk.d.ts", + "fp/clamp.d.ts", + "fp/clone.d.ts", + "fp/cloneDeep.d.ts", + "fp/cloneDeepWith.d.ts", + "fp/cloneWith.d.ts", + "fp/compact.d.ts", + "fp/complement.d.ts", + "fp/compose.d.ts", + "fp/concat.d.ts", + "fp/cond.d.ts", + "fp/conforms.d.ts", + "fp/conformsTo.d.ts", + "fp/constant.d.ts", + "fp/contains.d.ts", + "fp/countBy.d.ts", + "fp/create.d.ts", + "fp/curry.d.ts", + "fp/curryN.d.ts", + "fp/curryRight.d.ts", + "fp/curryRightN.d.ts", + "fp/debounce.d.ts", + "fp/deburr.d.ts", + "fp/defaults.d.ts", + "fp/defaultsAll.d.ts", + "fp/defaultsDeep.d.ts", + "fp/defaultsDeepAll.d.ts", + "fp/defaultTo.d.ts", + "fp/defer.d.ts", + "fp/delay.d.ts", + "fp/difference.d.ts", + "fp/differenceBy.d.ts", + "fp/differenceWith.d.ts", + "fp/dissoc.d.ts", + "fp/dissocPath.d.ts", + "fp/divide.d.ts", + "fp/drop.d.ts", + "fp/dropLast.d.ts", + "fp/dropLastWhile.d.ts", + "fp/dropRight.d.ts", + "fp/dropRightWhile.d.ts", + "fp/dropWhile.d.ts", + "fp/each.d.ts", + "fp/eachRight.d.ts", + "fp/endsWith.d.ts", + "fp/entries.d.ts", + "fp/entriesIn.d.ts", + "fp/eq.d.ts", + "fp/equals.d.ts", + "fp/escape.d.ts", + "fp/escapeRegExp.d.ts", + "fp/every.d.ts", + "fp/extend.d.ts", + "fp/extendAll.d.ts", + "fp/extendAllWith.d.ts", + "fp/extendWith.d.ts", + "fp/F.d.ts", + "fp/fill.d.ts", + "fp/filter.d.ts", + "fp/find.d.ts", + "fp/findFrom.d.ts", + "fp/findIndex.d.ts", + "fp/findIndexFrom.d.ts", + "fp/findKey.d.ts", + "fp/findLast.d.ts", + "fp/findLastFrom.d.ts", + "fp/findLastIndex.d.ts", + "fp/findLastIndexFrom.d.ts", + "fp/findLastKey.d.ts", + "fp/first.d.ts", + "fp/flatMap.d.ts", + "fp/flatMapDeep.d.ts", + "fp/flatMapDepth.d.ts", + "fp/flatten.d.ts", + "fp/flattenDeep.d.ts", + "fp/flattenDepth.d.ts", + "fp/flip.d.ts", + "fp/floor.d.ts", + "fp/flow.d.ts", + "fp/flowRight.d.ts", + "fp/forEach.d.ts", + "fp/forEachRight.d.ts", + "fp/forIn.d.ts", + "fp/forInRight.d.ts", + "fp/forOwn.d.ts", + "fp/forOwnRight.d.ts", + "fp/fromPairs.d.ts", + "fp/functions.d.ts", + "fp/functionsIn.d.ts", + "fp/get.d.ts", + "fp/getOr.d.ts", + "fp/groupBy.d.ts", + "fp/gt.d.ts", + "fp/gte.d.ts", + "fp/has.d.ts", + "fp/hasIn.d.ts", + "fp/head.d.ts", + "fp/identical.d.ts", + "fp/identity.d.ts", + "fp/includes.d.ts", + "fp/includesFrom.d.ts", + "fp/indexBy.d.ts", + "fp/indexOf.d.ts", + "fp/indexOfFrom.d.ts", + "fp/init.d.ts", + "fp/initial.d.ts", + "fp/inRange.d.ts", + "fp/intersection.d.ts", + "fp/intersectionBy.d.ts", + "fp/intersectionWith.d.ts", + "fp/invert.d.ts", + "fp/invertBy.d.ts", + "fp/invertObj.d.ts", + "fp/invoke.d.ts", + "fp/invokeArgs.d.ts", + "fp/invokeArgsMap.d.ts", + "fp/invokeMap.d.ts", + "fp/isArguments.d.ts", + "fp/isArray.d.ts", + "fp/isArrayBuffer.d.ts", + "fp/isArrayLike.d.ts", + "fp/isArrayLikeObject.d.ts", + "fp/isBoolean.d.ts", + "fp/isBuffer.d.ts", + "fp/isDate.d.ts", + "fp/isElement.d.ts", + "fp/isEmpty.d.ts", + "fp/isEqual.d.ts", + "fp/isEqualWith.d.ts", + "fp/isError.d.ts", + "fp/isFinite.d.ts", + "fp/isFunction.d.ts", + "fp/isInteger.d.ts", + "fp/isLength.d.ts", + "fp/isMap.d.ts", + "fp/isMatch.d.ts", + "fp/isMatchWith.d.ts", + "fp/isNaN.d.ts", + "fp/isNative.d.ts", + "fp/isNil.d.ts", + "fp/isNull.d.ts", + "fp/isNumber.d.ts", + "fp/isObject.d.ts", + "fp/isObjectLike.d.ts", + "fp/isPlainObject.d.ts", + "fp/isRegExp.d.ts", + "fp/isSafeInteger.d.ts", + "fp/isSet.d.ts", + "fp/isString.d.ts", + "fp/isSymbol.d.ts", + "fp/isTypedArray.d.ts", + "fp/isUndefined.d.ts", + "fp/isWeakMap.d.ts", + "fp/isWeakSet.d.ts", + "fp/iteratee.d.ts", + "fp/join.d.ts", + "fp/juxt.d.ts", + "fp/kebabCase.d.ts", + "fp/keyBy.d.ts", + "fp/keys.d.ts", + "fp/keysIn.d.ts", + "fp/last.d.ts", + "fp/lastIndexOf.d.ts", + "fp/lastIndexOfFrom.d.ts", + "fp/lowerCase.d.ts", + "fp/lowerFirst.d.ts", + "fp/lt.d.ts", + "fp/lte.d.ts", + "fp/map.d.ts", + "fp/mapKeys.d.ts", + "fp/mapValues.d.ts", + "fp/matches.d.ts", + "fp/matchesProperty.d.ts", + "fp/max.d.ts", + "fp/maxBy.d.ts", + "fp/mean.d.ts", + "fp/meanBy.d.ts", + "fp/memoize.d.ts", + "fp/merge.d.ts", + "fp/mergeAll.d.ts", + "fp/mergeAllWith.d.ts", + "fp/mergeWith.d.ts", + "fp/method.d.ts", + "fp/methodOf.d.ts", + "fp/min.d.ts", + "fp/minBy.d.ts", + "fp/multiply.d.ts", + "fp/nAry.d.ts", + "fp/negate.d.ts", + "fp/noConflict.d.ts", + "fp/noop.d.ts", + "fp/now.d.ts", + "fp/nth.d.ts", + "fp/nthArg.d.ts", + "fp/omit.d.ts", + "fp/omitAll.d.ts", + "fp/omitBy.d.ts", + "fp/once.d.ts", + "fp/orderBy.d.ts", + "fp/over.d.ts", + "fp/overArgs.d.ts", + "fp/overEvery.d.ts", + "fp/overSome.d.ts", + "fp/pad.d.ts", + "fp/padChars.d.ts", + "fp/padCharsEnd.d.ts", + "fp/padCharsStart.d.ts", + "fp/padEnd.d.ts", + "fp/padStart.d.ts", + "fp/parseInt.d.ts", + "fp/partial.d.ts", + "fp/partialRight.d.ts", + "fp/partition.d.ts", + "fp/path.d.ts", + "fp/pathEq.d.ts", + "fp/pathOr.d.ts", + "fp/paths.d.ts", + "fp/pick.d.ts", + "fp/pickAll.d.ts", + "fp/pickBy.d.ts", + "fp/pipe.d.ts", + "fp/pluck.d.ts", + "fp/prop.d.ts", + "fp/propEq.d.ts", + "fp/property.d.ts", + "fp/propertyOf.d.ts", + "fp/propOr.d.ts", + "fp/props.d.ts", + "fp/pull.d.ts", + "fp/pullAll.d.ts", + "fp/pullAllBy.d.ts", + "fp/pullAllWith.d.ts", + "fp/pullAt.d.ts", + "fp/random.d.ts", + "fp/range.d.ts", + "fp/rangeRight.d.ts", + "fp/rangeStep.d.ts", + "fp/rangeStepRight.d.ts", + "fp/rearg.d.ts", + "fp/reduce.d.ts", + "fp/reduceRight.d.ts", + "fp/reject.d.ts", + "fp/remove.d.ts", + "fp/repeat.d.ts", + "fp/replace.d.ts", + "fp/rest.d.ts", + "fp/restFrom.d.ts", + "fp/result.d.ts", + "fp/reverse.d.ts", + "fp/round.d.ts", + "fp/runInContext.d.ts", + "fp/sample.d.ts", + "fp/sampleSize.d.ts", + "fp/set.d.ts", + "fp/setWith.d.ts", + "fp/shuffle.d.ts", + "fp/size.d.ts", + "fp/slice.d.ts", + "fp/snakeCase.d.ts", + "fp/some.d.ts", + "fp/sortBy.d.ts", + "fp/sortedIndex.d.ts", + "fp/sortedIndexBy.d.ts", + "fp/sortedIndexOf.d.ts", + "fp/sortedLastIndex.d.ts", + "fp/sortedLastIndexBy.d.ts", + "fp/sortedLastIndexOf.d.ts", + "fp/sortedUniq.d.ts", + "fp/sortedUniqBy.d.ts", + "fp/split.d.ts", + "fp/spread.d.ts", + "fp/spreadFrom.d.ts", + "fp/startCase.d.ts", + "fp/startsWith.d.ts", + "fp/stubArray.d.ts", + "fp/stubFalse.d.ts", + "fp/stubObject.d.ts", + "fp/stubString.d.ts", + "fp/stubTrue.d.ts", + "fp/subtract.d.ts", + "fp/sum.d.ts", + "fp/sumBy.d.ts", + "fp/symmetricDifference.d.ts", + "fp/symmetricDifferenceBy.d.ts", + "fp/symmetricDifferenceWith.d.ts", + "fp/T.d.ts", + "fp/tail.d.ts", + "fp/take.d.ts", + "fp/takeLast.d.ts", + "fp/takeLastWhile.d.ts", + "fp/takeRight.d.ts", + "fp/takeRightWhile.d.ts", + "fp/takeWhile.d.ts", + "fp/tap.d.ts", + "fp/template.d.ts", + "fp/throttle.d.ts", + "fp/thru.d.ts", + "fp/times.d.ts", + "fp/toArray.d.ts", + "fp/toFinite.d.ts", + "fp/toInteger.d.ts", + "fp/toLength.d.ts", + "fp/toLower.d.ts", + "fp/toNumber.d.ts", + "fp/toPairs.d.ts", + "fp/toPairsIn.d.ts", + "fp/toPath.d.ts", + "fp/toPlainObject.d.ts", + "fp/toSafeInteger.d.ts", + "fp/toString.d.ts", + "fp/toUpper.d.ts", + "fp/transform.d.ts", + "fp/trim.d.ts", + "fp/trimChars.d.ts", + "fp/trimCharsEnd.d.ts", + "fp/trimCharsStart.d.ts", + "fp/trimEnd.d.ts", + "fp/trimStart.d.ts", + "fp/truncate.d.ts", + "fp/unapply.d.ts", + "fp/unary.d.ts", + "fp/unescape.d.ts", + "fp/union.d.ts", + "fp/unionBy.d.ts", + "fp/unionWith.d.ts", + "fp/uniq.d.ts", + "fp/uniqBy.d.ts", + "fp/uniqueId.d.ts", + "fp/uniqWith.d.ts", + "fp/unnest.d.ts", + "fp/unset.d.ts", + "fp/unzip.d.ts", + "fp/unzipWith.d.ts", + "fp/update.d.ts", + "fp/updateWith.d.ts", + "fp/upperCase.d.ts", + "fp/upperFirst.d.ts", + "fp/useWith.d.ts", + "fp/values.d.ts", + "fp/valuesIn.d.ts", + "fp/where.d.ts", + "fp/whereEq.d.ts", + "fp/without.d.ts", + "fp/words.d.ts", + "fp/wrap.d.ts", + "fp/xor.d.ts", + "fp/xorBy.d.ts", + "fp/xorWith.d.ts", + "fp/zip.d.ts", + "fp/zipAll.d.ts", + "fp/zipObj.d.ts", + "fp/zipObject.d.ts", + "fp/zipObjectDeep.d.ts", + "fp/zipWith.d.ts" ] } \ No newline at end of file diff --git a/types/lodash/tslint.json b/types/lodash/tslint.json index 57df94df09..9457e4398f 100644 --- a/types/lodash/tslint.json +++ b/types/lodash/tslint.json @@ -2,20 +2,10 @@ "extends": "dtslint/dt.json", "rules": { // All are TODOs - "comment-format": [false], - "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": [false], - "no-namespace": false, "no-unnecessary-generics": false, - "no-void-expression": false, - "object-literal-key-quotes": false, - "one-line": false, - "prefer-const": false, - "semicolon": false, - "space-within-parens": false, "typedef-whitespace": [false], - "unified-signatures": false, - "whitespace": [false] + "unified-signatures": false } } diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index 68f87793d9..fc6dcc3b4b 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -75,14 +75,14 @@ export interface LolexClock { * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ - setTimeout(callback: () => any, timeout: number, ...args: any[]): TTimerId; + setTimeout: (callback: () => any, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setTimeout. * * @param id Timer ID or object. */ - clearTimeout(id: TTimerId): void; + clearTimeout: (id: TTimerId) => void; /** * Schedules a callback to be fired every time timeout milliseconds have ticked by. @@ -92,14 +92,14 @@ export interface LolexClock { * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ - setInterval(callback: () => any, timeout: number, ...args: any[]): TTimerId; + setInterval: (callback: () => any, timeout: number, ...args: any[]) => TTimerId; /** * Clears a timer, as long as it was created using setInterval. * * @param id Timer ID or object. */ - clearInterval(id: TTimerId): void; + clearInterval: (id: TTimerId) => void; /** * Schedules the callback to be fired once 0 milliseconds have ticked by. @@ -108,44 +108,44 @@ export interface LolexClock { * @remarks You'll still have to call clock.tick() for the callback to fire. * @remarks If called during a tick the callback won't fire until 1 millisecond has ticked by. */ - setImmediate(callback: () => any): TTimerId; + setImmediate: (callback: () => any) => TTimerId; /** * Clears a timer, as long as it was created using setImmediate. * * @param id Timer ID or object. */ - clearImmediate(id: TTimerId): void; + clearImmediate: (id: TTimerId) => void; /** * Simulates process.nextTick(); */ - nextTick(callback: () => void): void; + nextTick: (callback: () => void) => void; /** * Advances the clock to the the moment of the first scheduled timer, firing it. */ - next(): void; + next: () => void; /** * Advance the clock, firing callbacks if necessary. * * @param time How many ticks to advance by. */ - tick(time: number | string): void; + tick: (time: number | string) => void; /** * Runs all pending timers until there are none remaining. * * @remarks If new timers are added while it is executing they will be run as well. */ - runAll(): void; + runAll: () => void; /** * Takes note of the last scheduled timer when it is run, and advances the clock to * that time firing callbacks as necessary. */ - runToLast(): void; + runToLast: () => void; /** * Simulates a user changing the system clock. @@ -153,13 +153,13 @@ export interface LolexClock { * @param now New system time. * @remarks This affects the current time but it does not in itself cause timers to fire. */ - setSystemTime(now?: number | Date): void; + setSystemTime: (now?: number | Date) => void; /** * Restores the original methods on the context that was passed to lolex.install, * or the native timers if no context was given. */ - uninstall(): void; + uninstall: () => void; } /** diff --git a/types/lolex/lolex-tests.ts b/types/lolex/lolex-tests.ts index 95b6a2be78..4de6ecc7a6 100644 --- a/types/lolex/lolex-tests.ts +++ b/types/lolex/lolex-tests.ts @@ -73,3 +73,7 @@ nodeClock.nextTick(() => undefined); browserClock.uninstall(); nodeClock.uninstall(); + +// Clocks should be typed to have unbound method signatures that can be passed around +const { clearTimeout } = browserClock; +clearTimeout(0); diff --git a/types/lolex/tslint.json b/types/lolex/tslint.json index a41bf5d19a..2fd2e55629 100644 --- a/types/lolex/tslint.json +++ b/types/lolex/tslint.json @@ -43,6 +43,7 @@ "no-self-import": false, "no-single-declare-module": false, "no-string-throw": false, + "no-unbound-method": true, "no-unnecessary-callback-wrapper": false, "no-unnecessary-class": false, "no-unnecessary-generics": false, diff --git a/types/mem-fs/index.d.ts b/types/mem-fs/index.d.ts new file mode 100644 index 0000000000..0cece1da38 --- /dev/null +++ b/types/mem-fs/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for mem-fs 1.1 +// Project: https://github.com/sboudrias/mem-fs +// Definitions by: My Food Bag +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { EventEmitter } from 'events'; +import { Transform } from 'stream'; +import * as File from 'vinyl'; + +export function create(...args: any[]): memFs.Store; + +export namespace memFs { + interface Store extends EventEmitter { + add: (file: File, content: string) => void; + each: (callback: (file: File, index: number) => void) => void; + get: (filepath: string) => File; + stream: () => Transform; + } +} diff --git a/types/mem-fs/mem-fs-tests.ts b/types/mem-fs/mem-fs-tests.ts new file mode 100644 index 0000000000..ada05c22c7 --- /dev/null +++ b/types/mem-fs/mem-fs-tests.ts @@ -0,0 +1,8 @@ +import * as fs from 'mem-fs'; + +const store = fs.create(); +const file = store.get('hello'); + +store.add(file, 'hahahahah'); + +store.each(file => console.dir(store.get(file.path))); diff --git a/types/mem-fs/tsconfig.json b/types/mem-fs/tsconfig.json new file mode 100644 index 0000000000..23cb94acb6 --- /dev/null +++ b/types/mem-fs/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mem-fs-tests.ts" + ] +} diff --git a/types/mem-fs/tslint.json b/types/mem-fs/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/mem-fs/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/mini-css-extract-plugin/index.d.ts b/types/mini-css-extract-plugin/index.d.ts new file mode 100644 index 0000000000..f9b57632ef --- /dev/null +++ b/types/mini-css-extract-plugin/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for mini-css-extract-plugin 0.2 +// Project: https://github.com/webpack-contrib/mini-css-extract-plugin +// Definitions by: JounQin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Loader, Plugin } from 'webpack'; + +/** + * Lightweight CSS extraction webpack plugin + * This plugin extract CSS into separate files. It creates a CSS file per JS file which contains CSS. It supports On-Demand-Loading of CSS and SourceMaps. + * Configuration Detail: https://github.com/webpack-contrib/mini-css-extract-plugin#configuration + */ +declare class MiniCssExtractPlugin extends Plugin { + /** webpack loader used always at the end of loaders list */ + static loader: Loader; + + constructor(options?: MiniCssExtractPlugin.PluginOptions); +} + +declare namespace MiniCssExtractPlugin { + interface PluginOptions { + /** + * Options similar to the same options in webpackOptions.output, both options are optional + * May contain `[name]`, `[id]`, `hash` and `[chunkhash]` + */ + filename?: string; + chunkFilename?: string; + } +} + +export = MiniCssExtractPlugin; diff --git a/types/mini-css-extract-plugin/mini-css-extract-plugin-tests.ts b/types/mini-css-extract-plugin/mini-css-extract-plugin-tests.ts new file mode 100644 index 0000000000..9d418ed211 --- /dev/null +++ b/types/mini-css-extract-plugin/mini-css-extract-plugin-tests.ts @@ -0,0 +1,58 @@ +import webpack = require('webpack'); +import MiniCssExtractPlugin = require('mini-css-extract-plugin'); + +let configuration: webpack.Configuration; + +configuration = { + // The standard entry point and output config + entry: { + posts: './posts', + post: './post', + about: './about', + }, + output: { + filename: '[name].js', + chunkFilename: '[id].js', + }, + module: { + rules: [ + // Extract css files + { + test: /\.css$/, + use: [MiniCssExtractPlugin.loader, 'css-loader'], + }, + // Optionally extract less files + // or any other compile-to-css language + { + test: /\.less$/, + use: [ + MiniCssExtractPlugin.loader, + 'css-loader', + 'style-loader', + ], + }, + // You could also use other loaders the same way. I. e. the autoprefixer-loader + ], + }, + // Use the plugin to specify the resulting filename (and add needed behavior to the compiler) + plugins: [ + new MiniCssExtractPlugin({ + filename: '[name].css', + }), + ], +}; + +configuration = { + // ... + plugins: [new MiniCssExtractPlugin()], +}; + +configuration = { + // ... + plugins: [ + new MiniCssExtractPlugin({ + filename: 'styles.css', + chunkFilename: 'style.css', + }), + ], +}; diff --git a/types/mini-css-extract-plugin/tsconfig.json b/types/mini-css-extract-plugin/tsconfig.json new file mode 100644 index 0000000000..e79daeceef --- /dev/null +++ b/types/mini-css-extract-plugin/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mini-css-extract-plugin-tests.ts" + ] +} diff --git a/types/mini-css-extract-plugin/tslint.json b/types/mini-css-extract-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mini-css-extract-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/mocha-steps/index.d.ts b/types/mocha-steps/index.d.ts index 0234f02529..8bd32496aa 100644 --- a/types/mocha-steps/index.d.ts +++ b/types/mocha-steps/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rprieto/mocha-steps // Definitions by: AryloYeung // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/types/mocha/index.d.ts b/types/mocha/index.d.ts index 06ef96c618..98443f5569 100644 --- a/types/mocha/index.d.ts +++ b/types/mocha/index.d.ts @@ -1,19 +1,24 @@ -// Type definitions for mocha 2.2.5 +// Type definitions for mocha 5.0 // Project: http://mochajs.org/ -// Definitions by: Kazi Manzur Rashid , otiai10 , jt000 , Vadim Macagon +// Definitions by: Kazi Manzur Rashid +// otiai10 +// jt000 +// Vadim Macagon +// Andrew Bradley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 interface MochaSetupOptions { - //milliseconds to wait before considering a test slow + // milliseconds to wait before considering a test slow slow?: number; // timeout in milliseconds timeout?: number; // ui name "bdd", "tdd", "exports" etc - ui?: string; + ui?: Mocha.Interface; - //array of accepted globals + // array of accepted globals globals?: any[]; // reporter instance (function or string), defaults to `mocha.reporters.Spec` @@ -32,38 +37,36 @@ interface MochaSetupOptions { require?: string[]; } -declare var mocha: Mocha; -declare var describe: Mocha.IContextDefinition; -declare var xdescribe: Mocha.IContextDefinition; +declare const mocha: Mocha; +declare const describe: Mocha.IContextDefinition; +declare const xdescribe: Mocha.IContextDefinition; // alias for `describe` -declare var context: Mocha.IContextDefinition; +declare const context: Mocha.IContextDefinition; // alias for `describe` -declare var suite: Mocha.IContextDefinition; -declare var it: Mocha.ITestDefinition; -declare var xit: Mocha.ITestDefinition; +declare const suite: Mocha.IContextDefinition; +declare const it: Mocha.ITestDefinition; +declare const xit: Mocha.ITestDefinition; // alias for `it` -declare var test: Mocha.ITestDefinition; -declare var specify: Mocha.ITestDefinition; +declare const test: Mocha.ITestDefinition; +declare const specify: Mocha.ITestDefinition; // Used with the --delay flag; see https://mochajs.org/#hooks declare function run(): void; -interface MochaDone { - (error?: any): any; -} +type MochaDone = (error?: any) => void; -declare function setup(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => any): void; -declare function teardown(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => any): void; -declare function suiteSetup(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => any): void; -declare function suiteTeardown(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => any): void; -declare function before(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => any): void; -declare function before(description: string, callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => any): void; -declare function after(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => any): void; -declare function after(description: string, callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => any): void; -declare function beforeEach(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => any): void; -declare function beforeEach(description: string, callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => any): void; -declare function afterEach(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => any): void; -declare function afterEach(description: string, callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => any): void; +declare function setup(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; +declare function teardown(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; +declare function suiteSetup(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; +declare function suiteTeardown(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; +declare function before(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; +declare function before(description: string, callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; +declare function after(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; +declare function after(description: string, callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; +declare function beforeEach(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; +declare function beforeEach(description: string, callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; +declare function afterEach(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; +declare function afterEach(description: string, callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; interface ReporterConstructor { new(runner: Mocha.IRunner, options: any): any; @@ -81,6 +84,8 @@ declare class Mocha { bail?: boolean; }); + /** Setup mocha with the given interface. */ + setup(interface: Mocha.Interface): Mocha; /** Setup mocha with the given options. */ setup(options: MochaSetupOptions): Mocha; bail(value?: boolean): Mocha; @@ -118,6 +123,16 @@ declare class Mocha { // merge the Mocha class declaration with a module declare namespace Mocha { + /** Third-party declarations that want to add new interfaces can contribute names here */ + interface InterfaceContributions { + bdd: any; + tdd: any; + qunit: any; + exports: any; + } + + type Interface = keyof InterfaceContributions; + interface ISuiteCallbackContext { timeout(ms: number | string): this; retries(n: number): this; @@ -130,7 +145,6 @@ declare namespace Mocha { [index: string]: any; } - interface ITestCallbackContext { skip(): this; timeout(ms: number | string): this; @@ -204,33 +218,33 @@ declare namespace Mocha { } interface ITestDefinition { - (expectation: string, callback?: (this: ITestCallbackContext, done: MochaDone) => any): ITest; - only(expectation: string, callback?: (this: ITestCallbackContext, done: MochaDone) => any): ITest; - skip(expectation: string, callback?: (this: ITestCallbackContext, done: MochaDone) => any): void; + (expectation: string, callback?: (this: ITestCallbackContext, done: MochaDone) => PromiseLike | void): ITest; + only(expectation: string, callback?: (this: ITestCallbackContext, done: MochaDone) => PromiseLike | void): ITest; + skip(expectation: string, callback?: (this: ITestCallbackContext, done: MochaDone) => PromiseLike | void): void; timeout(ms: number | string): void; state: "failed" | "passed"; } - export module reporters { - export class Base { + namespace reporters { + class Base { stats: IStats; constructor(runner: IRunner); } - export class Doc extends Base { } - export class Dot extends Base { } - export class HTML extends Base { } - export class HTMLCov extends Base { } - export class JSON extends Base { } - export class JSONCov extends Base { } - export class JSONStream extends Base { } - export class Landing extends Base { } - export class List extends Base { } - export class Markdown extends Base { } - export class Min extends Base { } - export class Nyan extends Base { } - export class Progress extends Base { + class Doc extends Base { } + class Dot extends Base { } + class HTML extends Base { } + class HTMLCov extends Base { } + class JSON extends Base { } + class JSONCov extends Base { } + class JSONStream extends Base { } + class Landing extends Base { } + class List extends Base { } + class Markdown extends Base { } + class Min extends Base { } + class Nyan extends Base { } + class Progress extends Base { /** * @param options.open String used to indicate the start of the progress bar. * @param options.complete String used to indicate a complete test on the progress bar. @@ -244,12 +258,70 @@ declare namespace Mocha { close?: string; }); } - export class Spec extends Base { } - export class TAP extends Base { } - export class XUnit extends Base { + class Spec extends Base { } + class TAP extends Base { } + class XUnit extends Base { constructor(runner: IRunner, options?: any); } } + + /* + * All ambient functions are also available via require('mocha') when invoked via the mocha CLI + * See for details: https://mochajs.org/#require + */ + + /** Only available when invoked via the mocha CLI */ + const describe: IContextDefinition; + /** Only available when invoked via the mocha CLI */ + const xdescribe: IContextDefinition; + /** + * alias for `describe` + * Only available when invoked via the mocha CLI + */ + const context: IContextDefinition; + /** + * alias for `describe` + * Only available when invoked via the mocha CLI + */ + const suite: IContextDefinition; + /** Only available when invoked via the mocha CLI */ + const it: ITestDefinition; + /** Only available when invoked via the mocha CLI */ + const xit: ITestDefinition; + /** + * alias for `it` + * Only available when invoked via the mocha CLI + */ + const test: ITestDefinition; + /** + * Alias for `it` + * Only available when invoked via the mocha CLI + */ + const specify: ITestDefinition; + /** Only available when invoked via the mocha CLI */ + function setup(callback: (this: IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function teardown(callback: (this: IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function suiteSetup(callback: (this: IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function suiteTeardown(callback: (this: IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function before(callback: (this: IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function before(description: string, callback: (this: IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function after(callback: (this: IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function after(description: string, callback: (this: IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function beforeEach(callback: (this: IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function beforeEach(description: string, callback: (this: IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function afterEach(callback: (this: IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + /** Only available when invoked via the mocha CLI */ + function afterEach(description: string, callback: (this: IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; } declare module "mocha" { diff --git a/types/mocha/mocha-tests.ts b/types/mocha/mocha-tests.ts index 0146c04b13..4694c66fe7 100644 --- a/types/mocha/mocha-tests.ts +++ b/types/mocha/mocha-tests.ts @@ -1,8 +1,50 @@ +import { + after as importedAfter, + before as importedBefore, + afterEach as importedAfterEach, + beforeEach as importedBeforeEach, + context as importedContext, + describe as importedDescribe, + it as importedIt, + xdescribe as importedXdescribe, + xit as importedXit +} from 'mocha'; + let boolean: boolean; let string: string; let number: number; let stringOrUndefined: string | undefined; let dateOrUndefined: Date | undefined; +const resolved = Promise.resolve(); +const rejected = Promise.reject('some error'); + +// Use module augmentation to add a third-party interface +declare module 'mocha' { + interface InterfaceContributions { + 'third-party-interface': any; + } +} +const i: Mocha.Interface = 'third-party-interface'; + +// Lazy tests of compatibility between imported and global functions; should be identical +const _after: typeof after = importedAfter; +const _after2: typeof importedAfter = after; +const _before: typeof before = importedBefore; +const _before2: typeof importedBefore = before; +const _afterEach: typeof afterEach = importedAfterEach; +const _afterEach2: typeof importedAfterEach = afterEach; +const _beforeEach: typeof beforeEach = importedBeforeEach; +const _beforeEach2: typeof importedBeforeEach = beforeEach; +const _context: typeof context = importedContext; +const _context2: typeof importedContext = context; +const _describe: typeof describe = importedDescribe; +const _describe2: typeof importedDescribe = describe; +const _it: typeof it = importedIt; +const _it2: typeof importedIt = it; +const _xdescribe: typeof xdescribe = importedXdescribe; +const _xdescribe2: typeof importedXdescribe = xdescribe; +const _xit: typeof xit = importedXit; +const _xit2: typeof importedXit = xit; function test_describe() { describe('something', () => { }); @@ -11,7 +53,7 @@ function test_describe() { describe.skip('something', () => { }); - describe('something', function () { + describe('something', function() { this.retries(3).slow(1000).timeout(2000).retries(3); }); } @@ -23,7 +65,7 @@ function test_context() { context.skip('some context', () => { }); - context('some context', function () { + context('some context', function() { this.retries(3).slow(1000).timeout(2000).retries(3); }); } @@ -35,58 +77,64 @@ function test_suite() { suite.skip('some context', () => { }); - suite('some context', function () { + suite('some context', function() { this.retries(3).slow(1000).timeout(2000).retries(3); }); } function test_it() { - it('does something', () => { }).timeout('2s'); - it('does something', function () { this['sharedState'] = true; }); + it('does something', function() { this['sharedState'] = true; }); it('does something', (done) => { done(); }); + it('does something', () => resolved); + it('does something', () => rejected); + it.only('does something', () => { }); it.skip('does something', () => { }); - it('does something', function () { + it('does something', function() { this.skip().retries(3).slow(1000).timeout(2000).skip(); }); } function test_test() { - test('does something', () => { }); - test('does something', function () { this['sharedState'] = true; }); + test('does something', function() { this['sharedState'] = true; }); test('does something', (done) => { done(); }); + test('does something', () => resolved); + test('does something', () => rejected); + test.only('does something', () => { }); test.skip('does something', () => { }); - test('does something', function () { + test('does something', function() { this.skip().retries(3).slow(1000).timeout(2000).skip(); }); } function test_specify() { - specify('does something', () => { }); - specify('does something', function () { this['sharedState'] = true; }); + specify('does something', function() { this['sharedState'] = true; }); specify('does something', (done) => { done(); }); + specify('does something', () => resolved); + specify('does something', () => rejected); + specify.only('does something', () => { }); specify.skip('does something', () => { }); - specify('does something', function () { + specify('does something', function() { this.skip().retries(3).slow(1000).timeout(2000).skip(); }); } @@ -94,21 +142,26 @@ function test_specify() { function test_before() { before(() => { }); - before(function () { this['sharedState'] = true; }); + before(function() { this['sharedState'] = true; }); before((done) => { done(); }); + before(() => resolved); + before(() => rejected); + before("my description", () => { }); before("my description", done => { }); - before("my description", function () { + before("my description", () => resolved); + + before("my description", function() { this.skip().timeout(2000).skip(); }); } function test_setup() { - setup(function () { + setup(function() { boolean = this.currentTest.async; boolean = this.currentTest.pending; boolean = this.currentTest.sync; @@ -118,7 +171,7 @@ function test_setup() { stringOrUndefined = this.currentTest.state; }); - setup(function () { + setup(function() { this['sharedState'] = true; boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -129,7 +182,7 @@ function test_setup() { stringOrUndefined = this.currentTest.state; }); - setup(function (done) { + setup(function(done) { done(); boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -139,22 +192,37 @@ function test_setup() { string = this.currentTest.fullTitle(); stringOrUndefined = this.currentTest.state; }); + + setup(function() { + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + stringOrUndefined = this.currentTest.state; + return resolved; + }); } function test_after() { after(() => { }); - after(function () { this['sharedState'] = true; }); + after(function() { this['sharedState'] = true; }); after((done) => { done(); }); + after(() => resolved); + after("my description", () => { }); after("my description", done => { }); + + after("my description", () => resolved); } function test_teardown() { - teardown(function () { + teardown(function() { boolean = this.currentTest.async; boolean = this.currentTest.pending; boolean = this.currentTest.sync; @@ -164,7 +232,7 @@ function test_teardown() { stringOrUndefined = this.currentTest.state; }); - teardown(function () { + teardown(function() { this['sharedState'] = true; boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -175,7 +243,7 @@ function test_teardown() { stringOrUndefined = this.currentTest.state; }); - teardown(function (done) { + teardown(function(done) { done(); boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -185,10 +253,21 @@ function test_teardown() { string = this.currentTest.fullTitle(); stringOrUndefined = this.currentTest.state; }); + + teardown(function() { + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + stringOrUndefined = this.currentTest.state; + return resolved; + }); } function test_beforeEach() { - beforeEach(function () { + beforeEach(function() { boolean = this.currentTest.async; boolean = this.currentTest.pending; boolean = this.currentTest.sync; @@ -198,7 +277,7 @@ function test_beforeEach() { stringOrUndefined = this.currentTest.state; }); - beforeEach(function () { + beforeEach(function() { this['sharedState'] = true; boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -209,7 +288,7 @@ function test_beforeEach() { stringOrUndefined = this.currentTest.state; }); - beforeEach(function (done) { + beforeEach(function(done) { done(); boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -220,7 +299,18 @@ function test_beforeEach() { stringOrUndefined = this.currentTest.state; }); - beforeEach("my description", function () { + beforeEach(function() { + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + stringOrUndefined = this.currentTest.state; + return resolved; + }); + + beforeEach("my description", function() { boolean = this.currentTest.async; boolean = this.currentTest.pending; boolean = this.currentTest.sync; @@ -230,7 +320,7 @@ function test_beforeEach() { stringOrUndefined = this.currentTest.state; }); - beforeEach("my description", function (done) { + beforeEach("my description", function(done) { done(); boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -240,18 +330,31 @@ function test_beforeEach() { string = this.currentTest.fullTitle(); stringOrUndefined = this.currentTest.state; }); + + beforeEach("my description", function() { + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + stringOrUndefined = this.currentTest.state; + return resolved; + }); } function test_suiteSetup() { suiteSetup(() => { }); - suiteSetup(function () { this['sharedState'] = true; }); + suiteSetup(function() { this['sharedState'] = true; }); suiteSetup((done) => { done(); }); + + suiteSetup(() => resolved); } function test_afterEach() { - afterEach(function () { + afterEach(function() { boolean = this.currentTest.async; boolean = this.currentTest.pending; boolean = this.currentTest.sync; @@ -261,7 +364,7 @@ function test_afterEach() { stringOrUndefined = this.currentTest.state; }); - afterEach(function () { + afterEach(function() { this['sharedState'] = true; boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -272,7 +375,7 @@ function test_afterEach() { stringOrUndefined = this.currentTest.state; }); - afterEach(function (done) { + afterEach(function(done) { done(); boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -283,7 +386,18 @@ function test_afterEach() { stringOrUndefined = this.currentTest.state; }); - afterEach("my description", function () { + afterEach(function() { + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + stringOrUndefined = this.currentTest.state; + return resolved; + }); + + afterEach("my description", function() { boolean = this.currentTest.async; boolean = this.currentTest.pending; boolean = this.currentTest.sync; @@ -293,7 +407,7 @@ function test_afterEach() { stringOrUndefined = this.currentTest.state; }); - afterEach("my description", function (done) { + afterEach("my description", function(done) { done(); boolean = this.currentTest.async; boolean = this.currentTest.pending; @@ -304,14 +418,26 @@ function test_afterEach() { stringOrUndefined = this.currentTest.state; }); + afterEach("my description", function() { + boolean = this.currentTest.async; + boolean = this.currentTest.pending; + boolean = this.currentTest.sync; + boolean = this.currentTest.timedOut; + string = this.currentTest.title; + string = this.currentTest.fullTitle(); + stringOrUndefined = this.currentTest.state; + return resolved; + }); } function test_suiteTeardown() { suiteTeardown(() => { }); - suiteTeardown(function () { this['sharedState'] = true; }); + suiteTeardown(function() { this['sharedState'] = true; }); suiteTeardown((done) => { done(); }); + + suiteTeardown(() => resolved); } function test_reporter_string() { @@ -385,7 +511,7 @@ function test_setup_all_options() { } function test_run() { - mocha.run(function () { }) + mocha.run(() => {}); } function test_growl() { @@ -420,7 +546,6 @@ function test_require_constructor_allOptions() { }); } - function test_require_fluentParams() { const instance = new MochaDef(); @@ -461,7 +586,7 @@ function test_throwError() { function test_mochaRunner_properties(runner: MochaDef.IRunner, suite: MochaDef.ISuite) { runner = runner.abort(); - + if (runner.stats !== undefined) { number = runner.stats.failures; number = runner.stats.passes; @@ -474,7 +599,7 @@ function test_mochaRunner_properties(runner: MochaDef.IRunner, suite: MochaDef.I dateOrUndefined = runner.stats.duration; } - let s: MochaDef.ISuite = runner.suite; + const s: MochaDef.ISuite = runner.suite; boolean = runner.started; number = runner.total; number = runner.failures; @@ -482,7 +607,7 @@ function test_mochaRunner_properties(runner: MochaDef.IRunner, suite: MochaDef.I runner = runner.grep("regex", false); number = runner.grepTotal(suite); - let globals: string[] | MochaDef.IRunner= runner.globals(["hello", "world"]); + const globals: string[] | MochaDef.IRunner = runner.globals(["hello", "world"]); runner = runner.run(); runner = runner.run((f: number) => {}); @@ -498,4 +623,4 @@ function test_base_reporter_properties(reporter: MochaDef.reporters.Base) { dateOrUndefined = reporter.stats.start; dateOrUndefined = reporter.stats.end; dateOrUndefined = reporter.stats.duration; -} \ No newline at end of file +} diff --git a/types/mocha/tslint.json b/types/mocha/tslint.json index a41bf5d19a..1e7d1ca65a 100644 --- a/types/mocha/tslint.json +++ b/types/mocha/tslint.json @@ -1,79 +1,10 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, "unified-signatures": false, - "void-return": false, - "whitespace": false + "interface-name": false, + "ban-types": false, + "no-single-declare-module": false, + "no-declare-current-package": false } } diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index ba27943739..0ebe9203bb 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -7,6 +7,7 @@ // Gaurav Lahoti // Mariano Cortesi // Enrico Picci +// Alexander Christie // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -93,7 +94,7 @@ export interface MongoClientOptions extends logger?: Object; // Default: false; validateOptions?: Object; - // The name of the application that created this MongoClient instance. + // The name of the application that created this MongoClient instance. appname?: string; } @@ -160,8 +161,8 @@ export interface DbCreateOptions extends CommonOptions { raw?: boolean; // Default: true; Promotes Long values to number if they fit inside the 53 bits resolution. promoteLongs?: boolean; - // Default: -1 (unlimited); Amount of operations the driver buffers up untill discard any new ones - promoteBuffers?: number; + // Default: false; Promotes Binary BSON values to native Node Buffers + promoteBuffers?: boolean; // the prefered read preference. use 'ReadPreference' class. readPreference?: ReadPreference | string; // Default: true; Promotes BSON values to native types where possible, set to false to only receive wrapper types. @@ -636,7 +637,7 @@ export interface Collection { watch(pipeline?: Object[], options?: ChangeStreamOptions & { session?: ClientSession }): ChangeStream; } -type FilterQuery = { +export type FilterQuery = { [P in keyof T]?: T[P] | { $eq?: T[P]; $gt?: T[P]; @@ -1495,7 +1496,7 @@ export interface ChangeStreamOptions { } type GridFSBucketWriteStreamId = string | number | Object | ObjectID; - + export interface LoggerOptions { loggerLevel?: string // Custom logger function logger?: log // Override default global log level. diff --git a/types/mongodb/mongodb-tests.ts b/types/mongodb/mongodb-tests.ts index 852522aadc..af307ce6d8 100644 --- a/types/mongodb/mongodb-tests.ts +++ b/types/mongodb/mongodb-tests.ts @@ -25,7 +25,8 @@ let options: mongodb.MongoClientOptions = { sslCA: ['str'], sslCert: new Buffer(999), sslKey: new Buffer(999), - sslPass: new Buffer(999) + sslPass: new Buffer(999), + promoteBuffers: false } MongoClient.connect('mongodb://127.0.0.1:27017/test', options, function (err: mongodb.MongoError, client: mongodb.MongoClient) { if (err) throw err; diff --git a/types/mysql/index.d.ts b/types/mysql/index.d.ts index 1e827a7d37..555fc703bf 100644 --- a/types/mysql/index.d.ts +++ b/types/mysql/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: William Johnston // Kacper Polak // Krittanan Pingclasai +// James Munro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -240,6 +241,11 @@ export interface QueryOptions { */ sql: string; + /** + * Values for template query + */ + values?: any; + /** * Every operation takes an optional inactivity timeout option. This allows you to specify appropriate timeouts for * operations. It is important to note that these timeouts are not part of the MySQL protocol, and rather timeout diff --git a/types/mysql/mysql-tests.ts b/types/mysql/mysql-tests.ts index a3ddb27248..480e7e0275 100644 --- a/types/mysql/mysql-tests.ts +++ b/types/mysql/mysql-tests.ts @@ -423,6 +423,9 @@ connection.query({ } }); +connection.query({sql: '...', values: ['test']}, (err: Error, results: any) => { +}); + connection = mysql.createConnection("mysql://localhost/test?flags=-FOUND_ROWS"); connection = mysql.createConnection({debug: true}); connection = mysql.createConnection({debug: ['ComQueryPacket', 'RowDataPacket']}); diff --git a/types/mz/mz-tests.ts b/types/mz/mz-tests.ts index 7eda9f28bf..b873c98bbe 100644 --- a/types/mz/mz-tests.ts +++ b/types/mz/mz-tests.ts @@ -1,8 +1,11 @@ -/// - import assert = require('assert') import fs = require('mz/fs') +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('fs', function () { it('.stat()', function (done) { diff --git a/types/navermaps/index.d.ts b/types/navermaps/index.d.ts new file mode 100644 index 0000000000..92409a44b0 --- /dev/null +++ b/types/navermaps/index.d.ts @@ -0,0 +1,1391 @@ +// Type definitions for Naver Maps JavaScript API 3.0 +// Project: https://navermaps.github.io/maps.js +// Definitions by: Ckboyjiy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare namespace naver.maps { + /** + * Types + */ + type PointArrayLiteral = [number, number]; + type PointLiteral = PointArrayLiteral | PointObjectLiteral; + type SizeArrayLiteral = [number, number]; + type SizeLiteral = SizeArrayLiteral | SizeObjectLiteral; + type LatLngLiteral = PointLiteral | LatLngObjectLiteral; + type PointBoundsArrayLiteral = [number, number, number, number]; + type PointBoundsLiteral = PointBoundsArrayLiteral | PointBoundsObjectLiteral; + type LatLngBoundsLiteral = PointBoundsLiteral | LatLngBoundsObjectLiteral; + type BoundsLiteral = PointBoundsLiteral | LatLngBoundsLiteral; + type CoordLiteral = PointLiteral | LatLngLiteral; + type Coord = Point | LatLng; + type Bounds = PointBounds | LatLngBounds; + type DOMEvent = Event; + type StylingFunction = (feature: Feature) => StyleOptions; + type ArrayOfCoords = Point[] | LatLng[]; + type ArrayOfBounds = PointBounds[] | LatLngBounds[]; + type ArrayOfBoundsLiteral = PointBoundsLiteral[] | LatLngBoundsLiteral[]; + type forEachOverlayCallback = (overlay: Marker | Polyline | Polygon, index: number) => void; + type GeoJSON = any; + type GPX = any; + type KML = any; + type KVOArrayOfCoords = any; + type ArrayOfCoordsLiteral = PointLiteral[] | LatLngLiteral[]; + type strokeStyleType = 'solid' | 'shortdash' | 'shortdot' | 'shortdashdot' | 'shortdashdotdot' | 'dot' | 'dash' | + 'longdash' | 'dashdot' | 'longdashdot' | 'longdashdotdot'; + type strokeLineCapType = 'butt' | 'round' | 'square'; + type strokeLineJoinType = 'miter' | 'round ' | 'bevel'; + + /** + * Interfaces + */ + interface MapEventListener { + eventName: string; + listener: () => any; + listenerId: string; + target: any; + } + interface PointObjectLiteral { + x: number; + y: number; + } + interface SizeObjectLiteral { + width: number; + height: number; + } + interface LatLngObjectLiteral { + lat: number; + lng: number; + } + interface PointBoundsObjectLiteral { + minX: number; + minY: number; + maxX: number; + maxY: number; + } + interface LatLngBoundsObjectLiteral { + north: number; + east: number; + south: number; + west: number; + } + interface MapSystemProjection extends KVO { + factor(zoom: number): number; + fromCoordToOffset(coord: Coord): Point; + fromCoordToPoint(coord: Coord): Point; + fromOffsetToCoord(offset: Point): Coord; + fromOffsetToPoint(offset: Point): Point; + fromPointToCoord(point: Point): Coord; + fromPointToOffset(point: Point): Point; + getDestinationCoord(fromCoord: Coord, angle: number, meter: number): Coord; + getDistance(coord1: Coord, coord2: Coord): number; + getProjectionName(): number; + scaleDown(operand: number | Point | Size, zoom: number): number | Point | Size; + scaleUp(operand: number | Point | Size, zoom: number): number | Point | Size; + } + interface MapOptions { + background?: string; + baseTileOpacity?: number; + bounds?: any; + center?: any; + disableDoubleClickZoom?: boolean; + disableDoubleTapZoom?: boolean; + disableKineticPan?: boolean; + disableTwoFingerTapZoom?: boolean; + draggable?: boolean; + keyboardShortcuts?: boolean; + logoControl?: boolean; + logoControlOptions?: any; + mapDataControl?: boolean; + mapDataControlOptions?: any; + mapTypeControl?: boolean; + mapTypeControlOptions?: any; + mapTypeId?: string; + mapTypes?: any; + maxBounds?: any; + maxZoom?: number; + minZoom?: number; + padding?: any; + pinchZoom?: boolean; + resizeOrigin?: any; + scaleControl?: boolean; + scaleControlOptions?: any; + scrollWheel?: boolean; + size?: any; + overlayZoomEffect?: null | string; + tileSpare?: number; + tileTransition?: boolean; + zoom?: number; + zoomControl?: boolean; + zoomControlOptions?: any; + zoomOrigin?: any; + } + interface MarkerOptions { + animation?: any; + map?: Map; + position?: any; + icon?: any; + shape?: any; + title?: string; + cursor?: string; + clickable?: boolean; + draggable?: boolean; + visible?: boolean; + zIndex?: number; + } + interface MapPanes { + overlayLayer: HTMLElement; + overlayImage: HTMLElement; + floatPane: HTMLElement; + } + interface InfoWindowOptions { + position?: Coord | CoordLiteral; + content: string | HTMLElement; + zIndex?: number; + maxWidth?: number; + pixelOffset?: Point | PointLiteral; + backgroundColor?: string; + borderColor?: string; + borderWidth?: number; + disableAutoPan?: boolean; + disableAnchor?: boolean; + anchorSkew?: boolean; + anchorSize?: Size | SizeLiteral; + anchorColor?: string; + } + interface ImageTileOptions { + urls: string[]; + imgonload?: () => any; + imgonerror?: () => any; + opacity?: number; + transition?: boolean; + offset?: Point; + zIndex?: number; + size?: Size; + pane?: HTMLElement; + } + interface ImageMapTypeOptions { + name: string; + maxZoom: number; + minZoom: number; + projection: Projection; + tileSize?: Size | SizeLiteral; + repeatX?: boolean; + vendor?: string; + provider?: MapDataProvider[]; + uid?: string; + darktheme?: boolean; + getTileUrl?: () => any; + tileSet?: string | string[]; + } + interface GroundOverlayOptions { + clickable?: boolean; + map?: Map | null; + opacity?: number; + } + interface EllipseOptions { + map?: Map; + bounds: Bounds | BoundsLiteral; + strokeWeight?: number; + strokeOpacity?: number; + strokeColor?: string; + strokeStyle?: strokeStyleType; + strokeLineCap?: strokeLineCapType; + strokeLineJoin?: strokeLineJoinType; + fillColor?: string; + fillOpacity?: number; + clickable?: boolean; + visible?: boolean; + zIndex?: number; + } + interface FeatureEvent { + feature: Feature; + } + interface PointerEvent { + coord: Coord; + point: Point; + offset: Point; + pointerEvent: DOMEvent; + feature: Feature; + } + interface PropertyEvent { + feature: Feature; + name: string; + oldValue: any; + newValue: any; + } + interface StyleOptions { + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + fillColor?: string; + fillOpacity?: number; + clickable?: boolean; + icon?: string | ImageIcon | SymbolIcon | HtmlIcon; + shape?: MarkerShape; + title?: string; + visible?: boolean; + zIndex?: number; + } + interface ControlOptions { + position: Position; + } + interface CircleOptions { + map?: Map; + center: Coord | CoordLiteral; + radius?: number; + strokeWeight?: number; + strokeOpacity?: number; + strokeColor?: string; + strokeStyle?: strokeStyleType; + strokeLineCap?: strokeLineCapType; + strokeLineJoin?: strokeLineJoinType; + fillColor?: string; + fillOpacity?: number; + clickable?: boolean; + visible?: boolean; + zIndex?: number; + } + interface TileOptions { + opacity?: number; + transition?: boolean; + offset?: Point; + zIndex?: number; + size?: Size; + pane?: HTMLElement; + } + interface TileIndex { + xIndex: number; + yIndex: number; + } + interface CanvasTileOptions { + imageData?: ImageData; + opacity?: number; + transition?: boolean; + offset?: Point; + zIndex?: number; + size?: Size; + pane?: HTMLElement; + } + interface CanvasMapTypeOptions { + name: string; + maxZoom: number; + minZoom: number; + projection: Projection; + tileSize?: Size | SizeLiteral; + repeatX?: boolean; + vendor?: string; + provider?: MapDataProvider[]; + uid?: string; + darktheme?: boolean; + getTileData?: () => any; + } + interface MapDataProvider { + title: string; + link?: string; + bounds?: Bounds | BoundsLiteral | ArrayOfBounds | ArrayOfBoundsLiteral; + } + interface MapType { + maxZoom: number; + minZoom: number; + name: string; + projection: Projection; + tileSize: Size; + getTile(x: number, y: number, z: number): HTMLElement | Tile; + } + interface Projection { + fromCoordToPoint(coord: Coord): Point; + fromPointToCoord(point: Point): Coord; + } + interface CadastralLayerOptions { + overlayMap: boolean | undefined; + zIndex: number | undefined; + } + interface AroundControlOptions { + position: Position; + } + interface NaverImageMapTypeOptions { + maxZoom?: number; + minZoom?: number; + projection?: Projection; + tileSize?: Size; + hd?: string; + } + interface LogoControlOptions { + position: Position; + } + interface MapDataControlOptions { + position: Position; + } + interface MapTypeControlOptions { + mapTypeIds: MapTypeId[] | null; + position: Position; + style: MapTypeControlStyle; + } + interface ScaleControlOptions { + position: Position; + } + interface ZoomControlOptions { + position: Position; + style: ZoomControlStyle; + legendDisabled: boolean; + } + interface LayerOptions { + hd: boolean; + overlayMap: boolean | undefined; + zIndex: number | undefined; + } + interface CadastralLayerOptions { + overlayMap: boolean | undefined; + zIndex: number | undefined; + } + interface StreetLayerOptions { + overlayMap: boolean | undefined; + zIndex: number | undefined; + } + interface TrafficLayerOptions { + interval: number; + overlayMap: boolean | undefined; + zIndex: number | undefined; + } + interface HtmlIcon { + content: string | HTMLElement; + size?: Size | SizeLiteral; + anchor?: Point | PointLiteral | Position; + } + interface ImageIcon { + url: string; + size?: Size | SizeLiteral; + scaledSize?: Size | SizeLiteral; + origin?: Point | PointLiteral; + anchor?: Point | PointLiteral | Position; + } + interface MarkerShape { + coords: any[]; + type: string; + } + interface SymbolIcon { + path: SymbolPath | Point[] | PointLiteral[]; + style?: SymbolStyle; + radius?: number; + fillColor?: string; + fillOpacity?: number; + strokeColor?: string; + strokeWeight?: number; + strokeOpacity?: number; + anchor?: Point | PointLiteral | Position; + } + interface PolygonOptions { + map?: Map; + paths: ArrayOfCoords[] | KVOArrayOfCoords[] | ArrayOfCoordsLiteral[]; + strokeWeight?: number; + strokeOpacity?: number; + strokeColor?: string; + strokeStyle?: strokeStyleType; + strokeLineCap?: strokeLineCapType; + strokeLineJoin?: strokeLineJoinType; + fillColor?: string; + fillOpacity?: number; + clickable?: boolean; + visible?: boolean; + zIndex?: number; + } + interface PolylineOptions { + map?: Map; + path: ArrayOfCoords | KVOArrayOfCoords | ArrayOfCoordsLiteral; + strokeWeight?: number; + strokeOpacity?: number; + strokeColor?: string; + strokeStyle?: strokeStyleType; + strokeLineCap?: strokeLineCapType; + strokeLineJoin?: strokeLineJoinType; + clickable?: boolean; + visible?: boolean; + zIndex?: number; + startIcon?: PointingIcon; + startIconSize?: number; + endIcon?: PointingIcon; + endIconSize?: number; + } + interface RectangleOptions { + map?: Map; + bounds: Bounds | BoundsLiteral; + strokeWeight?: number; + strokeOpacity?: number; + strokeColor?: string; + strokeStyle?: strokeStyleType; + strokeLineCap?: strokeLineCapType; + strokeLineJoin?: strokeLineJoinType; + fillColor?: string; + fillOpacity?: number; + clickable?: boolean; + visible?: boolean; + zIndex?: number; + } + interface PanoramaOptions { + size: Size | SizeLiteral; + panoId: string; + position: LatLng | LatLngLiteral; + pov: PanoramaPov; + visible: boolean; + minScale: number; + maxScale: number; + minZoom: number; + maxZoom: number; + logoControl: boolean; + logoControlOptions: LogoControlOptions; + zoomControl: boolean; + zoomControlOptions: ZoomControlOptions; + aroundControl: boolean; + aroundControlOptions: AroundControlOptions; + } + interface PanoramaPov { + pan: number; + tilt: number; + fov: number; + } + interface PanoramaLocation { + panoId: string; + title: string; + address: string; + coord: LatLng; + photodate: string; + } + interface DOMEventListener { + eventName: string; + listener: () => any; + target: HTMLElement; + } + interface Margin { + top?: number; + right?: number; + bottom?: number; + left?: number; + } + + interface TransitionOptions { + duration?: number; + easing?: string; + } + + /** + * Enums + */ + enum MapTypeControlStyle { + BUTTON, + DROPDOWN + } + enum ZoomControlStyle { + LARGE, + SMALL + } + + /** + * Members + */ + enum Animation { + BOUNCE = 1, + DROP + } + let jsContentLoaded: boolean; + type MapTypeId = string; + namespace MapTypeId { // TODO. 확실하지 않음 + let NORMAL: string; + let TERRAIN: string; + let SATELLITE: string; + let HYBRID: string; + } + function onJSContentLoaded(...args: any[]): any; + enum PointingIcon { + OPEN_ARROW = 1, + BLOCK_ARROW, + CIRCLE, + DIAMOND + } + enum Position { + CENTER = 0, + TOP_LEFT, + TOP_CENTER, + TOP_RIGHT, + LEFT_CENTER, + LEFT_TOP, + LEFT_BOTTOM, + RIGHT_TOP, + RIGHT_CENTER, + RIGHT_BOTTOM, + BOTTOM_LEFT, + BOTTOM_CENTER, + BOTTOM_RIGHT + } + enum SymbolPath { + BACKWARD_CLOSED_ARROW = 1, + BACKWARD_OPEN_ARROW, + CIRCLE, + FORWARD_CLOSED_ARROW, + FORWARD_OPEN_ARROW + } + type SymbolStyle = string; + namespace SymbolStyle { + let CIRCLE: string; + let PATH: string; + let CLOSED_PATH: string; + } + + /** + * Classes + */ + // KVO + class KVO { + constructor(); + addListener(eventName: any, listener: () => any): MapEventListener; + addListenerOnce(eventName: any, listener: () => any): MapEventListener; + bindTo(key: string, target: KVO, targetKey?: string): void; + clearListeners(eventName: string): void; + get(key: string): any; + hasListener(eventName: string): boolean; + removeListener(listeners: MapEventListener | MapEventListener[]): void; + set(key: string, value: any, silently?: boolean): void; + setValues(properties: any): void; + trigger(eventName: string, eventObject?: any): void; + unbind(key: string): void; + unbindAll(): void; + } + class KVOArray extends KVO { + constructor(array: any[]); + clear(): void; + forEach(callback: (element: any, index: number) => void): void; + getArray(): any[]; + getAt(index: number): any; + getIndexOfElement(element: any): number; + getLength(): number; + insertAt(index: number, element: any): void; + pop(): any; + push(element: any): number; + removeAt(index: number): any; + removeElement(element: any): void; + setAt(index: number, element: any): void; + splice(startIndex: number, deleteCount: number, element?: any): any[]; + } + // Base + class Point { + constructor(x: number, y: number); + add(point: Coord | PointLiteral): Point; + add(x: number, y: number): Point; + ceil(): Point; + clone(): Point; + div(point: Coord | PointLiteral): void; + div(x: number, y: number): Point; + equals(point: Point): boolean; + floor(): Point; + mul(point: Coord | PointLiteral): Point; + mul(x: number, y: number): Point; + round(): Point; + sub(point: Coord | PointLiteral): Point; + sub(x: number, y: number): Point; + toString(): string; + } + class Size { + width: number; + height: number; + constructor(width: number, height: number); + add(size: Size | SizeLiteral): Size; + add(width: number, height: number): Size; + ceil(): Size; + clone(): Size; + div(width: number, height: number): Size; + div(size: Size | SizeLiteral): Size; + equals(size: Size | SizeLiteral): boolean; + floor(): Size; + mul(size: Size | SizeLiteral): Size; + mul(width: number, height: number): Size; + round(): Size; + sub(size: Size | SizeLiteral): Size; + sub(width: number, height: number): Size; + toString(): string; + } + class PointBounds { + constructor(minPoint: Point, maxPoint: Point); + static bounds(point: Coord | PointLiteral, + pointN: Coord | PointLiteral): PointBounds; + clone(): PointBounds; + equals(bounds: Bounds | PointBoundsLiteral): boolean; + extend(point: Coord | PointLiteral): PointBounds; + getCenter(): Point; + getMax(): Point; + getMin(): Point; + hasBounds(bounds: Bounds | PointBoundsLiteral): boolean; + hasPoint(point: Coord | PointLiteral): boolean; + intersects(bounds: Bounds | PointBoundsLiteral): boolean; + maxX(): number; + maxY(): number; + minX(): number; + minY(): number; + toString(): string; + union(bounds: Bounds | PointBoundsLiteral): PointBounds; + } + class LatLng extends Point { + constructor(lat: number, lng: number); + clone(): LatLng; + destinationPoint(angle: number, meter: number): LatLng; + equals(point: Coord | LatLngLiteral): boolean; + lat(): number; + lng(): number; + toPoint(): Point; + toString(): string; + } + class LatLngBounds extends PointBounds { + constructor(sw: LatLng, ne: LatLng); + static bounds(latlng: Coord | LatLngLiteral, + latlngN: Coord | LatLngLiteral): LatLngBounds; + clone(): LatLngBounds; + east(): number; + equals(bounds: Bounds | LatLngBoundsLiteral): boolean; + extend(latlng: Coord | LatLngLiteral): LatLngBounds; + getCenter(): LatLng; + getNE(): LatLng; + getSW(): LatLng; + hasLatLng(latlng: Coord | LatLngLiteral): boolean; + intersects(bounds: Bounds | LatLngBoundsLiteral): boolean; + north(): number; + south(): number; + toPointBounds(): PointBounds; + union(bounds: Bounds | LatLngBoundsLiteral): LatLngBounds; + west(): number; + } + // Map + class Map extends KVO { + controls: any; + data: any; + layers: any; + mapTypes: any; + mapSystemProjection: any; + constructor(mapDiv: string, mapOptions?: MapOptions); + addPane(name: string, elementOrIndex: HTMLElement | number): void; + destory(): void; + fitBounds(bounds: any, margin?: any): void; + getBounds(): Bounds; + getCenter(): Coord; + getCenterPoint(): Coord; + getElement(): HTMLElement; + getMapTypeId(): string; + getOptions(key?: string): any; + getPanes(): MapPanes; + getPrimitiveProjection(): Projection; + getProjection(): MapSystemProjection; + getSize(): Size; + getZoom(): number; + morph(coord: Coord | CoordLiteral, zoom?: number, transitionOptions?: TransitionOptions): void; + panBy(offset: Point | PointLiteral): void; + panTo(coord: Coord | CoordLiteral, transitionOptions: TransitionOptions): void; + panToBounds(bounds: Bounds | BoundsLiteral, transitionOptions: TransitionOptions, margin?: Margin): void; + refresh(noEffect?: boolean): void; + removePane(name: string): void; + setCenter(center: Coord | CoordLiteral): void; + setCenterPoint(point: Point | PointLiteral): void; + setMapTypeId(mapTypeId: string): void; + setOptions(newOptionsOrKey: any, value?: any): void; + setSize(size: Size | SizeLiteral): void; + setZoom(zoom: number, effect?: boolean): void; + updateBy(coord: Coord | CoordLiteral, zoom: number): void; + zoomBy(deltaZoom: number, zoomOrigin?: Coord | CoordLiteral, effect?: boolean): void; + } + // Map.Tile + class Tile extends KVO { + constructor(element: HTMLElement, tileOptions?: TileOptions); + appendTo(parentNode: HTMLElement): void; + cancelFadeIn(): void; + destroy(): void; + fadeIn(callback: () => any, startOpacity?: number): void; + getElement(): HTMLElement; + getOffset(): Point; + getOpacity(): number; + getSize(): Size; + getTileIndex(): TileIndex; + getZIndex(): number; + hide(): void; + load(tileOptions?: TileOptions): void; + remove(): void; + reset(mapType: MapType, zoom: number, tileOptions?: TileOptions): void; + setBlank(): void; + setOffset(offset: Point): void; + setOffset(x: number, y: number): void; + setOpacity(opacity: number): void; + setSize(size: Size): void; + setTileIndex(tileIndex: TileIndex): void; + setZIndex(zIndex: number): void; + show(): void; + } + class CanvasTile extends Tile { + constructor(canvasTileOptions: CanvasTileOptions); + } + class ImageTile extends Tile { + constructor(imageTileOptions: ImageTileOptions); + getImageElements(): HTMLElement[]; + getUrls(): string[]; + setUrls(urls: string[]): void; + } + // Map.MapType + class CanvasMapType implements MapType { + maxZoom: number; + minZoom: number; + name: string; + projection: Projection; + tileSize: Size; + constructor(canvasMapTypeOptions: CanvasMapTypeOptions); + getMapTypeOptions(): CanvasMapTypeOptions; + getMaxZoom(): number; + getMinZoom(): number; + getName(): string; + getTile(x: number, y: number, z: number): CanvasTile; + getTileData(x: number, y: number, z: number): ImageData; + setMapTypeOptions(canvasMapTypeOptions: CanvasMapTypeOptions): void; + } + class ImageMapType implements MapType { + maxZoom: number; + minZoom: number; + name: string; + projection: Projection; + tileSize: Size; + constructor(imageMapTypeOptions: ImageMapTypeOptions); + getMapTypeOptions(): ImageMapTypeOptions; + getMaxZoom(): number; + getMinZoom(): number; + getName(): string; + getTile(x: number, y: number, z: number): ImageTile; + getTileUrls(x: number, y: number, z: number): string[]; + setMapTypeOptions(imageMapTypeOptions: ImageMapTypeOptions): void; + } + class MapTypeRegistry extends KVO { + constructor(mapTypeInfo?: any, defaultMapTypeId?: string); + getPreviousTypeId(): string; + getSelectedType(): MapType; + getSelectedTypeId(): string; + getTypeIds(): string[]; + set(mapTypeId: string, mapType: MapType): void; + setSelectedTypeId(mapTypeId: string): void; + } + + // Map.MapType.Preset + function NaverMapTypeOption(options: NaverImageMapTypeOptions): void; + namespace NaverMapTypeOption { + function getBicycleLayer(opts: NaverImageMapTypeOptions): ImageMapType; + function getBlankMap(opts: NaverImageMapTypeOptions): ImageMapType; + function getCadastralLayer(opts?: NaverImageMapTypeOptions): ImageMapType; + function getHybridMap(opts?: NaverImageMapTypeOptions): ImageMapType; + function getMapTypes(opts?: NaverImageMapTypeOptions): MapTypeRegistry; + function getNormalLabelLayer(opts?: NaverImageMapTypeOptions): ImageMapType; + function getNormalMap(opts?: NaverImageMapTypeOptions): ImageMapType; + function getSatelliteLabelLayer(opts?: NaverImageMapTypeOptions): ImageMapType; + function getSatelliteMap(opts?: NaverImageMapTypeOptions): ImageMapType; + function getStreetLayer(opts?: NaverImageMapTypeOptions): ImageMapType; + function getTerrainMap(opts?: NaverImageMapTypeOptions): ImageMapType; + function getTrafficLayer(opts?: NaverImageMapTypeOptions): ImageMapType; + function getVectorMap(opts?: NaverImageMapTypeOptions): ImageMapType; + function getWorldMap(opts?: NaverImageMapTypeOptions): ImageMapType; + } + + // Control + class CustomControl extends KVO { + constructor(html: string, ControlOptions: ControlOptions); + getElement(): HTMLElement; + getMap(): Map | null; + getOptions(key?: string): any; + html(html?: string): string | undefined; + setMap(map?: Map | null): void; + setOptions(newOptions: ControlOptions): void; + setPosition(position: Position): void; + } + // Naver Controls + class LogoControl extends CustomControl { + constructor(LogoControlOptions: LogoControlOptions); + } + class MapDataControl extends CustomControl { + constructor(MapDataControlOptions: MapDataControlOptions); + } + class MapTypeControl extends CustomControl { + constructor(MapTypeControlOptions: MapTypeControlOptions); + } + class ScaleControl extends CustomControl { + constructor(ScaleControlOptions: ScaleControlOptions); + } + class ZoomControl extends CustomControl { + constructor(ZoomControlOptions: ZoomControlOptions); + } + // Layer + class Layer extends KVO { + constructor(name: string, MapTypeRegistry: MapTypeRegistry, options: LayerOptions); + getLayerType(): MapType; + getLayerTypeId(): string; + getMap(): Map | null; + getOpacity(): number; + getPaneElement(): HTMLElement; + refresh(noEffect?: boolean): void; + setLayerTypeId(typeId: string): void; + setMap(map: Map | null): void; + setOpacity(opacity: number): void; + } + // Naver Layers + class LabelLayer extends Layer { + constructor(name: string, registry: ImageMapType, option: any); + } + class CadastralLayer extends LabelLayer { + name: string; + constructor(option?: CadastralLayerOptions); + } + class StreetLayer extends LabelLayer { + name: string; + constructor(option?: StreetLayerOptions); + } + class TrafficLayer extends LabelLayer { + name: string; + constructor(option?: TrafficLayerOptions); + endAutoRefresh(): void; + startAutoRefresh(): void; + } + // Data Layer + class Data extends KVO { + constructor(); + addFeature(feature: Feature, autoStyle: boolean): void; + addGeoJson(geojson: GeoJSON, autoStyle: boolean): void; + addGpx(xmlDoc: GPX, autoStyle: boolean): void; + addKml(xmlDoc: KML, autoStyle: boolean): void; + forEach(callback: (feature: Feature, index: number) => void): void; + getAllFeature(): Feature[]; + getFeatureById(id: string | number): Feature; + getMap(): Map | null; + getStyle(): StyleOptions | StylingFunction; + overrideStyle(feature: Feature, style: StyleOptions): void; + removeFeature(feature: Feature): void; + removeGeoJson(geojson: GeoJSON): void; + revertStyle(feature: Feature): void; + setMap(map: Map | null): void; + setStyle(style: StyleOptions | StylingFunction): void; + toGeoJson(): GeoJSON; + } + class Feature extends KVO { + constructor(rawFeature: any); + forEachOverlay(callback: forEachOverlayCallback): void; + getBounds(): Bounds; + getGeometries(): Geometry[]; + getId(): string; + getOverlays(): Marker[] | Polyline[] | Polygon[]; + getProperty(name: string): any; + getRaw(): GeoJSON; + setProperty(name: string, value: any): void; + setStyle(styleOptions: StyleOptions): void; // Data.StyleOptions + } + class Geometry extends KVO { + constructor(rawGeometry: any); + getCoords(): ArrayOfCoords; + getType(): string; + } + // Overlay + class OverlayView extends KVO { + draw(): void; + getContainerTopLeft(): Point; + getMap(): Map | null; + getPanes(): MapPanes; + getProjection(): MapSystemProjection; + onAdd(): any; + onRemove(): any; + setMap(map: Map | null): void; + } + // Naver Overlays + class Circle extends OverlayView { + constructor(options?: CircleOptions); + getAreaSize(): number; + getBounds(): Bounds; + getCenter(): Coord; + getClickable(): boolean; + getDrawingRect(): Bounds; + getOptions(key?: string): CircleOptions; + getRadius(): number; + getStyles(key: string): CircleOptions; + getVisible(): boolean; + getZIndex(): number; + setCenter(center: Coord | CoordLiteral): void; + setClickable(clickable: boolean): void; + setOptions(key: string, value: any): void; + setOptions(options: CircleOptions): void; + setRadius(radius: number): void; + setStyles(key: string, value: string): void; + setStyles(options: CircleOptions): void; + setVisible(visible: boolean): void; + setZIndex(zIndex: number): void; + } + class Ellipse extends OverlayView { + constructor(options?: EllipseOptions); + getAreaSize(): number; + getBounds(): Bounds; + getClickable(): boolean; + getDrawingRect(): Bounds; + getOptions(key?: string): EllipseOptions; + getStyles(key?: string): EllipseOptions; + getVisible(): boolean; + getZIndex(): number; + setBounds(bounds: Bounds | BoundsLiteral): void; + setOptions(options: EllipseOptions): void; + setOptions(key: string, value: any): void; + setStyles(options: EllipseOptions): void; + setStyles(key: string, value: any): void; + setVisible(visible: boolean): void; + setZIndex(zIndex: number): void; + } + class GroundOverlay extends OverlayView { + constructor(url: string, bounds: Bounds | BoundsLiteral, options?: GroundOverlayOptions); + getBounds(): Bounds; + getOpacity(): number; + getUrl(): string; + setOpacity(opacity: number): void; + } + class InfoWindow extends OverlayView { + constructor(options: InfoWindowOptions); + close(): void; + getContent(): HTMLElement; + getOptions(key?: string): InfoWindowOptions; + getPosition(): Coord; + getZIndex(): number; + open(map: Map, anchor: Coord | CoordLiteral | Marker): void; + setContent(content: string | HTMLElement): void; + setOptions(options: InfoWindowOptions): void; + setPosition(position: Coord | CoordLiteral): void; + setZIndex(zIndex: number): void; + } + class Marker extends OverlayView { + constructor(options: MarkerOptions); + draw(): void; + getAnimation(): Animation; + getClickable(): boolean; + getCursor(): string; + getDraggable(): boolean; + getDrawingRect(): Bounds; + getIcon(): ImageIcon | SymbolIcon | HtmlIcon; + getOptions(key?: string): MarkerOptions; + getPosition(): Coord; + getShape(): MarkerShape; + getTitle(): string; + getVisible(): boolean; + getZIndex(): number; + onAdd(): void; + onRemove(): void; + setAnimation(animation: Animation): void; + setClickable(clickable: boolean): void; + setCursor(cursor: string): void; + setDraggable(draggable: boolean): void; + setIcon(icon: string | ImageIcon | SymbolIcon | HtmlIcon): void; + setOptions(options: MarkerOptions): void; + setPosition(position: Coord | CoordLiteral): void; + setShape(shape: MarkerShape): void; + setTitle(title: string): void; + setVisible(visible: boolean): void; + setZIndex(zIndex: number): void; + } + class Polygon extends OverlayView { + constructor(options?: PolygonOptions); + getAreaSize(): number; + getBounds(): Bounds; + getClickable(): boolean; + getDrawingRect(): Bounds; + getOptions(key?: string): PolygonOptions; + getPath(): ArrayOfCoords | KVOArrayOfCoords; + getPaths(): ArrayOfCoords[] | KVOArrayOfCoords[]; + getStyles(key?: string): PolygonOptions; + getVisible(): boolean; + getZIndex(): number; + setClickable(clickable: boolean): void; + setOptions(key: string, value: any): void; + setOptions(options: PolygonOptions): void; + setPath(path: ArrayOfCoords | KVOArrayOfCoords | ArrayOfCoordsLiteral): void; + setPaths(paths: ArrayOfCoords[] | ArrayOfCoordsLiteral): void; // TODO. KVOArray. + setStyles(key: string, value: any): void; + setStyles(options: PolygonOptions): void; + setVisible(visible: boolean): void; + setZIndex(zIndex: number): void; + } + class Polyline extends OverlayView { + constructor(options?: PolylineOptions); + getBounds(): Bounds; + getClickable(): boolean; + getDistance(): number; + getDrawingRect(): Bounds; + getOptions(key?: string): PolylineOptions; + getPath(): ArrayOfCoords | KVOArrayOfCoords; + getStyles(key?: string): PolylineOptions; + getVisible(): boolean; + getZIndex(): number; + setClickable(clickable: boolean): void; + setOptions(key: string, value: any): void; + setOptions(options: PolylineOptions): void; + setPath(path: ArrayOfCoords | KVOArrayOfCoords | ArrayOfCoordsLiteral): void; + setStyles(key: string, value: any): void; + setStyles(options: PolylineOptions): void; + setVisible(visible: boolean): void; + setZIndex(zIndex: number): void; + } + class Rectangle extends OverlayView { + constructor(options?: RectangleOptions); + getAreaSize(): number; + getBounds(): Bounds; + getClickable(): boolean; + getDrawingRect(): Bounds; + getOptions(key?: string): RectangleOptions; + getStyles(key?: string): RectangleOptions; + getVisible(): boolean; + getZIndex(): number; + setBounds(bounds: Bounds | BoundsLiteral): void; + setClickable(clickable: boolean): void; + setOptions(options: RectangleOptions): void; + setOptions(key: string, value: any): void; + setStyles(key: string, value: any): void; + setStyles(options: RectangleOptions): void; + setVisible(visible: boolean): void; + setZIndex(zIndex: number): void; + } + + // Sub module: panorama + class PanoramaProjection extends KVO { + fromCoordToPov(coord: LatLng): PanoramaPov; + } + class Panorama extends KVO { + constructor(panoramaDiv: string | HTMLElement, panoramaOptions: PanoramaOptions); + getLocation(): PanoramaLocation; + getMaxScale(): number; + getMaxZoom(): number; + getMinScale(): number; + getMinZoom(): number; + getPanoId(): string; + getPosition(): LatLng; + getPov(): PanoramaPov; + getProjection(): PanoramaProjection; + getScale(): number; + getSize(): Size; + getVisible(): boolean; + getZoom(): number; + setOptions(key: string, value: any): void; + setOptions(newOptions: PanoramaOptions): void; + setPanoId(panoId: string): void; + setPanoIdWithPov(panoId: string, pov: PanoramaPov): void; + setPosition(position: LatLng | LatLngLiteral): void; + setPov(pov: PanoramaPov): void; + setScale(scale: number): void; + setSize(size: Size | SizeLiteral): void; + setVisible(visible: boolean): void; + setZoom(zoom: number): void; + zoomIn(): void; + zoomOut(): void; + } + class FlightSpot extends KVO { + constructor(); + getMap(): Map | null; + setMap(map: Map | null): void; + } + class AroundControl extends CustomControl { + constructor(aroundControlOptions: AroundControlOptions); + } + + // Sub module: drawing + namespace drawing { + interface DrawingOptions { + map?: Map; + drawingControl?: DrawingMode[]; + drawingControlOptions?: drawingControlOptions; + drawingMode?: DrawingMode; + controlPointOptions?: controlPointOptions; + rectangleOptions?: RectangleOptions; + ellipseOptions?: EllipseOptions; + polylineOptions?: PolylineOptions; + arrowlineOptions?: PolylineOptions; + polygonOptions?: PolygonOptions; + markerOptions?: MarkerOptions; + } + type drawingControlOptions = DrawingControlOptions; + interface DrawingControlOptions { + position?: Position; + style?: DrawingStyle; + } + type controlPointOptions = ControlPointOptions; + interface ControlPointOptions { + anchorPointOptions: CircleOptions; + midPointOptions: CircleOptions; + } + interface DrawingOverlay { + id: string; + name: string; + setEditable: (editable: boolean, controlPointOptions?: controlPointOptions) => void; + } + enum DrawingStyle { + HORIZONTAL = 0, + VERTICAL, + HORIZONTAL_2, + VERTICAL_2 + } + enum DrawingMode { + HAND = 0, + RECTANGLE, + ELLIPSE, + POLYLINE, + ARROWLINE, + POLYGON, + MARKER + } + enum DrawingEvent { + ADD, + REMOVE, + SELECT, + Added, + Removed, + Selected + } + class DrawingManager extends KVO { + constructor(options?: DrawingOptions); + addDrawing(overlay: DrawingOverlay, drawingMode: DrawingMode, id?: string): void; + addListener(eventName: DrawingEvent, + listener: (overlay: DrawingOverlay) => void): MapEventListener; + destroy(): void; + getDrawing(id: string): DrawingOverlay; + getDrawings(): any; + getMap(): Map | null; + setMap(map: Map | null): void; + toGeoJson(): any; + } + } + + // Sub module: visualization + namespace visualization { + interface DotMapOptions { + map: Map; + data: LatLng[] | PointArrayLiteral[] | WeightedLocation[]; + opacity?: number; + radius?: number; + strokeWeight?: number; + strokeColor?: string; + strokeLineCap?: strokeLineCapType; + strokeLineJoin?: strokeLineJoinType; + fillColor?: string; + } + interface HeatMapOptions { + map: Map; + data: LatLng[] | PointArrayLiteral[] | WeightedLocation[]; + opacity?: number; + radius?: number; + colorMap?: SpectrumStyle; + } + enum SpectrumStyle { + JET, + HSV, + HOT, + COOL, + GREYS, + YIGnBu, + YIOrRd, + RdBu, + RAINBOW, + PORTLAND, + OXYGEN + } + class DotMap extends KVO { + constructor(dotMapOptions?: DotMapOptions); + addDrawing(overlay: drawing.DrawingOverlay, drawingMode: drawing.DrawingMode, id?: string): void; + addListener(eventName: drawing.DrawingEvent, + listener: (overlay: drawing.DrawingOverlay) => void): MapEventListener; + destroy(): void; + getDrawing(id: string): drawing.DrawingOverlay; + getDrawings(): any; + getMap(): Map | null; + setMap(map: Map | null): void; + toGeoJson(): any; + } + class HeatMap { + constructor(heatMapOptions?: HeatMapOptions); + getColorMap(): SpectrumStyle; + getData(): LatLng[] | PointArrayLiteral[]; + getMap(): Map | null; + getOptions(key?: string): HeatMapOptions; + redraw(): void; + setColorMap(colormap: SpectrumStyle, inReverse: boolean): void; + setData(data: LatLng[] | PointArrayLiteral[]): void; + setMap(map: Map | null): void; + setOptions(key: string, value: any): void; + setOptions(options: HeatMapOptions): void; + } + class WeightedLocation { + constructor(lat: number, lng: number, weight?: number); + clone(): WeightedLocation; + getLocation(): LatLng; + getWeight(): number; + lat(): number; + lng(): number; + toString(): string; + } + } + + // Sub module: geocoder + namespace Service { + interface ServiceOptions { + encoding?: any; + coordType?: any; + } + interface GeocodeServiceOptions extends ServiceOptions { + address?: string; + } + interface ReverseServiceOptions extends ServiceOptions { + location?: Coord | CoordLiteral; + } + interface AddressItem { + address: string; + addrdetail: { + country: string; + sido: string; + sigugun: string; + dongmyun: string; + rest: string; + }; + } + interface GeocodeResponse { + result: { + userquery: any; + total: number; + items: AddressItem[]; + }; + } + interface ReverseGeocodeResponse { + result: { + userquery: string; + total: number; + items: AddressItem[]; + }; + } + enum CoordType { + LATLNG, + TM128 + } + enum Encoding { + UTF_8, + EUC_KR + } + enum Status { + OK, + ERROR + } + + function fromAddrToCoord(): void; + function fromCoordToAddr(): void; + function geocode(options: GeocodeServiceOptions, + callback?: (status: Status, response: GeocodeResponse) => void): void; + function reverseGeocode(options: ReverseServiceOptions, + callback?: (status: Status, response: ReverseGeocodeResponse) => void): void; + } + + namespace TransCoord { + function fromEPSG3857ToLatLng(coord: Point): LatLng; + function fromEPSG3857ToNaver(coord: Point): Point; + function fromEPSG3857ToTM128(coord: Point): Point; + function fromEPSG3857ToUTMK(coord: Point): Point; + function fromLatLngToEPSG3857(latlng: Coord): Point; + function fromLatLngToNaver(latlng: Coord): Point; + function fromLatLngToTM128(latlng: Coord): Point; + function fromLatLngToUTMK(latlng: Coord): Point; + function fromNaverToEPSG3857(n: Point): Point; + function fromNaverToLatLng(n: Point): LatLng; + function fromNaverToTM128(n: Point): Point; + function fromNaverToUTMK(n: Point): Point; + function fromTM128ToEPSG3857(tm128: Point): Point; + function fromTM128ToLatLng(tm128: Point): LatLng; + function fromTM128ToNaver(tm128: Point): Point; + function fromTM128ToUTMK(tm128: Point): Point; + function fromUTMKToEPSG3857(utmk: Point): Point; + function fromUTMKToLatLng(utmk: Point): LatLng; + function fromUTMKToNaver(utmk: Point): Point; + function fromUTMKToTM128(utmk: Point): Point; + } + + namespace Event { + function addDOMListener(element: HTMLElement, eventName: string, listener: () => any): void; + function addListener(target: any, eventName: string, listener: () => any): MapEventListener; + function clearInstanceListeners(target: any): void; + function clearListeners(target: any, fromEventName: string): void; + function forward(source: any, fromEventName: string, target: any, toEventName: string): MapEventListener; + function hasListener(target: any, eventName: string): boolean; + function once(target: any, eventName: string, listener: () => any): MapEventListener; + function removeDOMListener(element: HTMLElement, eventName: string, listener: () => any): void; + function removeDOMListener(listeners: DOMEventListener | DOMEventListener[]): void; + function removeListener(listeners: MapEventListener | MapEventListener[]): void; + function resumeDispatch(target: any, eventName: string): void; + function stopDispatch(target: any, eventName: string): void; + function trigger(target: any, eventName: string, eventObject?: any): void; + } + + // Projection + namespace EPSG3857 { // implements Projection + function fromCoordToPoint(coord: Coord): Point; + function fromLatLngToPoint(latlng: LatLng): Point; + function fromPointToCoord(point: Point): LatLng; + function fromPointToLatLng(point: Point): LatLng; + function getDestinationCoord(fromLatLng: LatLng, angle: number, meter: number): LatLng; + function getDistance(latlng1: LatLng, latlng2: LatLng): number; + } + namespace UTMK { + let name: string; + let pointPerMeter: number; + function fromCoordToPoint(latlng: LatLng): Point; + function fromCoordToUTMK(latlng: LatLng): Point; + function fromLatLngToPoint(latlng: LatLng): Point; + function fromLatLngToUTMK(latlng: LatLng): Point; + function fromPointToCoord(point: Point): LatLng; + function fromPointToLatLng(point: Point): LatLng; + function fromPointToUTMK(point: Point): Point; + function fromUTMKToCoord(utmk: Point): LatLng; + function fromUTMKToLatLng(utmk: Point): LatLng; + function fromUTMKToPoint(utmk: Point): Point; + function getDestinationCoord(fromLatLng: LatLng, angle: number, meter: number): LatLng; + function getDistance(latlng1: LatLng, latlng2: LatLng): number; + } + namespace UTMK_NAVER { // extends UTMK + let name: string; + let pointPerMeter: number; + function fromCoordToNaver(latlng: LatLng): Point; + function fromLatLngToNaver(latlng: LatLng): Point; + function fromNaverToCoord(naverPoint: Point): LatLng; + function fromNaverToLatLng(naverPoint: Point): LatLng; + function fromNaverToPoint(naverPoint: Point): Point; + function fromNaverToUTMK(naverPoint: Point): Point; + function fromPointToNaver(point: Point): Point; + function fromUTMKToNaver(utmk: Point): Point; + } + namespace EPSG3857Coord { + function fromCoordToLatLng(coord: Point): LatLng; + function fromCoordToPoint(coord: Point): Point; + function fromEPSG3857ToLatLng(coord: Point): LatLng; + function fromEPSG3857ToPoint(coord: Point): Point; + function fromLatLngToCoord(coord: Coord): Point; + function fromLatLngToEPSG3857(coord: Coord): Point; + function fromPointToCoord(point: Point): Point; + function fromPointToEPSG3857(point: Point): Point; + } + namespace TM128 { // extends TM128Coord + function fromCoordToPoint(latlng: Coord): Point; + function fromPointToCoord(point: Point): LatLng; + } + namespace TM128Coord { // extends UTMK + function fromCoordToLatLng(tm128: Point): LatLng; + function fromCoordToPoint(tm128: Point): Point; + function fromLatLngToCoord(latlng: Coord): Point; + function fromLatLngToTM128(latlng: Coord): Point; + function fromPointToCoord(point: Point): Point; + function fromPointToTM128(point: Point): Point; + function fromTM128ToLatLng(tm128: Point): LatLng; + function fromTM128ToPoint(tm128: Point): Point; + function fromTM128ToUTMK(tm128: Point): Point; + function fromUTMKToTM128(utmk: Point): Point; + } + namespace UTMK_NAVERCoord { // extends UTMK_NAVER + function fromCoordToLatLng(n: Point): LatLng; + function fromCoordToPoint(n: Point): Point; + function fromLatLngToCoord(latlng: Coord): Point; + function fromPointToCoord(point: Point): Point; + } + namespace UTMKCoord { // extends UTMK + function fromCoordToLatLng(utmk: Point): LatLng; + function fromCoordToPoint(utmk: Point): Point; + function fromLatLngToCoord(latlng: Coord): Point; + function fromPointToCoord(point: Point): Point; + } +} diff --git a/types/navermaps/navermaps-tests.ts b/types/navermaps/navermaps-tests.ts new file mode 100644 index 0000000000..81bbe620f5 --- /dev/null +++ b/types/navermaps/navermaps-tests.ts @@ -0,0 +1,151 @@ +let map = new naver.maps.Map('map'); +map.setMapTypeId(naver.maps.MapTypeId.HYBRID); + +const jeju = new naver.maps.LatLng(33.3590628, 126.534361); + +map.setCenter(jeju); // 중심 좌표 이동 +map.setZoom(13); // 줌 레벨 변경 + +const seoul = new naver.maps.LatLngBounds( + new naver.maps.LatLng(37.42829747263545, 126.76620435615891), + new naver.maps.LatLng(37.7010174173061, 127.18379493229875)); + +map.fitBounds(seoul); // 좌표 경계 이동 + +map.panBy(new naver.maps.Point(10, 10)); // 우측 하단으로 10 픽셀 이동 + +map = new naver.maps.Map('map', { + mapTypeId: naver.maps.MapTypeId.HYBRID +}); + +const registry = new naver.maps.MapTypeRegistry(); + +map = new naver.maps.Map('map', { + mapTypes: registry, + mapTypeId: naver.maps.MapTypeId.SATELLITE +}); + +map.mapTypes.set(naver.maps.MapTypeId.SATELLITE, naver.maps.NaverMapTypeOption.getSatelliteMap()); +map.mapTypes.set(naver.maps.MapTypeId.HYBRID, naver.maps.NaverMapTypeOption.getHybridMap()); + +map.setMapTypeId(naver.maps.MapTypeId.NORMAL); // error thrown + +const GTA5MapTypeOption1 = { + minZoom: 0, + maxZoom: 22, + projection: naver.maps.EPSG3857, + name: '세계 지도', + tileSize: new naver.maps.Size(256, 256), + repeatX: true, + vendor: 'MyCorp.', + provider: [{ + title: "내 지도 ver 1.0" + }, { + title: "OpenStreetMap", + link: "http://www.openstreetmap.org/copyright" + }, { + title: "/인천광역시", + bounds: new naver.maps.LatLngBounds( + new naver.maps.LatLng(36.915887, 125.690716), + new naver.maps.LatLng(37.687529, 126.853252)) + }], + tileSet: [ + "http://mymap1.com/tiles/world/{z}/{x}/{y}.png", + "http://mymap2.com/tiles/world/{z}/{x}/{y}.png", + "http://mymap3.com/tiles/world/{z}/{x}/{y}.png", + "http://mymap4.com/tiles/world/{z}/{x}/{y}.png" + ] +}; + +map = new naver.maps.Map('map', { + center: new naver.maps.LatLng(74.92514151088395, -127.880859375), + zoom: 2, + mapTypes: new naver.maps.MapTypeRegistry({ + Atlas: new naver.maps.ImageMapType(GTA5MapTypeOption1) + }) +}); + +map.setMapTypeId("Atlas"); + +const map2 = new naver.maps.Map('map', { + center: new naver.maps.LatLng(37.3595704, 127.105399), + zoom: 10 +}); + +const marker = new naver.maps.Marker({ + position: new naver.maps.LatLng(37.3595704, 127.105399), + map: map2 +}); + +const HOME_PATH = ''; + +const cityhall = new naver.maps.LatLng(37.5666805, 126.9784147); +const map3 = new naver.maps.Map('map', { + center: cityhall.destinationPoint(0, 500), + zoom: 10 +}); +const marker2 = new naver.maps.Marker({ + map: map3, + position: cityhall +}); + +const contentString = [ + `
+

서울특별시청

+

서울특별시 중구 태평로1가 31 | 서울특별시 중구 세종대로 110 서울특별시청
+ 서울시청
+ 02-120 | 공공,사회기관 > 특별,광역시청
+ www.seoul.go.kr/ +

+
` + ].join(''); + +const infowindow = new naver.maps.InfoWindow({ + content: contentString +}); + +naver.maps.Event.addListener(marker2, "click", () => { + if (infowindow.getMap()) { + infowindow.close(); + } else { + infowindow.open(map3, marker2); + } +}); + +infowindow.open(map3, marker2); + +const GREEN_FACTORY = new naver.maps.LatLng(37.3595953, 127.1053971); + +const map4 = new naver.maps.Map('map', { + center: GREEN_FACTORY, + zoom: 3 +}); + +const rectangle = new naver.maps.Rectangle({ + map: map4, + bounds: new naver.maps.LatLngBounds( + new naver.maps.LatLng(37.1793196, 125.8795594), + new naver.maps.LatLng(37.5398662, 126.3312422) + ) +}); + +const circle = new naver.maps.Circle({ + map: map4, + center: GREEN_FACTORY, + radius: 20000, + fillColor: 'crimson', + fillOpacity: 0.8 +}); + +const ellipse = new naver.maps.Ellipse({ + map: map4, + bounds: new naver.maps.LatLngBounds( + new naver.maps.LatLng(37.1793196, 127.6795594), + new naver.maps.LatLng(37.5398662, 128.4312422) + ), + strokeColor: 'yellowgreen', + strokeOpacity: 1, + strokeWeight: 3, + fillColor: 'yellowgreen', + fillOpacity: 0.3 +}); diff --git a/types/navermaps/tsconfig.json b/types/navermaps/tsconfig.json new file mode 100644 index 0000000000..5e1beca4fb --- /dev/null +++ b/types/navermaps/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "navermaps-tests.ts" + ] +} diff --git a/types/navermaps/tslint.json b/types/navermaps/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/navermaps/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/navigo/index.d.ts b/types/navigo/index.d.ts index ebc0ecb8c5..30fb656d45 100644 --- a/types/navigo/index.d.ts +++ b/types/navigo/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/krasimir/navigo // Definitions by: Adrian Ehrsam // Dancespiele +// Daniel Almaguer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -53,7 +54,7 @@ declare class Navigo { link(path: string): string; - lastRouteResolved(): {url: string, query: string}; + lastRouteResolved(): {url: string, query: string, hooks: NavigoHooks, params?: Params, name?: string}; disableIfAPINotAvailable(): void; diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index 061f22bd10..60c73d850f 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Nightmare 2.10.0 +// Type definitions for Nightmare 2.10.1 // Project: https://github.com/segmentio/nightmare // Definitions by: horiuchi // Sam Yang @@ -12,7 +12,6 @@ declare class Nightmare { constructor(options?: Nightmare.IConstructorOptions); // Interact - userAgent(agent: string): Nightmare; end(): Nightmare; then(fn: (value: T) => R): Promise; halt(error: string, cb: () => void): Nightmare; @@ -57,8 +56,8 @@ declare class Nightmare { run(cb?: (err: any, nightmare: Nightmare) => void): Nightmare; // Extract - exists(selector: string, cb: (result: boolean) => void): Nightmare; - visible(selector: string, cb: (result: boolean) => void): Nightmare; + exists(selector: string, cb?: (result: boolean) => void): Nightmare; + visible(selector: string, cb?: (result: boolean) => void): Nightmare; on(event: string, cb: () => void): Nightmare; on(event: 'initialized', cb: () => void): Nightmare; on(event: 'loadStarted', cb: () => void): Nightmare; @@ -114,6 +113,7 @@ declare class Nightmare { html(path: string, saveType: 'MHTML'): Nightmare; pdf(path: string): Nightmare; pdf(path: string, options: Object): Nightmare; + pdf(cb: (err: Error, data: Buffer) => void): Nightmare; title(): string; title(cb: (title: string) => void): Nightmare; url(cb: (url: string) => void): Nightmare; diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index 7eb376b996..d49d8b5932 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -52,6 +52,16 @@ new Nightmare() }) .run(done); +new Nightmare() + .goto('http://www.wikipedia.org/') + .exists('a.link-box') + .then((exists: boolean) => { }) + +new Nightmare() + .goto('http://www.wikipedia.org/') + .visible('a.link-box') + .then((isVisible: boolean) => { }) + new Nightmare() .goto('http://www.wikipedia.org/') .title(function (title) { @@ -189,6 +199,13 @@ new Nightmare() .pdf('test/test.pdf') .run(done); +new Nightmare() + .goto("http://yahoo.com") + .pdf((err,data)=>{ + console.log(Buffer.isBuffer(data)) + }) + .run(done) + new Nightmare() .goto('http://www.google.com/') .wait('input') @@ -387,7 +404,3 @@ new Nightmare({ executionTimeout: 1000 }) }, 2000) }) }) - - - - diff --git a/types/nivo-slider/index.d.ts b/types/nivo-slider/index.d.ts new file mode 100644 index 0000000000..f30f6d445b --- /dev/null +++ b/types/nivo-slider/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for Nivo Slider 3.2 +// Project: https://github.com/Codeinwp/Nivo-Slider-jQuery +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +export type EffectType = 'sliceDown' | 'sliceDownLeft' | 'sliceUp' | 'sliceUpLeft' | 'sliceUpDown' | 'sliceUpDownLeft' | + 'fold' | 'fade' | 'random' | 'slideInRight' | 'slideInLeft' | 'boxRandom' | 'boxRain' | 'boxRainReverse' | + 'boxRainGrow' | 'boxRainGrowReverse'; + +export interface Options { + effect?: EffectType; + slices?: number; + boxCols?: number; + boxRows?: number; + animSpeed?: number; + pauseTime?: number; + startSlide?: number; + directionNav?: boolean; + controlNav?: boolean; + controlNavThumbs?: boolean; + pauseOnHover?: boolean; + manualAdvance?: boolean; + prevText?: string; + nextText?: string; + randomStart?: boolean; + beforeChange?: () => void; + afterChange?: () => void; + slideshowEnd?: () => void; + lastSlide?: () => void; + afterLoad?: () => void; +} +declare global { + interface JQuery { + nivoSlider(options?: Options): JQuery; + } +} diff --git a/types/nivo-slider/nivo-slider-tests.ts b/types/nivo-slider/nivo-slider-tests.ts new file mode 100644 index 0000000000..a82ec64106 --- /dev/null +++ b/types/nivo-slider/nivo-slider-tests.ts @@ -0,0 +1,23 @@ +import { Options } from "nivo-slider"; + +// basic usage +$('#slider').nivoSlider(); + +// with options +const options: Options = { + effect: 'random', + slices: 15, + boxCols: 8, + boxRows: 4, + animSpeed: 500, + pauseTime: 3000, + startSlide: 0, + directionNav: true, + controlNav: true, + controlNavThumbs: false, + pauseOnHover: true, + manualAdvance: false, + prevText: 'Prev', + nextText: 'Next' +}; +$('#slider').nivoSlider(options); diff --git a/types/nivo-slider/tsconfig.json b/types/nivo-slider/tsconfig.json new file mode 100644 index 0000000000..4275013350 --- /dev/null +++ b/types/nivo-slider/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "nivo-slider-tests.ts" + ] +} \ No newline at end of file diff --git a/types/nivo-slider/tslint.json b/types/nivo-slider/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/nivo-slider/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file diff --git a/types/node-pushnotifications/index.d.ts b/types/node-pushnotifications/index.d.ts new file mode 100644 index 0000000000..5b9ed891f9 --- /dev/null +++ b/types/node-pushnotifications/index.d.ts @@ -0,0 +1,180 @@ +// Type definitions for node-pushnotifications 1.0 +// Project: https://github.com/appfeel/node-pushnotifications +// Definitions by: Menushka Weeratunga +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.1 +/// + +export = PushNotifications; + +declare class PushNotifications { + constructor(settings: PushNotifications.Settings); + + setOptions(opts: PushNotifications.Settings): void; + sendWith(method: PushNotifications.PushMethod, regIds: string[], data: PushNotifications.Data, cb: PushNotifications.Callback): void; + send(registrationIds: string[], data: PushNotifications.Data, cb: PushNotifications.Callback): void; + send(registrationIds: string[], data: PushNotifications.Data): Promise; +} + +declare namespace PushNotifications { + interface Settings { + /** Google Cloud Messaging */ + gcm?: { + /** GCM or FCM token */ + id?: string; + }; + /** Apple Push Notifications */ + apn?: { + /** APN Token */ + token?: { + /** + * The filename of the provider token key (as supplied by Apple) to load from disk, or a + * Buffer/String containing the key data. + */ + key?: Buffer | string; + /** The ID of the key issued by Apple */ + keyId?: string; + /** ID of the team associated with the provider token key */ + teamId?: string; + }; + /** + * The filename of the connection certificate to load from disk, or a Buffer/String containing the + * certificate data. + */ + cert?: string; + /** The filename of the connection key to load from disk, or a Buffer or String containing the key data. */ + key?: string; + /** + * An array of trusted certificates. Each element should contain either a filename to load, or a + * Buffer/String (in PEM format) to be used directly. If this is omitted several well known "root" CAs + * will be used. - You may need to use this as some environments don't include the CA used by + * Apple (entrust_2048). + */ + ca?: Array; + /** + * File path for private key, certificate and CA certs in PFX or PKCS12 format, or a Buffer containing + * the PFX data. If supplied will always be used instead of certificate and key above. + */ + pfx?: Buffer | string; + /** The passphrase for the connection key, if required */ + passphrase?: string; + production?: boolean; + voip?: boolean; + address?: string; + port?: number; + rejectUnauthorized?: boolean; + connectionRetryLimit?: number; + cacheLength?: number; + connectionTimeout?: number; + autoAdjustCache?: boolean; + maxConnections?: number; + minConnections?: number; + connectTimeout?: number; + buffersNotifications?: boolean; + fastMode?: boolean; + disableNagle?: boolean; + disableEPIPEFix?: boolean; + }; + /** Amazon Device Messaging */ + adm?: { + client_id?: string; + client_secret?: string; + }; + /** Windows Push Notifications */ + wns?: { + client_id?: string; + client_secret?: string; + accessToken?: string; + headers?: string; + notificationMethod?: string; + }; + /** Microsoft Push Notification Service */ + mpns?: { + options?: { + client_id?: string; + client_secret?: string; + }; + }; + } + interface Data { + /** REQUIRED */ + title: string; + /** REQUIRED */ + body: string; + custom?: { + sender?: string; + }; + /** + * gcm, apn. Supported values are 'high' or 'normal' (gcm). Will be translated to 10 and 5 for apn. Defaults + * to 'high' + */ + priority?: string; + /** gcm for android, used as collapseId in apn */ + collapseKey?: string; + /** gcm for android */ + contentAvailable?: boolean | string; + /** gcm for android */ + delayWhileIdle?: boolean; + /** gcm for android */ + restrictedPackageName?: string; + /** gcm for android */ + dryRun?: boolean; + /** gcm for android */ + icon?: string; + /** gcm for android */ + tag?: string; + /** gcm for android */ + color?: string; + /** gcm for android. In ios, category will be used if not supplied */ + clickAction?: string; + /** gcm, apn */ + locKey?: string; + /** gcm, apn */ + bodyLocArgs?: string; + /** gcm, apn */ + titleLocKey?: string; + /** gcm, apn */ + titleLocArgs?: string; + /** gcm, apn */ + retries?: number; + /** apn */ + encoding?: string; + /** gcm for ios, apn */ + badge?: number; + /** gcm, apn */ + sound?: string; + /** apn, will take precedence over title and body. It is also accepted a text message in alert */ + alert?: {} | string; + /** apn and gcm for ios */ + launchImage?: string; + /** apn and gcm for ios */ + action?: string; + /** apn and gcm for ios */ + topic?: string; + /** apn and gcm for ios */ + category?: string; + /** apn and gcm for ios */ + mdm?: string; + /** apn and gcm for ios */ + urlArgs?: string; + /** apn and gcm for ios */ + truncateAtWordEnd?: boolean; + /** apn */ + mutableContent?: number; + /** seconds */ + expiry?: number; + /** if both expiry and timeToLive are given, expiry will take precedency */ + timeToLive?: number; + /** wns */ + headers?: string[]; + /** wns */ + launch?: string; + /** wns */ + duration?: string; + /** ADM */ + consolidationKey?: string; + } + type PushMethod = (regIds: string[], data: Data, settings: Settings) => void; + type Callback = (err: any, result: any) => void; +} diff --git a/types/node-pushnotifications/node-pushnotifications-tests.ts b/types/node-pushnotifications/node-pushnotifications-tests.ts new file mode 100644 index 0000000000..6a4d9d3335 --- /dev/null +++ b/types/node-pushnotifications/node-pushnotifications-tests.ts @@ -0,0 +1,51 @@ +import PushNotifications = require('node-pushnotifications'); + +const settings = { + gcm: { + id: "null" + }, + apn: { + token: { + key: './certs/key.p8', + keyId: 'ABCD', + teamId: 'EFGH', + } + }, + adm: { + client_id: "null", + client_secret: "null" + }, + wns: { + client_id: "null", + client_secret: "null", + notificationMethod: 'sendTileSquareBlock', + } +}; +const push = new PushNotifications(settings); + +const registrationIds = []; +registrationIds.push('INSERT_YOUR_DEVICE_ID'); +registrationIds.push('INSERT_OTHER_DEVICE_ID'); + +const data = { + title: 'New push notification', + body: 'Powered by AppFeel' +}; + +// You can use it in node callback style +push.send(registrationIds, data, (err, result) => { + if (err) { + console.log(err); + } else { + console.log(result); + } +}); + +// Or you could use it as a promise: +push.send(registrationIds, data) + .then((results) => { + console.log(results); + }) + .catch((err) => { + console.log(err); + }); diff --git a/types/node-pushnotifications/tsconfig.json b/types/node-pushnotifications/tsconfig.json new file mode 100644 index 0000000000..54ace6c986 --- /dev/null +++ b/types/node-pushnotifications/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-pushnotifications-tests.ts" + ] +} diff --git a/types/node-pushnotifications/tslint.json b/types/node-pushnotifications/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/node-pushnotifications/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/node-rsa/index.d.ts b/types/node-rsa/index.d.ts index 63d569378d..e0730eef74 100644 --- a/types/node-rsa/index.d.ts +++ b/types/node-rsa/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for node-rsa 0.4 // Project: https://github.com/rzcoder/node-rsa // Definitions by: Ali Taheri +// Christian Moniz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -17,6 +18,11 @@ declare class NodeRSA { */ constructor(key: NodeRSA.Key, format?: NodeRSA.Format, options?: NodeRSA.Options); + /** + * Set and validate options for key instance. + */ + setOptions(options: NodeRSA.Options): void; + /** * @param bits Key size in bits. 2048 by default. * @param exponent public exponent. 65537 by default. @@ -31,7 +37,10 @@ declare class NodeRSA { /** * Export key to PEM string, PEM/DER Buffer or components. */ - exportKey(format?: NodeRSA.Format): NodeRSA.Key; + exportKey(format?: NodeRSA.FormatPem): string; + exportKey(format: NodeRSA.FormatDer): Buffer; + exportKey(format: NodeRSA.FormatComponentsPrivate): NodeRSA.KeyComponentsPrivate; + exportKey(format: NodeRSA.FormatComponentsPublic): NodeRSA.KeyComponentsPublic; isPrivate(): boolean; @@ -85,20 +94,26 @@ declare class NodeRSA { } declare namespace NodeRSA { - type Key = string | Buffer | KeyComponents; + type Key = string | Buffer | KeyComponentsPrivate | KeyComponentsPublic; type Data = string | object | any[]; - type Format = + type FormatPem = | 'private' | 'public' - | 'pkcs1' | 'pkcs1-pem' | 'pkcs1-der' - | 'pkcs1-private' | 'pkcs1-private-pem' | 'pkcs1-private-der' - | 'pkcs1-public' | 'pkcs1-public-pem' | 'pkcs1-public-der' - | 'pkcs8' | 'pkcs8-pem' | 'pkcs8-der' - | 'pkcs8-private' | 'pkcs8-private-pem' | 'pkcs8-private-der' - | 'pkcs8-public' | 'pkcs8-public-pem' | 'pkcs8-public-der' + | 'pkcs1' | 'pkcs1-pem' + | 'pkcs1-private' | 'pkcs1-private-pem' + | 'pkcs1-public' | 'pkcs1-public-pem' + | 'pkcs8' | 'pkcs8-pem' + | 'pkcs8-private' | 'pkcs8-private-pem' + | 'pkcs8-public' | 'pkcs8-public-pem'; + type FormatDer = + | 'pkcs1-der' | 'pkcs1-private-der' | 'pkcs1-public-der' + | 'pkcs8-der' | 'pkcs8-private-der' | 'pkcs8-public-der'; + type FormatComponentsPrivate = | 'components' | 'components-pem' | 'components-der' - | 'components-private' | 'components-private-pem' | 'components-private-der' + | 'components-private' | 'components-private-pem' | 'components-private-der'; + type FormatComponentsPublic = | 'components-public' | 'components-public-pem' | 'components-public-der'; + type Format = FormatPem | FormatDer | FormatComponentsPrivate | FormatComponentsPublic; type EncryptionScheme = 'pkcs1_oaep' | 'pkcs1'; @@ -124,7 +139,7 @@ declare namespace NodeRSA { | 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'latin1' | 'base64' | 'hex' | 'binary' | 'buffer'; - interface KeyComponents { + interface KeyComponentsPrivate { n: Buffer; e: Buffer | number; d: Buffer; @@ -135,6 +150,11 @@ declare namespace NodeRSA { coeff: Buffer; } + interface KeyComponentsPublic { + n: Buffer; + e: Buffer | number; + } + interface KeyBits { /** * The length of the key in bits. diff --git a/types/node-rsa/node-rsa-tests.ts b/types/node-rsa/node-rsa-tests.ts index 0f8defacbd..88d8bdcb2e 100644 --- a/types/node-rsa/node-rsa-tests.ts +++ b/types/node-rsa/node-rsa-tests.ts @@ -2,6 +2,11 @@ import NodeRSA = require('node-rsa'); const key = new NodeRSA({ b: 512 }); +key.setOptions({ + encryptionScheme: 'pkcs1_oaep', + signingScheme: 'pkcs1' +}); + const text = 'Hello RSA!'; const encrypted = key.encrypt(text, 'base64'); const decrypted = key.decrypt(encrypted, 'utf8'); @@ -26,8 +31,10 @@ Es+KCn25OKXR/FJ5fu6A6A+MptABL3r8SEjlpLc= const keyData = '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----'; key.importKey(keyData, 'pkcs8'); -const publicDer = key.exportKey('pkcs8-public-der'); -const privateDer = key.exportKey('pkcs1-der'); +const defaultPem: string = key.exportKey(); +const publicPem: string = key.exportKey('pkcs8-public-pem'); +const publicDer: Buffer = key.exportKey('pkcs8-public-der'); +const privateDer: Buffer = key.exportKey('pkcs1-der'); key.importKey({ n: new Buffer('0086fa9ba066685845fc03833a9699c8baefb53cfbf19052a7f10f1eaa30488cec1ceb752bdff2df9fad6c64b3498956e7dbab4035b4823c99a44cc57088a23783', 'hex'), e: 65537, @@ -39,6 +46,17 @@ key.importKey({ coeff: new Buffer('00b399675e5e81506b729a777cc03026f0b2119853dfc5eb124610c0ab82999e45', 'hex') }, 'components'); const publicComponents = key.exportKey('components-public'); +let b: Buffer = publicComponents.n; +let bn: Buffer|number = publicComponents.e; +const privateComponents = key.exportKey('components-private'); +b = privateComponents.n; +bn = privateComponents.e; +b = privateComponents.d; +b = privateComponents.p; +b = privateComponents.q; +b = privateComponents.dmp1; +b = privateComponents.dmq1; +b = privateComponents.coeff; key.isPrivate(); key.isPublic(true); diff --git a/types/node/index.d.ts b/types/node/index.d.ts index b2e310cffa..0994982b41 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Node.js 9.4.x +// Type definitions for Node.js 9.6.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -19,6 +19,7 @@ // Alberto Schiabel // Klaus Meinhardt // Huw +// Nicolas Even // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -1768,6 +1769,7 @@ declare module "https" { export class Agent extends http.Agent { constructor(options?: AgentOptions); + options: AgentOptions; } export class Server extends tls.Server { @@ -5575,18 +5577,18 @@ declare module "util" { export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function promisify(fn: CustomPromisify): TCustom; - export function promisify(fn: (callback: (err: Error, result: TResult) => void) => void): () => Promise; - export function promisify(fn: (callback: (err: Error) => void) => void): () => Promise; - export function promisify(fn: (arg1: T1, callback: (err: Error, result: TResult) => void) => void): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, callback: (err: Error) => void) => void): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise; + export function promisify(fn: (callback: (err: Error | null) => void) => void): () => Promise; + export function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, callback: (err: Error | null) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; export function promisify(fn: Function): Function; export namespace promisify { const custom: symbol; @@ -6080,6 +6082,23 @@ declare module "async_hooks" { */ export function createHook(options: HookCallbacks): AsyncHook; + export interface AsyncResourceOptions { + /** + * The ID of the execution context that created this async event. + * Default: `executionAsyncId()` + */ + triggerAsyncId?: number; + + /** + * Disables automatic `emitDestroy` when the object is garbage collected. + * This usually does not need to be set (even if `emitDestroy` is called + * manually), unless the resource's `asyncId` is retrieved and the + * sensitive API's `emitDestroy` is called with it. + * Default: `false` + */ + requireManualDestroy?: boolean; + } + /** * The class AsyncResource was designed to be extended by the embedder's async resources. * Using this users can easily trigger the lifetime events of their own resources. @@ -6089,21 +6108,38 @@ declare module "async_hooks" { * AsyncResource() is meant to be extended. Instantiating a * new AsyncResource() also triggers init. If triggerAsyncId is omitted then * async_hook.executionAsyncId() is used. - * @param type the name of this async resource type - * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created + * @param type The type of async event. + * @param triggerAsyncId The ID of the execution context that created + * this async event (default: `executionAsyncId()`), or an + * AsyncResourceOptions object (since 9.3) */ - constructor(type: string, triggerAsyncId?: number) + constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions); /** * Call AsyncHooks before callbacks. + * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead. */ emitBefore(): void; /** - * Call AsyncHooks after callbacks + * Call AsyncHooks after callbacks. + * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead. */ emitAfter(): void; + /** + * Call the provided function with the provided arguments in the + * execution context of the async resource. This will establish the + * context, trigger the AsyncHooks before callbacks, call the function, + * trigger the AsyncHooks after callbacks, and then restore the original + * execution context. + * @param fn The function to call in the execution context of this + * async resource. + * @param thisArg The receiver to be used for the function call. + * @param args Optional arguments to pass to the function. + */ + runInAsyncScope(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result; + /** * Call AsyncHooks destroy callbacks. */ diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 1eb6539b09..08dbb68b8a 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -1497,6 +1497,8 @@ namespace https_tests { https.request('http://www.example.com/xyz'); + https.globalAgent.options.ca = []; + { const server = new https.Server(); @@ -3333,13 +3335,23 @@ namespace async_hooks_tests { const tId: number = this.triggerAsyncId(); } run() { - this.emitBefore(); - this.emitAfter(); + this.runInAsyncScope(() => {}); + this.runInAsyncScope(Array.prototype.find, [], () => true); } destroy() { this.emitDestroy(); } } + + // check AsyncResource constructor options. + new async_hooks.AsyncResource(''); + new async_hooks.AsyncResource('', 0); + new async_hooks.AsyncResource('', {}); + new async_hooks.AsyncResource('', { triggerAsyncId: 0 }); + new async_hooks.AsyncResource('', { + triggerAsyncId: 0, + requireManualDestroy: true + }); } //////////////////////////////////////////////////// diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 09cbd8bb43..16e54d002d 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1081,7 +1081,9 @@ declare module "https" { secureProtocol?: string; } - export interface Agent extends http.Agent { } + export interface Agent extends http.Agent { + options?: AgentOptions; + } export interface AgentOptions extends http.AgentOptions { pfx?: any; diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index e60b578ccf..2b3be03f8d 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -561,6 +561,8 @@ namespace https_tests { }); https.request('http://www.example.com/xyz'); + + https.globalAgent.options.ca = []; } //////////////////////////////////////////////////// diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 152507c3a8..3ca66a2df5 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -1468,7 +1468,9 @@ declare module "https" { secureProtocol?: string; } - export interface Agent extends http.Agent { } + export interface Agent extends http.Agent { + options?: AgentOptions; + } export interface AgentOptions extends http.AgentOptions { pfx?: any; diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index cd363c708c..6cfb45692b 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -1015,6 +1015,8 @@ namespace https_tests { }); https.request('http://www.example.com/xyz'); + + https.globalAgent.options.ca = []; } //////////////////////////////////////////////////// diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index bdcb47d2e1..748f932d80 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -1528,7 +1528,9 @@ declare module "https" { secureProtocol?: string; } - export interface Agent extends http.Agent { } + export interface Agent extends http.Agent { + options?: AgentOptions; + } export interface AgentOptions extends http.AgentOptions { pfx?: any; diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index 0240dcc120..eb25e01f10 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -1093,6 +1093,8 @@ namespace https_tests { }); https.request('http://www.example.com/xyz'); + + https.globalAgent.options.ca = []; } //////////////////////////////////////////////////// diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index f28c0959a4..1697093de7 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Node.js 8.9.x +// Type definitions for Node.js 8.10.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -18,6 +18,7 @@ // Hannes Magnusson // Alberto Schiabel // Huw +// Nicolas Even // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -1757,6 +1758,7 @@ declare module "https" { export class Agent extends http.Agent { constructor(options?: AgentOptions); + options: AgentOptions; } export class Server extends tls.Server { @@ -5545,18 +5547,18 @@ declare module "util" { export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function promisify(fn: CustomPromisify): TCustom; - export function promisify(fn: (callback: (err: Error, result: TResult) => void) => void): () => Promise; - export function promisify(fn: (callback: (err: Error) => void) => void): () => Promise; - export function promisify(fn: (arg1: T1, callback: (err: Error, result: TResult) => void) => void): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, callback: (err: Error) => void) => void): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise; + export function promisify(fn: (callback: (err: Error | null) => void) => void): () => Promise; + export function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, callback: (err: Error | null) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; export function promisify(fn: Function): Function; export namespace promisify { const custom: symbol; @@ -6052,6 +6054,23 @@ declare module "async_hooks" { */ export function createHook(options: HookCallbacks): AsyncHook; + export interface AsyncResourceOptions { + /** + * The ID of the execution context that created this async event. + * Default: `executionAsyncId()` + */ + triggerAsyncId?: number; + + /** + * Disables automatic `emitDestroy` when the object is garbage collected. + * This usually does not need to be set (even if `emitDestroy` is called + * manually), unless the resource's `asyncId` is retrieved and the + * sensitive API's `emitDestroy` is called with it. + * Default: `false` + */ + requireManualDestroy?: boolean; + } + /** * The class AsyncResource was designed to be extended by the embedder's async resources. * Using this users can easily trigger the lifetime events of their own resources. @@ -6061,10 +6080,12 @@ declare module "async_hooks" { * AsyncResource() is meant to be extended. Instantiating a * new AsyncResource() also triggers init. If triggerAsyncId is omitted then * async_hook.executionAsyncId() is used. - * @param type the name of this async resource type - * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created + * @param type The type of async event. + * @param triggerAsyncId The ID of the execution context that created + * this async event (default: `executionAsyncId()`), or an + * AsyncResourceOptions object (since 8.10) */ - constructor(type: string, triggerAsyncId?: number) + constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions); /** * Call AsyncHooks before callbacks. diff --git a/types/node/v8/node-tests.ts b/types/node/v8/node-tests.ts index 74d4c5c222..b63d494fbd 100644 --- a/types/node/v8/node-tests.ts +++ b/types/node/v8/node-tests.ts @@ -1471,6 +1471,8 @@ namespace https_tests { https.request('http://www.example.com/xyz'); + https.globalAgent.options.ca = []; + { const server = new https.Server(); @@ -3304,6 +3306,16 @@ namespace async_hooks_tests { this.emitDestroy(); } } + + // check AsyncResource constructor options. + new async_hooks.AsyncResource(''); + new async_hooks.AsyncResource('', 0); + new async_hooks.AsyncResource('', {}); + new async_hooks.AsyncResource('', { triggerAsyncId: 0 }); + new async_hooks.AsyncResource('', { + triggerAsyncId: 0, + requireManualDestroy: true + }); } //////////////////////////////////////////////////// diff --git a/types/nodecredstash/index.d.ts b/types/nodecredstash/index.d.ts new file mode 100644 index 0000000000..9b2fed47c8 --- /dev/null +++ b/types/nodecredstash/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for nodecredstash 2.0 +// Project: https://github.com/DavidTanner/nodecredstash +// Definitions by: Mike Cook +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import * as AWS from 'aws-sdk'; + +interface CredstashConfig { + table?: string; + awsOpts?: AWS.KMS.ClientConfiguration; + dynamoOpts?: AWS.DynamoDB.ClientConfiguration; + kmsKey?: string; + kmsOpts?: AWS.KMS.ClientConfiguration; +} + +interface CredstashContext { + [key: string]: string; +} + +interface PutSecretOptions { + name: string; + secret: string; + context: CredstashContext; + digest?: string; + version?: number; +} + +interface Credstash { + getHighestVersion: (options: { name: string }) => Promise; + incrementVersion: (options: { name: string }) => Promise; + putSecret: (options: PutSecretOptions) => Promise; + decryptStash: (stash: { key: string; }, context?: CredstashContext) => Promise; + getAllVersions: (options: { name: string, context?: CredstashContext, limit?: number }) => Promise>; + getSecret: (options: { name: string, context?: CredstashContext, version?: number }) => Promise; + deleteSecrets: (options: { name: string }) => Promise; + deleteSecret: (options: { name: string, version: number }) => Promise; + listSecrets: () => Promise; + getAllSecrets: (options: { version?: number, context?: CredstashContext, startsWith?: string }) => Promise<{ [key: string]: string }>; + createDdbTable: () => Promise; +} + +declare function Credstash(config: CredstashConfig): Credstash; + +export = Credstash; diff --git a/types/nodecredstash/nodecredstash-tests.ts b/types/nodecredstash/nodecredstash-tests.ts new file mode 100644 index 0000000000..f3788adc55 --- /dev/null +++ b/types/nodecredstash/nodecredstash-tests.ts @@ -0,0 +1,59 @@ +import Credstash = require('nodecredstash'); + +const credstash = Credstash({ + awsOpts: { region: 'us-east-1' }, + dynamoOpts: { accessKeyId: 'foo' }, + kmsKey: 'bar', + kmsOpts: { accessKeyId: 'baz' }, + table: 'something' +}); + +credstash.decryptStash({ key: 'foo' }).then((result) => { + return { + id: result.KeyId, + text: result.Plaintext + }; +}); + +credstash.deleteSecret({ name: 'foo', version: 1 }).then((result) => { + if (result.Attributes) return result.Attributes['blah']; + if (result.ConsumedCapacity) return result.ConsumedCapacity.TableName; + if (result.ItemCollectionMetrics) return result.ItemCollectionMetrics.ItemCollectionKey; +}); + +credstash.deleteSecrets({ name: 'foo' }).then((results) => { + const result = results[0]; + if (result.Attributes) return result.Attributes['blah'].toUpperCase(); + if (result.ConsumedCapacity) return result.ConsumedCapacity.TableName; + if (result.ItemCollectionMetrics) return result.ItemCollectionMetrics.ItemCollectionKey; +}); + +credstash.getAllSecrets({ version: 1 }).then((result) => { + return result['foo'].toUpperCase(); +}); + +credstash.getAllVersions({ name: 'foo', context: { bar: 'baz' }, limit: 1 }).then((result) => { + return result[0].secret.toUpperCase() + result[0].version.toUpperCase(); +}); + +credstash.getHighestVersion({ name: 'foo' }).then((result) => { + return result['foo'].S; +}); + +credstash.getSecret({ name: 'foo', version: 1, context: { bar: 'baz' } }).then((result) => { + return result.toUpperCase(); +}); + +credstash.incrementVersion({ name: 'foo' }).then((result) => { + return result.toUpperCase(); +}); + +credstash.listSecrets().then((result) => { + return result.map((str) => str.toUpperCase()); +}); + +credstash.putSecret({ name: 'foo', secret: 'bar', context: { baz: 'qux' }, digest: 'quux', version: 1 }).then((result) => { + if (result.Attributes) return result.Attributes['foo']; + if (result.ConsumedCapacity) return result.ConsumedCapacity.TableName; + if (result.ItemCollectionMetrics) return result.ItemCollectionMetrics.ItemCollectionKey; +}); diff --git a/types/nodecredstash/package.json b/types/nodecredstash/package.json new file mode 100644 index 0000000000..0347abc684 --- /dev/null +++ b/types/nodecredstash/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "aws-sdk": "^2.211.0" + }, + "private": true +} diff --git a/types/nodecredstash/tsconfig.json b/types/nodecredstash/tsconfig.json new file mode 100644 index 0000000000..ec4305243c --- /dev/null +++ b/types/nodecredstash/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "nodecredstash-tests.ts" + ] +} diff --git a/types/nodecredstash/tslint.json b/types/nodecredstash/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/nodecredstash/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 159293057e..3b1173505d 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -1666,18 +1666,6 @@ declare namespace Office { Beta } } - export module cast { - export module item { - function toAppointmentCompose(item: Office.Item): Office.AppointmentCompose; - function toAppointmentRead(item: Office.Item): Office.AppointmentRead; - function toAppointment(item: Office.Item): Office.Appointment; - function toMessageCompose(item: Office.Item): Office.MessageCompose; - function toMessageRead(item: Office.Item): Office.MessageRead; - function toMessage(item: Office.Item): Office.Message; - function toItemCompose(item: Office.Item): Office.ItemCompose; - function toItemRead(item: Office.Item): Office.ItemRead; - } - } export interface AsyncContextOptions { asyncContext?: any; } diff --git a/types/parcel-env/index.d.ts b/types/parcel-env/index.d.ts new file mode 100644 index 0000000000..3de90c93bf --- /dev/null +++ b/types/parcel-env/index.d.ts @@ -0,0 +1,177 @@ +// Type definitions for Parcel (module API) +// Project: https://github.com/parcel/parcel-bundler +// Definitions by: Fathy Boundjadj +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Based on @types/webpack-env + +/** + * Parcel module API - variables and global functions available inside modules + */ + +declare namespace __ParcelModuleApi { + interface RequireFunction { + /** + * Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. + */ + (path: string): any; + (path: string): T; + } + + interface Module { + exports: any; + require(id: string): any; + require(id: string): T; + id: string; + filename: string; + loaded: boolean; + parent: any; + children: any[]; + hot?: Hot; + } + type ModuleId = string|number; + + interface Hot { + /** + * Accept code updates for the specified dependencies. The callback is called when dependencies were replaced. + * @param dependencies + * @param callback + */ + accept(dependencies: string[], callback: (updatedDependencies: ModuleId[]) => void): void; + /** + * Accept code updates for the specified dependencies. The callback is called when dependencies were replaced. + * @param dependency + * @param callback + */ + accept(dependency: string, callback: () => void): void; + /** + * Accept code updates for this module without notification of parents. + * This should only be used if the module doesn’t export anything. + * The errHandler can be used to handle errors that occur while loading the updated module. + * @param errHandler + */ + accept(errHandler?: (err: Error) => void): void; + /** + * Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline". + */ + decline(dependencies: string[]): void; + /** + * Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline". + */ + decline(dependency: string): void; + /** + * Flag the current module as not update-able. If updated the update code would fail with code "decline". + */ + decline(): void; + /** + * Add a one time handler, which is executed when the current module code is replaced. + * Here you should destroy/remove any persistent resource you have claimed/created. + * If you want to transfer state to the new module, add it to data object. + * The data will be available at module.hot.data on the new module. + * @param callback + */ + dispose(callback: (data: any) => void): void; + dispose(callback: (data: T) => void): void; + /** + * Add a one time handler, which is executed when the current module code is replaced. + * Here you should destroy/remove any persistent resource you have claimed/created. + * If you want to transfer state to the new module, add it to data object. + * The data will be available at module.hot.data on the new module. + * @param callback + */ + addDisposeHandler(callback: (data: any) => void): void; + addDisposeHandler(callback: (data: T) => void): void; + /** + * Remove a handler. + * This can useful to add a temporary dispose handler. You could i. e. replace code while in the middle of a multi-step async function. + * @param callback + */ + removeDisposeHandler(callback: (data: any) => void): void; + removeDisposeHandler(callback: (data: T) => void): void; + /** + * Throws an exceptions if status() is not idle. + * Check all currently loaded modules for updates and apply updates if found. + * If no update was found, the callback is called with null. + * If autoApply is truthy the callback will be called with all modules that were disposed. + * apply() is automatically called with autoApply as options parameter. + * If autoApply is not set the callback will be called with all modules that will be disposed on apply(). + * @param autoApply + * @param callback + */ + check(autoApply: boolean, callback: (err: Error, outdatedModules: ModuleId[]) => void): void; + /** + * Throws an exceptions if status() is not idle. + * Check all currently loaded modules for updates and apply updates if found. + * If no update was found, the callback is called with null. + * The callback will be called with all modules that will be disposed on apply(). + * @param callback + */ + check(callback: (err: Error, outdatedModules: ModuleId[]) => void): void; + /** + * If status() != "ready" it throws an error. + * Continue the update process. + * @param options + * @param callback + */ + apply(options: AcceptOptions, callback: (err: Error, outdatedModules: ModuleId[]) => void): void; + /** + * If status() != "ready" it throws an error. + * Continue the update process. + * @param callback + */ + apply(callback: (err: Error, outdatedModules: ModuleId[]) => void): void; + /** + * Return one of idle, check, watch, watch-delay, prepare, ready, dispose, apply, abort or fail. + */ + status(): string; + /** Register a callback on status change. */ + status(callback: (status: string) => void): void; + /** Register a callback on status change. */ + addStatusHandler(callback: (status: string) => void): void; + /** + * Remove a registered status change handler. + * @param callback + */ + removeStatusHandler(callback: (status: string) => void): void; + + active: boolean; + data: any; + } + + interface AcceptOptions { + /** + * If true the update process continues even if some modules are not accepted (and would bubble to the entry point). + */ + ignoreUnaccepted?: boolean; + /** + * Indicates that apply() is automatically called by check function + */ + autoApply?: boolean; + } + /** + * Inside env you can pass any variable + */ + interface NodeProcess { + env?: any; + } + + type __Require1 = (id: string) => any; + type __Require2 = (id: string) => T; + type RequireLambda = __Require1 & __Require2; +} + +interface NodeRequire extends __ParcelModuleApi.RequireFunction { +} + +declare var require: NodeRequire; + +interface NodeModule extends __ParcelModuleApi.Module {} + +declare var module: NodeModule; + +/** +* Declare process variable +*/ +declare namespace NodeJS { + interface Process extends __ParcelModuleApi.NodeProcess {} +} +declare var process: NodeJS.Process; diff --git a/types/parcel-env/parcel-env-tests.ts b/types/parcel-env/parcel-env-tests.ts new file mode 100644 index 0000000000..9c17be0748 --- /dev/null +++ b/types/parcel-env/parcel-env-tests.ts @@ -0,0 +1,76 @@ + + +interface SomeModule { + someMethod(): void; +} + +let someModule = require('./someModule'); +someModule.someMethod(); + +let otherModule = require('./otherModule'); +otherModule.otherMethod(); + +// check if HMR is enabled +if(module.hot) { + // accept update of dependency + module.hot.accept("./handler.js", function() { + //... + }); +} + +module.exports = null; + +// check if HMR is enabled +if(module.hot) { + + // accept itself + module.hot.accept(); + + // dispose handler + module.hot.dispose(function() { + // revoke the side effect + //... + }); +} + +class ModuleData { + updated: boolean; +} + +if (module.hot) { + module.hot.accept((err: Error) => { + //... + }); + + module.hot.decline("./someModule"); + + module.hot.dispose((data: ModuleData) => { + data.updated = true; + // ... + }); + + let disposeHandler: ((data: ModuleData) => void) = data => { + // ... + }; + module.hot.addDisposeHandler(disposeHandler); + module.hot.removeDisposeHandler(disposeHandler); + + module.hot.check(true, (err: Error, outdatedModules: (string|number)[]) => { + // ... + }); + + module.hot.apply({ ignoreUnaccepted: true }, (err: Error, outdatedModules: (string|number)[]) => { + // ... + }); + + var status: string = module.hot.status(); + let statusHandler: ((status: string) => void) = status => { + // ... + }; + module.hot.status(statusHandler); + module.hot.addStatusHandler(statusHandler); + module.hot.removeStatusHandler(statusHandler); +} + + + diff --git a/types/parcel-env/tsconfig.json b/types/parcel-env/tsconfig.json new file mode 100644 index 0000000000..bf765d8bae --- /dev/null +++ b/types/parcel-env/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "parcel-env-tests.ts" + ] +} diff --git a/types/parcel-env/tslint.json b/types/parcel-env/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/parcel-env/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 15d653a791..908281f84d 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for parse 2.4 -// Project: https://parse.com/ +// Type definitions for parse 1.11.1 +// Project: https://parseplatform.org/ // Definitions by: Ullisen Media Group // David Poetzsch-Heffter // Cedric Kemp // Flavio Negrão // Wes Grimes +// Otherwise SAS // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -88,6 +89,7 @@ declare namespace Parse { then(resolvedCallback: (...values: T[]) => IPromise, rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise; + catch(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise; } class Promise implements IPromise { @@ -109,6 +111,7 @@ declare namespace Parse { rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise; + catch(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise; } interface Pointer { @@ -607,6 +610,7 @@ declare namespace Parse { static or(...var_args: Query[]): Query; + aggregate(pipeline: Query.AggregationOptions|Query.AggregationOptions[]): Query; addAscending(key: string): Query; addAscending(key: string[]): Query; addDescending(key: string): Query; @@ -623,6 +627,7 @@ declare namespace Parse { doesNotExist(key: string): Query; doesNotMatchKeyInQuery(key: string, queryKey: string, query: Query): Query; doesNotMatchQuery(key: string, query: Query): Query; + distinct(key: string): Query; each(callback: Function, options?: Query.EachOptions): Promise; endsWith(key: string, suffix: string): Query; equalTo(key: string, value: any): Query; @@ -659,6 +664,17 @@ declare namespace Parse { interface FindOptions extends SuccessFailureOptions, ScopeOptions { } interface FirstOptions extends SuccessFailureOptions, ScopeOptions { } interface GetOptions extends SuccessFailureOptions, ScopeOptions { } + + // According to http://docs.parseplatform.org/rest/guide/#aggregate-queries + interface AggregationOptions { + group?: { objectId?: string, [key:string]: any }; + match?: {[key: string]: any}; + project?: {[key: string]: any}; + limit?: number; + skip?: number; + // Sort documentation https://docs.mongodb.com/v3.2/reference/operator/aggregation/sort/#pipe._S_sort + sort?: {[key: string]: 1|-1}; + } } /** @@ -1151,4 +1167,4 @@ declare module "parse/node" { declare module "parse" { import * as parse from "parse/node"; export = parse -} \ No newline at end of file +} diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index ceb5693087..acb194ed6a 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -134,6 +134,16 @@ function test_query() { query.include("score"); query.include(["score.team"]); + // Find objects that match the aggregation pipeline + query.aggregate({ + group:{ + objectId: '$name' + } + }); + + // Find objects with distinct key + query.distinct('name'); + const testQuery = Parse.Query.or(query, query); } @@ -396,7 +406,7 @@ function test_cloud_functions() { Parse.Cloud.beforeSave('MyCustomClass', (request: Parse.Cloud.BeforeSaveRequest, response: Parse.Cloud.BeforeSaveResponse) => { - + if (request.object.isNew()) { if (!request.object.has('immutable')) return response.error('Field immutable is required') } else { @@ -504,6 +514,15 @@ function test_promise() { // failed }); + // Test promise with a query + const query = new Parse.Query('Test'); + query.find() + .then(() => { + // success + }).catch(() => { + // error + }); + // can check whether an object is a Parse.Promise object or not Parse.Promise.is(resolved); } diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index e636c3e7c1..4b1d56d860 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -514,6 +514,12 @@ declare namespace PouchDB { * How many old revisions we keep track (not a copy) of. */ revs_limit?: number; + /** + * Size of the database (Most significant for Safari) + * option to set the max size in MB that Safari will grant to the local database. Valid options are: 10, 50, 100, 500 and 1000 + * ex_ new PouchDB("dbName", {size:100}); + */ + size?: number; } interface RemoteRequesterConfiguration { diff --git a/types/project-oxford/project-oxford-tests.ts b/types/project-oxford/project-oxford-tests.ts index ea2849d986..b4a76a78c4 100644 --- a/types/project-oxford/project-oxford-tests.ts +++ b/types/project-oxford/project-oxford-tests.ts @@ -1,11 +1,14 @@ -/// - import oxford = require("project-oxford"); import assert = require('assert'); import _Promise = require('bluebird'); import fs = require('fs'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + var client = new oxford.Client(process.env.OXFORD_KEY); // Store variables, no point in calling the api too often diff --git a/types/quixote/quixote-tests.ts b/types/quixote/quixote-tests.ts index 5ee9905ac0..381ee5f5fd 100644 --- a/types/quixote/quixote-tests.ts +++ b/types/quixote/quixote-tests.ts @@ -1,5 +1,7 @@ -/// - +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; function test_createFrame() { var frame: QFrame; diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 9b4ebf5a24..eb4b4569c6 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1481,6 +1481,7 @@ declare namespace R { */ prop

(p: P, obj: T): T[P]; prop

(p: P): (obj: Record) => T; + prop

(p: P): (obj: Record) => T; /** * Determines whether the given property of an object has a specific @@ -1519,6 +1520,7 @@ declare namespace R { */ props

(ps: ReadonlyArray

, obj: Record): T[]; props

(ps: ReadonlyArray

): (obj: Record) => T[]; + props

(ps: ReadonlyArray

): (obj: Record) => T[]; /** * Returns true if the specified object property satisfies the given predicate; false otherwise. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 933b468f09..dbb697e658 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -724,7 +724,9 @@ interface Obj { const list: Book[] = [{id: "xyz", title: "A"}, {id: "abc", title: "B"}]; const a1 = R.indexBy(R.prop("id"), list); const a2 = R.indexBy(R.prop("id"))(list); - const a3 = R.indexBy<{ id: string }>(R.prop("id"))(list); + const a3 = R.indexBy<{ id: string }>(R.prop("id"))(list); + const a4 = R.indexBy(R.prop<"id", string>("id"))(list); + const a5 = R.indexBy<{ id: string }>(R.prop<"id", string>("id"))(list); const titlesIndexedByTitles: { [k: string]: string } = R.pipe( R.map((x: Book) => x.title), @@ -1161,7 +1163,8 @@ type Pair = KeyValuePair; () => { const x = R.prop("x"); - const a: boolean = R.tryCatch(R.prop("x"), R.F)({x: true}); // => true + const a: boolean = R.tryCatch(R.prop("x"), R.F)({x: true}); // => true + const a1: boolean = R.tryCatch(R.prop<"x", true>("x"), R.F)({x: true}); // => true const b: boolean = R.tryCatch(R.prop("x"), R.F)(null); // => false const c: boolean = R.tryCatch(R.and, R.F)(true, true); // => true }; @@ -1754,7 +1757,7 @@ class Rectangle { const format = R.converge( R.call, [ - R.pipe<{}, number, (s: string) => string>(R.prop("indent"), indentN), + R.pipe(R.prop<"indent", number>("indent"), indentN), R.prop("value") ] ); diff --git a/types/react-beautiful-dnd/index.d.ts b/types/react-beautiful-dnd/index.d.ts index 085ad4e8b7..d02c86bbcf 100644 --- a/types/react-beautiful-dnd/index.d.ts +++ b/types/react-beautiful-dnd/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for react-beautiful-dnd 4.0 +// Type definitions for react-beautiful-dnd 6.0 // Project: https://github.com/atlassian/react-beautiful-dnd // Definitions by: varHarrie // Bradley Ayers +// Austin Turner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -12,12 +13,18 @@ export type DraggableId = Id; export type DroppableId = Id; export type TypeId = Id; export type ZIndex = number | string; +export type DropReason = 'DROP' | 'CANCEL'; +export type Announce = (message: string) => void; export interface DraggableLocation { droppableId: DroppableId; index: number; } +export interface HookProvided { + announce: Announce; +} + /** * DragDropContext */ @@ -28,16 +35,18 @@ export interface DragStart { source: DraggableLocation; } -export interface DropResult { - draggableId: DraggableId; - type: TypeId; - source: DraggableLocation; +export interface DragUpdate extends DragStart { destination?: DraggableLocation | null; } +export interface DropResult extends DragUpdate { + reason: DropReason; +} + export interface DragDropContextProps { - onDragStart?(initial: DragStart): void; - onDragEnd(result: DropResult): void; + onDragStart?(initial: DragStart, provided: HookProvided): void; + onDragUpdate?(initial: DragUpdate, provided: HookProvided): void; + onDragEnd(result: DropResult, provided: HookProvided): void; } export class DragDropContext extends React.Component {} @@ -46,9 +55,14 @@ export class DragDropContext extends React.Component {} * Droppable */ +export interface DroppableProvidedProps { + // used for shared global styles + 'data-react-beautiful-dnd-droppable': string; +} export interface DroppableProvided { innerRef(element: HTMLElement | null): any; placeholder?: React.ReactElement | null; + droppableProps: DroppableProvidedProps; } export interface DroppableStateSnapshot { @@ -98,12 +112,14 @@ export interface DraggableProvidedDraggableProps { export interface DraggableProvidedDragHandleProps { onMouseDown: React.MouseEventHandler; onKeyDown: React.KeyboardEventHandler; - onClick: React.MouseEventHandler; + onTouchStart: React.TouchEventHandler; + onTouchMove: React.TouchEventHandler; + 'data-react-beautiful-dnd-drag-handle': string; + 'aria-roledescription': string; tabIndex: number; 'aria-grabbed': boolean; draggable: boolean; - onDragStart(): void; - onDrop(): void; + onDragStart: React.DragEventHandler; } export interface DraggableProvided { @@ -125,6 +141,7 @@ export interface DraggableProps { isDragDisabled?: boolean; disableInteractiveElementBlocking?: boolean; children(provided: DraggableProvided, snapshot: DraggableStateSnapshot): React.ReactElement; + type?: TypeId; } export class Draggable extends React.Component {} diff --git a/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx b/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx index b05ff46550..882b28a9ad 100644 --- a/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx +++ b/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { DragDropContext, Draggable, Droppable, DropResult } from 'react-beautiful-dnd'; +import { DragDropContext, Draggable, Droppable, DropResult, DragStart, DragUpdate, HookProvided } from 'react-beautiful-dnd'; interface Item { id: string; @@ -49,7 +49,15 @@ class App extends React.Component<{}, AppState> { this.onDragEnd = this.onDragEnd.bind(this); } - onDragEnd(result: DropResult) { + onDragStart(dragStart: DragStart, provided: HookProvided) { + // + } + + onDragUpdate(dragUpdate: DragUpdate, provided: HookProvided) { + // + } + + onDragEnd(result: DropResult, provided: HookProvided) { if (!result.destination) { return; } @@ -65,10 +73,10 @@ class App extends React.Component<{}, AppState> { render() { return ( - + {(provided, snapshot) => ( -

+
{this.state.items.map((item, index) => ( {(provided, snapshot) => ( diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index 27f12bccb6..af6edce257 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -97,6 +97,11 @@ declare namespace AdazzleReactDataGrid { * @default rowHeight */ headerRowHeight?: number + /** + * The height of the header filter row in pixels. + * @default 45 + */ + headerFiltersHeight?: number /** * The minimum width of each column in pixels. * @default 80 @@ -163,11 +168,11 @@ declare namespace AdazzleReactDataGrid { enableCellSelect?: boolean /** - * Enables cells to be dragged and dropped + * Enables cells to be dragged and dropped * @default false */ enableDragAndDrop?: boolean - + /** * Called when a cell is selected. * @param coordinates The row and column indices of the selected cell. @@ -211,10 +216,10 @@ declare namespace AdazzleReactDataGrid { * @param props OnRowExpandToggle object */ onRowExpandToggle?: (props: OnRowExpandToggle ) => void - + /** * Responsible for returning an Array of values that can be used for filtering - * a column that is column.filterable and using a column.filterRenderer that + * a column that is column.filterable and using a column.filterRenderer that * displays a list of options. * @param columnKey the column key that we are looking to pull values from */ @@ -485,7 +490,7 @@ declare namespace AdazzleReactDataGrid { * Excel-like grid component built with React, with editors, keyboard navigation, copy & paste, and the like * http://adazzle.github.io/react-data-grid/ */ - export class ReactDataGrid extends React.Component { + export class ReactDataGrid extends React.Component { /** * Opens the editor for the cell (idx) in the given row (rowIdx). If the column is not editable then nothing will happen. */ diff --git a/types/react-form/index.d.ts b/types/react-form/index.d.ts index e2c2823d7f..4ae175d83b 100644 --- a/types/react-form/index.d.ts +++ b/types/react-form/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-form 2.12 +// Type definitions for react-form 2.16 // Project: https://github.com/tannerlinsley/react-form#readme // Definitions by: Cameron McAteer +// Mathieu Masy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -18,7 +19,7 @@ export interface FormErrors { [key: string]: FormError; } export type NestedErrors = Nested; -export type RenderReturn = JSX.Element | false | null; +export type RenderReturn = JSX.Element | false | null | never[]; export interface FormState { values: FormValues; @@ -29,7 +30,10 @@ export interface FormState { } export interface FormProps { + component?: React.ReactType<{ formApi: FormApi }>; + render?: (formApi: FormApi) => RenderReturn; dontValidateOnMount?: boolean; + validateOnSubmit?: boolean; defaultValues?: FormValues; onSubmit?(values: FormValues, submissionEvent: React.SyntheticEvent, formApi: FormApi): void; preSubmit?(values: FormValues, formApi: FormApi): FormValues; @@ -43,6 +47,7 @@ export interface FormProps { [field: string]: (value: FormValue) => Promise }; dontPreventDefault?: boolean; + getApi?: (formApi: FormApi) => void; } export interface FormApi { @@ -137,6 +142,7 @@ export type SelectOptions = Array<{ export interface SelectProps extends FieldProps, React.SelectHTMLAttributes { options: SelectOptions; + placeholder?: string; } export const Select: React.StatelessComponent; diff --git a/types/react-form/react-form-tests.tsx b/types/react-form/react-form-tests.tsx index 2d08cc4b8a..36aa86db94 100644 --- a/types/react-form/react-form-tests.tsx +++ b/types/react-form/react-form-tests.tsx @@ -21,6 +21,50 @@ import { FormApi } from 'react-form'; +// Form Api +class FormApiMethods extends React.Component { + constructor(props: {}) { + super(props); + this.state = {}; + } + + render() { + const FormContent = (props: { formApi?: FormApi }) => ( +
{}}> + + + + ); + + return ( +
+
+ { formApi => ( + + + + + )} + + +
( + + + + + )}> + + +
+ + + +
+
+ ); + } +} + // Basic Form Example const statusOptions = [ { diff --git a/types/react-form/tsconfig.json b/types/react-form/tsconfig.json index d6c6d41dca..d3a981a1be 100644 --- a/types/react-form/tsconfig.json +++ b/types/react-form/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-form-tests.tsx" ] -} \ No newline at end of file +} diff --git a/types/react-i18next/src/I18n.d.ts b/types/react-i18next/src/I18n.d.ts index 122249c6e8..6bc1cf8f0f 100644 --- a/types/react-i18next/src/I18n.d.ts +++ b/types/react-i18next/src/I18n.d.ts @@ -8,7 +8,7 @@ export interface Options { export interface i18nProps { wait?: boolean; - ns: string | string[]; + ns?: string | string[]; nsMode?: string; bindI18n?: string; bindStore?: string; diff --git a/types/react-image-gallery/index.d.ts b/types/react-image-gallery/index.d.ts index 5b10b5925b..45de6e4d0a 100644 --- a/types/react-image-gallery/index.d.ts +++ b/types/react-image-gallery/index.d.ts @@ -79,7 +79,7 @@ declare class ReactImageGallery extends React.Component fullScreen: () => void; exitFullScreen: () => void; slideToIndex: (index: number) => void; - getCurrentIndex: () => void; + getCurrentIndex: () => number; } export default ReactImageGallery; diff --git a/types/react-image-gallery/react-image-gallery-tests.tsx b/types/react-image-gallery/react-image-gallery-tests.tsx index 65fedd7828..04e7d6a6f9 100644 --- a/types/react-image-gallery/react-image-gallery-tests.tsx +++ b/types/react-image-gallery/react-image-gallery-tests.tsx @@ -2,6 +2,14 @@ import * as React from 'react'; import ReactImageGallery, { ReactImageGalleryItem, ReactImageGalleryProps } from 'react-image-gallery'; class ImageGallery extends React.Component { + private gallery: ReactImageGallery | null; + + componentDidMount() { + if (this.gallery) { + const message = `Showing ${this.gallery.getCurrentIndex() + 1}. image the gallery.`; + } + } + render() { const galleryItem: ReactImageGalleryItem = { original: 'http://localhost/logo.jpg', @@ -14,6 +22,6 @@ class ImageGallery extends React.Component { showFullscreenButton: false }; - return ; + return this.gallery = r} {...props} />; } } diff --git a/types/react-infinite-calendar/index.d.ts b/types/react-infinite-calendar/index.d.ts new file mode 100644 index 0000000000..0264c70d91 --- /dev/null +++ b/types/react-infinite-calendar/index.d.ts @@ -0,0 +1,66 @@ +// Type definitions for react-infinite-calendar 2.3 +// Project: https://github.com/clauderic/react-infinite-calendar +// Definitions by: Christian Chown +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from 'react'; + +export interface ReactInfiniteCalendarProps { + selected?: Date | boolean; + width?: number | 'auto'; + height?: number | 'auto'; + min?: Date; + max?: Date; + minDate?: Date; + maxDate?: Date; + disabledDays?: Array<0 | 1 | 2 | 3 | 4 | 5 | 6>; + disabledDates?: Date[]; + display?: 'days' | 'years'; + displayOptions?: { + hideYearsOnSelect?: boolean; + layout?: 'portrait' | 'landscape'; + overscanMonthCount?: number; + shouldHeaderAnimate?: boolean; + showHeader?: boolean; + showMonthsForYears?: boolean; + showOverlay?: boolean; + showTodayHelper?: boolean; + showWeekdays?: boolean; + todayHelperRowOffset?: number; + }; + locale?: { + blank?: string; + headerFormat?: string; + todayLabel?: { + long: string; + }; + weekdays?: string[]; + weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6; + }; + theme?: { + accentColor?: string; + floatingNav?: { + background?: string; + chevron?: string; + color?: string; + }; + headerColor?: string; + selectionColor?: string; + textColor?: { + active?: string; + default?: string; + }; + todayColor?: string; + weekdayColor?: string; + }; + className?: string; + onSelect?: (date: string) => void; + onScroll?: (scrollTop: number) => void; + onScrollEnd?: (scrollTop: number) => void; + rowHeight?: number; + autoFocus?: boolean; + tabIndex?: number; +} + +export default class ReactInfiniteCalendar extends React.Component {} diff --git a/types/react-infinite-calendar/react-infinite-calendar-tests.tsx b/types/react-infinite-calendar/react-infinite-calendar-tests.tsx new file mode 100644 index 0000000000..ff1918d539 --- /dev/null +++ b/types/react-infinite-calendar/react-infinite-calendar-tests.tsx @@ -0,0 +1,61 @@ +import * as React from 'react'; +import ReactInfiniteCalendar from 'react-infinite-calendar'; + +const test: React.SFC = () => ( + {}} + onScroll={(scrollTop: number) => { console.log(scrollTop); }} + onScrollEnd={(scrollTop: number) => { console.log(scrollTop); }} + rowHeight={40} + autoFocus={false} + tabIndex={1} + /> +); diff --git a/types/react-infinite-calendar/tsconfig.json b/types/react-infinite-calendar/tsconfig.json new file mode 100644 index 0000000000..dab62fb64c --- /dev/null +++ b/types/react-infinite-calendar/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-infinite-calendar-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-infinite-calendar/tslint.json b/types/react-infinite-calendar/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/react-infinite-calendar/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/react-native-collapsible/Accordion.d.ts b/types/react-native-collapsible/Accordion.d.ts index 2a2fc04a9f..d4f3ae0dab 100644 --- a/types/react-native-collapsible/Accordion.d.ts +++ b/types/react-native-collapsible/Accordion.d.ts @@ -5,7 +5,7 @@ export interface AccordionProps { /** * An array of sections passed to the render methods */ - sections: string[]; + sections: any[]; /** * A function that should return a renderable representing the header diff --git a/types/react-native-collapsible/index.d.ts b/types/react-native-collapsible/index.d.ts index bdfc7cde09..bc107f140a 100644 --- a/types/react-native-collapsible/index.d.ts +++ b/types/react-native-collapsible/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-native-collapsible 0.8 // Project: https://github.com/oblador/react-native-collapsible // Definitions by: Kyle Roach +// Umidbek Karimov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/react-native-collapsible/react-native-collapsible-tests.tsx b/types/react-native-collapsible/react-native-collapsible-tests.tsx index 1107084f3d..65dd0015b8 100644 --- a/types/react-native-collapsible/react-native-collapsible-tests.tsx +++ b/types/react-native-collapsible/react-native-collapsible-tests.tsx @@ -36,3 +36,27 @@ class AccordianTest extends React.Component { ); } } + +class AccordionComplexTest extends React.Component { + _renderHeader() { + return ( + + ); + } + + _renderContent() { + return ( + + ); + } + + render() { + return ( + + ); + } +} diff --git a/types/react-native-collapsible/tsconfig.json b/types/react-native-collapsible/tsconfig.json index c9cb0c9278..7b0c98aa63 100644 --- a/types/react-native-collapsible/tsconfig.json +++ b/types/react-native-collapsible/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ + "dom", "es6" ], "noImplicitAny": true, @@ -22,4 +23,4 @@ "Accordion.d.ts", "react-native-collapsible-tests.tsx" ] -} \ No newline at end of file +} diff --git a/types/react-native-elevated-view/index.d.ts b/types/react-native-elevated-view/index.d.ts new file mode 100644 index 0000000000..4ad853294b --- /dev/null +++ b/types/react-native-elevated-view/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for react-native-elevated-view 0.0 +// Project: https://github.com/alekhurst/react-native-elevated-view +// Definitions by: fhelwanger +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from 'react'; +import * as ReactNative from 'react-native'; + +export interface ElevatedViewProperties extends ReactNative.ViewProperties { + elevation?: number; +} + +export default class ElevatedView extends React.Component {} diff --git a/types/react-native-elevated-view/react-native-elevated-view-tests.tsx b/types/react-native-elevated-view/react-native-elevated-view-tests.tsx new file mode 100644 index 0000000000..f66932b1bf --- /dev/null +++ b/types/react-native-elevated-view/react-native-elevated-view-tests.tsx @@ -0,0 +1,10 @@ +import * as React from "react"; +import ElevatedView from "react-native-elevated-view"; + +() => { + ; +}; + +() => { + ; +}; diff --git a/types/react-native-elevated-view/tsconfig.json b/types/react-native-elevated-view/tsconfig.json new file mode 100644 index 0000000000..89b476781c --- /dev/null +++ b/types/react-native-elevated-view/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-elevated-view-tests.tsx" + ] +} diff --git a/types/react-native-elevated-view/tslint.json b/types/react-native-elevated-view/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-elevated-view/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-native-material-ui/index.d.ts b/types/react-native-material-ui/index.d.ts index e643b4198f..89b01d13bc 100644 --- a/types/react-native-material-ui/index.d.ts +++ b/types/react-native-material-ui/index.d.ts @@ -426,6 +426,7 @@ export interface Searchable { onSearchClosed?(): void; onSearchPressed?(): void; onSubmitEditing?(): void; + onSearchCloseRequested?(): void; } export interface ToolBarRightElement { diff --git a/types/react-native-material-ui/react-native-material-ui-tests.tsx b/types/react-native-material-ui/react-native-material-ui-tests.tsx index b4380fc388..5aed665ec4 100644 --- a/types/react-native-material-ui/react-native-material-ui-tests.tsx +++ b/types/react-native-material-ui/react-native-material-ui-tests.tsx @@ -11,7 +11,8 @@ import { Checkbox, Dialog, DialogDefaultActions, - BottomNavigation + BottomNavigation, + Toolbar } from 'react-native-material-ui'; const theme = { @@ -113,3 +114,27 @@ class BottomNavigationExample extends React.Component { ); } } + +class ToolbarExample extends React.Component<{}, {search: string}> { + state = { + search: '' + }; + + handleResults(search: string) { + this.setState({ search }); + } + + render() { + return ( + this.handleResults(text), + onSearchCloseRequested: () => this.handleResults(''), + }} + /> + ); + } +} diff --git a/types/react-native-navigation/index.d.ts b/types/react-native-navigation/index.d.ts index 5b5344a4d5..96b21b01e2 100644 --- a/types/react-native-navigation/index.d.ts +++ b/types/react-native-navigation/index.d.ts @@ -128,7 +128,7 @@ export class Navigator { toggleDrawer(params: { side: 'left' | 'right'; animated?: boolean; to?: 'open' | 'closed' }): void; setDrawerEnabled(params: { side: 'left' | 'right'; enabled: boolean }): void; toggleTabs(params: { to: 'hidden' | 'shown'; animated?: boolean }): void; - setTabBadge(params?: { tabIndex?: number; badge?: number; badgeColor?: string; }): void; + setTabBadge(params?: { tabIndex?: number; badge: number | null; badgeColor?: string; }): void; setTabButton(params?: { tabIndex?: number; icon?: any; selectedIcon?: any; label?: string; }): void; switchToTab(params?: { tabIndex?: number }): void; toggleNavBar(params: { to: 'hidden' | 'shown'; animated?: boolean }): void; @@ -241,6 +241,8 @@ export type SystemItemIOS = 'done' | 'cancel' | 'edit' | 'save' | 'add' | 'bookmarks' | 'search' | 'refresh' | 'stop' | 'camera' | 'trash' | 'play' | 'pause' | 'rewind' | 'fastForward' | 'undo' | 'redo'; +export type ShowAsActionAndroid = 'ifRoom' | 'always' | 'withText' | 'never'; + export interface NavigatorButton { id: string | IdAndroid; title?: string; @@ -254,6 +256,7 @@ export interface NavigatorButton { buttonFontSize?: number; buttonFontWeight?: string | number; systemItem?: SystemItemIOS; + showAsAction?: ShowAsActionAndroid; } export interface FABAndroid { diff --git a/types/react-native-navigation/react-native-navigation-tests.tsx b/types/react-native-navigation/react-native-navigation-tests.tsx index b67aa3cfed..6feb7bc397 100644 --- a/types/react-native-navigation/react-native-navigation-tests.tsx +++ b/types/react-native-navigation/react-native-navigation-tests.tsx @@ -11,6 +11,7 @@ class Screen1 extends React.Component +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +export function openDatabase(params: DatabaseParams, success?: () => void, error?: (e: SQLError) => void): SQLiteDatabase; +export function deleteDatabase(params: DatabaseParams, success?: () => void, error?: (err: SQLError) => void): void; +export type Location = 'default' | 'Library' | 'Documents'; +export interface DatabaseOptionalParams { + createFromLocation?: number | string; + // Database encryption pass phrase + key?: string; + readOnly?: boolean; +} + +export interface DatabaseParams extends DatabaseOptionalParams { + name: string; + /** + * Affects iOS database file location + * 'default': Library/LocalDatabase subdirectory - NOT visible to iTunes and NOT backed up by iCloud + * 'Library': Library subdirectory - backed up by iCloud, NOT visible to iTunes + * 'Documents': Documents subdirectory - visible to iTunes and backed up by iCloud + */ + location: Location; +} + +export interface ResultSet { + insertId: number; + rowsAffected: number; + rows: ResultSetRowList; +} + +export interface ResultSetRowList { + length: number; + item(index: number): any; +} + +export enum SQLErrors { + UNKNOWN_ERR = 0, + DATABASE_ERR = 1, + VERSION_ERR = 2, + TOO_LARGE_ERR = 3, + QUOTA_ERR = 4, + SYNTAX_ERR = 5, + CONSTRAINT_ERR = 6, + TIMEOUT_ERR = 7 +} + +export interface SQLError { + code: number; + message: string; +} + +export type StatementCallback = (transaction: Transaction, resultSet: ResultSet) => void; +export type StatementErrorCallback = (transaction: Transaction, error: SQLError) => void; +export interface Transaction { + executeSql(sqlStatement: string, arguments?: any[], callback?: StatementCallback, errorCallback?: StatementErrorCallback): void; +} + +export type TransactionCallback = (transaction: Transaction) => void; +export type TransactionErrorCallback = (error: SQLError) => void; + +export interface SQLiteDatabase { + transaction(scope: (tx: Transaction) => void, error?: TransactionErrorCallback, success?: TransactionCallback): void; + readTransaction(scope: (tx: Transaction) => void, error?: TransactionErrorCallback, success?: TransactionCallback): void; + close(success: () => void, error: (err: SQLError) => void): void; + executeSql(statement: string, params?: any[], success?: StatementCallback, error?: StatementErrorCallback): void; + attach(nameToAttach: string, alias: string, success?: () => void, error?: (err: SQLError) => void): void; + dettach(alias: string, success?: () => void, error?: (err: SQLError) => void): void; +} diff --git a/types/react-native-sqlite-storage/react-native-sqlite-storage-tests.ts b/types/react-native-sqlite-storage/react-native-sqlite-storage-tests.ts new file mode 100644 index 0000000000..76451cfe32 --- /dev/null +++ b/types/react-native-sqlite-storage/react-native-sqlite-storage-tests.ts @@ -0,0 +1,16 @@ +import * as sqlite from 'react-native-sqlite-storage'; + +const db = sqlite.openDatabase({name: 'test.db', location: 'default'}, () => { + db.transaction((tx) => { + tx.executeSql('SELECT * FROM Employees a, Departments b WHERE a.department = b.department_id', [], (tx, results) => { + // Get rows with Web SQL Database spec compliance. + const len = results.rows.length; + for (let i = 0; i < len; i++) { + const row = results.rows.item(i); + const log = `Employee name: ${row.name}, Dept Name: ${row.deptName}`; + } + }); + }); +}, (err) => { + // log error +}); diff --git a/types/react-native-sqlite-storage/tsconfig.json b/types/react-native-sqlite-storage/tsconfig.json new file mode 100644 index 0000000000..9039a8e62b --- /dev/null +++ b/types/react-native-sqlite-storage/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-native-sqlite-storage-tests.ts" + ] +} diff --git a/types/react-native-sqlite-storage/tslint.json b/types/react-native-sqlite-storage/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-sqlite-storage/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-native-text-input-mask/index.d.ts b/types/react-native-text-input-mask/index.d.ts new file mode 100644 index 0000000000..e95e68d7f7 --- /dev/null +++ b/types/react-native-text-input-mask/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for react-native-text-input-mask 0.7 +// Project: https://github.com/react-native-community/react-native-text-input-mask +// Definitions by: Rodrigo Weber +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; +import * as ReactNative from "react-native"; + +export type onChangeTextCallback = (formatted: string, extracted: string) => void; + +export interface TextInputMaskProps { + maskDefaultValue?: boolean; + mask: string; + value?: string; + onChangeText: onChangeTextCallback; + keyboardType?: 'default' | 'numeric' | 'email-address' | 'phone-pad'; +} + +export default class TextInputMask extends React.Component { } diff --git a/types/react-native-text-input-mask/react-native-text-input-mask-tests.tsx b/types/react-native-text-input-mask/react-native-text-input-mask-tests.tsx new file mode 100644 index 0000000000..918a994e35 --- /dev/null +++ b/types/react-native-text-input-mask/react-native-text-input-mask-tests.tsx @@ -0,0 +1,16 @@ +import * as React from 'react'; +import TextInputMask from 'react-native-text-input-mask'; + +class Example extends React.Component { + render() { + return ( + { + console.log(formatted); // +1 (123) 456-78-90 + console.log(extracted); // 1234567890 + }} + mask={"+1 ([000]) [000] [00] [00]"} + /> + ); + } +} diff --git a/types/react-native-text-input-mask/tsconfig.json b/types/react-native-text-input-mask/tsconfig.json new file mode 100644 index 0000000000..c9b3f10fc3 --- /dev/null +++ b/types/react-native-text-input-mask/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-text-input-mask-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-native-text-input-mask/tslint.json b/types/react-native-text-input-mask/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-text-input-mask/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 5abf96e04c..934b738293 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -6,6 +6,7 @@ // Tim Wang // Kamal Mahyuddin // Naoufal El Yousfi +// Alex Dunne // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -6125,6 +6126,7 @@ export interface ActionSheetIOSOptions { cancelButtonIndex?: number; destructiveButtonIndex?: number; message?: string; + tintColor?: string; } export interface ShareActionSheetIOSOptions { @@ -6550,7 +6552,7 @@ export interface BackAndroidStatic { */ export interface BackHandlerStatic { exitApp(): void; - addEventListener(eventName: BackPressEventName, handler: () => void): void; + addEventListener(eventName: BackPressEventName, handler: () => void): NativeEventSubscription; removeEventListener(eventName: BackPressEventName, handler: () => void): void; } @@ -8257,26 +8259,71 @@ interface ImageEditorStatic { ): void; } -export interface ARTShapeProps { - d: string; - strokeWidth: number; +export interface ARTNodeMixin { + opacity?: number; + originX?: number; + originY?: number; + scaleX?: number; + scaleY?: number; + scale?: number; + title?: string; + x?: number; + y?: number; + visible?: boolean; +} + +export interface ARTGroupProps extends ARTNodeMixin { + width?: number; + height?: number; +} + +export interface ARTClippingRectangleProps extends ARTNodeMixin { + width?: number; + height?: number; +} + +export interface ARTRenderableMixin extends ARTNodeMixin { + fill?: string; + stroke?: string; + strokeCap?: "butt" | "square" | "round"; strokeDash?: number[]; - stroke: string; + strokeJoin?: "bevel" | "miter" | "round"; + strokeWidth?: number; +} + +export interface ARTShapeProps extends ARTRenderableMixin { + d: string; + width?: number; + height?: number; +} + +export interface ARTTextProps extends ARTRenderableMixin { + font?: string; + alignment?: string; } export interface ARTSurfaceProps { - style: StyleProp; + style?: StyleProp; width: number; height: number; } +export interface ClippingRectangleStatic extends React.ComponentClass {} + +export interface GroupStatic extends React.ComponentClass {} + export interface ShapeStatic extends React.ComponentClass {} export interface SurfaceStatic extends React.ComponentClass {} +export interface ARTTextStatic extends React.ComponentClass {} + export interface ARTStatic { + ClippingRectangle: ClippingRectangleStatic; + Group: GroupStatic; Shape: ShapeStatic; Surface: SurfaceStatic; + Text: ARTTextStatic; } export interface KeyboardStatic extends NativeEventEmitter { diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 879a0c522d..65db445695 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -17,6 +17,7 @@ import { AppState, AppStateIOS, BackAndroid, + BackHandler, Button, DataSourceAssetCallback, DeviceEventEmitterStatic, @@ -73,6 +74,8 @@ function testDimensions() { Dimensions.removeEventListener('change', dimensionsListener); } +BackHandler.addEventListener("hardwareBackPress", () => {}).remove(); + BackAndroid.addEventListener("hardwareBackPress", () => {}); interface LocalStyles { diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 0e6bb2d94c..9ec404a6fb 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-navigation 1.2 +// Type definitions for react-navigation 1.5 // Project: https://github.com/react-navigation/react-navigation // Definitions by: Huhuanming // mhcgrq @@ -45,7 +45,6 @@ export interface HeaderProps extends NavigationSceneRendererProps { mode: HeaderMode; router: NavigationRouter< NavigationState, - NavigationAction, NavigationStackScreenOptions >; getScreenDetails: (navigationScene: NavigationScene) => NavigationScreenDetails< @@ -75,9 +74,9 @@ export interface NavigationState { routes: any[]; } -export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; +export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; -export interface NavigationLeafRoute { +export interface NavigationLeafRoute { /** * React's key used by some navigators. No need to specify these manually, * they will be defined by the router. @@ -96,23 +95,23 @@ export interface NavigationLeafRoute { * Params passed to this route when navigating to it, * e.g. `{ car_id: 123 }` in a route that displays a car. */ - params?: NavigationParams; + params?: Params; } -export type NavigationStateRoute = NavigationLeafRoute & NavigationState; +export type NavigationStateRoute = NavigationLeafRoute & NavigationState; export type NavigationScreenOptionsGetter = ( - navigation: NavigationScreenProp, + navigation: NavigationScreenProp>, screenProps?: { [key: string]: any } ) => Options; -export interface NavigationRouter { +export interface NavigationRouter { /** * The reducer that outputs the new navigation state for a given action, with * an optional previous state. When the action is considered handled but the * state is unchanged, the output state is null. */ - getStateForAction: (action: Action, lastState?: State) => (State | null); + getStateForAction: (action: NavigationAction, lastState?: State) => (State | null); /** * Maps a URI-like string to an action. This can be mapped to a state @@ -121,7 +120,7 @@ export interface NavigationRouter { getActionForPathAndParams: ( path: string, params?: NavigationParams - ) => (Action | null); + ) => (NavigationAction | null); getPathAndParamsForState: ( state: State @@ -175,16 +174,22 @@ export type NavigationScreenConfig = export type NavigationComponent = NavigationScreenComponent - | NavigationNavigator; + | NavigationNavigator; -export interface NavigationScreenComponent extends React.ComponentClass { - navigationOptions?: NavigationScreenConfig; -} +export type NavigationScreenComponent< + Options = {}, + Props = {} +> = React.ComponentType & Props> & +({} | { navigationOptions: NavigationScreenConfig }); -export interface NavigationNavigator extends React.ComponentClass { - router?: NavigationRouter; - navigationOptions?: NavigationScreenConfig; -} +export type NavigationNavigator< + State = NavigationState, + Options = {}, + Props = {} +> = React.ComponentType & Props> & { + router: NavigationRouter, + navigationOptions?: NavigationScreenConfig, +}; export interface NavigationParams { [key: string]: any; @@ -452,10 +457,10 @@ export interface NavigationScreenProp { popToTop: (params?: { immediate?: boolean }) => boolean; } -export interface NavigationNavigatorProps { +export interface NavigationNavigatorProps { navigation?: NavigationProp; screenProps?: { [key: string]: any }; - navigationOptions?: any; + navigationOptions?: O; } /** @@ -587,7 +592,7 @@ export interface NavigationContainerProps { export interface NavigationContainer extends React.ComponentClass< NavigationContainerProps & NavigationNavigatorProps > { - router: NavigationRouter; + router: NavigationRouter; screenProps: { [key: string]: any }; navigationOptions: any; state: { nav: NavigationState | null }; @@ -810,7 +815,7 @@ export class Transitioner extends React.Component< export function TabRouter( routeConfigs: NavigationRouteConfigMap, config: NavigationTabRouterConfig -): NavigationRouter; +): NavigationRouter; /** * Stack Router @@ -820,19 +825,19 @@ export function TabRouter( export function StackRouter( routeConfigs: NavigationRouteConfigMap, config: NavigationTabRouterConfig -): NavigationRouter; +): NavigationRouter; /** * Create Navigator * * @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js */ -export function createNavigator( - router: NavigationRouter, +export function createNavigator( + router: NavigationRouter, routeConfigs?: NavigationRouteConfigMap, navigatorConfig?: {} | null, navigatorType?: NavigatorType -): (NavigationView: React.ComponentClass) => NavigationNavigator; +): (NavigationView: React.ComponentClass) => NavigationNavigator; /** * Create an HOC that injects the navigation and manages the navigation state @@ -843,7 +848,7 @@ export function createNavigator( * @see https://github.com/react-navigation/react-navigation/blob/master/src/createNavigationContainer.js */ export function createNavigationContainer( - Component: NavigationNavigator + Component: NavigationNavigator ): NavigationContainer; /** * END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS @@ -853,8 +858,8 @@ export function createNavigationContainer( * BEGIN CUSTOM CONVENIENCE INTERFACES */ -export interface NavigationScreenProps { - navigation: NavigationScreenProp; +export interface NavigationScreenProps { + navigation: NavigationScreenProp>; screenProps?: { [key: string]: any }; navigationOptions?: NavigationScreenConfig; } diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index d0e65dfc8e..5c03253d35 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -36,6 +36,7 @@ import { NavigationParams, NavigationPopAction, NavigationPopToTopAction, + NavigationScreenComponent, } from 'react-navigation'; // Constants @@ -48,14 +49,19 @@ const viewStyle: ViewStyle = { const ROUTE_NAME_START_SCREEN = "StartScreen"; +interface StartScreenNavigationParams { + id: number; + s: string; +} + /** * @desc Simple screen component class with typed component props that should * receive the navigation prop from the AppNavigator. */ -class StartScreen extends React.Component { +class StartScreen extends React.Component> { render() { // Implicit type checks. - const navigationStateParams = this.props.navigation.state.params; + const navigationStateParams: StartScreenNavigationParams | undefined = this.props.navigation.state.params; const id = this.props.navigation.state.params && this.props.navigation.state.params.id; const s = this.props.navigation.state.params && this.props.navigation.state.params.s; @@ -84,10 +90,15 @@ class StartScreen extends React.Component { const ROUTE_NAME_NEXT_SCREEN = "NextScreen"; -class NextScreen extends React.Component { +interface NextScreenNavigationParams { + id: number; + name: string; +} + +class NextScreen extends React.Component> { render() { // Implicit type checks. - const navigationStateParams = this.props.navigation.state.params; + const navigationStateParams: NextScreenNavigationParams | undefined = this.props.navigation.state.params; const id = this.props.navigation.state.params && this.props.navigation.state.params.id; const name = this.props.navigation.state.params && this.props.navigation.state.params.name; @@ -100,7 +111,7 @@ class NextScreen extends React.Component { const navigationOptions = { headerBackTitle: null, }; -const initialRouteParams: NavigationParams = { +const initialRouteParams: StartScreenNavigationParams = { id: 1, s: "Start", }; @@ -123,6 +134,16 @@ export const AppNavigator = StackNavigator( }, ); +const StatelessScreen: NavigationScreenComponent = () => ; + +const SimpleStackNavigator = StackNavigator( + { + simple: { + screen: StatelessScreen, + }, + } +); + /** * Router. */ diff --git a/types/react-notification-system/index.d.ts b/types/react-notification-system/index.d.ts index 8176ad097c..a993f6cc4d 100644 --- a/types/react-notification-system/index.d.ts +++ b/types/react-notification-system/index.d.ts @@ -12,6 +12,7 @@ declare namespace NotificationSystem { addNotification(notification: Notification): Notification; removeNotification(uidOrNotification: number | string | Notification): void; clearNotifications(): void; + editNotification(uidOrNotification: number | string | Notification, newNotification: Notification): void; } export type CallBackFunction = (notification: Notification) => void; diff --git a/types/react-router-dom/index.d.ts b/types/react-router-dom/index.d.ts index c5b795761c..9165f1182e 100644 --- a/types/react-router-dom/index.d.ts +++ b/types/react-router-dom/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ReactTraining/react-router // Definitions by: Tanguy Krotoff // Huy Nguyen +// Philip Jackson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -44,6 +45,7 @@ export class HashRouter extends React.Component {} export interface LinkProps extends React.AnchorHTMLAttributes { to: H.LocationDescriptor; replace?: boolean; + innerRef?: (node: HTMLAnchorElement | null) => void; } export class Link extends React.Component {} diff --git a/types/react-router-dom/react-router-dom-tests.tsx b/types/react-router-dom/react-router-dom-tests.tsx index c748405580..0fedbe412e 100644 --- a/types/react-router-dom/react-router-dom-tests.tsx +++ b/types/react-router-dom/react-router-dom-tests.tsx @@ -2,7 +2,8 @@ import * as React from 'react'; import { NavLink, NavLinkProps, - match + match, + Link } from 'react-router-dom'; import * as H from 'history'; @@ -19,3 +20,8 @@ export default function(props: Props) { ); } + +; + +const acceptRef = (node: HTMLAnchorElement | null) => {}; +; diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index 7adf0d0750..e2a0520154 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -11,6 +11,7 @@ // Ian Johnson // Anton Novik // David Schkalee +// Arthur Udalov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -18,12 +19,15 @@ import * as React from 'react'; export default class ReactSelectClass extends React.Component> { focus(): void; + setValue(value: Option): void; } // Other components export class Creatable extends React.Component> { } export class Async extends React.Component> { } export class AsyncCreatable extends React.Component> { } +export type OptionComponentType = React.ComponentType>; + export type HandlerRendererResult = JSX.Element | null | false; // Handlers @@ -128,6 +132,16 @@ export interface MenuRendererProps { * Array of currently selected options. */ valueArray: Options; + + /** + * Callback to remove selection from option; receives the option as a parameter. + */ + removeValue: SelectValueHandler; + + /** + * function which returns a custom way to render the options in the menu + */ + optionRenderer: OptionRendererHandler; } export interface OptionComponentProps { @@ -196,6 +210,11 @@ export interface ArrowRendererProps { * Arrow mouse down event handler. */ onMouseDown: React.MouseEventHandler; + + /** + * whether the Select is open or not. + */ + isOpen: boolean; } export interface ReactSelectProps extends React.Props> { @@ -449,7 +468,7 @@ export interface ReactSelectProps extends React.Props>; + optionComponent?: OptionComponentType; /** * function which returns a custom way to render the options in the menu */ diff --git a/types/react-select/lib/Option/index.d.ts b/types/react-select/lib/Option/index.d.ts new file mode 100644 index 0000000000..0f9e97d540 --- /dev/null +++ b/types/react-select/lib/Option/index.d.ts @@ -0,0 +1,5 @@ +import { OptionComponentType } from '../../'; + +declare const OptionComponent: OptionComponentType; + +export default OptionComponent; diff --git a/types/react-select/lib/utils/defaultMenuRenderer/index.d.ts b/types/react-select/lib/utils/defaultMenuRenderer/index.d.ts new file mode 100644 index 0000000000..baf530d59d --- /dev/null +++ b/types/react-select/lib/utils/defaultMenuRenderer/index.d.ts @@ -0,0 +1,3 @@ +import { MenuRendererProps } from '../../../'; + +export default function defaultMenuRenderer(props: MenuRendererProps): JSX.Element[]; diff --git a/types/react-select/react-select-tests.tsx b/types/react-select/react-select-tests.tsx index 3635fe3145..a6b450f513 100644 --- a/types/react-select/react-select-tests.tsx +++ b/types/react-select/react-select-tests.tsx @@ -1,5 +1,7 @@ import * as React from "react"; import ReactSelect, * as ReactSelectModule from "react-select"; +import defaultMenuRenderer from 'react-select/lib/utils/defaultMenuRenderer'; +import DefaultOptionComponent from 'react-select/lib/Option'; declare function describe(desc: string, f: () => void): void; declare function it(desc: string, f: () => void): void; @@ -126,6 +128,22 @@ describe("react-select", () => { } }); + it("setValue method", () => { + class Component extends React.PureComponent { + private readonly selectRef = (component: ReactSelect) => { + component.setValue({ + value: 'value' + }); + } + + render() { + return ; + } + } + }); + it("Overriding default key-down behavior with onInputKeyDown", () => { const keyDownHandler: ReactSelectModule.OnInputKeyDownHandler = (event => { const divEvent = event as React.KeyboardEvent; @@ -246,7 +264,13 @@ describe("Examples", () => { private readonly menuRenderer: ReactSelectModule.MenuRendererHandler = props => { const options = props.options.map(option => { - return
{option.label}
; + return ( +
+
{option.label}
+
{props.optionRenderer({})}
+
+ ); }); return
{options}
; @@ -289,6 +313,41 @@ describe("Examples", () => { } }); + it("Extend default menu renderer", () => { + return class Component extends React.Component { + private readonly menuRenderer: ReactSelectModule.MenuRendererHandler = props => { + return
defaultMenuRenderer(props)
; + } + + render() { + return ; + } + }; + }); + + it("Extend default Option component", () => { + function OptionComponent(props: ReactSelectModule.OptionComponentProps) { + const {option, isFocused, isSelected} = props; + + return ( + + + {isSelected ? '+' : '-'} + {option.label} + + + ); + } + + return ( + + ); + }); + it("Input render example", () => { class Component extends React.Component { private readonly onSelectChange: ReactSelectModule.OnChangeSingleHandler = option => { @@ -330,6 +389,19 @@ describe("Examples", () => { />; }); + it("Arrow render example", () => { + return ( + ( +
+ )} + /> + ); + }); + it("Option render with custom value option", () => { const optionRenderer = (option: ReactSelectModule.Option): ReactSelectModule.HandlerRendererResult => null; diff --git a/types/react-select/tsconfig.json b/types/react-select/tsconfig.json index 727747e72c..7855eceaf1 100644 --- a/types/react-select/tsconfig.json +++ b/types/react-select/tsconfig.json @@ -1,6 +1,8 @@ { "files": [ "index.d.ts", + "lib/Option/index.d.ts", + "lib/utils/defaultMenuRenderer/index.d.ts", "react-select-tests.tsx" ], "compilerOptions": { @@ -22,4 +24,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} \ No newline at end of file +} diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index 441e0bb61b..0a0efc7f31 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -51,13 +51,12 @@ export interface ExtendedNodeData extends NodeData { export interface OnVisibilityToggleData extends FullTree, TreeNode { expanded: boolean; } -export interface PreviousAnNextLocation { - prevPath: number[]; - prevParent: TreeItem; +export interface PreviousAndNextLocation { prevTreeIndex: number; - nextPath: number[]; - nextParent: TreeItem; + prevPath: number[]; nextTreeIndex: number; + nextPath: number[]; + nextParentNode: TreeItem; } export type NodeRenderer = React.ComponentClass; @@ -113,7 +112,7 @@ export interface ReactSortableTreeProps { onMoveNode?(data: NodeData & FullTree): void; onVisibilityToggle?(data: OnVisibilityToggleData): void; canDrag?: ((data: ExtendedNodeData) => boolean) | boolean; - canDrop?(data: PreviousAnNextLocation & NodeData): boolean; + canDrop?(data: PreviousAndNextLocation & NodeData): boolean; reactVirtualizedListProps?: ListProps; rowHeight?: ((info: Index) => number) | number; slideRegionSize?: number; diff --git a/types/react-sortable-tree/react-sortable-tree-tests.tsx b/types/react-sortable-tree/react-sortable-tree-tests.tsx index 154a7284c6..d67e6ad123 100644 --- a/types/react-sortable-tree/react-sortable-tree-tests.tsx +++ b/types/react-sortable-tree/react-sortable-tree-tests.tsx @@ -11,7 +11,7 @@ import SortableTree, ExtendedNodeData, FullTree, OnVisibilityToggleData, - PreviousAnNextLocation, + PreviousAndNextLocation, PlaceholderRendererProps } from "react-sortable-tree"; import { ListProps, ListRowRenderer } from "react-virtualized"; @@ -55,7 +55,7 @@ class Test extends React.Component { onMoveNode={(data: NodeData & FullTree) => {}} onVisibilityToggle={(data: OnVisibilityToggleData) => {}} canDrag={true} - canDrop={(data: PreviousAnNextLocation & NodeData) => true} + canDrop={(data: PreviousAndNextLocation & NodeData) => true} reactVirtualizedListProps={reactVirtualizedListProps} rowHeight={62} slideRegionSize={100} diff --git a/types/react-stripe-elements/index.d.ts b/types/react-stripe-elements/index.d.ts index 56f0f3c33a..0ef90dc839 100644 --- a/types/react-stripe-elements/index.d.ts +++ b/types/react-stripe-elements/index.d.ts @@ -47,7 +47,7 @@ export namespace ReactStripeElements { className?: string; - elementRef?(): void; + elementRef?(ref: any): void; onChange?(event: ElementChangeResponse): void; diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts index 503b5f4e02..b463807003 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -642,9 +642,6 @@ export interface RowInfo { /** An array of any expandable sub-rows contained in this row */ subRows: any[]; - - /** Original object passed to row */ - original: any; } export interface FinalState extends TableProps { diff --git a/types/react-virtualized/dist/es/Grid.d.ts b/types/react-virtualized/dist/es/Grid.d.ts index 630e64df69..1cc1623a04 100644 --- a/types/react-virtualized/dist/es/Grid.d.ts +++ b/types/react-virtualized/dist/es/Grid.d.ts @@ -129,7 +129,7 @@ export type GridCellRangeProps = { scrollTop: number, deferredMeasurementCache: CellMeasurerCache, horizontalOffsetAdjustment: number, - parent: Grid | List | Table, + parent: typeof Grid | typeof List | typeof Table, styleCache: Map, verticalOffsetAdjustment: number, visibleColumnIndices: VisibleCellRange, diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx index d912c1f28f..f11fa644f5 100644 --- a/types/react-virtualized/react-virtualized-tests.tsx +++ b/types/react-virtualized/react-virtualized-tests.tsx @@ -114,7 +114,7 @@ export class AutoSizerExample extends PureComponent { } } import { } from 'react' -import { CellMeasurer, CellMeasurerCache } from 'react-virtualized' +import { CellMeasurer, CellMeasurerCache, ListRowProps } from 'react-virtualized' export class DynamicHeightList extends PureComponent { @@ -148,7 +148,7 @@ export class DynamicHeightList extends PureComponent { ) } - _rowRenderer({ index, isScrolling, key, parent, style }) { + _rowRenderer({ index, isScrolling, key, parent, style }: ListRowProps) { const { getClassName, list } = this.props const datum = list.get(index % list.size) @@ -1835,3 +1835,114 @@ export class WindowScrollerExample extends PureComponent<{}, any> { this.context.setScrollingCustomElement(event.target.checked) } } + +import { GridCellProps, GridCellRangeProps } from 'react-virtualized' + +export class GridCellRangeRendererExample extends PureComponent<{}, any> { + + constructor(props) { + super(props) + + this.state = { + columnWidth: 75, + columnCount: 50, + height: 300, + rowHeight: 40, + rowCount: 100 + } + + this._cellRangeRenderer = this._cellRangeRenderer.bind(this) + } + + render() { + const { + columnCount, + columnWidth, + height, + rowHeight, + rowCount + } = this.state + + return ( + ( +
+ I'm a table cell +
+ )} + columnCount={columnCount} + columnWidth={columnWidth} + height={height} + rowCount={rowCount} + rowHeight={rowHeight} + width={columnWidth} + /> + ) + } + + _cellRangeRenderer({ + cellCache, // Temporary cell cache used while scrolling + cellRenderer, // Cell renderer prop supplied to Grid + columnSizeAndPositionManager, // @see CellSizeAndPositionManager, + columnStartIndex, // Index of first column (inclusive) to render + columnStopIndex, // Index of last column (inclusive) to render + horizontalOffsetAdjustment, // Horizontal pixel offset (required for scaling) + isScrolling, // The Grid is currently being scrolled + rowSizeAndPositionManager, // @see CellSizeAndPositionManager, + rowStartIndex, // Index of first column (inclusive) to render + rowStopIndex, // Index of last column (inclusive) to render + scrollLeft, // Current horizontal scroll offset of Grid + scrollTop, // Current vertical scroll offset of Grid + styleCache, // Temporary style (size & position) cache used while scrolling + verticalOffsetAdjustment, // Vertical pixel offset (required for scaling) + parent, + visibleColumnIndices, + visibleRowIndices, + }: GridCellRangeProps): React.ReactNode[] { + const renderedCells: React.ReactNode[] = [] + const style: React.CSSProperties = {} + + for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) { + // This contains :offset (top) and :size (height) information for the cell + const rowDatum = rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex) + + for (let columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) { + // This contains :offset (left) and :size (width) information for the cell + const columnDatum = columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex) + + // Be sure to adjust cell position in case the total set of cells is too large to be supported by the browser natively. + // In this case, Grid will shift cells as a user scrolls to increase cell density. + const left = columnDatum.offset + horizontalOffsetAdjustment + const top = rowDatum.offset + verticalOffsetAdjustment + + // The rest of the information you need to render the cell are contained in the data. + // Be sure to provide unique :key attributes. + const key = `${rowIndex}-${columnIndex}` + const height = rowDatum.size + const width = columnDatum.size + const isVisible = + columnIndex >= visibleColumnIndices.start && + columnIndex <= visibleColumnIndices.stop && + rowIndex >= visibleRowIndices.start && + rowIndex <= visibleRowIndices.stop + + // Now render your cell and additional UI as you see fit. + // Add all rendered children to the :renderedCells Array. + const gridCellProps: GridCellProps = { + columnIndex, + isScrolling, + isVisible, + key, + parent, + rowIndex, + style, + } + + renderedCells.push(cellRenderer(gridCellProps)) + } + } + + return renderedCells + } +} diff --git a/types/react/global.d.ts b/types/react/global.d.ts index 2103069854..8d6062b4bc 100644 --- a/types/react/global.d.ts +++ b/types/react/global.d.ts @@ -176,3 +176,5 @@ interface SVGTextPathElement extends SVGElement { } interface SVGTSpanElement extends SVGElement { } interface SVGUseElement extends SVGElement { } interface SVGViewElement extends SVGElement { } + +interface TouchList { } diff --git a/types/react/index.d.ts b/types/react/index.d.ts index d56d9571e1..c38f57b0a7 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React 16.0 +// Type definitions for React 16.1 // Project: http://facebook.github.io/react/ // Definitions by: Asana // AssureSign @@ -15,6 +15,7 @@ // Rich Seviora // Josh Rutherford // Guilherme Hübner +// Josh Goldberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -2450,6 +2451,7 @@ declare namespace React { defaultChecked?: boolean; defaultValue?: string | string[]; suppressContentEditableWarning?: boolean; + suppressHydrationWarning?: boolean; // Standard HTML Attributes accessKey?: string; @@ -2533,6 +2535,11 @@ declare namespace React { * @see aria-colindex @see aria-rowspan. */ 'aria-colspan'?: number; + /** + * Identifies the element (or elements) whose contents or presence are controlled by the current element. + * @see aria-owns. + */ + 'aria-controls'?: string; /** Indicates the element that represents the current item within a container or set of related elements. */ 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; /** diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 757a1da669..e0e4a09065 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -44,7 +44,7 @@ const props: Props & React.ClassAttributes<{}> = { foo: 42 }; -const container: Element = document.createElement("div"); +declare const container: Element; // // Top-Level API @@ -226,9 +226,9 @@ const clonedSvgElement: React.ReactSVGElement = const component: ModernComponent = ReactDOM.render(element, container); const componentNullContainer: ModernComponent = ReactDOM.render(element, null); -const componentElementOrNull: ModernComponent = ReactDOM.render(element, document.getElementById("anelement")); +const componentElementOrNull: ModernComponent = ReactDOM.render(element, container); const componentNoState: ModernComponentNoState = ReactDOM.render(elementNoState, container); -const componentNoStateElementOrNull: ModernComponentNoState = ReactDOM.render(elementNoState, document.getElementById("anelement")); +const componentNoStateElementOrNull: ModernComponentNoState = ReactDOM.render(elementNoState, container); const domComponent: Element = ReactDOM.render(domElement, container); // Other Top-Level API @@ -313,7 +313,7 @@ const htmlAttr: React.HTMLProps = { event.stopPropagation(); }, onAnimationStart: event => { - console.log(event.currentTarget.className); + const currentTarget: EventTarget & HTMLElement = event.currentTarget; }, dangerouslySetInnerHTML: { __html: "STRONG" @@ -624,7 +624,7 @@ if (TestUtils.isElementOfType(emptyElement2, StatelessComponent)) { } if (TestUtils.isDOMComponent(container)) { - container.getAttribute("className"); + const reassignedContainer: Element = container; } else if (TestUtils.isCompositeComponent(new ModernComponent({ hello: 'hi', foo: 3 }))) { new ModernComponent({ hello: 'hi', foo: 3 }).props; } @@ -670,7 +670,9 @@ class SyntheticEventTargetValue extends React.Component<{}, { value: string }> { render() { return DOM.textarea({ value: this.state.value, - onChange: e => this.setState({ value: e.target.value }) + onChange: e => { + const target: HTMLTextAreaElement = e.target; + } }); } } @@ -678,7 +680,7 @@ class SyntheticEventTargetValue extends React.Component<{}, { value: string }> { DOM.input({ onChange: event => { // `event.target` is guaranteed to be HTMLInputElement - event.target.value; + const target: HTMLInputElement = event.target; } }); diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 4ad5a3e2c8..7fa151fd29 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -37,6 +37,7 @@ StatelessComponent2.defaultProps = { defaultValue="some value" contentEditable suppressContentEditableWarning + suppressHydrationWarning > foo
; diff --git a/types/react/tsconfig.json b/types/react/tsconfig.json index 46866c10b1..4ee84e7a7c 100644 --- a/types/react/tsconfig.json +++ b/types/react/tsconfig.json @@ -8,8 +8,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": false, diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 534d92de29..2111008d0d 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2481,6 +2481,11 @@ declare namespace React { * @see aria-colindex @see aria-rowspan. */ 'aria-colspan'?: number; + /** + * Identifies the element (or elements) whose contents or presence are controlled by the current element. + * @see aria-owns. + */ + 'aria-controls'?: string; /** Indicates the element that represents the current item within a container or set of related elements. */ 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; /** diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index edff2061b5..c057521570 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Iskander Sierra // Samuel DeSota // Curtis Layne +// Rasmus Eneman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -78,13 +79,25 @@ declare module 'recompose' { // withHandlers: https://github.com/acdlite/recompose/blob/master/docs/API.md#withhandlers type EventHandler = Function; - type HandleCreators = { - [handlerName in keyof THandlers]: mapper; + // This type is required to infer TOutter + type HandleCreatorsStructure = { + [handlerName: string]: mapper; }; - type HandleCreatorsFactory = (initialProps: TOutter) => HandleCreators; + // This type is required to infer THandlers + type HandleCreatorsHandlers = { + [P in keyof THandlers]: (props: TOutter) => THandlers[P]; + }; + type HandleCreators = + & HandleCreatorsStructure + & HandleCreatorsHandlers + type HandleCreatorsFactory = (initialProps: TOutter) => + HandleCreators; + export function withHandlers( - handlerCreators: HandleCreators | HandleCreatorsFactory - ): InferableComponentEnhancerWithProps; + handlerCreators: + | HandleCreators + | HandleCreatorsFactory + ): InferableComponentEnhancerWithProps; // defaultProps: https://github.com/acdlite/recompose/blob/master/docs/API.md#defaultprops export function defaultProps( diff --git a/types/recompose/recompose-tests.tsx b/types/recompose/recompose-tests.tsx index 1504ab563a..c239cbacb1 100644 --- a/types/recompose/recompose-tests.tsx +++ b/types/recompose/recompose-tests.tsx @@ -120,10 +120,35 @@ function testWithHandlers() { /> ) - const handlerNameTypecheckProof = withHandlers({ + const handlerNameTypecheckProof = withHandlers({ // $ExpectError onChange: () => () => {}, - notAKeyOnHandlerProps: () => () => {}, // $ExpectError + notAKeyOnHandlerProps: () => () => {}, }); + + // The inner props should be fully inferrable + const enhancer3 = withHandlers({ + onChange: (props: OutterProps) => (e: any) => {}, + onSubmit: (props: OutterProps) => (e: React.MouseEvent) => {}, + }); + const Enhanced3 = enhancer3(({onChange, onSubmit, out}) => +
{out}
); + const rendered3 = ( + + ) + + const enhancer4 = withHandlers((props: OutterProps) => ({ + onChange: (props) => (e: any) => {}, + onSubmit: (props) => (e: React.MouseEvent) => {}, + })); + const Enhanced4 = enhancer4(({onChange, onSubmit, out}) => +
{out}
); + const rendered4 = ( + + ) } function testDefaultProps() { @@ -220,7 +245,24 @@ function testWithStateHandlers() { (props: OutterProps) => ({ counter: props.initialCounter }), { notAKeyOfUpdaters: (state, props) => n => ({ ...state, counter: state.counter + n ** props.power }), }, // $ExpectError ); - } + + // The inner props should be fully inferrable + const enhancer2 = withStateHandlers( + (props: OutterProps) => ({ counter: props.initialCounter }), + { + add: (state, props) => n => ({ ...state, counter: state.counter + n ** props.power }), + }, + ); + const Enhanced2 = enhancer((props) => +
+
{`Counts from: ${props.initialCounter}`}
+
{`Counter: ${props.counter}`}
+
props.add(2)}>
+
); + const rendered2 = ( + + ); +} function testWithReducer() { interface State { count: number } diff --git a/types/sanctuary/index.d.ts b/types/sanctuary/index.d.ts index 0d61fe22aa..b0a8fd7750 100644 --- a/types/sanctuary/index.d.ts +++ b/types/sanctuary/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/sanctuary-js/sanctuary#readme // Definitions by: David Chambers // Juan J. Jimenez-Anca +// Ken Aguilar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var S: Sanctuary.Environment; @@ -73,12 +74,12 @@ interface Contravariant {} interface ListToMaybeList { (xs: string): Maybe; - (xs: A[]): Maybe; + (xs: ReadonlyArray): Maybe; } interface MatchObj { match: string; - groups: Array>; + groups: ReadonlyArray>; } declare namespace Sanctuary { @@ -108,13 +109,13 @@ declare namespace Sanctuary { max(x: Ord): (y: Ord) => A; id(p: TypeRep): Fn | Category; concat(x: Semigroup): (y: Semigroup) => Semigroup; - concat(x: A[]): (y: A[]) => A[]; + concat(x: ReadonlyArray): (y: ReadonlyArray) => A[]; concat(x: StrMap): (y: StrMap) => StrMap; concat(x: string): (y: string) => string; empty(p: TypeRep): Monoid; map(p: Fn): { (q: Fn): Fn; - (q: A[]): B[]; + (q: ReadonlyArray): B[]; (q: StrMap): StrMap; (q: Functor): Functor; }; @@ -125,7 +126,7 @@ declare namespace Sanctuary { }; alt(x: Alt): (y: Alt) => Alt; zero(p: TypeRep): Plus; - reduce(p: Fn2): (q: B) => (r: A[] | StrMap | Maybe | Either | Foldable) => B; + reduce(p: Fn2): (q: B) => (r: ReadonlyArray | StrMap | Maybe | Either | Foldable) => B; traverse(typeRep: TypeRep): (f: Fn>) => (traversable: Traversable) => Applicative>; sequence(typeRep: TypeRep): (traversable: Traversable>) => Applicative>; ap(p: Apply>): (q: Apply) => Apply; @@ -144,7 +145,7 @@ declare namespace Sanctuary { chain(f: Fn2): (chain_: Fn) => Fn; chain(f: Fn >): (chain_: Chain) => Chain; join(chain_: Fn2): Fn; - join(chain_: A[][]): A[]; + join(chain_: ReadonlyArray>): A[]; join(chain_: Maybe>): Maybe; join(chain_: Chain>): Chain; chainRec(typeRep: TypeRep): { @@ -158,11 +159,11 @@ declare namespace Sanctuary { (contravariant: Contravariant): Contravariant; }; filter (pred: Predicate): { - (m: A[]): A[]; + (m: ReadonlyArray): A[]; (m: Foldable): Foldable; }; filterM(pred: Predicate): { - (m: A[]): A[]; + (m: ReadonlyArray): A[]; (m: Foldable): Foldable; }; takeWhile(pred: Predicate): (foldable: Foldable) => Foldable; @@ -185,7 +186,7 @@ declare namespace Sanctuary { pipe(fs: [Fn, Fn, Fn]): (x: A) => D; pipe(fs: [Fn, Fn, Fn, Fn]): (x: A) => E; pipe(fs: [Fn, Fn, Fn, Fn, Fn]): (x: A) => F; - pipe(fs: Array>): (x: any) => any; + pipe(fs: ReadonlyArray>): (x: any) => any; on(p: Fn2): (q: Fn) => (r: A) => Fn; // TODO: Maybe isNothing(p: Maybe): boolean; @@ -196,7 +197,7 @@ declare namespace Sanctuary { toMaybe(p: A | null | undefined): Maybe; maybe(p: B): (q: Fn) => (r: Maybe) => B; maybe_(p: Thunk): (q: Fn) => (r: Maybe) => B; - justs(p: Array>): A[]; + justs(p: ReadonlyArray>): A[]; mapMaybe(p: Fn>): (q: A[]) => A[]; encase(p: Fn): Fn>; encase2(p: Fn2): Fn2>; @@ -208,8 +209,8 @@ declare namespace Sanctuary { fromEither(p: B): (q: Either) => B; toEither(p: A): (q: B | null | undefined) => Either; either(p: Fn): (q: Fn) => (r: Either) => C; - lefts(p: Array>): A[]; - rights(p: Array>): B[]; + lefts(p: ReadonlyArray>): A[]; + rights(p: ReadonlyArray>): B[]; tagBy(p: Predicate): (q: A) => Either; encaseEither(p: Fn): (q: Fn) => Fn>; encaseEither2(p: Fn): (q: Fn2) => Fn2>; @@ -223,22 +224,22 @@ declare namespace Sanctuary { ifElse(p: Predicate): (q: Fn) => (r: Fn) => Fn; when(p: Predicate): (q: Fn) => Fn; unless(p: Predicate): (q: Fn) => Fn; - allPass(p: Array>): Predicate; - anyPass(p: Array>): Predicate; + allPass(p: ReadonlyArray>): Predicate; + anyPass(p: ReadonlyArray>): Predicate; // List slice(p: Integer): (q: Integer) => ListToMaybeList; at(p: Integer): { (q: string): Maybe; - (q: A[]): Maybe; + (q: ReadonlyArray): Maybe; }; head(xs: string): Maybe; - head(xs: A[]): Maybe; + head(xs: ReadonlyArray): Maybe; last(xs: string): Maybe; - last(xs: A[]): Maybe; + last(xs: ReadonlyArray): Maybe; tail(xs: string): Maybe; - tail(xs: A[]): Maybe; + tail(xs: ReadonlyArray): Maybe; init(xs: string): Maybe; - init(xs: A[]): Maybe; + init(xs: ReadonlyArray): Maybe; take(n: Integer): ListToMaybeList; takeLast(n: Integer): ListToMaybeList; drop(n: Integer): ListToMaybeList; @@ -246,33 +247,33 @@ declare namespace Sanctuary { // Array // TODO: Fantasyland overloads, non-curried versions append(x: A): { - (xs: A[]): A[]; + (xs: ReadonlyArray): A[]; (xs: Applicative): Applicative; }; prepend(x: A): { - (xs: A[]): A[]; + (xs: ReadonlyArray): A[]; (xs: Applicative): Applicative; }; - joinWith(p: string): (q: string[]) => string; - elem(p: A): (q: Foldable | StrMap | A[]) => boolean; - find(p: Predicate): (q: A[] | StrMap | Foldable) => Maybe; + joinWith(p: string): (q: ReadonlyArray) => string; + elem(p: A): (q: Foldable | StrMap | ReadonlyArray) => boolean; + find(p: Predicate): (q: ReadonlyArray | StrMap | Foldable) => Maybe; pluck(key: string): (xs: Functor) => Functor; unfoldr(f: Fn>>): (x: B) => A[]; range(from: Integer): (to: Integer) => Integer[]; - groupBy(f: Fn2): (xs: A[]) => A[][]; - reverse(foldable: A[]): A[]; + groupBy(f: Fn2): (xs: ReadonlyArray) => A[][]; + reverse(foldable: ReadonlyArray): A[]; reverse(foldable: Foldable): Foldable; - sort(foldable: A[]): A[]; + sort(foldable: ReadonlyArray): A[]; sort(foldable: Foldable): Foldable; sortBy(f: Fn>): { - (foldable: A[]): A[]; + (foldable: ReadonlyArray): A[]; (foldable: Foldable): Foldable; }; // Object prop(p: string): (q: any) => any; - props(p: string[]): (q: any) => any; + props(p: ReadonlyArray): (q: any) => any; get(p: Predicate): (q: string) => (r: any) => Maybe; - gets(p: Predicate): (q: string[]) => (r: any) => Maybe; + gets(p: Predicate): (q: ReadonlyArray) => (r: any) => Maybe; // StrMap keys(p: StrMap): string[]; values(p: StrMap): A[]; @@ -280,13 +281,13 @@ declare namespace Sanctuary { // Number negate(n: ValidNumber): ValidNumber; add(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; - sum(p: Foldable | FiniteNumber[]): FiniteNumber; + sum(p: Foldable | ReadonlyArray): FiniteNumber; sub(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; mult(x: FiniteNumber): (q: FiniteNumber) => FiniteNumber; - product(p: Foldable | FiniteNumber[]): FiniteNumber; + product(p: Foldable | ReadonlyArray): FiniteNumber; div(p: NonZeroFiniteNumber): (q: FiniteNumber) => FiniteNumber; pow(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; - mean(p: Foldable | FiniteNumber[]): Maybe; + mean(p: Foldable | ReadonlyArray): Maybe; // Integer even(n: Integer): boolean; odd(n: Integer): boolean; @@ -308,15 +309,15 @@ declare namespace Sanctuary { stripPrefix(prefix: string): (q: string) => Maybe; stripSuffix(suffix: string): (q: string) => Maybe; words(s: string): string[]; - unwords(xs: string[]): string; + unwords(xs: ReadonlyArray): string; lines(s: string): string[]; - unlines(xs: string[]): string; + unlines(xs: ReadonlyArray): string; splitOn(separator: string): (q: string) => string[]; splitOnRegex(pattern: RegExp): (q: string) => string[]; } interface Environment extends Static { - env: any[]; - create(opts: {checkTypes: boolean, env: any[]}): Static; + env: ReadonlyArray; + create(opts: {checkTypes: boolean, env: ReadonlyArray}): Static; } } diff --git a/types/screeps/index.d.ts b/types/screeps/index.d.ts index 17155770d5..77d472f447 100644 --- a/types/screeps/index.d.ts +++ b/types/screeps/index.d.ts @@ -53,6 +53,7 @@ declare const FIND_MY_CONSTRUCTION_SITES: 114; declare const FIND_HOSTILE_CONSTRUCTION_SITES: 115; declare const FIND_MINERALS: 116; declare const FIND_NUKES: 117; +declare const FIND_TOMBSTONES: 118; declare const TOP: 1; declare const TOP_RIGHT: 2; @@ -246,7 +247,7 @@ declare const RESOURCE_CATALYZED_KEANIUM_ALKALIDE: "XKHO2"; declare const RESOURCE_CATALYZED_LEMERGIUM_ACID: "XLH2O"; declare const RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE: "XLHO2"; declare const RESOURCE_CATALYZED_ZYNTHIUM_ACID: "XZH2O"; -declare const RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE: "ZXHO2"; +declare const RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE: "XZHO2"; declare const RESOURCE_CATALYZED_GHODIUM_ACID: "XGH2O"; declare const RESOURCE_CATALYZED_GHODIUM_ALKALIDE: "XGHO2"; declare const RESOURCES_ALL: ResourceConstant[]; @@ -627,11 +628,14 @@ declare const LOOK_FLAGS: "flag"; declare const LOOK_CONSTRUCTION_SITES: "constructionSite"; declare const LOOK_NUKES: "nuke"; declare const LOOK_TERRAIN: "terrain"; +declare const LOOK_TOMBSTONES: 'tombstone'; declare const ORDER_SELL: "sell"; declare const ORDER_BUY: "buy"; declare const SYSTEM_USERNAME: string; + +declare const TOMBSTONE_DECAY_PER_PART: 5; /** * A site of a structure which is currently under construction. */ @@ -1190,6 +1194,31 @@ interface CPU { * @memberof CPU */ setShardLimits(limits: CPUShardLimits): OK | ERR_BUSY | ERR_INVALID_ARGS; + + /** + * Use this method to get heap statistics for your virtual machine. + * + * This method will be undefined if you are not using IVM. + * + * The return value is almost identical to the Node.js function v8.getHeapStatistics(). + * This function returns one additional property: externally_allocated_size which is the total amount of currently + * allocated memory which is not included in the v8 heap but counts against this isolate's memory limit. + * ArrayBuffer instances over a certain size are externally allocated and will be counted here. + */ + getHeapStatistics?(): HeapStatistics; +} + +interface HeapStatistics { + total_heap_size: number; + total_heap_size_executable: number; + total_physical_size: number; + total_available_size: number; + used_heap_size: number; + heap_size_limit: number; + malloced_memory: number; + peak_malloced_memory: number; + does_zap_garbage: 0 | 1; + externally_allocated_size: number; } /** @@ -1250,6 +1279,7 @@ interface AllLookAtTypes { source: Source; structure: Structure; terrain: Terrain; + tombstone: Tombstone; } type LookAtTypes = Partial; @@ -1280,7 +1310,7 @@ type LookForAtAreaResultWithPos = Array>; interface FindTypes { - [key: number]: RoomPosition | Creep | Source | Resource | Structure | Flag | ConstructionSite | Mineral | Nuke; + [key: number]: RoomPosition | Creep | Source | Resource | Structure | Flag | ConstructionSite | Mineral | Nuke | Tombstone; 1: RoomPosition; // FIND_EXIT_TOP 3: RoomPosition; // FIND_EXIT_RIGHT 5: RoomPosition; // FIND_EXIT_BOTTOM @@ -1303,6 +1333,7 @@ interface FindTypes { 115: ConstructionSite; // FIND_HOSTILE_CONSTRUCTION_SITES 116: Mineral; // FIND_MINERALS 117: Nuke; // FIND_NUKES + 118: Tombstone; // FIND_TOMBSTONES } interface FindPathOpts { @@ -1531,7 +1562,8 @@ type FindConstant = FIND_MY_CONSTRUCTION_SITES | FIND_HOSTILE_CONSTRUCTION_SITES | FIND_MINERALS | - FIND_NUKES; + FIND_NUKES | + FIND_TOMBSTONES; type FIND_EXIT_TOP = 1; type FIND_EXIT_RIGHT = 3; @@ -1556,6 +1588,7 @@ type FIND_MY_CONSTRUCTION_SITES = 114; type FIND_HOSTILE_CONSTRUCTION_SITES = 115; type FIND_MINERALS = 116; type FIND_NUKES = 117; +type FIND_TOMBSTONES = 118; type FilterOptions = string | FilterFunction | { filter: FilterFunction }; @@ -1594,7 +1627,8 @@ type LookConstant = LOOK_FLAGS | LOOK_CONSTRUCTION_SITES | LOOK_NUKES | - LOOK_TERRAIN; + LOOK_TERRAIN | + LOOK_TOMBSTONES; type LOOK_CONSTRUCTION_SITES = "constructionSite"; type LOOK_CREEPS = "creep"; @@ -1606,6 +1640,7 @@ type LOOK_RESOURCES = "resource"; type LOOK_SOURCES = "source"; type LOOK_STRUCTURES = "structure"; type LOOK_TERRAIN = "terrain"; +type LOOK_TOMBSTONES = "tombstone"; // Direction Constants @@ -1844,9 +1879,11 @@ type RESOURCE_CATALYZED_KEANIUM_ALKALIDE = "XKHO2"; type RESOURCE_CATALYZED_LEMERGIUM_ACID = "XLH2O"; type RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE = "XLHO2"; type RESOURCE_CATALYZED_ZYNTHIUM_ACID = "XZH2O"; -type RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "ZXHO2"; +type RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "XZHO2"; type RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O"; type RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2"; + +type TOMBSTONE_DECAY_PER_PART = 5; /** * The options that can be accepted by `findRoute()` and friends. */ @@ -3078,11 +3115,8 @@ interface StructureSpawn extends OwnedStructure { name: string; /** * If the spawn is in process of spawning a new creep, this object will contain the new creep’s information, or null otherwise. - * @param name The name of a new creep. - * @param needTime Time needed in total to complete the spawning. - * @param remainingTime Remaining time to go. */ - spawning: { name: string, needTime: number, remainingTime: number }; + spawning: Spawning | null; /** * Check if a creep can be created. @@ -3180,11 +3214,56 @@ interface StructureSpawn extends OwnedStructure { } interface StructureSpawnConstructor extends _Constructor, _ConstructorById { + Spawning: SpawningConstructor; } declare const StructureSpawn: StructureSpawnConstructor; declare const Spawn: StructureSpawnConstructor; // legacy alias // declare type Spawn = StructureSpawn; + +interface Spawning { + readonly prototype: Spawning; + + /** + * An array with the spawn directions + * @see http://docs.screeps.com/api/#StructureSpawn.Spawning.setDirections + */ + directions: DirectionConstant[]; + + /** + * The name of the creep + */ + name: string; + + /** + * Time needed in total to complete the spawning. + */ + needTime: number; + + /** + * Remaining time to go. + */ + remainingTime: number; + + /** + * A link to the spawn + */ + spawn: StructureSpawn; + + /** + * Cancel spawning immediately. Energy spent on spawning is not returned. + */ + cancel(): ScreepsReturnCode & (OK | ERR_NOT_OWNER); + + /** + * Set desired directions where the creep should move when spawned. + * @param directions An array with the spawn directions + */ + setDirections(directions: DirectionConstant[]): ScreepsReturnCode & (OK | ERR_NOT_OWNER | ERR_INVALID_ARGS); +} + +interface SpawningConstructor extends _Constructor, _ConstructorById { +} /** * Parent object for structure classes */ @@ -3642,7 +3721,7 @@ interface StructureLab extends OwnedStructure { /** * The type of minerals containing in the lab. Labs can contain only one mineral type at the same time. */ - mineralType: MineralConstant; + mineralType: _ResourceConstantSansEnergy | undefined; /** * The total amount of minerals the lab can contain. */ @@ -3819,3 +3898,17 @@ type AnyStructure = StructurePortal | StructureRoad | StructureWall; +interface Tombstone extends RoomObject { + /** The tick that the creep died. */ + deathTime: number; + store: StoreDefinition; + /** How many ticks until this tombstone decays */ + ticksToDecay: number; + /** The creep that died to create this tombstone */ + creep: Creep; +} + +interface TombstoneConstructor extends _Constructor, _ConstructorById { +} + +declare const Tombstone: TombstoneConstructor; diff --git a/types/screeps/screeps-tests.ts b/types/screeps/screeps-tests.ts index bbe542b568..17a78de496 100644 --- a/types/screeps/screeps-tests.ts +++ b/types/screeps/screeps-tests.ts @@ -43,6 +43,21 @@ interface CreepMemory { { for (const i in Game.spawns) { Game.spawns[i].createCreep(body); + + // Test StructureSpawn.Spawning + let creep: Spawning | null = Game.spawns[i].spawning; + if (creep) { + const name: string = creep.name; + const needTime: number = creep.needTime; + const remainingTime: number = creep.remainingTime; + const creepSpawn: StructureSpawn = creep.spawn; + + const cancelStatus: OK | ERR_NOT_OWNER = creep.cancel(); + const setDirectionStatus: OK | ERR_NOT_OWNER | ERR_INVALID_ARGS = creep.setDirections([TOP, BOTTOM, LEFT, RIGHT]); + } + + creep = new StructureSpawn.Spawning(""); + creep = StructureSpawn.Spawning(""); } } @@ -275,11 +290,12 @@ interface CreepMemory { { const pfCreep = Game.creeps.John; - const goals = pfCreep.room.find(FIND_SOURCES).map((source) => { - // We can't actually walk on sources-- set `range` to 1 - // so we path next to it. - return { pos: source.pos, range: 1 }; - }); + const goals = pfCreep.room.find(FIND_SOURCES) + .map((source) => { + // We can't actually walk on sources-- set `range` to 1 + // so we path next to it. + return { pos: source.pos, range: 1 }; + }); const ret = PathFinder.search( pfCreep.pos, goals, @@ -299,22 +315,24 @@ interface CreepMemory { } const costs = new PathFinder.CostMatrix(); - curRoom.find(FIND_STRUCTURES).forEach((struct) => { - if (struct.structureType === STRUCTURE_ROAD) { - // Favor roads over plain tiles - costs.set(struct.pos.x, struct.pos.y, 1); - } else if (struct.structureType !== STRUCTURE_CONTAINER && - (struct.structureType !== STRUCTURE_RAMPART || - !(struct as OwnedStructure).my)) { - // Can't walk through non-walkable buildings - costs.set(struct.pos.x, struct.pos.y, 0xff); - } - }); + curRoom.find(FIND_STRUCTURES) + .forEach((struct) => { + if (struct.structureType === STRUCTURE_ROAD) { + // Favor roads over plain tiles + costs.set(struct.pos.x, struct.pos.y, 1); + } else if (struct.structureType !== STRUCTURE_CONTAINER && + (struct.structureType !== STRUCTURE_RAMPART || + !(struct as OwnedStructure).my)) { + // Can't walk through non-walkable buildings + costs.set(struct.pos.x, struct.pos.y, 0xff); + } + }); // Avoid creeps in the room - curRoom.find(FIND_CREEPS).forEach((thisCreep) => { - costs.set(thisCreep.pos.x, thisCreep.pos.y, 0xff); - }); + curRoom.find(FIND_CREEPS) + .forEach((thisCreep) => { + costs.set(thisCreep.pos.x, thisCreep.pos.y, 0xff); + }); return costs; }, @@ -504,7 +522,8 @@ interface CreepMemory { const from = Game.rooms.myRoom.find(FIND_STRUCTURES, (s) => (s.structureType === STRUCTURE_CONTAINER || s.structureType === STRUCTURE_STORAGE) && s.store.energy > 0)[0]; const to = from.pos.findClosestByPath(FIND_MY_STRUCTURES, {filter: (s) => (s.structureType === STRUCTURE_SPAWN || s.structureType === STRUCTURE_EXTENSION) && s.energy < s.energyCapacity}); - Game.rooms.myRoom.find(FIND_MY_STRUCTURES, (s) => s.structureType === STRUCTURE_RAMPART).forEach((r) => r.notifyWhenAttacked(false)); + Game.rooms.myRoom.find(FIND_MY_STRUCTURES, (s) => s.structureType === STRUCTURE_RAMPART) + .forEach((r) => r.notifyWhenAttacked(false)); } { @@ -515,3 +534,18 @@ interface CreepMemory { BOOSTS[creep.body[0].type]; } + +{ + const tombstone = room.find(FIND_TOMBSTONES)[0]; + + tombstone.creep.my; + + tombstone.store.energy; +} + +{ + if (Game.cpu.hasOwnProperty('getHeapStatistics')) { + const heap = Game.cpu.getHeapStatistics!(); + heap.total_heap_size; + } +} diff --git a/types/seededshuffle/index.d.ts b/types/seededshuffle/index.d.ts new file mode 100644 index 0000000000..d32e5e3de1 --- /dev/null +++ b/types/seededshuffle/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for seededshuffle 0.2 +// Project: https://github.com/LouisT/SeededShuffle +// Definitions by: Uri Shaked +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export const seed: number; +export const strSeed: string; + +export function shuffle(arr: T[], seed: string|number): T[]; +export function shuffle(arr: ReadonlyArray, seed: string|number, copy: true): T[]; + +export function unshuffle(arr: T[], seed: string|number): T[]; +export function unshuffle(arr: ReadonlyArray, seed: string|number, copy: true): T[]; diff --git a/types/seededshuffle/seededshuffle-tests.ts b/types/seededshuffle/seededshuffle-tests.ts new file mode 100644 index 0000000000..3abbd8ca71 --- /dev/null +++ b/types/seededshuffle/seededshuffle-tests.ts @@ -0,0 +1,7 @@ +import { shuffle, unshuffle } from 'seededshuffle'; + +const a: number[] = shuffle([1, 2, 3] as ReadonlyArray, 'Example seed', true); +const b: number[] = unshuffle(a as ReadonlyArray, 'Example seed', true); + +const c: string[] = shuffle(['a', 'b', 'c'], 'another seed'); +const d: string[] = unshuffle(c, 'another seed'); diff --git a/types/seededshuffle/tsconfig.json b/types/seededshuffle/tsconfig.json new file mode 100644 index 0000000000..e816622b91 --- /dev/null +++ b/types/seededshuffle/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "seededshuffle-tests.ts" + ] +} diff --git a/types/seededshuffle/tslint.json b/types/seededshuffle/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/seededshuffle/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/select2/index.d.ts b/types/select2/index.d.ts index 51e297a9a8..3f04a52414 100644 --- a/types/select2/index.d.ts +++ b/types/select2/index.d.ts @@ -1,10 +1,9 @@ -// Type definitions for Select2 4.0.1 +// Type definitions for Select2 4.0 // Project: http://ivaynberg.github.com/select2/ // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 - /// interface Select2QueryOptions { @@ -14,15 +13,14 @@ interface Select2QueryOptions { callback?: (result: { results: any; more?: boolean; context?: any; }) => void; } -interface AjaxFunction { - (settings: JQueryAjaxSettings, success?: (data: any) => null, failure?: () => null): JQueryXHR; -} +type AjaxFunction = + (settings: JQueryAjaxSettings, success?: (data: any) => null, failure?: () => null) => JQueryXHR; interface Select2AjaxOptions extends JQueryAjaxSettings { transport?: AjaxFunction; /** - * Url to make request to, Can be string or a function returning a string. - */ + * Url to make request to, can be string or a function returning a string. + */ url?: any; dataType?: string; delay?: number; @@ -66,7 +64,6 @@ interface Select2Options { formatInputTooShort?: (term: string, minLength: number) => string; formatSelectionTooBig?: (maxSize: number) => string; formatLoadMore?: (pageNumber: number) => string; - createSearchChoice?: (term: string, data: any) => any; initSelection?: (element: JQuery, callback: (data: any) => void) => void; tokenizer?: (input: string, selection: any[], selectCallback: () => void, options: Select2Options) => string; tokenSeparators?: string[]; @@ -82,8 +79,8 @@ interface Select2Options { escapeMarkup?: (markup: string) => string; theme?: string; /** - * Template can return both plain string that will be HTML escaped and a jquery object that can render HTML - */ + * Template can return both plain string that will be HTML escaped and a jquery object that can render HTML + */ templateSelection?: (object: Select2SelectionObject, container: JQuery) => any; templateResult?: (object: Select2SelectionObject) => any; language?: string | string[] | {}; @@ -92,8 +89,6 @@ interface Select2Options { dropdownParent?: JQuery; debug?: boolean; dropdownAdapter?: any; - selectionAdapter?: any; - resultsAdapter?: any; } interface Select2JQueryEventObject extends JQueryEventObject { @@ -189,32 +184,22 @@ interface JQuery { on(events: "change", selector?: string, data?: any, handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; on(events: "change", selector?: string, handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; on(events: "change", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-opening", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-open", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-close", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-highlight", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-selecting", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-removing", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-removed", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-loaded", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-focus", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-blur", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-opening", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-open", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-close", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-highlight", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-selecting", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-removing", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-removed", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-loaded", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-focus", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; - on(events: "select2-blur", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2:closing", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2:close", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2:opening", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2:open", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2:selecting", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2:select", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2:unselecting", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2:unselect", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; } declare class Select2 { constructor(element: JQuery, options: Select2Options); focus(): void; destroy(): void; + // TODO: Don't use 'Function' as a type. + // tslint:disable-next-line:ban-types on(event: string, callback: Function): void; selection: any; dropdown: any; diff --git a/types/select2/select2-tests.ts b/types/select2/select2-tests.ts index 29da3b6f81..0a5458063a 100644 --- a/types/select2/select2-tests.ts +++ b/types/select2/select2-tests.ts @@ -12,9 +12,9 @@ $("#e2_3").select2({ $("#e3").select2({ minimumInputLength: 2 }); -function format(state) { +function format(state: any) { if (!state.id) return state.text; - return "" + state.text; + return `` + state.text; } $("#e4").select2({ formatResult: format, @@ -22,11 +22,11 @@ $("#e4").select2({ }); $("#e5").select2({ minimumInputLength: 1, - query: function (query) { - var data = { results: [] }, i, j, s; - for (i = 1; i < 5; i++) { - s = ""; - for (j = 0; j < i; j++) { s = s + query.term; } + query(query) { + const data = { results: [] as IdTextPair[] }; + for (let i = 1; i < 5; i++) { + let s = ""; + for (let j = 0; j < i; j++) { s = s + query.term; } data.results.push({ id: query.term + i, text: s }); } } @@ -37,7 +37,7 @@ $("#e10").select2({ data: [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }] }); -var data = [{ id: 0, tag: 'enhancement' }, { id: 1, tag: 'bug' }, { id: 2, tag: 'duplicate' }, { id: 3, tag: 'invalid' }, { id: 4, tag: 'wontfix' }]; +const data = [{ id: 0, tag: 'enhancement' }, { id: 1, tag: 'bug' }, { id: 2, tag: 'duplicate' }, { id: 3, tag: 'invalid' }, { id: 4, tag: 'wontfix' }]; $("#e10_2").select2({ data: { results: data, text: 'tag' }, @@ -46,11 +46,18 @@ $("#e10_2").select2({ }); $("#e10_3").select2({ - data: { results: data, text: function (item) { console.log('called with', item); return item.tag; } }, + data: { + results: data, + text: (item: {tag: string}) => { + console.log('called with', item); + return item.tag; + }}, formatSelection: format, formatResult: format }); -var movieFormatResult, movieFormatSelection; + +let movieFormatResult; +let movieFormatSelection; $("#e6").select2({ placeholder: "Search for a movie", minimumInputLength: 1, @@ -58,14 +65,14 @@ $("#e6").select2({ url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json", dataType: 'jsonp', cache: false, - data: function (params, page) { + data(params, page) { return { q: params.term, page_limit: 10, apikey: "ju6z9mjyajq2djue3gbvv26t" }; }, - results: function (data, page) { + results(data, page) { return { results: data.movies }; } }, @@ -73,20 +80,22 @@ $("#e6").select2({ formatSelection: movieFormatSelection, dropdownCssClass: "bigdrop" }); + +let t: ArrayLike; $("#e6").select2({ placeholder: "Search for a movie", minimumInputLength: 1, ajax: { - url: () => { return "http://api.rottentomatoes.com/api/public/v1.0/movies.json"; }, + url: () => "http://api.rottentomatoes.com/api/public/v1.0/movies.json", dataType: 'jsonp', - data: function (params, page) { + data(params, page) { return { q: params.term, page_limit: 10, apikey: "ju6z9mjyajq2djue3gbvv26t" }; }, - results: function (data, page) { + results(data, page) { return { results: data.movies }; } }, @@ -102,14 +111,14 @@ $("#e6").select2({ type: 'GET', dataType: 'jsonp', cache: false, - data: function (params, page) { + data(params, page) { return { q: params.term, page_limit: 10, apikey: "ju6z9mjyajq2djue3gbvv26t" }; }, - results: function (data, page) { + results(data, page) { return { results: data.movies }; } }, @@ -124,17 +133,17 @@ $("#e7").select2({ url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json", dataType: 'jsonp', delay: 100, - data: function (params, page) { + data(params, aPage) { return { q: params.term, page_limit: 10, - page: page, + page: aPage, apikey: "ju6z9mjyajq2djue3gbvv26t" }; }, - results: function (data, page) { - var more = (page * 10) < data.total; - return { results: data.movies, more: more }; + results(data, page) { + const moreValue = (page * 10) < data.total; + return { results: data.movies, more: moreValue }; } }, formatResult: movieFormatResult, @@ -142,7 +151,7 @@ $("#e7").select2({ dropdownCssClass: "bigdrop" }); -function sort(elements) { +function sort(elements: any) { return elements.sort(); } $("#e20").select2({ @@ -150,66 +159,65 @@ $("#e20").select2({ }); $("#e8").select2(); -$("#e8_get").click(function () { alert("Selected value is: " + $("#e8").select2("val")); }); -$("#e8_set").click(function () { $("#e8").select2("val", "CA"); }); -$("#e8_cl").click(function () { $("#e8").select2("val", ""); }); -$("#e8_get2").click(function () { alert("Selected data is: " + JSON.stringify($("#e8").select2("data"))); }); -$("#e8_set2").click(function () { $("#e8").select2("data", { id: "CA", text: "California" }); }); -$("#e8_open").click(function () { $("#e8").select2("open"); }); -$("#e8_close").click(function () { $("#e8").select2("close"); }); +$("#e8_get").click(() => alert("Selected value is: " + $("#e8").select2("val"))); +$("#e8_set").click(() => $("#e8").select2("val", "CA")); +$("#e8_cl").click(() => $("#e8").select2("val", "")); +$("#e8_get2").click(() => alert("Selected data is: " + JSON.stringify($("#e8").select2("data")))); +$("#e8_set2").click(() => $("#e8").select2("data", { id: "CA", text: "California" })); +$("#e8_open").click(() => $("#e8").select2("open")); +$("#e8_close").click(() => $("#e8").select2("close")); $("#e8_2").select2(); -$("#e8_2_get").click(function () { alert("Selected value is: " + $("#e8_2").select2("val")); }); -$("#e8_2_set").click(function () { $("#e8_2").select2("val", ["CA", "MA"]); }); -$("#e8_2_get2").click(function () { alert("Selected value is: " + JSON.stringify($("#e8_2").select2("data"))); }); -$("#e8_2_set2").click(function () { $("#e8_2").select2("data", [{ id: "CA", text: "California" }, { id: "MA", text: "Massachusetts" }]); }); -$("#e8_2_cl").click(function () { $("#e8_2").select2("val", ""); }); -$("#e8_2_open").click(function () { $("#e8_2").select2("open"); }); -$("#e8_2_close").click(function () { $("#e8_2").select2("close"); }); +$("#e8_2_get").click(() => alert("Selected value is: " + $("#e8_2").select2("val"))); +$("#e8_2_set").click(() => $("#e8_2").select2("val", ["CA", "MA"])); +$("#e8_2_get2").click(() => alert("Selected value is: " + JSON.stringify($("#e8_2").select2("data")))); +$("#e8_2_set2").click(() => $("#e8_2").select2("data", [{ id: "CA", text: "California" }, { id: "MA", text: "Massachusetts" }])); +$("#e8_2_cl").click(() => $("#e8_2").select2("val", "")); +$("#e8_2_open").click(() => $("#e8_2").select2("open")); +$("#e8_2_close").click(() => $("#e8_2").select2("close")); $("#e11").select2({ placeholder: "Select report type", allowClear: true, data: [{ id: 0, text: 'story' }, { id: 1, text: 'bug' }, { id: 2, text: 'task' }] }); $("#e11_2").select2({ - createSearchChoice: function (term, data) { if ($(data).filter(function () { return this.textContent.localeCompare(term) === 0; }).length === 0) { return { id: term, text: term }; } }, multiple: true, data: [{ id: 0, text: 'story' }, { id: 1, text: 'bug' }, { id: 2, text: 'task' }] }); -function log(e) { - var item = $("
  • " + e + "
  • "); +function log(e: string) { + const item = $(`
  • ${e}
  • `); $("#events_11").append(item); - item.animate({ opacity: 1 }, 10000, 'linear', function () { item.animate({ opacity: 0 }, 2000, 'linear', function () { item.remove(); }); }); + item.animate({ opacity: 1 }, 10000, 'linear', () => item.animate({ opacity: 0 }, 2000, 'linear', () => item.remove())); } $("#e11") // TS 0.9.5: correct overload not resolved https://typescript.codeplex.com/discussions/472172 - .on("change", function (e: Select2JQueryEventObject) { log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed })); }) - .on("open", function () { log("open"); }); + .on("change", (e: Select2JQueryEventObject) => log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed }))) + .on("open", () => log("open")); $("#e11_2") - .on("change", function (e: Select2JQueryEventObject) { log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed })); }) - .on("open", function () { log("open"); }); + .on("change", (e: Select2JQueryEventObject) => log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed }))) + .on("open", () => log("open")); $("#e12").select2({ tags: ["red", "green", "blue"] }); $("#e20").select2({ tags: ["red", "green", "blue"], tokenSeparators: [",", " "] }); $("#e13").select2(); -$("#e13_ca").click(function () { $("#e13").val("CA").trigger("change"); }); -$("#e13_ak_co").click(function () { $("#e13").val(["AK", "CO"]).trigger("change"); }); +$("#e13_ca").click(() => $("#e13").val("CA").trigger("change")); +$("#e13_ak_co").click(() => $("#e13").val(["AK", "CO"]).trigger("change")); $("#e14").val(["AL", "AZ"]).select2(); -$("#e14_init").click(function () { $("#e14").select2(); }); -$("#e14_destroy").click(function () { $("#e14").select2("destroy"); }); +$("#e14_init").click(() => $("#e14").select2()); +$("#e14_destroy").click(() => $("#e14").select2("destroy")); $("#e15").select2({ tags: ["red", "green", "blue", "orange", "white", "black", "purple", "cyan", "teal"] }); -$("#e15").on("change", function () { $("#e15_val").html($("#e15").val() as string); }); +$("#e15").on("change", () => $("#e15_val").html($("#e15").val() as string)); $("#e16").select2(); $("#e16_2").select2(); -$("#e16_enable").click(function () { $("#e16,#e16_2").select2("enable"); }); -$("#e16_disable").click(function () { $("#e16,#e16_2").select2("disable"); }); +$("#e16_enable").click(() => $("#e16,#e16_2").select2("enable")); +$("#e16_disable").click(() => $("#e16,#e16_2").select2("disable")); $("#e17").select2({ - matcher: function (term, text) { return text.toUpperCase().indexOf(term.toUpperCase()) == 0; } + matcher: (term, text) => text.toUpperCase().indexOf(term.toUpperCase()) === 0 }); $("#e17_2").select2({ - matcher: function (term, text, opt) { + matcher: (term, text, opt) => { return text.toUpperCase().indexOf(term.toUpperCase()) >= 0 || opt.attr("alt").toUpperCase().indexOf(term.toUpperCase()) >= 0; } diff --git a/types/select2/tsconfig.json b/types/select2/tsconfig.json index 292cf878b4..257d07ea49 100644 --- a/types/select2/tsconfig.json +++ b/types/select2/tsconfig.json @@ -5,8 +5,8 @@ "es6", "dom" ], - "noImplicitAny": false, - "noImplicitThis": false, + "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "strictFunctionTypes": true, "baseUrl": "../", diff --git a/types/select2/tslint.json b/types/select2/tslint.json index a41bf5d19a..08b1465cd6 100644 --- a/types/select2/tslint.json +++ b/types/select2/tslint.json @@ -1,79 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } } diff --git a/types/select2/v3/index.d.ts b/types/select2/v3/index.d.ts new file mode 100644 index 0000000000..21bb2611c7 --- /dev/null +++ b/types/select2/v3/index.d.ts @@ -0,0 +1,174 @@ +// Type definitions for Select2 3.5 +// Project: http://ivaynberg.github.com/select2/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + + +/// + +interface Select2QueryOptions { + term?: string; + page?: number; + context?: any; + callback?: (result: { results: any; more?: boolean; context?: any; }) => void; +} + +interface AjaxFunction { + (settings: JQueryAjaxSettings): JQueryXHR; + (url: string, settings?: JQueryAjaxSettings): JQueryXHR; +} + +interface Select2AjaxOptions extends JQueryAjaxSettings { + transport?: AjaxFunction; + /** + * Url to make request to, Can be string or a function returning a string. + */ + url?: any; + dataType?: string; + quietMillis?: number; + cache?: boolean; + jsonpCallback?: any; + data?: (term: string, page: number, context: any) => any; + results?: (term: any, page: number, context: any) => any; + params?: any; +} + +interface IdTextPair { + id: any; + text: string; +} + +interface Select2Options { + width?: string; + dropdownAutoWidth?: boolean; + minimumInputLength?: number; + maximumInputLength?: number; + minimumResultsForSearch?: number; + maximumSelectionSize?: number; + placeholder?: string; + separator?: string; + allowClear?: boolean; + multiple?: boolean; + closeOnSelect?: boolean; + openOnEnter?: boolean; + id?: (object: any) => string; + matcher?: (term: string, text: string, option: any) => boolean; + formatSelection?: (object: any, container: JQuery, escapeMarkup: (markup: string) => string) => string; + formatResult?: (object: any, container: JQuery, query: any, escapeMarkup: (markup: string) => string) => string; + formatResultCssClass?: (object: any) => string; + formatNoMatches?: (term: string) => string; + formatSearching?: () => string; + formatInputTooShort?: (term: string, minLength: number) => string; + formatSelectionTooBig?: (maxSize: number) => string; + formatLoadMore?: (pageNumber: number) => string; + createSearchChoice?: (term: string, data: any) => any; + initSelection?: (element: JQuery, callback: (data: any) => void) => void; + tokenizer?: (input: string, selection: any[], selectCallback: () => void, options: Select2Options) => string; + tokenSeparators?: string[]; + query?: (options: Select2QueryOptions) => void; + ajax?: Select2AjaxOptions; + data?: any; + tags?: any; + containerCss?: any; + containerCssClass?: any; + dropdownCss?: any; + dropdownCssClass?: any; + escapeMarkup?: (markup: string) => string; +} + +interface Select2JQueryEventObject extends JQueryEventObject { + val: any; + added: any; + removed: any; + choice: { + id: any; + text: string; + }; +} + +interface Select2Plugin { + (): JQuery; + (it: IdTextPair): JQuery; + + /** + * Get the id value of the current selection + */ + (method: 'val'): any; + /** + * Set the id value of the current selection + * @params value Value to set the id to + * @params triggerChange Should a change event be triggered + */ + (method: 'val', value: any, triggerChange?: boolean): any; + /** + * Get the data object of the current selection + */ + (method: 'data'): any; + /** + * Set the data of the current selection + * @params value Object to set the data to + * @params triggerChange Should a change event be triggered + */ + (method: 'data', value: any, triggerChange?: boolean): any; + /** + * Reverts changes to DOM done by Select2. Any selection done via Select2 will be preserved. + */ + (method: 'destroy'): JQuery; + /** + * Opens the dropdown + */ + (method: 'open'): JQuery; + /** + * Closes the dropdown + */ + (method: 'close'): JQuery; + /** + * Enables or disables Select2 and its underlying form component + * @param value True if it should be enabled false if it should be disabled + */ + (method: 'enable', value?: boolean): JQuery; + /** + * Toggles readonly mode on Select2 and its underlying form component + * @param value True if it should be readonly false if it should be read write + */ + (method: 'readonly', value: boolean): JQuery; + /** + * Retrieves the main container element that wraps all of DOM added by Select2 + */ + (method: 'container'): JQuery; + /** + * Notifies Select2 that a drag and drop sorting operation has started + */ + (method: 'onSortStart'): JQuery; + /** + * Notifies Select2 that a drag and drop sorting operation has finished + */ + (method: 'onSortEnd'): JQuery; + /** + * Executes a new search using the provided value. Example: $("#tags").select2("search", "California") + */ + (method: 'search'): JQuery; + + (options: Select2Options): JQuery; +} + +interface JQuery { + select2: Select2Plugin; + off(events?: "change", selector?: any, handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + + on(events: "change", selector?: string, data?: any, handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "change", selector?: string, handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "change", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-opening", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-open", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-close", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-highlight", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-selecting", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-clearing", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-removing", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-removed", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-loaded", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-focus", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-blur", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; +} diff --git a/types/select2/v3/select2-tests.ts b/types/select2/v3/select2-tests.ts new file mode 100644 index 0000000000..3b331cec3b --- /dev/null +++ b/types/select2/v3/select2-tests.ts @@ -0,0 +1,224 @@ +$("#e9").select2(); +$("#e2").select2({ + placeholder: "Select a State", + allowClear: true +}); +$("#e2_2").select2({ + placeholder: "Select a State" +}); +$("#e3").select2({ + minimumInputLength: 2 +}); +function format(state) { + if (!state.id) return state.text; + return "" + state.text; +} +$("#e4").select2({ + formatResult: format, + formatSelection: format +}); +$("#e5").select2({ + minimumInputLength: 1, + query: function (query) { + var data = { results: [] }, i, j, s; + for (i = 1; i < 5; i++) { + s = ""; + for (j = 0; j < i; j++) { s = s + query.term; } + data.results.push({ id: query.term + i, text: s }); + } + } +}); + +$("#e19").select2({ maximumSelectionSize: 3 }); +$("#e10").select2({ + data: [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }] +}); + +var data = [{ id: 0, tag: 'enhancement' }, { id: 1, tag: 'bug' }, { id: 2, tag: 'duplicate' }, { id: 3, tag: 'invalid' }, { id: 4, tag: 'wontfix' }]; + +$("#e10_2").select2({ + data: { results: data, text: 'tag' }, + formatSelection: format, + formatResult: format +}); + +$("#e10_3").select2({ + data: { results: data, text: function (item) { console.log('called with', item); return item.tag; } }, + formatSelection: format, + formatResult: format +}); +var movieFormatResult, movieFormatSelection; +$("#e6").select2({ + placeholder: "Search for a movie", + minimumInputLength: 1, + ajax: { + url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json", + dataType: 'jsonp', + cache: false, + data: function (term, page) { + return { + q: term, + page_limit: 10, + apikey: "ju6z9mjyajq2djue3gbvv26t" + }; + }, + results: function (data, page) { + return { results: data.movies }; + } + }, + formatResult: movieFormatResult, + formatSelection: movieFormatSelection, + dropdownCssClass: "bigdrop" +}); +$("#e6").select2({ + placeholder: "Search for a movie", + minimumInputLength: 1, + ajax: { + url: () => { return "http://api.rottentomatoes.com/api/public/v1.0/movies.json"; }, + dataType: 'jsonp', + data: function (term, page) { + return { + q: term, + page_limit: 10, + apikey: "ju6z9mjyajq2djue3gbvv26t" + }; + }, + results: function (data, page) { + return { results: data.movies }; + } + }, + formatResult: movieFormatResult, + formatSelection: movieFormatSelection, + dropdownCssClass: "bigdrop" +}); +$("#e6").select2({ + placeholder: "Search for a movie", + minimumInputLength: 1, + ajax: { + url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json", + type: 'GET', + dataType: 'jsonp', + cache: false, + data: function (term, page) { + return { + q: term, + page_limit: 10, + apikey: "ju6z9mjyajq2djue3gbvv26t" + }; + }, + results: function (data, page) { + return { results: data.movies }; + } + }, + formatResult: movieFormatResult, + formatSelection: movieFormatSelection, + dropdownCssClass: "bigdrop" +}); +$("#e7").select2({ + placeholder: "Search for a movie", + minimumInputLength: 3, + ajax: { + url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json", + dataType: 'jsonp', + quietMillis: 100, + data: function (term, page) { + return { + q: term, + page_limit: 10, + page: page, + apikey: "ju6z9mjyajq2djue3gbvv26t" + }; + }, + results: function (data, page) { + var more = (page * 10) < data.total; + return { results: data.movies, more: more }; + } + }, + formatResult: movieFormatResult, + formatSelection: movieFormatSelection, + dropdownCssClass: "bigdrop" +}); + +function sort(elements) { + return elements.sort(); +} + +$("#e8").select2(); +$("#e8_get").click(function () { alert("Selected value is: " + $("#e8").select2("val")); }); +$("#e8_set").click(function () { $("#e8").select2("val", "CA"); }); +$("#e8_cl").click(function () { $("#e8").select2("val", ""); }); +$("#e8_get2").click(function () { alert("Selected data is: " + JSON.stringify($("#e8").select2("data"))); }); +$("#e8_set2").click(function () { $("#e8").select2("data", { id: "CA", text: "California" }); }); +$("#e8_open").click(function () { $("#e8").select2("open"); }); +$("#e8_close").click(function () { $("#e8").select2("close"); }); +$("#e8_2").select2(); +$("#e8_2_get").click(function () { alert("Selected value is: " + $("#e8_2").select2("val")); }); +$("#e8_2_set").click(function () { $("#e8_2").select2("val", ["CA", "MA"]); }); +$("#e8_2_get2").click(function () { alert("Selected value is: " + JSON.stringify($("#e8_2").select2("data"))); }); +$("#e8_2_set2").click(function () { $("#e8_2").select2("data", [{ id: "CA", text: "California" }, { id: "MA", text: "Massachusetts" }]); }); +$("#e8_2_cl").click(function () { $("#e8_2").select2("val", ""); }); +$("#e8_2_open").click(function () { $("#e8_2").select2("open"); }); +$("#e8_2_close").click(function () { $("#e8_2").select2("close"); }); +$("#e11").select2({ + placeholder: "Select report type", + allowClear: true, + data: [{ id: 0, text: 'story' }, { id: 1, text: 'bug' }, { id: 2, text: 'task' }] +}); +$("#e11_2").select2({ + createSearchChoice: function (term, data) { if ($(data).filter(function () { return this.textContent.localeCompare(term) === 0; }).length === 0) { return { id: term, text: term }; } }, + multiple: true, + data: [{ id: 0, text: 'story' }, { id: 1, text: 'bug' }, { id: 2, text: 'task' }] +}); +function log(e) { + var item = $("
  • " + e + "
  • "); + $("#events_11").append(item); + item.animate({ opacity: 1 }, 10000, 'linear', function () { item.animate({ opacity: 0 }, 2000, 'linear', function () { item.remove(); }); }); +} +$("#e11") + // TS 0.9.5: correct overload not resolved https://typescript.codeplex.com/discussions/472172 + .on("change", function (e: Select2JQueryEventObject) { log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed })); }) + .on("open", function () { log("open"); }); +$("#e11_2") + .on("change", function (e: Select2JQueryEventObject) { log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed })); }) + .on("open", function () { log("open"); }); +$("#e12").select2({ tags: ["red", "green", "blue"] }); +$("#e20").select2({ + tags: ["red", "green", "blue"], + tokenSeparators: [",", " "] +}); +$("#e13").select2(); +$("#e13_ca").click(function () { $("#e13").val("CA").trigger("change"); }); +$("#e13_ak_co").click(function () { $("#e13").val(["AK", "CO"]).trigger("change"); }); +$("#e14").val(["AL", "AZ"]).select2(); +$("#e14_init").click(function () { $("#e14").select2(); }); +$("#e14_destroy").click(function () { $("#e14").select2("destroy"); }); +$("#e15").select2({ tags: ["red", "green", "blue", "orange", "white", "black", "purple", "cyan", "teal"] }); +$("#e15").on("change", function () { $("#e15_val").html($("#e15").val() as string); }); + +$("#e16").select2(); +$("#e16_2").select2(); +$("#e16_enable").click(function () { $("#e16,#e16_2").select2("enable"); }); +$("#e16_disable").click(function () { $("#e16,#e16_2").select2("enable", false); }); +$("#e17").select2({ + matcher: function (term, text) { return text.toUpperCase().indexOf(term.toUpperCase()) == 0; } +}); +$("#e17_2").select2({ + matcher: function (term, text, opt) { + return text.toUpperCase().indexOf(term.toUpperCase()) >= 0 + || opt.attr("alt").toUpperCase().indexOf(term.toUpperCase()) >= 0; + } +}); +$("#e18,#e18_2").select2(); +alert("Selected value is: " + $("#e8").select2("val")); $("#e8").select2("val", { id: "CA", text: "Califoria" }); + +$("#e8").select2("val"); +$("#e8").select2("val", "CA"); +$("#e8").select2("data"); +$("#e8").select2("data", { id: "CA", text: "Califoria" }); +$("#e8").select2("destroy"); +$("#e8").select2("open"); +$("#e8").select2("enable", false); +$("#e8").select2("readonly", false); +$("#e8").select2('container'); +$("#e8").select2('onSortStart'); +$("#e8").select2('onSortEnd'); diff --git a/types/select2/v3/tsconfig.json b/types/select2/v3/tsconfig.json new file mode 100644 index 0000000000..8b8f30ed05 --- /dev/null +++ b/types/select2/v3/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "select2": [ + "select2/v3" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "select2-tests.ts" + ] +} \ No newline at end of file diff --git a/types/select2/v3/tslint.json b/types/select2/v3/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/select2/v3/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 7d72a0b096..09af63c2ec 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Sequelize 4.27.8 +// Type definitions for Sequelize 4.27.9 // Project: http://sequelizejs.com // Definitions by: samuelneff // Peter Harris @@ -12,6 +12,7 @@ // Nikola Vidic // Florian Oellerich // Todd Bealmear +// Nick Schultz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -3793,7 +3794,7 @@ declare namespace sequelize { * @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned * model will clear the previous scope. */ - scope(options?: string | ScopeOptions | AnyWhereOptions | Array): Model; + scope(options?: string | ScopeOptions | AnyWhereOptions | Array): this; /** * Search for multiple instances. @@ -3864,8 +3865,8 @@ declare namespace sequelize { * Search for a single instance by its primary key. This applies LIMIT 1, so the listener will * always be called with a single instance. */ - findById(identifier?: number | string, options?: FindOptions): Promise; - findByPrimary(identifier?: number | string, options?: FindOptions): Promise; + findById(identifier?: number | string | Buffer, options?: FindOptions): Promise; + findByPrimary(identifier?: number | string | Buffer, options?: FindOptions): Promise; /** * Search for a single instance. This applies LIMIT 1, so the listener will always be called with a single @@ -4006,9 +4007,9 @@ declare namespace sequelize { * whether the row was inserted or not. */ upsert(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise; - upsert(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>; + upsert(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[TInstance, boolean]>; insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise; - insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>; + insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[TInstance, boolean]>; /** * Create and insert multiple instances in bulk. diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 5d1f6eed34..6c4f6c0a6f 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -10,10 +10,14 @@ import Bluebird = require('bluebird'); interface AnyAttributes { [name: string]: boolean | number | string | object; }; interface AnyInstance extends Sequelize.Instance { }; +interface UserModel extends Sequelize.Model { + findUser?(arbitraryThing: any): Promise; +} + var s = new Sequelize( '' ); var sequelize = s; var DataTypes = Sequelize; -var User = s.define( 'user', {} ); +var User: UserModel = s.define( 'user', {} ); var user = User.build(); var Task = s.define( 'task', {} ); var Group = s.define( 'group', {} ); @@ -893,6 +897,7 @@ User.addScope('lowAccessWithParam', function(id: number) { } ); User.scope( 'lowAccess' ).count(); +User.scope( 'lowAccess' ).findUser( 'foo' ); User.scope( { where : { parent_id : 2 } } ); User.scope( [ 'lowAccess', { method: ['lowAccessWithParam', 2] }, { where : { parent_id : 2 } } ] ) @@ -957,6 +962,12 @@ User.findAll( { where: { $or:[ { username: { $not: "user" } }, { theDate: new Da User.findAll( { where: { emails: { $overlap: ["me@mail.com", "you@mail.com"] } } } ); User.findById( 'a string' ); +User.findById( 42 ); +User.findById( Buffer.from('a buffer') ); + +User.findByPrimary( 'a string' ); +User.findByPrimary( 42 ); +User.findByPrimary( Buffer.from('a buffer') ); User.findOne( { where : { username : 'foo' } } ); User.findOne( { where : { id : 1 }, attributes : ['id', ['username', 'name']] } ); @@ -1044,7 +1055,7 @@ findOrRetVal = User.findOrCreate( { where : { email : 'unique.email.@d.com', com findOrRetVal = User.findOrCreate( { where : { objectId : 1 }, defaults : { bool : false } } ); let upsertPromiseNoOptions: Bluebird = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) } ); -let upsertPromiseReturning: Bluebird<[boolean, AnyInstance]> = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: true } ); +let upsertPromiseReturning: Bluebird<[AnyInstance, boolean]> = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: true } ); let upsertPromiseNotReturning: Bluebird = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: false } ); User.bulkCreate( [{ aNumber : 10 }, { aNumber : 12 }] ).then( ( i ) => i[0].isNewRecord ); diff --git a/types/sinon-chrome/index.d.ts b/types/sinon-chrome/index.d.ts index 67614ff6bc..263135e060 100644 --- a/types/sinon-chrome/index.d.ts +++ b/types/sinon-chrome/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/vitalets/sinon-chrome // Definitions by: Tim Perry // CRIMX +// kobanyan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -37,6 +38,8 @@ declare namespace SinonChrome { */ export function reset(): void; + export function registerPlugin(plugin: {}): void; + export var csi: Sinon.SinonSpy; export var loadTimes: Sinon.SinonSpy; } @@ -353,6 +356,27 @@ declare namespace SinonChrome.permissions { export var request: SinonChromeStub; } +declare namespace SinonChrome.plugins { + export interface Translations { + [key: string]: { + message: string; + description?: string; + placeholders?: { + [key: string]: { + content: string; + example?: string; + }; + }; + }; + } + export class I18nPlugin { + constructor(translations?: Translations); + } + export class CookiePlugin { + constructor(state?: Array); + } +} + declare namespace SinonChrome.power { export var releaseKeepAwake: SinonChromeStub; export var requestKeepAwake: SinonChromeStub; diff --git a/types/sinon-chrome/sinon-chrome-tests.ts b/types/sinon-chrome/sinon-chrome-tests.ts index 58639b8a65..7ae8a3f862 100644 --- a/types/sinon-chrome/sinon-chrome-tests.ts +++ b/types/sinon-chrome/sinon-chrome-tests.ts @@ -32,3 +32,50 @@ var id: string = chromeStub.runtime.id; chromeStub.proxy.settings.set({value: { }, scope: 'regular'}); chromeStub.proxy.settings.onChange.trigger(); + +chromeStub.registerPlugin(new chromeStub.plugins.I18nPlugin({ + one: { + message: 'Hi!' + }, + two: { + message: 'Hi $first_name$ $last_name$!', + placeholders: { + first_name: { + content: '$1' + }, + last_name: { + content: '$2' + } + } + } +})); + +chromeStub.registerPlugin(new chromeStub.plugins.CookiePlugin()); + +chromeStub.registerPlugin(new chromeStub.plugins.CookiePlugin( + [ + { + domain: '.domain.com', + expirationDate: 1511612273, + hostOnly: false, + httpOnly: false, + name: 'COOKIE_NAME', + path: '/data', + secure: false, + session: false, + storeId: '0', + value: 'COOKIE_VALUE' + }, + { + domain: 'other-domain.com', + hostOnly: false, + httpOnly: false, + name: 'other-cookie', + path: '/', + secure: false, + session: true, + storeId: '0', + value: '123' + } + ] +)); diff --git a/types/snapsvg/index.d.ts b/types/snapsvg/index.d.ts index a3397cedaa..489b771752 100644 --- a/types/snapsvg/index.d.ts +++ b/types/snapsvg/index.d.ts @@ -136,16 +136,19 @@ declare namespace Snap { export interface Element { add(el:Snap.Element):Snap.Element; + add(el:Snap.Set):Snap.Element; addClass(value:string):Snap.Element; after(el:Snap.Element):Snap.Element; align(el: Snap.Element, way: string):Snap.Element; animate(animation:any):Snap.Element; animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num: number)=> number,callback?:()=>void):Snap.Element; append(el:Snap.Element):Snap.Element; + append(el:Snap.Set):Snap.Element; appendTo(el:Snap.Element):Snap.Element; asPX(attr:string,value?:string):number; //TODO: check what is really returned - attr(param:string):string; - attr(params:{[attr:string]:string|number|boolean|any}):Snap.Element; + attr(param: "viewBox"): BBox; + attr(param: string): string; + attr(params:{[attr:string]:string|number|boolean|BBox|any}):Snap.Element; before(el:Snap.Element):Snap.Element; children(): Snap.Element[]; clone():Snap.Element; @@ -284,12 +287,14 @@ declare namespace Snap { rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element; text(x:number,y:number,text:string|number):Snap.Element; text(x:number,y:number,text:Array):Snap.Element; + symbol(vbx:number,vby:number,vbw:number,vbh:number):Snap.Element; } export interface Set { animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num:number)=>number,callback?:()=>void):Snap.Element; animate(...params:Array<{attrs:any,duration:number,easing:(num:number)=>number,callback?:()=>void}>):Snap.Element; - attr(params: {[attr:string]:string|number|boolean|any}): Snap.Element; + attr(params: {[attr:string]:string|number|boolean|BBox|any}): Snap.Element; + attr(param: "viewBox"): BBox; attr(param: string): string; bind(attr: string, callback: Function): Snap.Set; bind(attr:string,element:Snap.Element):Snap.Set; diff --git a/types/snapsvg/test/2.ts b/types/snapsvg/test/2.ts index 0ab83291bd..5afcf36460 100644 --- a/types/snapsvg/test/2.ts +++ b/types/snapsvg/test/2.ts @@ -125,6 +125,19 @@ function tester6() { console.log(!path.isPointInsideBBox(b3, 50, 50)); } +function tester7() { + var paper = Snap(600, 800); + + Snap.load("http://snapsvg.io/assets/images/logo.svg", (fragment: Snap.Fragment) => { + // viewBox retrieveal + let fragmentViewBox = fragment.select("svg").attr("viewBox"); + let symbol = paper.symbol(fragmentViewBox.x, fragmentViewBox.y, fragmentViewBox.width, fragmentViewBox.height); + + symbol.add(fragment.selectAll("svg *")); + symbol.toDefs(); + }); +} + //$(function () { // tester1(); //}); @@ -134,3 +147,4 @@ function tester6() { //tester4(); //tester5(); //tester6(); +//tester7(); diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 921845e5a0..26f69d526d 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -83,6 +83,8 @@ export class Database extends events.EventEmitter { on(event: "error", listener: (err: Error) => void): this; on(event: "open" | "close", listener: () => void): this; on(event: string, listener: (...args: any[]) => void): this; + + configure(option: "busyTimeout", value: number): void; } export function verbose(): void; diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index 4ddfa0a502..ee5e4b17d7 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -5,7 +5,8 @@ let db: sqlite3.Database = new sqlite3.Database('chain.sqlite3', () => {}); function createDb() { console.log("createDb chain"); - db = new sqlite3.Database('chain.sqlite3', createTable); + db = new sqlite3.Database('chain.sqlite3', createTable); + db.configure("busyTimeout", 1000); } function createTable() { diff --git a/types/steam-client/index.d.ts b/types/steam-client/index.d.ts new file mode 100644 index 0000000000..97b386649c --- /dev/null +++ b/types/steam-client/index.d.ts @@ -0,0 +1,3390 @@ +// Type definitions for steam-client 2.5 +// Project: https://github.com/DoctorMcKay/node-steam-client +// Definitions by: Edward Sammut Alessi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// +/// + +export class CMClient extends NodeJS.EventEmitter { + /** + * A boolean that indicates whether you are currently connected and the encryption handshake is complete. + * 'connected' is emitted when it changes to true, and 'error' is emitted when it changes to false unless you called disconnect. + * Sending any client messages is only allowed while this is true. + */ + connected: boolean; + + /** + * A boolean that indicates whether you are currently logged on. + * Calling any handler methods except for methods to log on is only allowed while logged on. + */ + loggedOn: boolean; + + /** + * Your own SteamID while logged on, otherwise unspecified. + * Must be set to a valid initial value before sending a logon message. + */ + steamID: string; + + /** + * If we've initiated a connection previously, a string containing "ipv4:port" for the server we're connecting/connected to. + * Also contains the address of the last host we were connected to if we're currently disconnected. + */ + remoteAddress: string; + + // Default is TCP. UDP support is experimental + constructor(protocol?: EConnectionProtocol); + + /** + * Override the address and/or port that will be used for the outgoing connection. + * Takes effect the next time you connect. + * + * @param localAddress The local IP address you want to use for the outgoing connection + * @param localPort The local port you want to use for the outgoing connection + */ + bind(localAddress?: string, localPort?: string | number): void; + + /** + * Connects to Steam.It will keep trying to reconnect (provided autoRetry is not false) until encryption handshake is complete (see 'connected'), unless you cancel it with disconnect. + * + * You can call this method at any time. If you are already connected, disconnects you first. If there is an ongoing connection attempt, cancels it. + * + * @param server If you want to connect to a specific CM server, provide an object here containing host and port properties. Default is a random value from the servers property. + * @param autoRetry true if you want to automatically retry connection until successful, or false if you want an error event if connection fails. Default true + */ + connect(server?: Server, autoRetry?: boolean): void; + + /** + * Immediately terminates the connection and prevents any events (including 'error') from being emitted until you connect again. + * If you are already disconnected, does nothing. + * If there is an ongoing connection attempt, cancels it. + */ + disconnect(): void; + + /** + * Send a logon message to the CM. + * You must first be connected and set steamID to a valid initial value. + * You will receive the response in the logOnResponse event. + * + * @param details An object containing your logon parameters + */ + logOn(details: CMsgClientLogonPassword | CMsgClientLogonLoginKey): void; + + /** + * + * @param header + * @param body + * @param callback + */ + send: SendMessage; + + // Events + + on(eventType: T, callback: CMEventCallback[T]): this; +} + +/** + * Steam.servers contains the list of CM servers that CMClient will attempt to connect to. + * The bootstrapped list is not always up-to-date and might contain dead servers. + * To avoid timeouts, replace it with your own list before logging in if you have one (see 'servers' event). + */ +export const servers: Server[]; + +export type SendMessage = ( + /** + * An object containing the message header. It has the following properties: + * The following fields are reserved for internal use and shall be ignored: steamid, client_sessionid, jobid_source, jobid_target. + * (Note: pass an empty object if you don't need to set any fields) + */ + header: { + /** + * A value from EMsg + */ + msg: EMsg, + + /** + * A CMsgProtoBufHeader object if this message is protobuf-backed, otherwise header.proto is falsy. + */ + proto?: CMsgProtoBufHeader | false + }, + + /** + * A Buffer or ByteBuffer containing the rest of the message + */ + body: Buffer | ByteBuffer, + + /** + * If not falsy, then this message is a request, and callback shall be called with any response to it instead of 'message'/send. callback has the same arguments as 'message'/send. + */ + callback?: SendMessage | false +) => void; + +export interface CMEventCallback { + /** + * Connection closed by the server. + * Only emitted if the encryption handshake is complete, otherwise it will reconnect automatically (unless you disabled autoRetry). + * loggedOn is now false. + * + * @param err An Error object. May contain an eresult property. + */ + error: (err: Error) => void; + + /** + * Encryption handshake complete. + * From now on, it's your responsibility to handle disconnections and reconnect (see error). + * You'll likely want to log on now. + * + * @param serverLoad The load value of the CM server you're connected to. Only available if you're connecting using UDP. It's unclear at this time what scale this value uses. + */ + connected: (serverLoad: string) => void; + + /** + * Logon response received. If eresult is EResult.OK, loggedOn is now true. + * + * @param response An object with the properties in CMsgClientLogonResponse + */ + logOnResponse: (response: CMsgClientLogonResponse) => void; + + /** + * CMClient will use this new list when reconnecting, but it will be lost when your application restarts. + * You might want to save it to a file or a database and assign it to Steam.servers before logging in next time. + * + * Note that Steam.servers will be automatically updated after this event is emitted. + * This will be useful if you want to compare the old list with the new one for some reason - otherwise it shouldn't matter. + * + * @param servers An array containing the up-to-date server list + */ + servers: (servers: Server[]) => void; + + /** + * You were logged off from Steam. loggedOn is now false. + * + * @param eresesult A value from EResult + */ + loggedOff: (eresesult: EResult) => void; + + message: SendMessage; +} + +export interface Server { + host: string; + port: string | number; +} + +// Protobufs + +export interface CMsgClientLogon { + /** + * Your steam login + */ + account_name: string; + + /** + * Steam Guard code. Must be valid if provided, otherwise the logon will fail. Note that Steam Guard codes expire after a short while + */ + auth_code?: string; + + /** + * Two-factor authentication code provided by the Steam mobile application. You will have to provide this code every time you log in if your account uses 2FA. + */ + two_factor_code?: string; + + /** + * SHA1 hash of your sentry file. + * If not provided, Steam will send you a sentry file through the ClientUpdateMachineAuth message + * (unless a limit for registered sentries is reached? see https://github.com/seishun/node-steam/issues/178). + * If no Steam Guard code is provided, the hash must be already registered with this account, otherwise it's ignored. + * This value will be ignored if you enable 2FA. + */ + sha_sentryfile?: string; +} + +export interface CMsgClientLogonPassword extends CMsgClientLogon { + /** + * Required unless login_key is used + */ + password: string; +} + +export interface CMsgClientLogonLoginKey extends CMsgClientLogon { + /** + * Alternative to password + */ + login_key: string; +} + +export interface CMsgClientLogonResponse { + /** + * The logon was successful if equal to EResult.OK + */ + eresult: EResult; + + /** + * "loginkey" to be used with WebAPI's AuthenticateUser." + */ + webapi_authenticate_user_nonce: string; +} + +export interface CMsgProtoBufHeader { + steamid?: string; + client_sessionid?: number; + routing_appid?: number; + jobid_source?: string; + jobid_target?: string; + target_job_name?: string; + seq_num?: number; + eresult?: number; + error_message?: string; + ip?: number; + auth_account_flags?: number; + token_source?: number; + admin_spoofing_user?: boolean; + transport_error?: number; + messageid?: string; + publisher_group_id?: number; + sysid?: number; + trace_tag?: string; + webapi_key_id?: number; + is_from_external_source?: boolean; + forward_to_sysid?: number[]; +} + +// Enums + +export enum EConnectionProtocol { + TCP = 1, + UDP = 2, + WebSocket = 3, +} + +export enum EMsg { + Invalid = 0, + Multi = 1, + ProtobufWrapped = 2, + + BaseGeneral = 100, + GenericReply = 100, + DestJobFailed = 113, + Alert = 115, + SCIDRequest = 120, + SCIDResponse = 121, + JobHeartbeat = 123, + HubConnect = 124, + Subscribe = 126, + RouteMessage = 127, // obsolete + RemoteSysID = 128, // obsolete + AMCreateAccountResponse = 129, + WGRequest = 130, + WGResponse = 131, + KeepAlive = 132, + WebAPIJobRequest = 133, + WebAPIJobResponse = 134, + ClientSessionStart = 135, + ClientSessionEnd = 136, + ClientSessionUpdateAuthTicket = 137, // obsolete "renamed to ClientSessionUpdate" + ClientSessionUpdate = 137, + StatsDeprecated = 138, // obsolete + Ping = 139, + PingResponse = 140, + Stats = 141, + RequestFullStatsBlock = 142, + LoadDBOCacheItem = 143, + LoadDBOCacheItemResponse = 144, + InvalidateDBOCacheItems = 145, + ServiceMethod = 146, + ServiceMethodResponse = 147, + ClientPackageVersions = 148, + TimestampRequest = 149, + TimestampResponse = 150, + + BaseShell = 200, + AssignSysID = 200, + Exit = 201, + DirRequest = 202, + DirResponse = 203, + ZipRequest = 204, + ZipResponse = 205, + UpdateRecordResponse = 215, + UpdateCreditCardRequest = 221, + UpdateUserBanResponse = 225, + PrepareToExit = 226, + ContentDescriptionUpdate = 227, + TestResetServer = 228, + UniverseChanged = 229, + ShellConfigInfoUpdate = 230, + RequestWindowsEventLogEntries = 233, + ProvideWindowsEventLogEntries = 234, + ShellSearchLogs = 235, + ShellSearchLogsResponse = 236, + ShellCheckWindowsUpdates = 237, + ShellCheckWindowsUpdatesResponse = 238, + ShellFlushUserLicenseCache = 239, // obsolete + + BaseGM = 300, + Heartbeat = 300, + ShellFailed = 301, + ExitShells = 307, + ExitShell = 308, + GracefulExitShell = 309, + NotifyWatchdog = 314, + LicenseProcessingComplete = 316, + SetTestFlag = 317, + QueuedEmailsComplete = 318, + GMReportPHPError = 319, + GMDRMSync = 320, + PhysicalBoxInventory = 321, + UpdateConfigFile = 322, + TestInitDB = 323, + GMWriteConfigToSQL = 324, + GMLoadActivationCodes = 325, + GMQueueForFBS = 326, + GMSchemaConversionResults = 327, + GMSchemaConversionResultsResponse = 328, // obsolete + GMWriteShellFailureToSQL = 329, + GMWriteStatsToSOS = 330, + GMGetServiceMethodRouting = 331, + GMGetServiceMethodRoutingResponse = 332, + GMConvertUserWallets = 333, + + BaseAIS = 400, + AISRefreshContentDescription = 401, // obsolete + AISRequestContentDescription = 402, + AISUpdateAppInfo = 403, + AISUpdatePackageInfo = 404, // obsolete "renamed to AISUpdatePackageCosts" + AISUpdatePackageCosts = 404, + AISGetPackageChangeNumber = 405, + AISGetPackageChangeNumberResponse = 406, + AISAppInfoTableChanged = 407, // obsolete + AISUpdatePackageCostsResponse = 408, + AISCreateMarketingMessage = 409, + AISCreateMarketingMessageResponse = 410, + AISGetMarketingMessage = 411, + AISGetMarketingMessageResponse = 412, + AISUpdateMarketingMessage = 413, + AISUpdateMarketingMessageResponse = 414, + AISRequestMarketingMessageUpdate = 415, + AISDeleteMarketingMessage = 416, + AISGetMarketingTreatments = 419, // obsolete + AISGetMarketingTreatmentsResponse = 420, // obsolete + AISRequestMarketingTreatmentUpdate = 421, // obsolete + AISTestAddPackage = 422, // obsolete + AIGetAppGCFlags = 423, + AIGetAppGCFlagsResponse = 424, + AIGetAppList = 425, + AIGetAppListResponse = 426, + AIGetAppInfo = 427, // obsolete + AIGetAppInfoResponse = 428, // obsolete + AISGetCouponDefinition = 429, + AISGetCouponDefinitionResponse = 430, + AISUpdateSlaveContentDescription = 431, + AISUpdateSlaveContentDescriptionResponse = 432, + AISTestEnableGC = 433, + + BaseAM = 500, + AMUpdateUserBanRequest = 504, + AMAddLicense = 505, + AMBeginProcessingLicenses = 507, // obsolete + AMSendSystemIMToUser = 508, + AMExtendLicense = 509, + AMAddMinutesToLicense = 510, + AMCancelLicense = 511, + AMInitPurchase = 512, + AMPurchaseResponse = 513, + AMGetFinalPrice = 514, + AMGetFinalPriceResponse = 515, + AMGetLegacyGameKey = 516, + AMGetLegacyGameKeyResponse = 517, + AMFindHungTransactions = 518, + AMSetAccountTrustedRequest = 519, + AMCompletePurchase = 521, + AMCancelPurchase = 522, + AMNewChallenge = 523, + AMLoadOEMTickets = 524, + AMFixPendingPurchase = 525, + AMFixPendingPurchaseResponse = 526, + AMIsUserBanned = 527, + AMRegisterKey = 528, + AMLoadActivationCodes = 529, + AMLoadActivationCodesResponse = 530, + AMLookupKeyResponse = 531, + AMLookupKey = 532, + AMChatCleanup = 533, + AMClanCleanup = 534, + AMFixPendingRefund = 535, + AMReverseChargeback = 536, + AMReverseChargebackResponse = 537, + AMClanCleanupList = 538, + AMGetLicenses = 539, + AMGetLicensesResponse = 540, + AllowUserToPlayQuery = 550, + AllowUserToPlayResponse = 551, + AMVerfiyUser = 552, + AMClientNotPlaying = 553, + ClientRequestFriendship = 554, + AMRelayPublishStatus = 555, + AMResetCommunityContent = 556, // obsolete + AMPrimePersonaStateCache = 557, // obsolete + AMAllowUserContentQuery = 558, // obsolete + AMAllowUserContentResponse = 559, // obsolete + AMInitPurchaseResponse = 560, + AMRevokePurchaseResponse = 561, + AMLockProfile = 562, // obsolete + AMRefreshGuestPasses = 563, + AMInviteUserToClan = 564, + AMAcknowledgeClanInvite = 565, + AMGrantGuestPasses = 566, + AMClanDataUpdated = 567, + AMReloadAccount = 568, + AMClientChatMsgRelay = 569, + AMChatMulti = 570, + AMClientChatInviteRelay = 571, + AMChatInvite = 572, + AMClientJoinChatRelay = 573, + AMClientChatMemberInfoRelay = 574, + AMPublishChatMemberInfo = 575, + AMClientAcceptFriendInvite = 576, + AMChatEnter = 577, + AMClientPublishRemovalFromSource = 578, + AMChatActionResult = 579, + AMFindAccounts = 580, + AMFindAccountsResponse = 581, + AMRequestAccountData = 582, + AMRequestAccountDataResponse = 583, + AMSetAccountFlags = 584, + AMCreateClan = 586, + AMCreateClanResponse = 587, + AMGetClanDetails = 588, + AMGetClanDetailsResponse = 589, + AMSetPersonaName = 590, + AMSetAvatar = 591, + AMAuthenticateUser = 592, + AMAuthenticateUserResponse = 593, + AMGetAccountFriendsCount = 594, // obsolete + AMGetAccountFriendsCountResponse = 595, // obsolete + AMP2PIntroducerMessage = 596, + ClientChatAction = 597, + AMClientChatActionRelay = 598, + + BaseVS = 600, + ReqChallenge = 600, + VACResponse = 601, + ReqChallengeTest = 602, + VSMarkCheat = 604, + VSAddCheat = 605, + VSPurgeCodeModDB = 606, + VSGetChallengeResults = 607, + VSChallengeResultText = 608, + VSReportLingerer = 609, + VSRequestManagedChallenge = 610, + VSLoadDBFinished = 611, + + BaseDRMS = 625, + DRMBuildBlobRequest = 628, + DRMBuildBlobResponse = 629, + DRMResolveGuidRequest = 630, + DRMResolveGuidResponse = 631, + DRMVariabilityReport = 633, + DRMVariabilityReportResponse = 634, + DRMStabilityReport = 635, + DRMStabilityReportResponse = 636, + DRMDetailsReportRequest = 637, + DRMDetailsReportResponse = 638, + DRMProcessFile = 639, + DRMAdminUpdate = 640, + DRMAdminUpdateResponse = 641, + DRMSync = 642, + DRMSyncResponse = 643, + DRMProcessFileResponse = 644, + DRMEmptyGuidCache = 645, + DRMEmptyGuidCacheResponse = 646, + + BaseCS = 650, + CSUserContentRequest = 652, // obsolete + + BaseClient = 700, + ClientLogOn_Deprecated = 701, // obsolete + ClientAnonLogOn_Deprecated = 702, // obsolete + ClientHeartBeat = 703, + ClientVACResponse = 704, + ClientGamesPlayed_obsolete = 705, // obsolete + ClientLogOff = 706, + ClientNoUDPConnectivity = 707, + ClientInformOfCreateAccount = 708, + ClientAckVACBan = 709, // obsolete + ClientConnectionStats = 710, + ClientInitPurchase = 711, // obsolete + ClientPingResponse = 712, + ClientRemoveFriend = 714, + ClientGamesPlayedNoDataBlob = 715, + ClientChangeStatus = 716, + ClientVacStatusResponse = 717, + ClientFriendMsg = 718, + ClientGameConnect_obsolete = 719, // obsolete + ClientGamesPlayed2_obsolete = 720, // obsolete + ClientGameEnded_obsolete = 721, // obsolete + ClientGetFinalPrice = 722, // obsolete + ClientSystemIM = 726, + ClientSystemIMAck = 727, + ClientGetLicenses = 728, + ClientCancelLicense = 729, // obsolete + ClientGetLegacyGameKey = 730, + ClientContentServerLogOn_Deprecated = 731, // obsolete + ClientAckVACBan2 = 732, + ClientAckMessageByGID = 735, // obsolete + ClientGetPurchaseReceipts = 736, + ClientAckPurchaseReceipt = 737, // obsolete + ClientGamesPlayed3_obsolete = 738, // obsolete + ClientSendGuestPass = 739, // obsolete + ClientAckGuestPass = 740, + ClientRedeemGuestPass = 741, + ClientGamesPlayed = 742, + ClientRegisterKey = 743, + ClientInviteUserToClan = 744, + ClientAcknowledgeClanInvite = 745, + ClientPurchaseWithMachineID = 746, + ClientAppUsageEvent = 747, + ClientGetGiftTargetList = 748, // obsolete + ClientGetGiftTargetListResponse = 749, // obsolete + ClientLogOnResponse = 751, + ClientVACChallenge = 753, // obsolete + ClientSetHeartbeatRate = 755, + ClientNotLoggedOnDeprecated = 756, // obsolete + ClientLoggedOff = 757, + GSApprove = 758, + GSDeny = 759, + GSKick = 760, + ClientCreateAcctResponse = 761, + ClientPurchaseResponse = 763, + ClientPing = 764, + ClientNOP = 765, + ClientPersonaState = 766, + ClientFriendsList = 767, + ClientAccountInfo = 768, + ClientVacStatusQuery = 770, // obsolete + ClientNewsUpdate = 771, + ClientGameConnectDeny = 773, + GSStatusReply = 774, + ClientGetFinalPriceResponse = 775, // obsolete + ClientGameConnectTokens = 779, + ClientLicenseList = 780, + ClientCancelLicenseResponse = 781, // obsolete + ClientVACBanStatus = 782, + ClientCMList = 783, + ClientEncryptPct = 784, + ClientGetLegacyGameKeyResponse = 785, + ClientFavoritesList = 786, // obsolete + CSUserContentApprove = 787, // obsolete + CSUserContentDeny = 788, // obsolete + ClientInitPurchaseResponse = 789, // obsolete + ClientAddFriend = 791, + ClientAddFriendResponse = 792, + ClientInviteFriend = 793, // obsolete + ClientInviteFriendResponse = 794, // obsolete + ClientSendGuestPassResponse = 795, // obsolete + ClientAckGuestPassResponse = 796, + ClientRedeemGuestPassResponse = 797, + ClientUpdateGuestPassesList = 798, + ClientChatMsg = 799, + ClientChatInvite = 800, + ClientJoinChat = 801, + ClientChatMemberInfo = 802, + ClientLogOnWithCredentials_Deprecated = 803, // obsolete + ClientPasswordChangeResponse = 805, + ClientChatEnter = 807, + ClientFriendRemovedFromSource = 808, + ClientCreateChat = 809, + ClientCreateChatResponse = 810, + ClientUpdateChatMetadata = 811, // obsolete + ClientP2PIntroducerMessage = 813, + ClientChatActionResult = 814, + ClientRequestFriendData = 815, + ClientGetUserStats = 818, + ClientGetUserStatsResponse = 819, + ClientStoreUserStats = 820, + ClientStoreUserStatsResponse = 821, + ClientClanState = 822, + ClientServiceModule = 830, + ClientServiceCall = 831, + ClientServiceCallResponse = 832, + ClientPackageInfoRequest = 833, // obsolete + ClientPackageInfoResponse = 834, // obsolete + ClientNatTraversalStatEvent = 839, + ClientAppInfoRequest = 840, // obsolete + ClientAppInfoResponse = 841, // obsolete + ClientSteamUsageEvent = 842, + ClientCheckPassword = 845, + ClientResetPassword = 846, + ClientCheckPasswordResponse = 848, + ClientResetPasswordResponse = 849, + ClientSessionToken = 850, + ClientDRMProblemReport = 851, + ClientSetIgnoreFriend = 855, + ClientSetIgnoreFriendResponse = 856, + ClientGetAppOwnershipTicket = 857, + ClientGetAppOwnershipTicketResponse = 858, + ClientGetLobbyListResponse = 860, + ClientGetLobbyMetadata = 861, // obsolete + ClientGetLobbyMetadataResponse = 862, // obsolete + ClientVTTCert = 863, // obsolete + ClientAppInfoUpdate = 866, // obsolete + ClientAppInfoChanges = 867, // obsolete + ClientServerList = 880, + ClientEmailChangeResponse = 891, + ClientSecretQAChangeResponse = 892, + ClientDRMBlobRequest = 896, + ClientDRMBlobResponse = 897, + ClientLookupKey = 898, // obsolete + ClientLookupKeyResponse = 899, // obsolete + + BaseGameServer = 900, + GSDisconnectNotice = 901, + GSStatus = 903, + GSUserPlaying = 905, + GSStatus2 = 906, + GSStatusUpdate_Unused = 907, + GSServerType = 908, + GSPlayerList = 909, + GSGetUserAchievementStatus = 910, + GSGetUserAchievementStatusResponse = 911, + GSGetPlayStats = 918, + GSGetPlayStatsResponse = 919, + GSGetUserGroupStatus = 920, + AMGetUserGroupStatus = 921, + AMGetUserGroupStatusResponse = 922, + GSGetUserGroupStatusResponse = 923, + GSGetReputation = 936, + GSGetReputationResponse = 937, + GSAssociateWithClan = 938, + GSAssociateWithClanResponse = 939, + GSComputeNewPlayerCompatibility = 940, + GSComputeNewPlayerCompatibilityResponse = 941, + + BaseAdmin = 1000, + AdminCmd = 1000, + AdminCmdResponse = 1004, + AdminLogListenRequest = 1005, + AdminLogEvent = 1006, + LogSearchRequest = 1007, // obsolete + LogSearchResponse = 1008, // obsolete + LogSearchCancel = 1009, // obsolete + UniverseData = 1010, + RequestStatHistory = 1014, // obsolete + StatHistory = 1015, // obsolete + AdminPwLogon = 1017, // obsolete + AdminPwLogonResponse = 1018, // obsolete + AdminSpew = 1019, + AdminConsoleTitle = 1020, + AdminGCSpew = 1023, + AdminGCCommand = 1024, + AdminGCGetCommandList = 1025, + AdminGCGetCommandListResponse = 1026, + FBSConnectionData = 1027, + AdminMsgSpew = 1028, + + BaseFBS = 1100, + FBSReqVersion = 1100, + FBSVersionInfo = 1101, + FBSForceRefresh = 1102, + FBSForceBounce = 1103, + FBSDeployPackage = 1104, + FBSDeployResponse = 1105, + FBSUpdateBootstrapper = 1106, + FBSSetState = 1107, + FBSApplyOSUpdates = 1108, + FBSRunCMDScript = 1109, + FBSRebootBox = 1110, + FBSSetBigBrotherMode = 1111, + FBSMinidumpServer = 1112, + FBSSetShellCount_obsolete = 1113, // obsolete + FBSDeployHotFixPackage = 1114, + FBSDeployHotFixResponse = 1115, + FBSDownloadHotFix = 1116, + FBSDownloadHotFixResponse = 1117, + FBSUpdateTargetConfigFile = 1118, + FBSApplyAccountCred = 1119, + FBSApplyAccountCredResponse = 1120, + FBSSetShellCount = 1121, + FBSTerminateShell = 1122, + FBSQueryGMForRequest = 1123, + FBSQueryGMResponse = 1124, + FBSTerminateZombies = 1125, + FBSInfoFromBootstrapper = 1126, + FBSRebootBoxResponse = 1127, + FBSBootstrapperPackageRequest = 1128, + FBSBootstrapperPackageResponse = 1129, + FBSBootstrapperGetPackageChunk = 1130, + FBSBootstrapperGetPackageChunkResponse = 1131, + FBSBootstrapperPackageTransferProgress = 1132, + FBSRestartBootstrapper = 1133, + + BaseFileXfer = 1200, + FileXferRequest = 1200, + FileXferResponse = 1201, + FileXferData = 1202, + FileXferEnd = 1203, + FileXferDataAck = 1204, + + BaseChannelAuth = 1300, + ChannelAuthChallenge = 1300, + ChannelAuthResponse = 1301, + ChannelAuthResult = 1302, + ChannelEncryptRequest = 1303, + ChannelEncryptResponse = 1304, + ChannelEncryptResult = 1305, + + BaseBS = 1400, + BSPurchaseStart = 1401, + BSPurchaseResponse = 1402, // obsolete + BSSettleNOVA = 1404, // obsolete + BSSettleComplete = 1406, + BSBannedRequest = 1407, // obsolete + BSInitPayPalTxn = 1408, + BSInitPayPalTxnResponse = 1409, + BSGetPayPalUserInfo = 1410, + BSGetPayPalUserInfoResponse = 1411, + BSRefundTxn = 1413, // obsolete + BSRefundTxnResponse = 1414, // obsolete + BSGetEvents = 1415, // obsolete + BSChaseRFRRequest = 1416, // obsolete + BSPaymentInstrBan = 1417, + BSPaymentInstrBanResponse = 1418, + BSProcessGCReports = 1419, // obsolete + BSProcessPPReports = 1420, // obsolete + BSInitGCBankXferTxn = 1421, + BSInitGCBankXferTxnResponse = 1422, + BSQueryGCBankXferTxn = 1423, // obsolete + BSQueryGCBankXferTxnResponse = 1424, // obsolete + BSCommitGCTxn = 1425, + BSQueryTransactionStatus = 1426, + BSQueryTransactionStatusResponse = 1427, + BSQueryCBOrderStatus = 1428, // obsolete + BSQueryCBOrderStatusResponse = 1429, // obsolete + BSRunRedFlagReport = 1430, // obsolete + BSQueryPaymentInstUsage = 1431, + BSQueryPaymentInstResponse = 1432, + BSQueryTxnExtendedInfo = 1433, + BSQueryTxnExtendedInfoResponse = 1434, + BSUpdateConversionRates = 1435, + BSProcessUSBankReports = 1436, // obsolete + BSPurchaseRunFraudChecks = 1437, + BSPurchaseRunFraudChecksResponse = 1438, + BSStartShippingJobs = 1439, // obsolete + BSQueryBankInformation = 1440, + BSQueryBankInformationResponse = 1441, + BSValidateXsollaSignature = 1445, + BSValidateXsollaSignatureResponse = 1446, + BSQiwiWalletInvoice = 1448, + BSQiwiWalletInvoiceResponse = 1449, + BSUpdateInventoryFromProPack = 1450, + BSUpdateInventoryFromProPackResponse = 1451, + BSSendShippingRequest = 1452, + BSSendShippingRequestResponse = 1453, + BSGetProPackOrderStatus = 1454, + BSGetProPackOrderStatusResponse = 1455, + BSCheckJobRunning = 1456, + BSCheckJobRunningResponse = 1457, + BSResetPackagePurchaseRateLimit = 1458, + BSResetPackagePurchaseRateLimitResponse = 1459, + BSUpdatePaymentData = 1460, + BSUpdatePaymentDataResponse = 1461, + BSGetBillingAddress = 1462, + BSGetBillingAddressResponse = 1463, + BSGetCreditCardInfo = 1464, + BSGetCreditCardInfoResponse = 1465, + BSRemoveExpiredPaymentData = 1468, + BSRemoveExpiredPaymentDataResponse = 1469, + BSConvertToCurrentKeys = 1470, + BSConvertToCurrentKeysResponse = 1471, + BSInitPurchase = 1472, + BSInitPurchaseResponse = 1473, + BSCompletePurchase = 1474, + BSCompletePurchaseResponse = 1475, + BSPruneCardUsageStats = 1476, + BSPruneCardUsageStatsResponse = 1477, + BSStoreBankInformation = 1478, + BSStoreBankInformationResponse = 1479, + BSVerifyPOSAKey = 1480, + BSVerifyPOSAKeyResponse = 1481, + BSReverseRedeemPOSAKey = 1482, + BSReverseRedeemPOSAKeyResponse = 1483, + BSQueryFindCreditCard = 1484, + BSQueryFindCreditCardResponse = 1485, + BSStatusInquiryPOSAKey = 1486, + BSStatusInquiryPOSAKeyResponse = 1487, + BSValidateMoPaySignature = 1488, + BSValidateMoPaySignatureResponse = 1489, + BSMoPayConfirmProductDelivery = 1490, + BSMoPayConfirmProductDeliveryResponse = 1491, + BSGenerateMoPayMD5 = 1492, + BSGenerateMoPayMD5Response = 1493, + BSBoaCompraConfirmProductDelivery = 1494, + BSBoaCompraConfirmProductDeliveryResponse = 1495, + BSGenerateBoaCompraMD5 = 1496, + BSGenerateBoaCompraMD5Response = 1497, + BSCommitWPTxn = 1498, + + BaseATS = 1500, + ATSStartStressTest = 1501, + ATSStopStressTest = 1502, + ATSRunFailServerTest = 1503, + ATSUFSPerfTestTask = 1504, + ATSUFSPerfTestResponse = 1505, + ATSCycleTCM = 1506, + ATSInitDRMSStressTest = 1507, + ATSCallTest = 1508, + ATSCallTestReply = 1509, + ATSStartExternalStress = 1510, + ATSExternalStressJobStart = 1511, + ATSExternalStressJobQueued = 1512, + ATSExternalStressJobRunning = 1513, + ATSExternalStressJobStopped = 1514, + ATSExternalStressJobStopAll = 1515, + ATSExternalStressActionResult = 1516, + ATSStarted = 1517, + ATSCSPerfTestTask = 1518, + ATSCSPerfTestResponse = 1519, + + BaseDP = 1600, + DPSetPublishingState = 1601, + DPGamePlayedStats = 1602, // obsolete + DPUniquePlayersStat = 1603, + DPStreamingUniquePlayersStat = 1604, + DPVacInfractionStats = 1605, + DPVacBanStats = 1606, + DPBlockingStats = 1607, + DPNatTraversalStats = 1608, + DPSteamUsageEvent = 1609, // obsolete + DPVacCertBanStats = 1610, + DPVacCafeBanStats = 1611, + DPCloudStats = 1612, + DPAchievementStats = 1613, + DPAccountCreationStats = 1614, + DPGetPlayerCount = 1615, + DPGetPlayerCountResponse = 1616, + DPGameServersPlayersStats = 1617, + DPDownloadRateStatistics = 1618, // obsolete + DPFacebookStatistics = 1619, + ClientDPCheckSpecialSurvey = 1620, + ClientDPCheckSpecialSurveyResponse = 1621, + ClientDPSendSpecialSurveyResponse = 1622, + ClientDPSendSpecialSurveyResponseReply = 1623, + DPStoreSaleStatistics = 1624, + ClientDPUpdateAppJobReport = 1625, + ClientDPSteam2AppStarted = 1627, // obsolete + DPUpdateContentEvent = 1626, + DPPartnerMicroTxns = 1628, + DPPartnerMicroTxnsResponse = 1629, + ClientDPContentStatsReport = 1630, + DPVRUniquePlayersStat = 1631, + + BaseCM = 1700, + CMSetAllowState = 1701, + CMSpewAllowState = 1702, + CMAppInfoResponseDeprecated = 1703, // obsolete + + BaseDSS = 1800, // obsolete + DSSNewFile = 1801, // obsolete + DSSCurrentFileList = 1802, // obsolete + DSSSynchList = 1803, // obsolete + DSSSynchListResponse = 1804, // obsolete + DSSSynchSubscribe = 1805, // obsolete + DSSSynchUnsubscribe = 1806, // obsolete + + BaseEPM = 1900, // obsolete + EPMStartProcess = 1901, // obsolete + EPMStopProcess = 1902, // obsolete + EPMRestartProcess = 1903, // obsolete + + BaseGC = 2200, + GCSendClient = 2200, // obsolete + AMRelayToGC = 2201, // obsolete + GCUpdatePlayedState = 2202, // obsolete + GCCmdRevive = 2203, + GCCmdBounce = 2204, // obsolete + GCCmdForceBounce = 2205, // obsolete + GCCmdDown = 2206, + GCCmdDeploy = 2207, + GCCmdDeployResponse = 2208, + GCCmdSwitch = 2209, + AMRefreshSessions = 2210, + GCUpdateGSState = 2211, // obsolete + GCAchievementAwarded = 2212, + GCSystemMessage = 2213, + GCValidateSession = 2214, // obsolete + GCValidateSessionResponse = 2215, // obsolete + GCCmdStatus = 2216, + GCRegisterWebInterfaces = 2217, // obsolete + GCRegisterWebInterfaces_Deprecated = 2217, // obsolete + GCGetAccountDetails = 2218, // obsolete + GCGetAccountDetails_DEPRECATED = 2218, // obsolete + GCInterAppMessage = 2219, + GCGetEmailTemplate = 2220, + GCGetEmailTemplateResponse = 2221, + ISRelayToGCH = 2222, // obsolete "renamed to GCHRelay" + GCHRelay = 2222, + GCHRelayClientToIS = 2223, // obsolete "renamed to GCHRelayToClient" + GCHRelayToClient = 2223, + GCHUpdateSession = 2224, + GCHRequestUpdateSession = 2225, + GCHRequestStatus = 2226, + GCHRequestStatusResponse = 2227, + GCHAccountVacStatusChange = 2228, + GCHSpawnGC = 2229, + GCHSpawnGCResponse = 2230, + GCHKillGC = 2231, + GCHKillGCResponse = 2232, + GCHAccountTradeBanStatusChange = 2233, + GCHAccountLockStatusChange = 2234, + GCHVacVerificationChange = 2235, + GCHAccountPhoneNumberChange = 2236, + GCHAccountTwoFactorChange = 2237, + + BaseP2P = 2500, + P2PIntroducerMessage = 2502, + + BaseSM = 2900, + SMExpensiveReport = 2902, + SMHourlyReport = 2903, + SMFishingReport = 2904, + SMPartitionRenames = 2905, + SMMonitorSpace = 2906, + SMGetSchemaConversionResults = 2907, // obsolete + SMGetSchemaConversionResultsResponse = 2908, // obsolete + + BaseTest = 3000, + FailServer = 3000, + JobHeartbeatTest = 3001, + JobHeartbeatTestResponse = 3002, + + BaseFTSRange = 3100, + FTSGetBrowseCounts = 3101, // obsolete + FTSGetBrowseCountsResponse = 3102, // obsolete + FTSBrowseClans = 3103, // obsolete + FTSBrowseClansResponse = 3104, // obsolete + FTSSearchClansByLocation = 3105, // obsolete + FTSSearchClansByLocationResponse = 3106, // obsolete + FTSSearchPlayersByLocation = 3107, // obsolete + FTSSearchPlayersByLocationResponse = 3108, // obsolete + FTSClanDeleted = 3109, // obsolete + FTSSearch = 3110, // obsolete + FTSSearchResponse = 3111, // obsolete + FTSSearchStatus = 3112, // obsolete + FTSSearchStatusResponse = 3113, // obsolete + FTSGetGSPlayStats = 3114, // obsolete + FTSGetGSPlayStatsResponse = 3115, // obsolete + FTSGetGSPlayStatsForServer = 3116, // obsolete + FTSGetGSPlayStatsForServerResponse = 3117, // obsolete + FTSReportIPUpdates = 3118, // obsolete + + BaseCCSRange = 3150, + CCSGetComments = 3151, // obsolete + CCSGetCommentsResponse = 3152, // obsolete + CCSAddComment = 3153, // obsolete + CCSAddCommentResponse = 3154, // obsolete + CCSDeleteComment = 3155, // obsolete + CCSDeleteCommentResponse = 3156, // obsolete + CCSPreloadComments = 3157, // obsolete + CCSNotifyCommentCount = 3158, // obsolete + CCSGetCommentsForNews = 3159, // obsolete + CCSGetCommentsForNewsResponse = 3160, // obsolete + CCSDeleteAllCommentsByAuthor = 3161, + CCSDeleteAllCommentsByAuthorResponse = 3162, + + BaseLBSRange = 3200, + LBSSetScore = 3201, + LBSSetScoreResponse = 3202, + LBSFindOrCreateLB = 3203, + LBSFindOrCreateLBResponse = 3204, + LBSGetLBEntries = 3205, + LBSGetLBEntriesResponse = 3206, + LBSGetLBList = 3207, + LBSGetLBListResponse = 3208, + LBSSetLBDetails = 3209, + LBSDeleteLB = 3210, + LBSDeleteLBEntry = 3211, + LBSResetLB = 3212, + LBSResetLBResponse = 3213, + LBSDeleteLBResponse = 3214, + + BaseOGS = 3400, + OGSBeginSession = 3401, + OGSBeginSessionResponse = 3402, + OGSEndSession = 3403, + OGSEndSessionResponse = 3404, + OGSWriteAppSessionRow = 3406, + + BaseBRP = 3600, + BRPStartShippingJobs = 3601, + BRPProcessUSBankReports = 3602, + BRPProcessGCReports = 3603, + BRPProcessPPReports = 3604, + BRPSettleNOVA = 3605, // obsolete + BRPSettleCB = 3606, // obsolete + BRPCommitGC = 3607, + BRPCommitGCResponse = 3608, + BRPFindHungTransactions = 3609, + BRPCheckFinanceCloseOutDate = 3610, + BRPProcessLicenses = 3611, + BRPProcessLicensesResponse = 3612, + BRPRemoveExpiredPaymentData = 3613, + BRPRemoveExpiredPaymentDataResponse = 3614, + BRPConvertToCurrentKeys = 3615, + BRPConvertToCurrentKeysResponse = 3616, + BRPPruneCardUsageStats = 3617, + BRPPruneCardUsageStatsResponse = 3618, + BRPCheckActivationCodes = 3619, + BRPCheckActivationCodesResponse = 3620, + BRPCommitWP = 3621, + BRPCommitWPResponse = 3622, + BRPProcessWPReports = 3623, + BRPProcessPaymentRules = 3624, + BRPProcessPartnerPayments = 3625, + BRPCheckSettlementReports = 3626, + BRPPostTaxToAvalara = 3628, + BRPPostTransactionTax = 3629, + BRPPostTransactionTaxResponse = 3630, + BRPProcessIMReports = 3631, + + BaseAMRange2 = 4000, + AMCreateChat = 4001, + AMCreateChatResponse = 4002, + AMUpdateChatMetadata = 4003, // obsolete + AMPublishChatMetadata = 4004, // obsolete + AMSetProfileURL = 4005, + AMGetAccountEmailAddress = 4006, + AMGetAccountEmailAddressResponse = 4007, + AMRequestFriendData = 4008, // obsolete "renamed to AMRequestClanData" + AMRequestClanData = 4008, + AMRouteToClients = 4009, + AMLeaveClan = 4010, + AMClanPermissions = 4011, + AMClanPermissionsResponse = 4012, + AMCreateClanEvent = 4013, + AMCreateClanEventResponse = 4014, + AMUpdateClanEvent = 4015, + AMUpdateClanEventResponse = 4016, + AMGetClanEvents = 4017, + AMGetClanEventsResponse = 4018, + AMDeleteClanEvent = 4019, + AMDeleteClanEventResponse = 4020, + AMSetClanPermissionSettings = 4021, + AMSetClanPermissionSettingsResponse = 4022, + AMGetClanPermissionSettings = 4023, + AMGetClanPermissionSettingsResponse = 4024, + AMPublishChatRoomInfo = 4025, + ClientChatRoomInfo = 4026, + AMCreateClanAnnouncement = 4027, // obsolete + AMCreateClanAnnouncementResponse = 4028, // obsolete + AMUpdateClanAnnouncement = 4029, // obsolete + AMUpdateClanAnnouncementResponse = 4030, // obsolete + AMGetClanAnnouncementsCount = 4031, // obsolete + AMGetClanAnnouncementsCountResponse = 4032, // obsolete + AMGetClanAnnouncements = 4033, // obsolete + AMGetClanAnnouncementsResponse = 4034, // obsolete + AMDeleteClanAnnouncement = 4035, // obsolete + AMDeleteClanAnnouncementResponse = 4036, // obsolete + AMGetSingleClanAnnouncement = 4037, // obsolete + AMGetSingleClanAnnouncementResponse = 4038, // obsolete + AMGetClanHistory = 4039, + AMGetClanHistoryResponse = 4040, + AMGetClanPermissionBits = 4041, + AMGetClanPermissionBitsResponse = 4042, + AMSetClanPermissionBits = 4043, + AMSetClanPermissionBitsResponse = 4044, + AMSessionInfoRequest = 4045, + AMSessionInfoResponse = 4046, + AMValidateWGToken = 4047, + AMGetSingleClanEvent = 4048, + AMGetSingleClanEventResponse = 4049, + AMGetClanRank = 4050, + AMGetClanRankResponse = 4051, + AMSetClanRank = 4052, + AMSetClanRankResponse = 4053, + AMGetClanPOTW = 4054, + AMGetClanPOTWResponse = 4055, + AMSetClanPOTW = 4056, + AMSetClanPOTWResponse = 4057, + AMRequestChatMetadata = 4058, // obsolete + AMDumpUser = 4059, + AMKickUserFromClan = 4060, + AMAddFounderToClan = 4061, + AMValidateWGTokenResponse = 4062, + AMSetCommunityState = 4063, + AMSetAccountDetails = 4064, + AMGetChatBanList = 4065, + AMGetChatBanListResponse = 4066, + AMUnBanFromChat = 4067, + AMSetClanDetails = 4068, + AMGetAccountLinks = 4069, + AMGetAccountLinksResponse = 4070, + AMSetAccountLinks = 4071, + AMSetAccountLinksResponse = 4072, + AMGetUserGameStats = 4073, + AMGetUserGameStatsResponse = 4074, + AMCheckClanMembership = 4075, + AMGetClanMembers = 4076, + AMGetClanMembersResponse = 4077, + AMJoinPublicClan = 4078, + AMNotifyChatOfClanChange = 4079, + AMResubmitPurchase = 4080, + AMAddFriend = 4081, + AMAddFriendResponse = 4082, + AMRemoveFriend = 4083, + AMDumpClan = 4084, + AMChangeClanOwner = 4085, + AMCancelEasyCollect = 4086, + AMCancelEasyCollectResponse = 4087, + AMGetClanMembershipList = 4088, // obsolete + AMGetClanMembershipListResponse = 4089, // obsolete + AMClansInCommon = 4090, + AMClansInCommonResponse = 4091, + AMIsValidAccountID = 4092, + AMConvertClan = 4093, + AMGetGiftTargetListRelay = 4094, // obsolete + AMWipeFriendsList = 4095, + AMSetIgnored = 4096, + AMClansInCommonCountResponse = 4097, + AMFriendsList = 4098, + AMFriendsListResponse = 4099, + AMFriendsInCommon = 4100, + AMFriendsInCommonResponse = 4101, + AMFriendsInCommonCountResponse = 4102, + AMClansInCommonCount = 4103, + AMChallengeVerdict = 4104, + AMChallengeNotification = 4105, + AMFindGSByIP = 4106, + AMFoundGSByIP = 4107, + AMGiftRevoked = 4108, + AMCreateAccountRecord = 4109, + AMUserClanList = 4110, + AMUserClanListResponse = 4111, + AMGetAccountDetails2 = 4112, + AMGetAccountDetailsResponse2 = 4113, + AMSetCommunityProfileSettings = 4114, + AMSetCommunityProfileSettingsResponse = 4115, + AMGetCommunityPrivacyState = 4116, + AMGetCommunityPrivacyStateResponse = 4117, + AMCheckClanInviteRateLimiting = 4118, + AMGetUserAchievementStatus = 4119, + AMGetIgnored = 4120, + AMGetIgnoredResponse = 4121, + AMSetIgnoredResponse = 4122, + AMSetFriendRelationshipNone = 4123, + AMGetFriendRelationship = 4124, + AMGetFriendRelationshipResponse = 4125, + AMServiceModulesCache = 4126, + AMServiceModulesCall = 4127, + AMServiceModulesCallResponse = 4128, + AMGetCaptchaDataForIP = 4129, + AMGetCaptchaDataForIPResponse = 4130, + AMValidateCaptchaDataForIP = 4131, + AMValidateCaptchaDataForIPResponse = 4132, + AMTrackFailedAuthByIP = 4133, + AMGetCaptchaDataByGID = 4134, + AMGetCaptchaDataByGIDResponse = 4135, + AMGetLobbyList = 4136, // obsolete + AMGetLobbyListResponse = 4137, // obsolete + AMGetLobbyMetadata = 4138, // obsolete + AMGetLobbyMetadataResponse = 4139, // obsolete + CommunityAddFriendNews = 4140, + AMAddClanNews = 4141, // obsolete + AMWriteNews = 4142, // obsolete + AMFindClanUser = 4143, + AMFindClanUserResponse = 4144, + AMBanFromChat = 4145, + AMGetUserHistoryResponse = 4146, // obsolete + AMGetUserNewsSubscriptions = 4147, + AMGetUserNewsSubscriptionsResponse = 4148, + AMSetUserNewsSubscriptions = 4149, + AMGetUserNews = 4150, // obsolete + AMGetUserNewsResponse = 4151, // obsolete + AMSendQueuedEmails = 4152, + AMSetLicenseFlags = 4153, + AMGetUserHistory = 4154, // obsolete + CommunityDeleteUserNews = 4155, + AMAllowUserFilesRequest = 4156, + AMAllowUserFilesResponse = 4157, + AMGetAccountStatus = 4158, + AMGetAccountStatusResponse = 4159, + AMEditBanReason = 4160, + AMCheckClanMembershipResponse = 4161, + AMProbeClanMembershipList = 4162, + AMProbeClanMembershipListResponse = 4163, + AMGetFriendsLobbies = 4165, + AMGetFriendsLobbiesResponse = 4166, + AMGetUserFriendNewsResponse = 4172, + CommunityGetUserFriendNews = 4173, + AMGetUserClansNewsResponse = 4174, + AMGetUserClansNews = 4175, + AMStoreInitPurchase = 4176, // obsolete + AMStoreInitPurchaseResponse = 4177, // obsolete + AMStoreGetFinalPrice = 4178, // obsolete + AMStoreGetFinalPriceResponse = 4179, // obsolete + AMStoreCompletePurchase = 4180, // obsolete + AMStoreCancelPurchase = 4181, // obsolete + AMStorePurchaseResponse = 4182, // obsolete + AMCreateAccountRecordInSteam3 = 4183, // obsolete + AMGetPreviousCBAccount = 4184, + AMGetPreviousCBAccountResponse = 4185, + AMUpdateBillingAddress = 4186, // obsolete + AMUpdateBillingAddressResponse = 4187, // obsolete + AMGetBillingAddress = 4188, // obsolete + AMGetBillingAddressResponse = 4189, // obsolete + AMGetUserLicenseHistory = 4190, + AMGetUserLicenseHistoryResponse = 4191, + AMSupportChangePassword = 4194, + AMSupportChangeEmail = 4195, + AMSupportChangeSecretQA = 4196, // obsolete + AMResetUserVerificationGSByIP = 4197, + AMUpdateGSPlayStats = 4198, + AMSupportEnableOrDisable = 4199, + AMGetComments = 4200, // obsolete + AMGetCommentsResponse = 4201, // obsolete + AMAddComment = 4202, // obsolete + AMAddCommentResponse = 4203, // obsolete + AMDeleteComment = 4204, // obsolete + AMDeleteCommentResponse = 4205, // obsolete + AMGetPurchaseStatus = 4206, + AMSupportIsAccountEnabled = 4209, + AMSupportIsAccountEnabledResponse = 4210, + AMGetUserStats = 4211, + AMSupportKickSession = 4212, + AMGSSearch = 4213, + MarketingMessageUpdate = 4216, + AMRouteFriendMsg = 4219, + AMTicketAuthRequestOrResponse = 4220, + AMVerifyDepotManagementRights = 4222, + AMVerifyDepotManagementRightsResponse = 4223, + AMAddFreeLicense = 4224, + AMGetUserFriendsMinutesPlayed = 4225, // obsolete + AMGetUserFriendsMinutesPlayedResponse = 4226, // obsolete + AMGetUserMinutesPlayed = 4227, // obsolete + AMGetUserMinutesPlayedResponse = 4228, // obsolete + AMValidateEmailLink = 4231, + AMValidateEmailLinkResponse = 4232, + AMAddUsersToMarketingTreatment = 4234, // obsolete + AMStoreUserStats = 4236, + AMGetUserGameplayInfo = 4237, // obsolete + AMGetUserGameplayInfoResponse = 4238, // obsolete + AMGetCardList = 4239, // obsolete + AMGetCardListResponse = 4240, // obsolete + AMDeleteStoredCard = 4241, + AMRevokeLegacyGameKeys = 4242, + AMGetWalletDetails = 4244, + AMGetWalletDetailsResponse = 4245, + AMDeleteStoredPaymentInfo = 4246, + AMGetStoredPaymentSummary = 4247, + AMGetStoredPaymentSummaryResponse = 4248, + AMGetWalletConversionRate = 4249, + AMGetWalletConversionRateResponse = 4250, + AMConvertWallet = 4251, + AMConvertWalletResponse = 4252, + AMRelayGetFriendsWhoPlayGame = 4253, // obsolete + AMRelayGetFriendsWhoPlayGameResponse = 4254, // obsolete + AMSetPreApproval = 4255, + AMSetPreApprovalResponse = 4256, + AMMarketingTreatmentUpdate = 4257, // obsolete + AMCreateRefund = 4258, + AMCreateRefundResponse = 4259, + AMCreateChargeback = 4260, + AMCreateChargebackResponse = 4261, + AMCreateDispute = 4262, + AMCreateDisputeResponse = 4263, + AMClearDispute = 4264, + AMClearDisputeResponse = 4265, + AMPlayerNicknameList = 4266, + AMPlayerNicknameListResponse = 4267, + AMSetDRMTestConfig = 4268, + AMGetUserCurrentGameInfo = 4269, + AMGetUserCurrentGameInfoResponse = 4270, + AMGetGSPlayerList = 4271, + AMGetGSPlayerListResponse = 4272, + AMUpdatePersonaStateCache = 4275, // obsolete + AMGetGameMembers = 4276, + AMGetGameMembersResponse = 4277, + AMGetSteamIDForMicroTxn = 4278, + AMGetSteamIDForMicroTxnResponse = 4279, + AMAddPublisherUser = 4280, + AMRemovePublisherUser = 4281, + AMGetUserLicenseList = 4282, + AMGetUserLicenseListResponse = 4283, + AMReloadGameGroupPolicy = 4284, + AMAddFreeLicenseResponse = 4285, + AMVACStatusUpdate = 4286, + AMGetAccountDetails = 4287, + AMGetAccountDetailsResponse = 4288, + AMGetPlayerLinkDetails = 4289, + AMGetPlayerLinkDetailsResponse = 4290, + AMSubscribeToPersonaFeed = 4291, // obsolete + AMGetUserVacBanList = 4292, // obsolete + AMGetUserVacBanListResponse = 4293, // obsolete + AMGetAccountFlagsForWGSpoofing = 4294, + AMGetAccountFlagsForWGSpoofingResponse = 4295, + AMGetFriendsWishlistInfo = 4296, // obsolete + AMGetFriendsWishlistInfoResponse = 4297, // obsolete + AMGetClanOfficers = 4298, + AMGetClanOfficersResponse = 4299, + AMNameChange = 4300, + AMGetNameHistory = 4301, + AMGetNameHistoryResponse = 4302, + AMUpdateProviderStatus = 4305, + AMClearPersonaMetadataBlob = 4306, // obsolete + AMSupportRemoveAccountSecurity = 4307, + AMIsAccountInCaptchaGracePeriod = 4308, + AMIsAccountInCaptchaGracePeriodResponse = 4309, + AMAccountPS3Unlink = 4310, + AMAccountPS3UnlinkResponse = 4311, + AMStoreUserStatsResponse = 4312, + AMGetAccountPSNInfo = 4313, + AMGetAccountPSNInfoResponse = 4314, + AMAuthenticatedPlayerList = 4315, + AMGetUserGifts = 4316, + AMGetUserGiftsResponse = 4317, + AMTransferLockedGifts = 4320, + AMTransferLockedGiftsResponse = 4321, + AMPlayerHostedOnGameServer = 4322, + AMGetAccountBanInfo = 4323, + AMGetAccountBanInfoResponse = 4324, + AMRecordBanEnforcement = 4325, + AMRollbackGiftTransfer = 4326, + AMRollbackGiftTransferResponse = 4327, + AMHandlePendingTransaction = 4328, + AMRequestClanDetails = 4329, + AMDeleteStoredPaypalAgreement = 4330, + AMGameServerUpdate = 4331, + AMGameServerRemove = 4332, + AMGetPaypalAgreements = 4333, + AMGetPaypalAgreementsResponse = 4334, + AMGameServerPlayerCompatibilityCheck = 4335, + AMGameServerPlayerCompatibilityCheckResponse = 4336, + AMRenewLicense = 4337, + AMGetAccountCommunityBanInfo = 4338, + AMGetAccountCommunityBanInfoResponse = 4339, + AMGameServerAccountChangePassword = 4340, + AMGameServerAccountDeleteAccount = 4341, + AMRenewAgreement = 4342, + AMSendEmail = 4343, // obsolete + AMXsollaPayment = 4344, + AMXsollaPaymentResponse = 4345, + AMAcctAllowedToPurchase = 4346, + AMAcctAllowedToPurchaseResponse = 4347, + AMSwapKioskDeposit = 4348, + AMSwapKioskDepositResponse = 4349, + AMSetUserGiftUnowned = 4350, + AMSetUserGiftUnownedResponse = 4351, + AMClaimUnownedUserGift = 4352, + AMClaimUnownedUserGiftResponse = 4353, + AMSetClanName = 4354, + AMSetClanNameResponse = 4355, + AMGrantCoupon = 4356, + AMGrantCouponResponse = 4357, + AMIsPackageRestrictedInUserCountry = 4358, + AMIsPackageRestrictedInUserCountryResponse = 4359, + AMHandlePendingTransactionResponse = 4360, + AMGrantGuestPasses2 = 4361, + AMGrantGuestPasses2Response = 4362, + AMSessionQuery = 4363, + AMSessionQueryResponse = 4364, + AMGetPlayerBanDetails = 4365, + AMGetPlayerBanDetailsResponse = 4366, + AMFinalizePurchase = 4367, + AMFinalizePurchaseResponse = 4368, + AMPersonaChangeResponse = 4372, + AMGetClanDetailsForForumCreation = 4373, + AMGetClanDetailsForForumCreationResponse = 4374, + AMGetPendingNotificationCount = 4375, + AMGetPendingNotificationCountResponse = 4376, + AMPasswordHashUpgrade = 4377, + AMMoPayPayment = 4378, + AMMoPayPaymentResponse = 4379, + AMBoaCompraPayment = 4380, + AMBoaCompraPaymentResponse = 4381, + AMExpireCaptchaByGID = 4382, + AMCompleteExternalPurchase = 4383, + AMCompleteExternalPurchaseResponse = 4384, + AMResolveNegativeWalletCredits = 4385, + AMResolveNegativeWalletCreditsResponse = 4386, + AMPayelpPayment = 4387, + AMPayelpPaymentResponse = 4388, + AMPlayerGetClanBasicDetails = 4389, + AMPlayerGetClanBasicDetailsResponse = 4390, + AMMOLPayment = 4391, + AMMOLPaymentResponse = 4392, + GetUserIPCountry = 4393, + GetUserIPCountryResponse = 4394, + NotificationOfSuspiciousActivity = 4395, + AMDegicaPayment = 4396, + AMDegicaPaymentResponse = 4397, + AMEClubPayment = 4398, + AMEClubPaymentResponse = 4399, + AMPayPalPaymentsHubPayment = 4400, + AMPayPalPaymentsHubPaymentResponse = 4401, + AMTwoFactorRecoverAuthenticatorRequest = 4402, + AMTwoFactorRecoverAuthenticatorResponse = 4403, + AMSmart2PayPayment = 4404, + AMSmart2PayPaymentResponse = 4405, + AMValidatePasswordResetCodeAndSendSmsRequest = 4406, + AMValidatePasswordResetCodeAndSendSmsResponse = 4407, + AMGetAccountResetDetailsRequest = 4408, + AMGetAccountResetDetailsResponse = 4409, + AMBitPayPayment = 4410, + AMBitPayPaymentResponse = 4411, + AMSendAccountInfoUpdate = 4412, + + BasePSRange = 5000, + PSCreateShoppingCart = 5001, + PSCreateShoppingCartResponse = 5002, + PSIsValidShoppingCart = 5003, + PSIsValidShoppingCartResponse = 5004, + PSAddPackageToShoppingCart = 5005, + PSAddPackageToShoppingCartResponse = 5006, + PSRemoveLineItemFromShoppingCart = 5007, + PSRemoveLineItemFromShoppingCartResponse = 5008, + PSGetShoppingCartContents = 5009, + PSGetShoppingCartContentsResponse = 5010, + PSAddWalletCreditToShoppingCart = 5011, + PSAddWalletCreditToShoppingCartResponse = 5012, + + BaseUFSRange = 5200, + ClientUFSUploadFileRequest = 5202, + ClientUFSUploadFileResponse = 5203, + ClientUFSUploadFileChunk = 5204, + ClientUFSUploadFileFinished = 5205, + ClientUFSGetFileListForApp = 5206, + ClientUFSGetFileListForAppResponse = 5207, + ClientUFSDownloadRequest = 5210, + ClientUFSDownloadResponse = 5211, + ClientUFSDownloadChunk = 5212, + ClientUFSLoginRequest = 5213, + ClientUFSLoginResponse = 5214, + UFSReloadPartitionInfo = 5215, + ClientUFSTransferHeartbeat = 5216, + UFSSynchronizeFile = 5217, + UFSSynchronizeFileResponse = 5218, + ClientUFSDeleteFileRequest = 5219, + ClientUFSDeleteFileResponse = 5220, + UFSDownloadRequest = 5221, // obsolete + UFSDownloadResponse = 5222, // obsolete + UFSDownloadChunk = 5223, // obsolete + ClientUFSGetUGCDetails = 5226, + ClientUFSGetUGCDetailsResponse = 5227, + UFSUpdateFileFlags = 5228, + UFSUpdateFileFlagsResponse = 5229, + ClientUFSGetSingleFileInfo = 5230, + ClientUFSGetSingleFileInfoResponse = 5231, + ClientUFSShareFile = 5232, + ClientUFSShareFileResponse = 5233, + UFSReloadAccount = 5234, + UFSReloadAccountResponse = 5235, + UFSUpdateRecordBatched = 5236, + UFSUpdateRecordBatchedResponse = 5237, + UFSMigrateFile = 5238, + UFSMigrateFileResponse = 5239, + UFSGetUGCURLs = 5240, + UFSGetUGCURLsResponse = 5241, + UFSHttpUploadFileFinishRequest = 5242, + UFSHttpUploadFileFinishResponse = 5243, + UFSDownloadStartRequest = 5244, + UFSDownloadStartResponse = 5245, + UFSDownloadChunkRequest = 5246, + UFSDownloadChunkResponse = 5247, + UFSDownloadFinishRequest = 5248, + UFSDownloadFinishResponse = 5249, + UFSFlushURLCache = 5250, + UFSUploadCommit = 5251, + UFSUploadCommitResponse = 5252, + UFSMigrateFileAppID = 5253, + UFSMigrateFileAppIDResponse = 5254, + + BaseClient2 = 5400, + ClientRequestForgottenPasswordEmail = 5401, + ClientRequestForgottenPasswordEmailResponse = 5402, + ClientCreateAccountResponse = 5403, + ClientResetForgottenPassword = 5404, + ClientResetForgottenPasswordResponse = 5405, + ClientCreateAccount2 = 5406, + ClientInformOfResetForgottenPassword = 5407, + ClientInformOfResetForgottenPasswordResponse = 5408, + ClientAnonUserLogOn_Deprecated = 5409, // obsolete + ClientGamesPlayedWithDataBlob = 5410, + ClientUpdateUserGameInfo = 5411, + ClientFileToDownload = 5412, + ClientFileToDownloadResponse = 5413, + ClientLBSSetScore = 5414, + ClientLBSSetScoreResponse = 5415, + ClientLBSFindOrCreateLB = 5416, + ClientLBSFindOrCreateLBResponse = 5417, + ClientLBSGetLBEntries = 5418, + ClientLBSGetLBEntriesResponse = 5419, + ClientMarketingMessageUpdate = 5420, // obsolete + ClientChatDeclined = 5426, + ClientFriendMsgIncoming = 5427, + ClientAuthList_Deprecated = 5428, // obsolete + ClientTicketAuthComplete = 5429, + ClientIsLimitedAccount = 5430, + ClientRequestAuthList = 5431, + ClientAuthList = 5432, + ClientStat = 5433, + ClientP2PConnectionInfo = 5434, + ClientP2PConnectionFailInfo = 5435, + ClientGetNumberOfCurrentPlayers = 5436, // obsolete + ClientGetNumberOfCurrentPlayersResponse = 5437, // obsolete + ClientGetDepotDecryptionKey = 5438, + ClientGetDepotDecryptionKeyResponse = 5439, + GSPerformHardwareSurvey = 5440, + ClientGetAppBetaPasswords = 5441, // obsolete + ClientGetAppBetaPasswordsResponse = 5442, // obsolete + ClientEnableTestLicense = 5443, + ClientEnableTestLicenseResponse = 5444, + ClientDisableTestLicense = 5445, + ClientDisableTestLicenseResponse = 5446, + ClientRequestValidationMail = 5448, + ClientRequestValidationMailResponse = 5449, + ClientCheckAppBetaPassword = 5450, + ClientCheckAppBetaPasswordResponse = 5451, + ClientToGC = 5452, + ClientFromGC = 5453, + ClientRequestChangeMail = 5454, + ClientRequestChangeMailResponse = 5455, + ClientEmailAddrInfo = 5456, + ClientPasswordChange3 = 5457, + ClientEmailChange3 = 5458, + ClientPersonalQAChange3 = 5459, + ClientResetForgottenPassword3 = 5460, + ClientRequestForgottenPasswordEmail3 = 5461, + ClientCreateAccount3 = 5462, // obsolete + ClientNewLoginKey = 5463, + ClientNewLoginKeyAccepted = 5464, + ClientLogOnWithHash_Deprecated = 5465, // obsolete + ClientStoreUserStats2 = 5466, + ClientStatsUpdated = 5467, + ClientActivateOEMLicense = 5468, + ClientRegisterOEMMachine = 5469, + ClientRegisterOEMMachineResponse = 5470, + ClientRequestedClientStats = 5480, + ClientStat2Int32 = 5481, + ClientStat2 = 5482, + ClientVerifyPassword = 5483, + ClientVerifyPasswordResponse = 5484, + ClientDRMDownloadRequest = 5485, + ClientDRMDownloadResponse = 5486, + ClientDRMFinalResult = 5487, + ClientGetFriendsWhoPlayGame = 5488, + ClientGetFriendsWhoPlayGameResponse = 5489, + ClientOGSBeginSession = 5490, + ClientOGSBeginSessionResponse = 5491, + ClientOGSEndSession = 5492, + ClientOGSEndSessionResponse = 5493, + ClientOGSWriteRow = 5494, + ClientDRMTest = 5495, + ClientDRMTestResult = 5496, + ClientServerUnavailable = 5500, + ClientServersAvailable = 5501, + ClientRegisterAuthTicketWithCM = 5502, + ClientGCMsgFailed = 5503, + ClientMicroTxnAuthRequest = 5504, + ClientMicroTxnAuthorize = 5505, + ClientMicroTxnAuthorizeResponse = 5506, + ClientAppMinutesPlayedData = 5507, + ClientGetMicroTxnInfo = 5508, + ClientGetMicroTxnInfoResponse = 5509, + ClientMarketingMessageUpdate2 = 5510, + ClientDeregisterWithServer = 5511, + ClientSubscribeToPersonaFeed = 5512, + ClientLogon = 5514, + ClientGetClientDetails = 5515, + ClientGetClientDetailsResponse = 5516, + ClientReportOverlayDetourFailure = 5517, + ClientGetClientAppList = 5518, + ClientGetClientAppListResponse = 5519, + ClientInstallClientApp = 5520, + ClientInstallClientAppResponse = 5521, + ClientUninstallClientApp = 5522, + ClientUninstallClientAppResponse = 5523, + ClientSetClientAppUpdateState = 5524, + ClientSetClientAppUpdateStateResponse = 5525, + ClientRequestEncryptedAppTicket = 5526, + ClientRequestEncryptedAppTicketResponse = 5527, + ClientWalletInfoUpdate = 5528, + ClientLBSSetUGC = 5529, + ClientLBSSetUGCResponse = 5530, + ClientAMGetClanOfficers = 5531, + ClientAMGetClanOfficersResponse = 5532, + ClientCheckFileSignature = 5533, // obsolete + ClientCheckFileSignatureResponse = 5534, // obsolete + ClientFriendProfileInfo = 5535, + ClientFriendProfileInfoResponse = 5536, + ClientUpdateMachineAuth = 5537, + ClientUpdateMachineAuthResponse = 5538, + ClientReadMachineAuth = 5539, + ClientReadMachineAuthResponse = 5540, + ClientRequestMachineAuth = 5541, + ClientRequestMachineAuthResponse = 5542, + ClientScreenshotsChanged = 5543, + ClientEmailChange4 = 5544, + ClientEmailChangeResponse4 = 5545, + ClientGetCDNAuthToken = 5546, + ClientGetCDNAuthTokenResponse = 5547, + ClientDownloadRateStatistics = 5548, + ClientRequestAccountData = 5549, + ClientRequestAccountDataResponse = 5550, + ClientResetForgottenPassword4 = 5551, + ClientHideFriend = 5552, + ClientFriendsGroupsList = 5553, + ClientGetClanActivityCounts = 5554, + ClientGetClanActivityCountsResponse = 5555, + ClientOGSReportString = 5556, + ClientOGSReportBug = 5557, + ClientSentLogs = 5558, + ClientLogonGameServer = 5559, + AMClientCreateFriendsGroup = 5560, + AMClientCreateFriendsGroupResponse = 5561, + AMClientDeleteFriendsGroup = 5562, + AMClientDeleteFriendsGroupResponse = 5563, + AMClientRenameFriendsGroup = 5564, + AMClientRenameFriendsGroupResponse = 5565, + AMClientAddFriendToGroup = 5566, + AMClientAddFriendToGroupResponse = 5567, + AMClientRemoveFriendFromGroup = 5568, + AMClientRemoveFriendFromGroupResponse = 5569, + ClientAMGetPersonaNameHistory = 5570, + ClientAMGetPersonaNameHistoryResponse = 5571, + ClientRequestFreeLicense = 5572, + ClientRequestFreeLicenseResponse = 5573, + ClientDRMDownloadRequestWithCrashData = 5574, + ClientAuthListAck = 5575, + ClientItemAnnouncements = 5576, + ClientRequestItemAnnouncements = 5577, + ClientFriendMsgEchoToSender = 5578, + ClientChangeSteamGuardOptions = 5579, // obsolete + ClientChangeSteamGuardOptionsResponse = 5580, // obsolete + ClientOGSGameServerPingSample = 5581, + ClientCommentNotifications = 5582, + ClientRequestCommentNotifications = 5583, + ClientPersonaChangeResponse = 5584, + ClientRequestWebAPIAuthenticateUserNonce = 5585, + ClientRequestWebAPIAuthenticateUserNonceResponse = 5586, + ClientPlayerNicknameList = 5587, + AMClientSetPlayerNickname = 5588, + AMClientSetPlayerNicknameResponse = 5589, + ClientRequestOAuthTokenForApp = 5590, // obsolete + ClientRequestOAuthTokenForAppResponse = 5591, // obsolete + ClientCreateAccountProto = 5590, + ClientCreateAccountProtoResponse = 5591, + ClientGetNumberOfCurrentPlayersDP = 5592, + ClientGetNumberOfCurrentPlayersDPResponse = 5593, + ClientServiceMethod = 5594, + ClientServiceMethodResponse = 5595, + ClientFriendUserStatusPublished = 5596, + ClientCurrentUIMode = 5597, + ClientVanityURLChangedNotification = 5598, + ClientUserNotifications = 5599, + + BaseDFS = 5600, + DFSGetFile = 5601, + DFSInstallLocalFile = 5602, + DFSConnection = 5603, + DFSConnectionReply = 5604, + ClientDFSAuthenticateRequest = 5605, + ClientDFSAuthenticateResponse = 5606, + ClientDFSEndSession = 5607, + DFSPurgeFile = 5608, + DFSRouteFile = 5609, + DFSGetFileFromServer = 5610, + DFSAcceptedResponse = 5611, + DFSRequestPingback = 5612, + DFSRecvTransmitFile = 5613, + DFSSendTransmitFile = 5614, + DFSRequestPingback2 = 5615, + DFSResponsePingback2 = 5616, + ClientDFSDownloadStatus = 5617, + DFSStartTransfer = 5618, + DFSTransferComplete = 5619, + DFSRouteFileResponse = 5620, + + BaseMDS = 5800, + ClientMDSLoginRequest = 5801, // obsolete + ClientMDSLoginResponse = 5802, // obsolete + ClientMDSUploadManifestRequest = 5803, // obsolete + ClientMDSUploadManifestResponse = 5804, // obsolete + ClientMDSTransmitManifestDataChunk = 5805, // obsolete + ClientMDSHeartbeat = 5806, // obsolete + ClientMDSUploadDepotChunks = 5807, // obsolete + ClientMDSUploadDepotChunksResponse = 5808, // obsolete + ClientMDSInitDepotBuildRequest = 5809, // obsolete + ClientMDSInitDepotBuildResponse = 5810, // obsolete + AMToMDSGetDepotDecryptionKey = 5812, + MDSToAMGetDepotDecryptionKeyResponse = 5813, + MDSGetVersionsForDepot = 5814, // obsolete + MDSGetVersionsForDepotResponse = 5815, // obsolete + MDSSetPublicVersionForDepot = 5816, // obsolete + MDSSetPublicVersionForDepotResponse = 5817, // obsolete + ClientMDSInitWorkshopBuildRequest = 5816, // obsolete + ClientMDSInitWorkshopBuildResponse = 5817, // obsolete + ClientMDSGetDepotManifest = 5818, // obsolete + ClientMDSGetDepotManifestResponse = 5819, // obsolete + ClientMDSGetDepotManifestChunk = 5820, // obsolete + ClientMDSUploadRateTest = 5823, // obsolete + ClientMDSUploadRateTestResponse = 5824, // obsolete + MDSDownloadDepotChunksAck = 5825, // obsolete + MDSContentServerStatsBroadcast = 5826, // obsolete + MDSContentServerConfigRequest = 5827, + MDSContentServerConfig = 5828, + MDSGetDepotManifest = 5829, + MDSGetDepotManifestResponse = 5830, + MDSGetDepotManifestChunk = 5831, + MDSGetDepotChunk = 5832, + MDSGetDepotChunkResponse = 5833, + MDSGetDepotChunkChunk = 5834, + MDSUpdateContentServerConfig = 5835, // obsolete + MDSGetServerListForUser = 5836, + MDSGetServerListForUserResponse = 5837, + ClientMDSRegisterAppBuild = 5838, // obsolete + ClientMDSRegisterAppBuildResponse = 5839, // obsolete + ClientMDSSetAppBuildLive = 5840, // obsolete + ClientMDSSetAppBuildLiveResponse = 5841, // obsolete + ClientMDSGetPrevDepotBuild = 5842, // obsolete + ClientMDSGetPrevDepotBuildResponse = 5843, // obsolete + MDSToCSFlushChunk = 5844, + ClientMDSSignInstallScript = 5845, // obsolete + ClientMDSSignInstallScriptResponse = 5846, // obsolete + MDSMigrateChunk = 5847, + MDSMigrateChunkResponse = 5848, + + CSBase = 6200, + CSPing = 6201, + CSPingResponse = 6202, + + GMSBase = 6400, + GMSGameServerReplicate = 6401, + ClientGMSServerQuery = 6403, + GMSClientServerQueryResponse = 6404, + AMGMSGameServerUpdate = 6405, + AMGMSGameServerRemove = 6406, + GameServerOutOfDate = 6407, + + DeviceAuthorizationBase = 6500, + ClientAuthorizeLocalDeviceRequest = 6501, + ClientAuthorizeLocalDevice = 6502, // obsolete + ClientAuthorizeLocalDeviceResponse = 6502, + ClientDeauthorizeDeviceRequest = 6503, + ClientDeauthorizeDevice = 6504, + ClientUseLocalDeviceAuthorizations = 6505, + ClientGetAuthorizedDevices = 6506, + ClientGetAuthorizedDevicesResponse = 6507, + AMNotifySessionDeviceAuthorized = 6508, + ClientAuthorizeLocalDeviceNotification = 6509, + + MMSBase = 6600, + ClientMMSCreateLobby = 6601, + ClientMMSCreateLobbyResponse = 6602, + ClientMMSJoinLobby = 6603, + ClientMMSJoinLobbyResponse = 6604, + ClientMMSLeaveLobby = 6605, + ClientMMSLeaveLobbyResponse = 6606, + ClientMMSGetLobbyList = 6607, + ClientMMSGetLobbyListResponse = 6608, + ClientMMSSetLobbyData = 6609, + ClientMMSSetLobbyDataResponse = 6610, + ClientMMSGetLobbyData = 6611, + ClientMMSLobbyData = 6612, + ClientMMSSendLobbyChatMsg = 6613, + ClientMMSLobbyChatMsg = 6614, + ClientMMSSetLobbyOwner = 6615, + ClientMMSSetLobbyOwnerResponse = 6616, + ClientMMSSetLobbyGameServer = 6617, + ClientMMSLobbyGameServerSet = 6618, + ClientMMSUserJoinedLobby = 6619, + ClientMMSUserLeftLobby = 6620, + ClientMMSInviteToLobby = 6621, + ClientMMSFlushFrenemyListCache = 6622, + ClientMMSFlushFrenemyListCacheResponse = 6623, + ClientMMSSetLobbyLinked = 6624, + + NonStdMsgBase = 6800, + NonStdMsgMemcached = 6801, + NonStdMsgHTTPServer = 6802, + NonStdMsgHTTPClient = 6803, + NonStdMsgWGResponse = 6804, + NonStdMsgPHPSimulator = 6805, + NonStdMsgChase = 6806, + NonStdMsgDFSTransfer = 6807, + NonStdMsgTests = 6808, + NonStdMsgUMQpipeAAPL = 6809, + NonStdMsgSyslog = 6810, // obsolete + NonStdMsgLogsink = 6811, + NonStdMsgSteam2Emulator = 6812, + NonStdMsgRTMPServer = 6813, + + UDSBase = 7000, + ClientUDSP2PSessionStarted = 7001, + ClientUDSP2PSessionEnded = 7002, + UDSRenderUserAuth = 7003, + UDSRenderUserAuthResponse = 7004, + ClientUDSInviteToGame = 7005, + UDSFindSession = 7006, // obsolete "renamed to UDSHasSession" + UDSHasSession = 7006, + UDSFindSessionResponse = 7007, // obsolete "renamed to UDSHasSessionResponse" + UDSHasSessionResponse = 7007, + + MPASBase = 7100, + MPASVacBanReset = 7101, + + KGSBase = 7200, + KGSAllocateKeyRange = 7201, // obsolete + KGSAllocateKeyRangeResponse = 7202, // obsolete + KGSGenerateKeys = 7203, // obsolete + KGSGenerateKeysResponse = 7204, // obsolete + KGSRemapKeys = 7205, // obsolete + KGSRemapKeysResponse = 7206, // obsolete + KGSGenerateGameStopWCKeys = 7207, // obsolete + KGSGenerateGameStopWCKeysResponse = 7208, // obsolete + + UCMBase = 7300, + ClientUCMAddScreenshot = 7301, + ClientUCMAddScreenshotResponse = 7302, + UCMValidateObjectExists = 7303, // obsolete + UCMValidateObjectExistsResponse = 7304, // obsolete + UCMResetCommunityContent = 7307, + UCMResetCommunityContentResponse = 7308, + ClientUCMDeleteScreenshot = 7309, + ClientUCMDeleteScreenshotResponse = 7310, + ClientUCMPublishFile = 7311, + ClientUCMPublishFileResponse = 7312, + ClientUCMGetPublishedFileDetails = 7313, // obsolete + ClientUCMGetPublishedFileDetailsResponse = 7314, // obsolete + ClientUCMDeletePublishedFile = 7315, + ClientUCMDeletePublishedFileResponse = 7316, + ClientUCMEnumerateUserPublishedFiles = 7317, + ClientUCMEnumerateUserPublishedFilesResponse = 7318, + ClientUCMSubscribePublishedFile = 7319, // obsolete + ClientUCMSubscribePublishedFileResponse = 7320, // obsolete + ClientUCMEnumerateUserSubscribedFiles = 7321, + ClientUCMEnumerateUserSubscribedFilesResponse = 7322, + ClientUCMUnsubscribePublishedFile = 7323, // obsolete + ClientUCMUnsubscribePublishedFileResponse = 7324, // obsolete + ClientUCMUpdatePublishedFile = 7325, + ClientUCMUpdatePublishedFileResponse = 7326, + UCMUpdatePublishedFile = 7327, + UCMUpdatePublishedFileResponse = 7328, + UCMDeletePublishedFile = 7329, + UCMDeletePublishedFileResponse = 7330, + UCMUpdatePublishedFileStat = 7331, + UCMUpdatePublishedFileBan = 7332, + UCMUpdatePublishedFileBanResponse = 7333, + UCMUpdateTaggedScreenshot = 7334, // obsolete + UCMAddTaggedScreenshot = 7335, // obsolete + UCMRemoveTaggedScreenshot = 7336, // obsolete + UCMReloadPublishedFile = 7337, + UCMReloadUserFileListCaches = 7338, + UCMPublishedFileReported = 7339, + UCMUpdatePublishedFileIncompatibleStatus = 7340, + UCMPublishedFilePreviewAdd = 7341, + UCMPublishedFilePreviewAddResponse = 7342, + UCMPublishedFilePreviewRemove = 7343, + UCMPublishedFilePreviewRemoveResponse = 7344, + UCMPublishedFilePreviewChangeSortOrder = 7345, // obsolete + UCMPublishedFilePreviewChangeSortOrderResponse = 7346, // obsolete + ClientUCMPublishedFileSubscribed = 7347, + ClientUCMPublishedFileUnsubscribed = 7348, + UCMPublishedFileSubscribed = 7349, + UCMPublishedFileUnsubscribed = 7350, + UCMPublishFile = 7351, + UCMPublishFileResponse = 7352, + UCMPublishedFileChildAdd = 7353, + UCMPublishedFileChildAddResponse = 7354, + UCMPublishedFileChildRemove = 7355, + UCMPublishedFileChildRemoveResponse = 7356, + UCMPublishedFileChildChangeSortOrder = 7357, // obsolete + UCMPublishedFileChildChangeSortOrderResponse = 7358, // obsolete + UCMPublishedFileParentChanged = 7359, + ClientUCMGetPublishedFilesForUser = 7360, + ClientUCMGetPublishedFilesForUserResponse = 7361, + UCMGetPublishedFilesForUser = 7362, // obsolete + UCMGetPublishedFilesForUserResponse = 7363, // obsolete + ClientUCMSetUserPublishedFileAction = 7364, + ClientUCMSetUserPublishedFileActionResponse = 7365, + ClientUCMEnumeratePublishedFilesByUserAction = 7366, + ClientUCMEnumeratePublishedFilesByUserActionResponse = 7367, + ClientUCMPublishedFileDeleted = 7368, + UCMGetUserSubscribedFiles = 7369, + UCMGetUserSubscribedFilesResponse = 7370, + UCMFixStatsPublishedFile = 7371, + UCMDeleteOldScreenshot = 7372, // obsolete + UCMDeleteOldScreenshotResponse = 7373, // obsolete + UCMDeleteOldVideo = 7374, // obsolete + UCMDeleteOldVideoResponse = 7375, // obsolete + UCMUpdateOldScreenshotPrivacy = 7376, // obsolete + UCMUpdateOldScreenshotPrivacyResponse = 7377, // obsolete + ClientUCMEnumerateUserSubscribedFilesWithUpdates = 7378, + ClientUCMEnumerateUserSubscribedFilesWithUpdatesResponse = 7379, + UCMPublishedFileContentUpdated = 7380, + UCMPublishedFileUpdated = 7381, + ClientWorkshopItemChangesRequest = 7382, + ClientWorkshopItemChangesResponse = 7383, + ClientWorkshopItemInfoRequest = 7384, + ClientWorkshopItemInfoResponse = 7385, + + FSBase = 7500, + ClientRichPresenceUpload = 7501, + ClientRichPresenceRequest = 7502, + ClientRichPresenceInfo = 7503, + FSRichPresenceRequest = 7504, + FSRichPresenceResponse = 7505, + FSComputeFrenematrix = 7506, + FSComputeFrenematrixResponse = 7507, + FSPlayStatusNotification = 7508, + FSPublishPersonaStatus = 7509, + FSAddOrRemoveFollower = 7510, + FSAddOrRemoveFollowerResponse = 7511, + FSUpdateFollowingList = 7512, + FSCommentNotification = 7513, + FSCommentNotificationViewed = 7514, + ClientFSGetFollowerCount = 7515, + ClientFSGetFollowerCountResponse = 7516, + ClientFSGetIsFollowing = 7517, + ClientFSGetIsFollowingResponse = 7518, + ClientFSEnumerateFollowingList = 7519, + ClientFSEnumerateFollowingListResponse = 7520, + FSGetPendingNotificationCount = 7521, + FSGetPendingNotificationCountResponse = 7522, + ClientFSOfflineMessageNotification = 7523, + ClientFSRequestOfflineMessageCount = 7524, + ClientFSGetFriendMessageHistory = 7525, + ClientFSGetFriendMessageHistoryResponse = 7526, + ClientFSGetFriendMessageHistoryForOfflineMessages = 7527, + ClientFSGetFriendsSteamLevels = 7528, + ClientFSGetFriendsSteamLevelsResponse = 7529, + FSRequestFriendData = 7530, + + DRMRange2 = 7600, + CEGVersionSetEnableDisableRequest = 7600, + CEGVersionSetEnableDisableResponse = 7601, + CEGPropStatusDRMSRequest = 7602, + CEGPropStatusDRMSResponse = 7603, + CEGWhackFailureReportRequest = 7604, + CEGWhackFailureReportResponse = 7605, + DRMSFetchVersionSet = 7606, + DRMSFetchVersionSetResponse = 7607, + + EconBase = 7700, + EconTrading_InitiateTradeRequest = 7701, + EconTrading_InitiateTradeProposed = 7702, + EconTrading_InitiateTradeResponse = 7703, + EconTrading_InitiateTradeResult = 7704, + EconTrading_StartSession = 7705, + EconTrading_CancelTradeRequest = 7706, + EconFlushInventoryCache = 7707, + EconFlushInventoryCacheResponse = 7708, + EconCDKeyProcessTransaction = 7711, + EconCDKeyProcessTransactionResponse = 7712, + EconGetErrorLogs = 7713, + EconGetErrorLogsResponse = 7714, + + RMRange = 7800, + RMTestVerisignOTP = 7800, + RMTestVerisignOTPResponse = 7801, + RMDeleteMemcachedKeys = 7803, + RMRemoteInvoke = 7804, + BadLoginIPList = 7805, + RMMsgTraceAddTrigger = 7806, + RMMsgTraceRemoveTrigger = 7807, + RMMsgTraceEvent = 7808, + + UGSBase = 7900, + UGSUpdateGlobalStats = 7900, + ClientUGSGetGlobalStats = 7901, + ClientUGSGetGlobalStatsResponse = 7902, + + StoreBase = 8000, + StoreUpdateRecommendationCount = 8000, // obsolete + + UMQBase = 8100, + UMQLogonRequest = 8100, + UMQLogonResponse = 8101, + UMQLogoffRequest = 8102, + UMQLogoffResponse = 8103, + UMQSendChatMessage = 8104, + UMQIncomingChatMessage = 8105, + UMQPoll = 8106, + UMQPollResults = 8107, + UMQ2AM_ClientMsgBatch = 8108, + UMQEnqueueMobileSalePromotions = 8109, // obsolete + UMQEnqueueMobileAnnouncements = 8110, // obsolete + + WorkshopBase = 8200, + WorkshopAcceptTOSRequest = 8200, // obsolete + WorkshopAcceptTOSResponse = 8201, // obsolete + + WebAPIBase = 8300, + WebAPIValidateOAuth2Token = 8300, + WebAPIValidateOAuth2TokenResponse = 8301, + WebAPIInvalidateTokensForAccount = 8302, // obsolete + WebAPIRegisterGCInterfaces = 8303, + WebAPIInvalidateOAuthClientCache = 8304, + WebAPIInvalidateOAuthTokenCache = 8305, + WebAPISetSecrets = 8306, + + BackpackBase = 8400, + BackpackAddToCurrency = 8401, + BackpackAddToCurrencyResponse = 8402, + + CREBase = 8500, + CRERankByTrend = 8501, // obsolete + CRERankByTrendResponse = 8502, // obsolete + CREItemVoteSummary = 8503, + CREItemVoteSummaryResponse = 8504, + CRERankByVote = 8505, // obsolete + CRERankByVoteResponse = 8506, // obsolete + CREUpdateUserPublishedItemVote = 8507, + CREUpdateUserPublishedItemVoteResponse = 8508, + CREGetUserPublishedItemVoteDetails = 8509, + CREGetUserPublishedItemVoteDetailsResponse = 8510, + CREEnumeratePublishedFiles = 8511, + CREEnumeratePublishedFilesResponse = 8512, + CREPublishedFileVoteAdded = 8513, + + SecretsBase = 8600, + SecretsRequestCredentialPair = 8600, + SecretsCredentialPairResponse = 8601, + SecretsRequestServerIdentity = 8602, // obsolete + SecretsServerIdentityResponse = 8603, // obsolete + SecretsUpdateServerIdentities = 8604, // obsolete + + BoxMonitorBase = 8700, + BoxMonitorReportRequest = 8700, + BoxMonitorReportResponse = 8701, + + LogsinkBase = 8800, + LogsinkWriteReport = 8800, + + PICSBase = 8900, + ClientPICSChangesSinceRequest = 8901, + ClientPICSChangesSinceResponse = 8902, + ClientPICSProductInfoRequest = 8903, + ClientPICSProductInfoResponse = 8904, + ClientPICSAccessTokenRequest = 8905, + ClientPICSAccessTokenResponse = 8906, + + WorkerProcess = 9000, + WorkerProcessPingRequest = 9000, + WorkerProcessPingResponse = 9001, + WorkerProcessShutdown = 9002, + + DRMWorkerProcess = 9100, + DRMWorkerProcessDRMAndSign = 9100, + DRMWorkerProcessDRMAndSignResponse = 9101, + DRMWorkerProcessSteamworksInfoRequest = 9102, + DRMWorkerProcessSteamworksInfoResponse = 9103, + DRMWorkerProcessInstallDRMDLLRequest = 9104, + DRMWorkerProcessInstallDRMDLLResponse = 9105, + DRMWorkerProcessSecretIdStringRequest = 9106, + DRMWorkerProcessSecretIdStringResponse = 9107, + DRMWorkerProcessGetDRMGuidsFromFileRequest = 9108, // obsolete + DRMWorkerProcessGetDRMGuidsFromFileResponse = 9109, // obsolete + DRMWorkerProcessInstallProcessedFilesRequest = 9110, + DRMWorkerProcessInstallProcessedFilesResponse = 9111, + DRMWorkerProcessExamineBlobRequest = 9112, + DRMWorkerProcessExamineBlobResponse = 9113, + DRMWorkerProcessDescribeSecretRequest = 9114, + DRMWorkerProcessDescribeSecretResponse = 9115, + DRMWorkerProcessBackfillOriginalRequest = 9116, + DRMWorkerProcessBackfillOriginalResponse = 9117, + DRMWorkerProcessValidateDRMDLLRequest = 9118, + DRMWorkerProcessValidateDRMDLLResponse = 9119, + DRMWorkerProcessValidateFileRequest = 9120, + DRMWorkerProcessValidateFileResponse = 9121, + DRMWorkerProcessSplitAndInstallRequest = 9122, + DRMWorkerProcessSplitAndInstallResponse = 9123, + DRMWorkerProcessGetBlobRequest = 9124, + DRMWorkerProcessGetBlobResponse = 9125, + DRMWorkerProcessEvaluateCrashRequest = 9126, + DRMWorkerProcessEvaluateCrashResponse = 9127, + DRMWorkerProcessAnalyzeFileRequest = 9128, + DRMWorkerProcessAnalyzeFileResponse = 9129, + DRMWorkerProcessUnpackBlobRequest = 9130, + DRMWorkerProcessUnpackBlobResponse = 9131, + DRMWorkerProcessInstallAllRequest = 9132, + DRMWorkerProcessInstallAllResponse = 9133, + + TestWorkerProcess = 9200, + TestWorkerProcessLoadUnloadModuleRequest = 9200, + TestWorkerProcessLoadUnloadModuleResponse = 9201, + TestWorkerProcessServiceModuleCallRequest = 9202, + TestWorkerProcessServiceModuleCallResponse = 9203, + + QuestServerBase = 9300, + + ClientGetEmoticonList = 9330, + ClientEmoticonList = 9331, + + ClientSharedLibraryBase = 9400, // obsolete "renamed to SLCBase" + SLCBase = 9400, + SLCUserSessionStatus = 9400, + SLCRequestUserSessionStatus = 9401, + SLCSharedLicensesLockStatus = 9402, + ClientSharedLicensesLockStatus = 9403, // obsolete + ClientSharedLicensesStopPlaying = 9404, // obsolete + ClientSharedLibraryLockStatus = 9405, + ClientSharedLibraryStopPlaying = 9406, + SLCOwnerLibraryChanged = 9407, + SLCSharedLibraryChanged = 9408, + + RemoteClientBase = 9500, + RemoteClientAuth = 9500, + RemoteClientAuthResponse = 9501, + RemoteClientAppStatus = 9502, + RemoteClientStartStream = 9503, + RemoteClientStartStreamResponse = 9504, + RemoteClientPing = 9505, + RemoteClientPingResponse = 9506, + ClientUnlockStreaming = 9507, + ClientUnlockStreamingResponse = 9508, + RemoteClientAcceptEULA = 9509, + RemoteClientGetControllerConfig = 9510, + RemoteClientGetControllerConfigResposne = 9511, + RemoteClientStreamingEnabled = 9512, + + ClientConcurrentSessionsBase = 9600, + ClientPlayingSessionState = 9600, + ClientKickPlayingSession = 9601, + + ClientBroadcastBase = 9700, + ClientBroadcastInit = 9700, + ClientBroadcastFrames = 9701, + ClientBroadcastDisconnect = 9702, + ClientBroadcastScreenshot = 9703, + ClientBroadcastUploadConfig = 9704, + + BaseClient3 = 9800, + ClientVoiceCallPreAuthorize = 9800, + ClientVoiceCallPreAuthorizeResponse = 9801, +} + +export enum EUniverse { + Invalid = 0, + + Public = 1, + Beta = 2, + Internal = 3, + Dev = 4, + + Max = 5, +} + +export enum EChatEntryType { + Invalid = 0, + + ChatMsg = 1, + Typing = 2, + InviteGame = 3, + Emote = 4, // removed "No longer supported by clients" + LobbyGameStart = 5, // removed "Listen for LobbyGameCreated_t callback instead" + LeftConversation = 6, + Entered = 7, + WasKicked = 8, + WasBanned = 9, + Disconnected = 10, + HistoricalChat = 11, + Reserved1 = 12, + Reserved2 = 13, + LinkBlocked = 14, +} + +export enum EPersonaState { + Offline = 0, + + Online = 1, + Busy = 2, + Away = 3, + Snooze = 4, + LookingToTrade = 5, + LookingToPlay = 6, + + Max = 7, +} + +export enum EAccountType { + Invalid = 0, + + Individual = 1, + Multiseat = 2, + GameServer = 3, + AnonGameServer = 4, + Pending = 5, + ContentServer = 6, + Clan = 7, + Chat = 8, + ConsoleUser = 9, + AnonUser = 10, + + Max = 11, +} + +export enum EFriendRelationship { + None = 0, + + Blocked = 1, + RequestRecipient = 2, + Friend = 3, + RequestInitiator = 4, + Ignored = 5, + IgnoredFriend = 6, + SuggestedFriend = 7, + + Max = 8, +} + +export enum EAccountFlags { + NormalUser = 0, + + PersonaNameSet = 1, + Unbannable = 2, + PasswordSet = 4, + Support = 8, + Admin = 16, + Supervisor = 32, + AppEditor = 64, + HWIDSet = 128, + PersonalQASet = 256, + VacBeta = 512, + Debug = 1024, + Disabled = 2048, + LimitedUser = 4096, + LimitedUserForce = 8192, + EmailValidated = 16384, + MarketingTreatment = 32768, + OGGInviteOptOut = 65536, + ForcePasswordChange = 131072, + ForceEmailVerification = 262144, + LogonExtraSecurity = 524288, + LogonExtraSecurityDisabled = 1048576, + Steam2MigrationComplete = 2097152, + NeedLogs = 4194304, + Lockdown = 8388608, + MasterAppEditor = 16777216, + BannedFromWebAPI = 33554432, + ClansOnlyFromFriends = 67108864, + GlobalModerator = 134217728, + ParentalSettings = 268435456, + ThirdPartySupport = 536870912, + NeedsSSANextSteamLogon = 1073741824, +} + +export enum EClanPermission { + Nobody = 0, + + Owner = 1, + Officer = 2, + OwnerAndOfficer = 3, + Member = 4, + Moderator = 8, + + OwnerOfficerModerator = Owner | Officer | Moderator, // 11 + AllMembers = Owner | Officer | Moderator | Member, // 15 + + OGGGameOwner = 16, + + NonMember = 128, + + MemberAllowed = NonMember | Member, // 132 + ModeratorAllowed = NonMember | Member | Moderator, // 140 + OfficerAllowed = NonMember | Member | Moderator | Officer, // 142 + OwnerAllowed = NonMember | Member | Moderator | Officer | Owner, // 143 + Anybody = NonMember | Member | Moderator | Officer | Owner, // 143 +} + +export enum EChatPermission { + Close = 1, + Invite = 2, + Talk = 8, + Kick = 16, + Mute = 32, + SetMetadata = 64, + ChangePermissions = 128, + Ban = 256, + ChangeAccess = 512, + + EveryoneNotInClanDefault = Talk, // 8 + EveryoneDefault = Talk | Invite, // 10 + + // todo: this doesn't seem correct... + MemberDefault = Ban | Kick | Talk | Invite, // 282 + + OfficerDefault = Ban | Kick | Talk | Invite, // 282 + OwnerDefault = ChangeAccess | Ban | SetMetadata | Mute | Kick | Talk | Invite | Close, // 891 + + Mask = 1019, +} + +export enum EFriendFlags { + None = 0, + Blocked = 1, + FriendshipRequested = 2, + Immediate = 4, + ClanMember = 8, + OnGameServer = 16, + RequestingFriendship = 128, + RequestingInfo = 256, + Ignored = 512, + IgnoredFriend = 1024, + Suggested = 2048, + ChatMember = 4096, + + FlagAll = 65535, +} + +export enum EPersonaStateFlag { + HasRichPresence = 1, + InJoinableGame = 2, + Golden = 4, // removed "no longer has any effect" + + OnlineUsingWeb = 256, // removed "renamed to ClientTypeWeb" + ClientTypeWeb = 256, + OnlineUsingMobile = 512, // removed "renamed to ClientTypeMobile" + ClientTypeMobile = 512, + OnlineUsingBigPicture = 1024, // removed "renamed to ClientTypeTenfoot" + ClientTypeTenfoot = 1024, + OnlineUsingVR = 2048, // removed "renamed to ClientTypeVR" + ClientTypeVR = 2048, + LaunchTypeGamepad = 4096, +} + +export enum EClientPersonaStateFlag { + Status = 1, + PlayerName = 2, + QueryPort = 4, + SourceID = 8, + Presence = 16, + Metadata = 32, // removed + LastSeen = 64, + ClanInfo = 128, + GameExtraInfo = 256, + GameDataBlob = 512, + ClanTag = 1024, + Facebook = 2048, +} + +export enum EAppUsageEvent { + GameLaunch = 1, + GameLaunchTrial = 2, + Media = 3, + PreloadStart = 4, + PreloadFinish = 5, + MarketingMessageView = 6, + InGameAdViewed = 7, + GameLaunchFreeWeekend = 8, +} + +export enum ELicenseFlags { + None = 0, + Renew = 0x01, + RenewalFailed = 0x02, + Pending = 0x04, + Expired = 0x08, + CancelledByUser = 0x10, + CancelledByAdmin = 0x20, + LowViolenceContent = 0x40, + ImportedFromSteam2 = 0x80, + ForceRunRestriction = 0x100, + RegionRestrictionExpired = 0x200, + CancelledByFriendlyFraudLock = 0x400, + NotActivated = 0x800, +} + +export enum ELicenseType { + NoLicense = 0, + SinglePurchase = 1, + SinglePurchaseLimitedUse = 2, + RecurringCharge = 3, + RecurringChargeLimitedUse = 4, + RecurringChargeLimitedUseWithOverages = 5, + RecurringOption = 6, + LimitedUseDelayedActivation = 7, +} + +export enum EPaymentMethod { + None = 0, + ActivationCode = 1, + CreditCard = 2, + Giropay = 3, + PayPal = 4, + Ideal = 5, + PaySafeCard = 6, + Sofort = 7, + GuestPass = 8, + WebMoney = 9, + MoneyBookers = 10, + AliPay = 11, + Yandex = 12, + Kiosk = 13, + Qiwi = 14, + GameStop = 15, + HardwarePromo = 16, + MoPay = 17, + BoletoBancario = 18, + BoaCompraGold = 19, + BancoDoBrasilOnline = 20, + ItauOnline = 21, + BradescoOnline = 22, + Pagseguro = 23, + VisaBrazil = 24, + AmexBrazil = 25, + Aura = 26, + Hipercard = 27, + MastercardBrazil = 28, + DinersCardBrazil = 29, + AuthorizedDevice = 30, + MOLPoints = 31, + ClickAndBuy = 32, + Beeline = 33, + Konbini = 34, + EClubPoints = 35, + CreditCardJapan = 36, + BankTransferJapan = 37, + PayEasyJapan = 38, // removed "renamed to PayEasy" + PayEasy = 38, + Zong = 39, + CultureVoucher = 40, + BookVoucher = 41, + HappymoneyVoucher = 42, + ConvenientStoreVoucher = 43, + GameVoucher = 44, + Multibanco = 45, + Payshop = 46, + Maestro = 47, // removed "renamed to MaestroBoaCompra" + MaestroBoaCompra = 47, + OXXO = 48, + ToditoCash = 49, + Carnet = 50, + SPEI = 51, + ThreePay = 52, + IsBank = 53, + Garanti = 54, + Akbank = 55, + YapiKredi = 56, + Halkbank = 57, + BankAsya = 58, + Finansbank = 59, + DenizBank = 60, + PTT = 61, + CashU = 62, + AutoGrant = 64, + WebMoneyJapan = 65, + OneCard = 66, + PSE = 67, + Exito = 68, + Efecty = 69, + Paloto = 70, + PinValidda = 71, + MangirKart = 72, + BancoCreditoDePeru = 73, + BBVAContinental = 74, + SafetyPay = 75, + PagoEfectivo = 76, + Trustly = 77, + UnionPay = 78, + BitCoin = 79, + Wallet = 128, + Valve = 129, + SteamPressMaster = 130, // removed "renamed to MasterComp" + MasterComp = 130, + StorePromotion = 131, // removed "renamed to Promotional" + Promotional = 131, + OEMTicket = 256, + Split = 512, + Complimentary = 1024, +} + +export enum EPurchaseResultDetail { + NoDetail = 0, + AVSFailure = 1, + InsufficientFunds = 2, + ContactSupport = 3, + Timeout = 4, + InvalidPackage = 5, + InvalidPaymentMethod = 6, + InvalidData = 7, + OthersInProgress = 8, + AlreadyPurchased = 9, + WrongPrice = 10, + FraudCheckFailed = 11, + CancelledByUser = 12, + RestrictedCountry = 13, + BadActivationCode = 14, + DuplicateActivationCode = 15, + UseOtherPaymentMethod = 16, + UseOtherFunctionSource = 17, + InvalidShippingAddress = 18, + RegionNotSupported = 19, + AcctIsBlocked = 20, + AcctNotVerified = 21, + InvalidAccount = 22, + StoreBillingCountryMismatch = 23, + DoesNotOwnRequiredApp = 24, + CanceledByNewTransaction = 25, + ForceCanceledPending = 26, + FailCurrencyTransProvider = 27, + FailedCyberCafe = 28, + NeedsPreApproval = 29, + PreApprovalDenied = 30, + WalletCurrencyMismatch = 31, + EmailNotValidated = 32, + ExpiredCard = 33, + TransactionExpired = 34, + WouldExceedMaxWallet = 35, + MustLoginPS3AppForPurchase = 36, + CannotShipToPOBox = 37, + InsufficientInventory = 38, + CannotGiftShippedGoods = 39, + CannotShipInternationally = 40, + BillingAgreementCancelled = 41, + InvalidCoupon = 42, + ExpiredCoupon = 43, + AccountLocked = 44, + OtherAbortableInProgress = 45, + ExceededSteamLimit = 46, + OverlappingPackagesInCart = 47, + NoWallet = 48, + NoCachedPaymentMethod = 49, + CannotRedeemCodeFromClient = 50, + PurchaseAmountNoSupportedByProvider = 51, + OverlappingPackagesInPendingTransaction = 52, + RateLimited = 53, + OwnsExcludedApp = 54, + CreditCardBinMismatchesType = 55, + CartValueTooHigh = 56, + BillingAgreementAlreadyExists = 57, + POSACodeNotActivated = 58, + CannotShipToCountry = 59, + HungTransactionCancelled = 60, + PaypalInternalError = 61, + UnknownGlobalCollectError = 62, + InvalidTaxAddress = 63, + PhysicalProductLimitExceeded = 64, + PurchaseCannotBeReplayed = 65, + DelayedCompletion = 66, + BundleTypeCannotBeGifted = 67, +} + +export enum EIntroducerRouting { + FileShare = 0, // removed + P2PVoiceChat = 1, + P2PNetworking = 2, +} + +export enum EServerFlags { + None = 0, + Active = 1, + Secure = 2, + Dedicated = 4, + Linux = 8, + Passworded = 16, + Private = 32, +} + +export enum EDenyReason { + InvalidVersion = 1, + Generic = 2, + NotLoggedOn = 3, + NoLicense = 4, + Cheater = 5, + LoggedInElseWhere = 6, + UnknownText = 7, + IncompatibleAnticheat = 8, + MemoryCorruption = 9, + IncompatibleSoftware = 10, + SteamConnectionLost = 11, + SteamConnectionError = 12, + SteamResponseTimedOut = 13, + SteamValidationStalled = 14, + SteamOwnerLeftGuestUser = 15, +} + +export enum EClanRank { + None = 0, + Owner = 1, + Officer = 2, + Member = 3, + Moderator = 4, +} + +export enum EClanRelationship { + None = 0, + Blocked = 1, + Invited = 2, + Member = 3, + Kicked = 4, + KickAcknowledged = 5, +} + +export enum EAuthSessionResponse { + OK = 0, + UserNotConnectedToSteam = 1, + NoLicenseOrExpired = 2, + VACBanned = 3, + LoggedInElseWhere = 4, + VACCheckTimedOut = 5, + AuthTicketCanceled = 6, + AuthTicketInvalidAlreadyUsed = 7, + AuthTicketInvalid = 8, + PublisherIssuedBan = 9, +} + +export enum EChatRoomEnterResponse { + Success = 1, + DoesntExist = 2, + NotAllowed = 3, + Full = 4, + Error = 5, + Banned = 6, + Limited = 7, + ClanDisabled = 8, + CommunityBan = 9, + MemberBlockedYou = 10, + YouBlockedMember = 11, + + // these appear to have been removed + NoRankingDataLobby = 12, // removed + NoRankingDataUser = 13, // removed + RankOutOfRange = 14, // removed +} + +export enum EChatRoomType { + Friend = 1, + MUC = 2, + Lobby = 3, +} + +export enum EChatInfoType { + StateChange = 1, + InfoUpdate = 2, + MemberLimitChange = 3, +} + +export enum EChatAction { + InviteChat = 1, + Kick = 2, + Ban = 3, + UnBan = 4, + StartVoiceSpeak = 5, + EndVoiceSpeak = 6, + LockChat = 7, + UnlockChat = 8, + CloseChat = 9, + SetJoinable = 10, + SetUnjoinable = 11, + SetOwner = 12, + SetInvisibleToFriends = 13, + SetVisibleToFriends = 14, + SetModerated = 15, + SetUnmoderated = 16, +} + +export enum EChatActionResult { + Success = 1, + Error = 2, + NotPermitted = 3, + NotAllowedOnClanMember = 4, + NotAllowedOnBannedUser = 5, + NotAllowedOnChatOwner = 6, + NotAllowedOnSelf = 7, + ChatDoesntExist = 8, + ChatFull = 9, + VoiceSlotsFull = 10, +} + +export enum EAppInfoSection { + Unknown = 0, + All = 1, + + First = 2, + Common = 2, + Extended = 3, + Config = 4, + Stats = 5, + Install = 6, + Depots = 7, + VAC = 8, // removed + VAC_UNUSED = 8, // removed + DRM = 9, // removed + DRM_UNUSED = 9, // removed + UFS = 10, + OGG = 11, + Items = 12, // removed + ItemsUNUSED = 12, // removed + Policies = 13, + SysReqs = 14, + Community = 15, + Store = 16, + + Max = 17, +} + +export enum EContentDownloadSourceType { + Invalid = 0, + + CS = 1, + CDN = 2, + LCS = 3, + ProxyCache = 4, + LANPeer = 5, + + Max = 5, +} + +export enum EPlatformType { + Unknown = 0, + + Win32 = 1, + Win64 = 2, + Linux = 3, // removed "split to Linux64 and Linux32" + Linux64 = 3, + OSX = 4, + PS3 = 5, + Linux32 = 6, + + Max = 6, +} + +export enum EOSType { + Unknown = -1, + + IOSUnknown = -600, + + AndroidUnknown = -500, + + UMQ = -400, + + PS3 = -300, + + MacOSUnknown = -102, + MacOS104 = -101, + MacOS105 = -100, + MacOS1058 = -99, + MacOS106 = -95, + MacOS1063 = -94, + MacOS1064_slgu = -93, + MacOS1067 = -92, + MacOS107 = -90, + MacOS108 = -89, + MacOS109 = -88, + MacOS1010 = -87, + MacOS1011 = -86, + MacOS1012 = -85, + MacOSMax = -1, + + LinuxUnknown = -203, + Linux22 = -202, + Linux24 = -201, + Linux26 = -200, + Linux32 = -199, + Linux35 = -198, + Linux36 = -197, + Linux310 = -196, + LinuxMax = -103, + + WinUnknown = 0, + Win311 = 1, + Win95 = 2, + Win98 = 3, + WinME = 4, + WinNT = 5, + Win200 = 6, // removed "renamed to Win2000" + Win2000 = 6, + WinXP = 7, + Win2003 = 8, + WinVista = 9, + Win7 = 10, // removed "renamed to Windows7" + Windows7 = 10, + Win2008 = 11, + Win2012 = 12, + Win8 = 13, // removed "renamed to Windows8" + Windows8 = 13, + Win81 = 14, // removed "renamed to Windows81" + Windows81 = 14, + Win2012R2 = 15, + Win10 = 16, // removed "renamed to Windows10" + Windows10 = 16, + + WinMAX = 15, + + Max = 26, +} + +export enum EServerType { + Invalid = -1, + First = 0, + + Shell = 0, + GM = 1, + BUM = 2, // removed + BUMOBOSOLETE = 2, // removed + AM = 3, + BS = 4, + VS = 5, + ATS = 6, + CM = 7, + FBS = 8, + FG = 9, // removed "renamed to BoxMonitor" + BoxMonitor = 9, + SS = 10, + DRMS = 11, + HubOBSOLETE = 12, // removed + Console = 13, + ASBOBSOLETE = 14, // removed + PICS = 14, + Client = 15, + BootstrapOBSOLETE = 16, // removed, + DP = 17, + WG = 18, + SM = 19, + SLC = 20, + UFS = 21, + Util = 23, + DSS = 24, // removed "renamed to Community" + Community = 24, + P2PRelayOBSOLETE = 25, // removed + AppInformation = 26, + Spare = 27, + FTS = 28, + EPM = 29, // removed + EPMOBSOLETE = 29, // removed + PS = 30, + IS = 31, + CCS = 32, + DFS = 33, + LBS = 34, + MDS = 35, + CS = 36, + GC = 37, + NS = 38, + OGS = 39, + WebAPI = 40, + UDS = 41, + MMS = 42, + GMS = 43, + KGS = 44, + UCM = 45, + RM = 46, + FS = 47, + Econ = 48, + Backpack = 49, + UGS = 50, + Store = 51, // removed "renamed to StoreFeature" + StoreFeature = 51, + MoneyStats = 52, + CRE = 53, + UMQ = 54, + Workshop = 55, + BRP = 56, + GCH = 57, + MPAS = 58, + Trade = 59, + Secrets = 60, + Logsink = 61, + Market = 62, + Quest = 63, + WDS = 64, + ACS = 65, + PNP = 66, + TaxForm = 67, + ExternalMonitor = 68, + Parental = 69, + PartnerUpload = 70, + Partner = 71, + ES = 72, + DepotWebContent = 73, + ExternalConfig = 74, + GameNotifications = 75, + MarketRepl = 76, + MarketSearch = 77, + Localization = 78, + Steam2Emulator = 79, + PublicTest = 80, + SolrMgr = 81, + BroadcastRelay = 82, + BroadcastDirectory = 83, + VideoManager = 84, + TradeOffer = 85, + BroadcastChat = 86, + Phone = 87, + AccountScore = 88, + Support = 89, + LogRequest = 90, + LogWorker = 91, + EmailDelivery = 92, + InventoryManagement = 93, + Auth = 94, + StoreCatalog = 95, + HLTVRelay = 96, + + Max = 97, +} + +export enum EBillingType { + NoCost = 0, + BillOnceOnly = 1, + BillMonthly = 2, + ProofOfPrepurchaseOnly = 3, + GuestPass = 4, + HardwarePromo = 5, + Gift = 6, + AutoGrant = 7, + OEMTicket = 8, + RecurringOption = 9, + BillOnceOrCDKey = 10, + Repurchaseable = 11, + FreeOnDemand = 12, + Rental = 13, + CommercialLicense = 14, + FreeCommercialLicense = 15, + + NumBillingTypes = 16, +} + +export enum EActivationCodeClass { + WonCDKey = 0, + ValveCDKey = 1, + Doom3CDKey = 2, + DBLookup = 3, + Steam2010Key = 4, + Max = 5, + Test = 2147483647, + Invalid = 4294967295, +} + +export enum EChatMemberStateChange { + Entered = 0x01, + Left = 0x02, + Disconnected = 0x04, + Kicked = 0x08, + Banned = 0x10, + + VoiceSpeaking = 0x1000, + VoiceDoneSpeaking = 0x2000, +} + +export enum ERegionCode { + USEast = 0x00, + USWest = 0x01, + SouthAmerica = 0x02, + Europe = 0x03, + Asia = 0x04, + Australia = 0x05, + MiddleEast = 0x06, + Africa = 0x07, + World = 0xFF, +} + +export enum ECurrencyCode { + Invalid = 0, + + USD = 1, + GBP = 2, + EUR = 3, + CHF = 4, + RUB = 5, + PLN = 6, + BRL = 7, + JPY = 8, + NOK = 9, + IDR = 10, + MYR = 11, + PHP = 12, + SGD = 13, + THB = 14, + VND = 15, + KRW = 16, + TRY = 17, + UAH = 18, + MXN = 19, + CAD = 20, + AUD = 21, + NZD = 22, + CNY = 23, + INR = 24, + CLP = 25, + PEN = 26, + COP = 27, + ZAR = 28, + HKD = 29, + TWD = 30, + SAR = 31, + AED = 32, + ARS = 34, + ILS = 35, + BYN = 36, + KZT = 37, + KWD = 38, + QAR = 39, + CRC = 40, + UYU = 41, + + Max = 42, +} + +export enum EDepotFileFlag { + UserConfig = 1, + VersionedUserConfig = 2, + Encrypted = 4, + ReadOnly = 8, + Hidden = 16, + Executable = 32, + Directory = 64, + CustomExecutable = 128, + InstallScript = 256, + Symlink = 512, +} + +export enum EWorkshopEnumerationType { + RankedByVote = 0, + Recent = 1, + Trending = 2, + FavoriteOfFriends = 3, + VotedByFriends = 4, + ContentByFriends = 5, + RecentFromFollowedUsers = 6, +} + +export enum EPublishedFileVisibility { + Public = 0, + FriendsOnly = 1, + Private = 2, +} + +export enum EWorkshopFileType { + First = 0, + + Community = 0, + Microtransaction = 1, + Collection = 2, + Art = 3, + Video = 4, + Screenshot = 5, + Game = 6, + Software = 7, + Concept = 8, + WebGuide = 9, + IntegratedGuide = 10, + Merch = 11, + ControllerBinding = 12, + SteamworksAccessInvite = 13, + SteamVideo = 14, + GameManagedItem = 15, + + Max = 16, +} + +export enum EWorkshopFileAction { + Played = 0, + Completed = 1, +} + +export enum EEconTradeResponse { + Accepted = 0, + Declined = 1, + TradeBannedInitiator = 2, + TradeBannedTarget = 3, + TargetAlreadyTrading = 4, + Disabled = 5, + NotLoggedIn = 6, + Cancel = 7, + TooSoon = 8, + TooSoonPenalty = 9, + ConnectionFailed = 10, + AlreadyTrading = 11, + AlreadyHasTradeRequest = 12, + NoResponse = 13, + CyberCafeInitiator = 14, + CyberCafeTarget = 15, + SchoolLabInitiator = 16, + SchoolLabTarget = 16, + InitiatorBlockedTarget = 18, + InitiatorNeedsVerifiedEmail = 20, + InitiatorNeedsSteamGuard = 21, + TargetAccountCannotTrade = 22, + InitiatorSteamGuardDuration = 23, + InitiatorPasswordResetProbation = 24, + InitiatorNewDeviceCooldown = 25, + InitiatorSentInvalidCookie = 26, + NeedsEmailConfirmation = 27, + InitiatorRecentEmailChange = 28, + NeedsMobileConfirmation = 29, + TradingHoldForClearedTradeOffersInitiator = 30, + WouldExceedMaxAssetCount = 31, + OKToDeliver = 50, +} + +export enum EMarketingMessageFlags { + None = 0, + + HighPriority = 1, + PlatformWindows = 2, + PlatformMac = 4, + PlatformLinux = 8, + PlatformRestrictions = PlatformWindows | PlatformMac | PlatformLinux, +} + +export enum ENewsUpdateType { + AppNews = 0, + SteamAds = 1, + SteamNews = 2, + CDDBUpdate = 3, + ClientUpdate = 4, +} + +export enum ESystemIMType { + RawText = 0, + InvalidCard = 1, + RecurringPurchaseFailed = 2, + CardWillExpire = 3, + SubscriptionExpired = 4, + GuestPassReceived = 5, + GuestPassGranted = 6, + GiftRevoked = 7, + SupportMessage = 8, + SupportMessageClearAlert = 9, + + Max = 10, +} + +export enum EChatFlags { + Locked = 1, + InvisibleToFriends = 2, + Moderated = 4, + Unjoinable = 8, +} + +export enum ERemoteStoragePlatform { + None = 0, + + Windows = 1, + OSX = 2, + PS3 = 4, + Linux = 8, + Reserved1 = 8, // removed + Reserved2 = 16, + + All = -1, +} + +export enum EDRMBlobDownloadType { + Error = 0, + + File = 1, + Parts = 2, + Compressed = 4, + AllMask = 7, + IsJob = 8, + HighPriority = 16, + AddTimestamp = 32, + LowPriority = 64, +} + +export enum EDRMBlobDownloadErrorDetail { + None = 0, + + DownloadFailed = 1, + TargetLocked = 2, + OpenZip = 3, + ReadZipDirectory = 4, + UnexpectedZipEntry = 5, + UnzipFullFile = 6, + UnknownBlobType = 7, + UnzipStrips = 8, + UnzipMergeGuid = 9, + UnzipSignature = 10, + ApplyStrips = 11, + ApplyMergeGuid = 12, + ApplySignature = 13, + AppIdMismatch = 14, + AppIdUnexpected = 15, + AppliedSignatureCorrupt = 16, + ApplyValveSignatureHeader = 17, + UnzipValveSignatureHeader = 18, + PathManipulationError = 19, + + TargetLocked_Base = 65536, + TargetLocked_Max = 131071, + + NextBase = 131072, +} + +export enum EClientStat { + P2PConnectionsUDP = 0, + P2PConnectionsRelay = 1, + P2PGameConnections = 2, + P2PVoiceConnections = 3, + BytesDownloaded = 4, + + Max = 5, +} + +export enum EClientStatAggregateMethod { + LatestOnly = 0, + Sum = 1, + Event = 2, + Scalar = 3, +} + +export enum ELeaderboardDataRequest { + Global = 0, + GlobalAroundUser = 1, + Friends = 2, + Users = 3, +} + +export enum ELeaderboardSortMethod { + None = 0, + + Ascending = 1, + Descending = 2, +} + +export enum ELeaderboardDisplayType { + None = 0, + Numeric = 1, + TimeSeconds = 2, + TimeMilliSeconds = 3, +} + +export enum ELeaderboardUploadScoreMethod { + None = 0, + + KeepBest = 1, + ForceUpdate = 2, +} + +export enum EUCMFilePrivacyState { + Invalid = -1, + Private = 2, + FriendsOnly = 4, + Public = 8, + + All = Public | FriendsOnly | Private, // 14 +} + +export enum EResult { + Invalid = 0, + + OK = 1, + Fail = 2, + NoConnection = 3, + InvalidPassword = 5, + LoggedInElsewhere = 6, + InvalidProtocolVer = 7, + InvalidParam = 8, + FileNotFound = 9, + Busy = 10, + InvalidState = 11, + InvalidName = 12, + InvalidEmail = 13, + DuplicateName = 14, + AccessDenied = 15, + Timeout = 16, + Banned = 17, + AccountNotFound = 18, + InvalidSteamID = 19, + ServiceUnavailable = 20, + NotLoggedOn = 21, + Pending = 22, + EncryptionFailure = 23, + InsufficientPrivilege = 24, + LimitExceeded = 25, + Revoked = 26, + Expired = 27, + AlreadyRedeemed = 28, + DuplicateRequest = 29, + AlreadyOwned = 30, + IPNotFound = 31, + PersistFailed = 32, + LockingFailed = 33, + LogonSessionReplaced = 34, + ConnectFailed = 35, + HandshakeFailed = 36, + IOFailure = 37, + RemoteDisconnect = 38, + ShoppingCartNotFound = 39, + Blocked = 40, + Ignored = 41, + NoMatch = 42, + AccountDisabled = 43, + ServiceReadOnly = 44, + AccountNotFeatured = 45, + AdministratorOK = 46, + ContentVersion = 47, + TryAnotherCM = 48, + PasswordRequiredToKickSession = 49, + AlreadyLoggedInElsewhere = 50, + Suspended = 51, + Cancelled = 52, + DataCorruption = 53, + DiskFull = 54, + RemoteCallFailed = 55, + PasswordNotSet = 56, // removed "renamed to PasswordUnset" + PasswordUnset = 56, + ExternalAccountUnlinked = 57, + PSNTicketInvalid = 58, + ExternalAccountAlreadyLinked = 59, + RemoteFileConflict = 60, + IllegalPassword = 61, + SameAsPreviousValue = 62, + AccountLogonDenied = 63, + CannotUseOldPassword = 64, + InvalidLoginAuthCode = 65, + AccountLogonDeniedNoMailSent = 66, // removed "renamed to AccountLogonDeniedNoMail" + AccountLogonDeniedNoMail = 66, + HardwareNotCapableOfIPT = 67, + IPTInitError = 68, + ParentalControlRestricted = 69, + FacebookQueryError = 70, + ExpiredLoginAuthCode = 71, + IPLoginRestrictionFailed = 72, + AccountLocked = 73, // removed "renamed to AccountLockedDown" + AccountLockedDown = 73, + AccountLogonDeniedVerifiedEmailRequired = 74, + NoMatchingURL = 75, + BadResponse = 76, + RequirePasswordReEntry = 77, + ValueOutOfRange = 78, + UnexpectedError = 79, + Disabled = 80, + InvalidCEGSubmission = 81, + RestrictedDevice = 82, + RegionLocked = 83, + RateLimitExceeded = 84, + AccountLogonDeniedNeedTwoFactorCode = 85, // removed "renamed to AccountLoginDeniedNeedTwoFactor" + AccountLoginDeniedNeedTwoFactor = 85, + ItemOrEntryHasBeenDeleted = 86, // removed "renamed to ItemDeleted" + ItemDeleted = 86, + AccountLoginDeniedThrottle = 87, + TwoFactorCodeMismatch = 88, + TwoFactorActivationCodeMismatch = 89, + AccountAssociatedToMultiplePlayers = 90, // removed "renamed to AccountAssociatedToMultiplePartners" + AccountAssociatedToMultiplePartners = 90, + NotModified = 91, + NoMobileDeviceAvailable = 92, // removed "renamed to NoMobileDevice" + NoMobileDevice = 92, + TimeIsOutOfSync = 93, // removed "renamed to TimeNotSynced" + TimeNotSynced = 93, + SMSCodeFailed = 94, + TooManyAccountsAccessThisResource = 95, // removed "renamed to AccountLimitExceeded" + AccountLimitExceeded = 95, + AccountActivityLimitExceeded = 96, + PhoneActivityLimitExceeded = 97, + RefundToWallet = 98, + EmailSendFailure = 99, + NotSettled = 100, + NeedCaptcha = 101, + GSLTDenied = 102, + GSOwnerDenied = 103, + InvalidItemType = 104, + IPBanned = 105, + GSLTExpired = 106, + InsufficientFunds = 107, + TooManyPending = 108, + NoSiteLicensesFound = 109, + WGNetworkSendExceeded = 110, +} diff --git a/types/steam-client/steam-client-tests.ts b/types/steam-client/steam-client-tests.ts new file mode 100644 index 0000000000..e330930c36 --- /dev/null +++ b/types/steam-client/steam-client-tests.ts @@ -0,0 +1,38 @@ +import Steam = require("steam-client"); + +const steamClient = new Steam.CMClient(Steam.EConnectionProtocol.TCP); + +steamClient.connect(); +steamClient.connect(Steam.servers[0]); +steamClient.connect(Steam.servers[0], true); + +steamClient.disconnect(); + +steamClient.on<'connected'>('connected', (serverLoad) => { + steamClient.logOn({ + account_name: serverLoad, + password: "password" + }); +}); + +Steam.servers.forEach((server) => server.host); + +steamClient.on<'logOnResponse'>('logOnResponse', (details) => { + return details.eresult + details.webapi_authenticate_user_nonce; +}); + +steamClient.send({ + msg: Steam.EMsg.ClientGetFinalPrice, + proto: { + eresult: Steam.EResult.AdministratorOK + } +}, new Buffer("lol"), (header, body) => { + return header.msg + body.reverse().toString(); +}); + +steamClient.bind("127.0.0.1", 80); + +if (steamClient.loggedOn) { + console.log(steamClient.steamID); + console.log(steamClient.remoteAddress); +} diff --git a/types/steam-client/tsconfig.json b/types/steam-client/tsconfig.json new file mode 100644 index 0000000000..a619b6452a --- /dev/null +++ b/types/steam-client/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "steam-client-tests.ts" + ] +} diff --git a/types/steam-client/tslint.json b/types/steam-client/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/steam-client/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/steamid/index.d.ts b/types/steamid/index.d.ts new file mode 100644 index 0000000000..e8b754ad57 --- /dev/null +++ b/types/steamid/index.d.ts @@ -0,0 +1,134 @@ +// Type definitions for steamid 1.1 +// Project: https://github.com/DoctorMcKay/node-steamid +// Definitions by: Edward Sammut Alessi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/** + * Render this SteamID into Steam2 textual format + * @param newerFormat [newerFormat=false] - true if you want to use 1 in place of the leading 0 for the public universe + */ +type getSteam2RenderedID = (newerFormat?: boolean) => string; + +/** + * Render this SteamID into Steam3 textual format + */ +type getSteam3RenderedID = () => string; + +/** + * Render this SteamID into 64-bit numeric format + */ +type getSteamID64 = () => string; + +declare class SteamID { + universe: SteamID.Universe; + type: SteamID.Type; + instance: SteamID.Instance; + accountid: number; + + /** + * You can create a SteamID object from a Steam2 rendered ID, a Steam3 rendered ID, a SteamID64, or from the four parts that make up a SteamID. + * @param input SteamID string + */ + constructor(input: string); + + /** + * Check whether this SteamID is valid (according to Steam's rules) + */ + isValid(): boolean; + + /** + * Check whether this chat SteamID is tied to a Steam group. + */ + isGroupChat(): boolean; + + /** + * Check whether this chat SteamID is a Steam lobby. + */ + isLobby(): boolean; + + getSteam2RenderedID: getSteam2RenderedID; + steam2: getSteam2RenderedID; + + getSteam3RenderedID: getSteam3RenderedID; + steam3: getSteam3RenderedID; + + getSteamID64: getSteamID64; + toString: getSteamID64; +} + +declare namespace SteamID { + // Universe constants + enum Universe { + INVALID = 0, + PUBLIC = 1, + BETA = 2, + INTERNAL = 3, + DEV = 4, + } + + // Type constants + enum Type { + INVALID = 0, + INDIVIDUAL = 1, + MULTISEAT = 2, + GAMESERVER = 3, + ANON_GAMESERVER = 4, + PENDING = 5, + CONTENT_SERVER = 6, + CLAN = 7, + CHAT = 8, + P2P_SUPER_SEEDER = 9, + ANON_USER = 10, + } + + // Instance constants + enum Instance { + ALL = 0, + DESKTOP = 1, + CONSOLE = 2, + WEB = 4, + } + + // Type chars + enum TypeChars { + I = Type.INVALID, + U = Type.INDIVIDUAL, + M = Type.MULTISEAT, + G = Type.GAMESERVER, + A = Type.ANON_GAMESERVER, + P = Type.PENDING, + C = Type.CONTENT_SERVER, + g = Type.CLAN, + T = Type.CHAT, + a = Type.ANON_USER, + } + + const AccountIDMask = 0xFFFFFFFF; + const AccountInstanceMask = 0x000FFFFF; + + enum ChatInstanceFlags { + /** + * (AccountInstanceMask + 1) >> 1 + */ + Clan = (0x000FFFFF + 1) >> 1, + + /** + * (AccountInstanceMask + 1) >> 2 + */ + Lobby = (0x000FFFFF + 1) >> 2, + + /** + * (AccountInstanceMask + 1) >> 3 + */ + MMSLobby = (0x000FFFFF + 1) >> 3, + } + + /** + * Create an individual SteamID in the public universe given an accountid + * @param accountid - The user's account ID + */ + function fromIndividualAccountID(accountid: number | string): SteamID; +} + +export = SteamID; diff --git a/types/steamid/steamid-tests.ts b/types/steamid/steamid-tests.ts new file mode 100644 index 0000000000..bbf556c100 --- /dev/null +++ b/types/steamid/steamid-tests.ts @@ -0,0 +1,19 @@ +import SteamID = require("steamid"); + +let sid: SteamID; + +sid = new SteamID("76561198006409530"); +sid = SteamID.fromIndividualAccountID(46143802); + +sid.universe = SteamID.Universe.PUBLIC; +sid.type = SteamID.Type.INDIVIDUAL; +sid.instance = SteamID.Instance.DESKTOP; +sid.accountid = 46143802; + +sid.isValid(); +sid.isGroupChat(); +sid.isLobby(); +sid.getSteam2RenderedID(); +sid.getSteam2RenderedID(true); +sid.getSteam3RenderedID(); +sid.getSteamID64(); diff --git a/types/steamid/tsconfig.json b/types/steamid/tsconfig.json new file mode 100644 index 0000000000..dca75b64b2 --- /dev/null +++ b/types/steamid/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "steamid-tests.ts" + ] +} diff --git a/types/steamid/tslint.json b/types/steamid/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/steamid/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/stellar-sdk/index.d.ts b/types/stellar-sdk/index.d.ts index 955360d3f0..b098ea0896 100644 --- a/types/stellar-sdk/index.d.ts +++ b/types/stellar-sdk/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for stellar-sdk 0.8 // Project: https://github.com/stellar/js-stellar-sdk // Definitions by: Carl Foster +// Triston Jones // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -596,7 +597,7 @@ export namespace Operation { } interface ChangeTrustOptions { asset: Asset; - limit: string; + limit?: string; source?: string; } function changeTrust(options: ChangeTrustOptions): xdr.Operation; diff --git a/types/strict-uri-encode/index.d.ts b/types/strict-uri-encode/index.d.ts new file mode 100644 index 0000000000..3c1fbb81af --- /dev/null +++ b/types/strict-uri-encode/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for strict-uri-encode 2.0 +// Project: https://github.com/kevva/strict-uri-encode#readme +// Definitions by: Keiichiro Amemiya +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = strict_uri_encode; + +declare function strict_uri_encode(str: string): string; diff --git a/types/strict-uri-encode/strict-uri-encode-tests.ts b/types/strict-uri-encode/strict-uri-encode-tests.ts new file mode 100644 index 0000000000..7ce3939765 --- /dev/null +++ b/types/strict-uri-encode/strict-uri-encode-tests.ts @@ -0,0 +1,7 @@ +import strictUriEncode = require('strict-uri-encode'); + +// $ExpectType string +strictUriEncode('!#$@*()jsjs'); + +// $ExpectError +strictUriEncode([12, 23]); diff --git a/types/strict-uri-encode/tsconfig.json b/types/strict-uri-encode/tsconfig.json new file mode 100644 index 0000000000..72b2cde06b --- /dev/null +++ b/types/strict-uri-encode/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "strict-uri-encode-tests.ts" + ] +} diff --git a/types/strict-uri-encode/tslint.json b/types/strict-uri-encode/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/strict-uri-encode/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/stylus/index.d.ts b/types/stylus/index.d.ts index 58a41872b1..5db1979770 100644 --- a/types/stylus/index.d.ts +++ b/types/stylus/index.d.ts @@ -1190,7 +1190,7 @@ declare namespace Stylus { /** * Merges this query list with the `other`. */ - merge(other: MediaQueryList): MediaQueryList; + merge(other: QueryList): QueryList; /** * Return a JSON representation of this node. diff --git a/types/sumo-logger/index.d.ts b/types/sumo-logger/index.d.ts index bc89e0eaa8..8e3cd3a27e 100644 --- a/types/sumo-logger/index.d.ts +++ b/types/sumo-logger/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for js-logging-sdk 1.0 +// Type definitions for js-logging-sdk 1.3 // Project: https://github.com/SumoLogic/js-logging-sdk // Definitions by: forabi +// clementallen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -67,6 +68,11 @@ declare namespace SumoLogger { * This value sets the Source Name for the logged message. */ sourceName?: string; + + /** + * This value enabled and disables sending data as graphite metrics + */ + graphite?: boolean; } interface PerMessageOptions { @@ -124,6 +130,21 @@ declare class SumoLogger { * messages are sent to Sumo Logic. */ flushLogs(): void; + + /** + * Stop sending batched logs + */ + stopLogSending(): void; + + /** + * Start sending batched logs at the preconfigured interval + */ + startLogSending(): void; + + /** + * Empty the current queue of logs + */ + emptyLogQueue(): void; } export = SumoLogger; diff --git a/types/sumo-logger/sumo-logger-tests.ts b/types/sumo-logger/sumo-logger-tests.ts index 2a0066a4e4..dab4945906 100644 --- a/types/sumo-logger/sumo-logger-tests.ts +++ b/types/sumo-logger/sumo-logger-tests.ts @@ -6,14 +6,15 @@ const onSuccessSpy = expect.createSpy(); const logger = new SumoLogger({ endpoint: 'http://example.com/', - onSuccess() { - console.log('success'); - }, + onSuccess: onSuccessSpy, onError: onErrorSpy, }); expect(logger.flushLogs).toExist(); expect(logger.log).toExist(); +expect(logger.emptyLogQueue).toExist(); +expect(logger.startLogSending).toExist(); +expect(logger.stopLogSending).toExist(); logger.log('message'); logger.log({ json: 'object' }); diff --git a/types/tapable/index.d.ts b/types/tapable/index.d.ts index c044a245ce..502b408e9e 100644 --- a/types/tapable/index.d.ts +++ b/types/tapable/index.d.ts @@ -9,6 +9,9 @@ export declare abstract class Tapable { [propName: string]: Tapable.Handler[] } + /** @deprecated Private internals. Do not use directly */ + _pluginCompat: Hook; + /** * @deprecated Tapable.plugin is deprecated. Use new API on `.hooks` instead * Register plugin(s) @@ -275,7 +278,9 @@ export class HookInterceptor { context: boolean; } +/** A HookMap is a helper class for a Map with Hooks */ export class HookMap { + constructor(fn: () => Hook); get: (key: any) => Hook | undefined; for: (key: any) => Hook; tap: (key: any, name: string | Tap, fn: (arg1: T1, arg2: T2, arg3: T3, ...args: any[]) => any) => void; @@ -287,3 +292,16 @@ export class HookMap { export class HookMapInterceptor { factory: (key: any, hook: Hook) => Hook; } + +/** + * A helper Hook-like class to redirect taps to multiple other hooks + * + * ``` + * const { MultiHook } = require("tapable"); + * + * this.hooks.allHooks = new MultiHook([this.hooks.hookA, this.hooks.hookB]); + * ``` + */ +export class MultiHook { + constructor(hooks: Hook[]) +} diff --git a/types/tapable/tapable-tests.ts b/types/tapable/tapable-tests.ts index 4d82e60a66..c78196c194 100644 --- a/types/tapable/tapable-tests.ts +++ b/types/tapable/tapable-tests.ts @@ -1,4 +1,4 @@ -import {Tapable} from "tapable"; +import {Tapable, MultiHook, SyncHook} from "tapable"; class DllPlugin { apply(compiler: Compiler) { @@ -43,3 +43,5 @@ compiler.applyPluginsAsyncWaterfall('doSomething', 'a', callback); compiler.applyPluginsParallel('doSomething', 'a', 'b'); compiler.applyPluginsParallelBailResult('doSomething', 'a', 'b'); compiler.applyPluginsParallelBailResult1('doSomething', 'a', callback); + +const multi = new MultiHook([new SyncHook(['hi'])]); diff --git a/types/three/index.d.ts b/types/three/index.d.ts index e553853293..50450fd793 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js 0.89 +// Type definitions for three.js 0.91 // Project: https://threejs.org // Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei , Ivo , David Asmuth , Brandon Roberge, Qinsi ZHU , Toshiya Nakakura , Poul Kjeldager Sørensen , Stefan Profanter , Edmund Fokschaner , Roelof Jooste , Daniel Hritzkiv , Apurva Ojas // Definitions: https://github.com//DefinitelyTyped diff --git a/types/three/test/math/test_unit_math.ts b/types/three/test/math/test_unit_math.ts index 4a8e0a8c14..b6c536085f 100644 --- a/types/three/test/math/test_unit_math.ts +++ b/types/three/test/math/test_unit_math.ts @@ -3,7 +3,7 @@ declare function ok(cond: any, desc?: string): void; declare function deepEqual(a: T, b: T, desc?: string): void; declare function equal(a: T, b: T, desc?: string): void; -// https://github.com/mrdoob/three.js/tree/master/test/unit/math +// https://github.com/mrdoob/three.js/tree/master/test/unit/src/math ()=>{ // -------------------------------------------- Constants @@ -91,57 +91,62 @@ declare function equal(a: T, b: T, desc?: string): void; test( "center", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); + var center = new THREE.Vector2(); - ok( a.getCenter().equals( zero2 ), "Passed!" ); + ok( a.getCenter(center).equals( zero2 ), "Passed!" ); a = new THREE.Box2( zero2, one2 ); var midpoint = one2.clone().multiplyScalar( 0.5 ); - ok( a.getCenter().equals( midpoint ), "Passed!" ); + ok( a.getCenter(center).equals( midpoint ), "Passed!" ); }); test( "size", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); + var size = new THREE.Vector2(); - ok( a.getSize().equals( zero2 ), "Passed!" ); + ok( a.getSize(size).equals( zero2 ), "Passed!" ); a = new THREE.Box2( zero2.clone(), one2.clone() ); - ok( a.getSize().equals( one2 ), "Passed!" ); + ok( a.getSize(size).equals( one2 ), "Passed!" ); }); test( "expandByPoint", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); + var size = new THREE.Vector2(); a.expandByPoint( zero2 ); - ok( a.getSize().equals( zero2 ), "Passed!" ); + ok( a.getSize(size).equals( zero2 ), "Passed!" ); a.expandByPoint( one2 ); - ok( a.getSize().equals( one2 ), "Passed!" ); + ok( a.getSize(size).equals( one2 ), "Passed!" ); a.expandByPoint( one2.clone().negate() ); - ok( a.getSize().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.getCenter().equals( zero2 ), "Passed!" ); + ok( a.getSize(size).equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter(new THREE.Vector2()).equals( zero2 ), "Passed!" ); }); test( "expandByVector", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); + var size = new THREE.Vector2(); a.expandByVector( zero2 ); - ok( a.getSize().equals( zero2 ), "Passed!" ); + ok( a.getSize(size).equals( zero2 ), "Passed!" ); a.expandByVector( one2 ); - ok( a.getSize().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.getCenter().equals( zero2 ), "Passed!" ); + ok( a.getSize(size).equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter(new THREE.Vector2()).equals( zero2 ), "Passed!" ); }); test( "expandByScalar", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); + var size = new THREE.Vector2(); a.expandByScalar( 0 ); - ok( a.getSize().equals( zero2 ), "Passed!" ); + ok( a.getSize(size).equals( zero2 ), "Passed!" ); a.expandByScalar( 1 ); - ok( a.getSize().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.getCenter().equals( zero2 ), "Passed!" ); + ok( a.getSize(size).equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter(new THREE.Vector2()).equals( zero2 ), "Passed!" ); }); test( "containsPoint", function() { @@ -185,16 +190,17 @@ declare function equal(a: T, b: T, desc?: string): void; test( "clampPoint", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); var b = new THREE.Box2( one2.clone().negate(), one2.clone() ); + var target = new THREE.Vector2(); - ok( a.clampPoint( new THREE.Vector2( 0, 0 ) ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" ); - ok( a.clampPoint( new THREE.Vector2( 1, 1 ) ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" ); - ok( a.clampPoint( new THREE.Vector2( -1, -1 ) ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" ); + ok( a.clampPoint( new THREE.Vector2( 0, 0 ), target ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" ); + ok( a.clampPoint( new THREE.Vector2( 1, 1 ), target ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" ); + ok( a.clampPoint( new THREE.Vector2( -1, -1 ), target ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector2( 2, 2 ) ).equals( new THREE.Vector2( 1, 1 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector2( 1, 1 ) ).equals( new THREE.Vector2( 1, 1 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector2( 0, 0 ) ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector2( -1, -1 ) ).equals( new THREE.Vector2( -1, -1 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector2( -2, -2 ) ).equals( new THREE.Vector2( -1, -1 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector2( 2, 2 ), target ).equals( new THREE.Vector2( 1, 1 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector2( 1, 1 ), target ).equals( new THREE.Vector2( 1, 1 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector2( 0, 0 ), target ).equals( new THREE.Vector2( 0, 0 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector2( -1, -1 ), target ).equals( new THREE.Vector2( -1, -1 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector2( -2, -2 ), target ).equals( new THREE.Vector2( -1, -1 ) ), "Passed!" ); }); test( "distanceToPoint", function() { @@ -332,57 +338,62 @@ declare function equal(a: T, b: T, desc?: string): void; test( "center", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); + var center = new THREE.Vector3(); - ok( a.getCenter().equals( zero3 ), "Passed!" ); + ok( a.getCenter(center).equals( zero3 ), "Passed!" ); a = new THREE.Box3( zero3.clone(), one3.clone() ); var midpoint = one3.clone().multiplyScalar( 0.5 ); - ok( a.getCenter().equals( midpoint ), "Passed!" ); + ok( a.getCenter(center).equals( midpoint ), "Passed!" ); }); test( "size", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); + var size = new THREE.Vector3(); - ok( a.getSize().equals( zero3 ), "Passed!" ); + ok( a.getSize(size).equals( zero3 ), "Passed!" ); a = new THREE.Box3( zero3.clone(), one3.clone() ); - ok( a.getSize().equals( one3 ), "Passed!" ); + ok( a.getSize(size).equals( one3 ), "Passed!" ); }); test( "expandByPoint", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); + var size = new THREE.Vector3(); a.expandByPoint( zero3 ); - ok( a.getSize().equals( zero3 ), "Passed!" ); + ok( a.getSize(size).equals( zero3 ), "Passed!" ); a.expandByPoint( one3 ); - ok( a.getSize().equals( one3 ), "Passed!" ); + ok( a.getSize(size).equals( one3 ), "Passed!" ); a.expandByPoint( one3.clone().negate() ); - ok( a.getSize().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.getCenter().equals( zero3 ), "Passed!" ); + ok( a.getSize(size).equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter(new THREE.Vector3()).equals( zero3 ), "Passed!" ); }); test( "expandByVector", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); + var size = new THREE.Vector3(); a.expandByVector( zero3 ); - ok( a.getSize().equals( zero3 ), "Passed!" ); + ok( a.getSize(size).equals( zero3 ), "Passed!" ); a.expandByVector( one3 ); - ok( a.getSize().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.getCenter().equals( zero3 ), "Passed!" ); + ok( a.getSize(size).equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter(new THREE.Vector3()).equals( zero3 ), "Passed!" ); }); test( "expandByScalar", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); + var size = new THREE.Vector3(); a.expandByScalar( 0 ); - ok( a.getSize().equals( zero3 ), "Passed!" ); + ok( a.getSize(size).equals( zero3 ), "Passed!" ); a.expandByScalar( 1 ); - ok( a.getSize().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.getCenter().equals( zero3 ), "Passed!" ); + ok( a.getSize(size).equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter(new THREE.Vector3()).equals( zero3 ), "Passed!" ); }); test( "containsPoint", function() { @@ -426,16 +437,17 @@ declare function equal(a: T, b: T, desc?: string): void; test( "clampPoint", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); var b = new THREE.Box3( one3.clone().negate(), one3.clone() ); + var target = new THREE.Vector3(); - ok( a.clampPoint( new THREE.Vector3( 0, 0, 0 ) ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); - ok( a.clampPoint( new THREE.Vector3( 1, 1, 1 ) ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); - ok( a.clampPoint( new THREE.Vector3( -1, -1, -1 ) ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); + ok( a.clampPoint( new THREE.Vector3( 0, 0, 0 ), target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); + ok( a.clampPoint( new THREE.Vector3( 1, 1, 1 ), target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); + ok( a.clampPoint( new THREE.Vector3( -1, -1, -1 ), target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector3( 2, 2, 2 ) ).equals( new THREE.Vector3( 1, 1, 1 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector3( 1, 1, 1 ) ).equals( new THREE.Vector3( 1, 1, 1 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector3( 0, 0, 0 ) ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector3( -1, -1, -1 ) ).equals( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" ); - ok( b.clampPoint( new THREE.Vector3( -2, -2, -2 ) ).equals( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector3( 2, 2, 2 ), target ).equals( new THREE.Vector3( 1, 1, 1 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector3( 1, 1, 1 ), target ).equals( new THREE.Vector3( 1, 1, 1 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector3( 0, 0, 0 ), target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector3( -1, -1, -1 ), target ).equals( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" ); + ok( b.clampPoint( new THREE.Vector3( -2, -2, -2 ), target ).equals( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" ); }); test( "distanceToPoint", function() { @@ -491,10 +503,11 @@ declare function equal(a: T, b: T, desc?: string): void; var a = new THREE.Box3( zero3.clone(), zero3.clone() ); var b = new THREE.Box3( zero3.clone(), one3.clone() ); var c = new THREE.Box3( one3.clone().negate(), one3.clone() ); + var target = new THREE.Sphere(); - ok( a.getBoundingSphere().equals( new THREE.Sphere( zero3, 0 ) ), "Passed!" ); - ok( b.getBoundingSphere().equals( new THREE.Sphere( one3.clone().multiplyScalar( 0.5 ), Math.sqrt( 3 ) * 0.5 ) ), "Passed!" ); - ok( c.getBoundingSphere().equals( new THREE.Sphere( zero3, Math.sqrt( 12 ) * 0.5 ) ), "Passed!" ); + ok( a.getBoundingSphere( target ).equals( new THREE.Sphere( zero3, 0 ) ), "Passed!" ); + ok( b.getBoundingSphere( target ).equals( new THREE.Sphere( one3.clone().multiplyScalar( 0.5 ), Math.sqrt( 3 ) * 0.5 ) ), "Passed!" ); + ok( c.getBoundingSphere( target ).equals( new THREE.Sphere( zero3, Math.sqrt( 12 ) * 0.5 ) ), "Passed!" ); }); test( "intersect", function() { @@ -1080,34 +1093,36 @@ declare function equal(a: T, b: T, desc?: string): void; test( "at", function() { var a = new THREE.Line3( one3.clone(), new THREE.Vector3( 1, 1, 2 ) ); + var target = new THREE.Vector3(); - ok( a.at( -1 ).distanceTo( new THREE.Vector3( 1, 1, 0 ) ) < 0.0001, "Passed!" ); - ok( a.at( 0 ).distanceTo( one3.clone() ) < 0.0001, "Passed!" ); - ok( a.at( 1 ).distanceTo( new THREE.Vector3( 1, 1, 2 ) ) < 0.0001, "Passed!" ); - ok( a.at( 2 ).distanceTo( new THREE.Vector3( 1, 1, 3 ) ) < 0.0001, "Passed!" ); + ok( a.at( -1, target ).distanceTo( new THREE.Vector3( 1, 1, 0 ) ) < 0.0001, "Passed!" ); + ok( a.at( 0, target ).distanceTo( one3.clone() ) < 0.0001, "Passed!" ); + ok( a.at( 1, target ).distanceTo( new THREE.Vector3( 1, 1, 2 ) ) < 0.0001, "Passed!" ); + ok( a.at( 2, target ).distanceTo( new THREE.Vector3( 1, 1, 3 ) ) < 0.0001, "Passed!" ); }); test( "closestPointToPoint/closestPointToPointParameter", function() { var a = new THREE.Line3( one3.clone(), new THREE.Vector3( 1, 1, 2 ) ); + var target = new THREE.Vector3(); // nearby the ray ok( a.closestPointToPointParameter( zero3.clone(), true ) == 0, "Passed!" ); - var b1 = a.closestPointToPoint( zero3.clone(), true ); + var b1 = a.closestPointToPoint( zero3.clone(), true, target ); ok( b1.distanceTo( new THREE.Vector3( 1, 1, 1 ) ) < 0.0001, "Passed!" ); // nearby the ray ok( a.closestPointToPointParameter( zero3.clone(), false ) == -1, "Passed!" ); - var b2 = a.closestPointToPoint( zero3.clone(), false ); + var b2 = a.closestPointToPoint( zero3.clone(), false, target ); ok( b2.distanceTo( new THREE.Vector3( 1, 1, 0 ) ) < 0.0001, "Passed!" ); // nearby the ray ok( a.closestPointToPointParameter( new THREE.Vector3( 1, 1, 5 ), true ) == 1, "Passed!" ); - var b = a.closestPointToPoint( new THREE.Vector3( 1, 1, 5 ), true ); + var b = a.closestPointToPoint( new THREE.Vector3( 1, 1, 5 ), true, target ); ok( b.distanceTo( new THREE.Vector3( 1, 1, 2 ) ) < 0.0001, "Passed!" ); // exactly on the ray ok( a.closestPointToPointParameter( one3.clone(), true ) == 0, "Passed!" ); - var c = a.closestPointToPoint( one3.clone(), true ); + var c = a.closestPointToPoint( one3.clone(), true, target ); ok( c.distanceTo( one3.clone() ) < 0.0001, "Passed!" ); }); @@ -1752,7 +1767,7 @@ declare function equal(a: T, b: T, desc?: string): void; var a = new THREE.Plane( new THREE.Vector3( 2, 0, 0 ), -2 ); a.normalize(); - ok( a.distanceToPoint( a.projectPoint( zero3.clone() ) ) === 0, "Passed!" ); + ok( a.distanceToPoint( a.projectPoint( zero3.clone(), new THREE.Vector3() ) ) === 0, "Passed!" ); ok( a.distanceToPoint( new THREE.Vector3( 4, 0, 0 ) ) === 3, "Passed!" ); }); @@ -1771,54 +1786,57 @@ declare function equal(a: T, b: T, desc?: string): void; test( "isInterestionLine/intersectLine", function() { var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 ); + var target = new THREE.Vector3(); var l1 = new THREE.Line3( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) ); ok( a.intersectsLine( l1 ), "Passed!" ); - ok( a.intersectLine( l1 ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); + ok( a.intersectLine( l1, target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), -3 ); ok( a.intersectsLine( l1 ), "Passed!" ); - ok( a.intersectLine( l1 ).equals( new THREE.Vector3( 3, 0, 0 ) ), "Passed!" ); + ok( a.intersectLine( l1, target ).equals( new THREE.Vector3( 3, 0, 0 ) ), "Passed!" ); a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), -11 ); ok( ! a.intersectsLine( l1 ), "Passed!" ); - ok( a.intersectLine( l1 ) === undefined, "Passed!" ); + ok( a.intersectLine( l1, target ) === undefined, "Passed!" ); a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 11 ); ok( ! a.intersectsLine( l1 ), "Passed!" ); - ok( a.intersectLine( l1 ) === undefined, "Passed!" ); + ok( a.intersectLine( l1, target ) === undefined, "Passed!" ); }); test( "projectPoint", function() { var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 ); + var target = new THREE.Vector3(); - ok( a.projectPoint( new THREE.Vector3( 10, 0, 0 ) ).equals( zero3 ), "Passed!" ); - ok( a.projectPoint( new THREE.Vector3( -10, 0, 0 ) ).equals( zero3 ), "Passed!" ); + ok( a.projectPoint( new THREE.Vector3( 10, 0, 0 ), target ).equals( zero3 ), "Passed!" ); + ok( a.projectPoint( new THREE.Vector3( -10, 0, 0 ), target ).equals( zero3 ), "Passed!" ); a = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), -1 ); - ok( a.projectPoint( new THREE.Vector3( 0, 0, 0 ) ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); - ok( a.projectPoint( new THREE.Vector3( 0, 1, 0 ) ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); + ok( a.projectPoint( new THREE.Vector3( 0, 0, 0 ), target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); + ok( a.projectPoint( new THREE.Vector3( 0, 1, 0 ), target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); }); test( "orthoPoint", function() { var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 ); + var target = new THREE.Vector3(); - ok( a.orthoPoint( new THREE.Vector3( 10, 0, 0 ) ).equals( new THREE.Vector3( 10, 0, 0 ) ), "Passed!" ); - ok( a.orthoPoint( new THREE.Vector3( -10, 0, 0 ) ).equals( new THREE.Vector3( -10, 0, 0 ) ), "Passed!" ); + ok( a.orthoPoint( new THREE.Vector3( 10, 0, 0 ), target ).equals( new THREE.Vector3( 10, 0, 0 ) ), "Passed!" ); + ok( a.orthoPoint( new THREE.Vector3( -10, 0, 0 ), target ).equals( new THREE.Vector3( -10, 0, 0 ) ), "Passed!" ); }); test( "coplanarPoint", function() { var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 ); - ok( a.distanceToPoint( a.coplanarPoint() ) === 0, "Passed!" ); + ok( a.distanceToPoint( a.coplanarPoint( new THREE.Vector3() ) ) === 0, "Passed!" ); a = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), -1 ); - ok( a.distanceToPoint( a.coplanarPoint() ) === 0, "Passed!" ); + ok( a.distanceToPoint( a.coplanarPoint( new THREE.Vector3() ) ) === 0, "Passed!" ); }); test( "applyMatrix4/translate", function() { @@ -2080,10 +2098,11 @@ declare function equal(a: T, b: T, desc?: string): void; test( "at", function() { var a = new THREE.Ray( one3.clone(), new THREE.Vector3( 0, 0, 1 ) ); + var target = new THREE.Vector3(); - ok( a.at( 0 ).equals( one3 ), "Passed!" ); - ok( a.at( -1 ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" ); - ok( a.at( 1 ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" ); + ok( a.at( 0, target ).equals( one3 ), "Passed!" ); + ok( a.at( -1, target ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" ); + ok( a.at( 1, target ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" ); }); test( "recast/clone", function() { @@ -2106,17 +2125,18 @@ declare function equal(a: T, b: T, desc?: string): void; test( "closestPointToPoint", function() { var a = new THREE.Ray( one3.clone(), new THREE.Vector3( 0, 0, 1 ) ); + var target = new THREE.Vector3(); // behind the ray - var b = a.closestPointToPoint( zero3 ); + var b = a.closestPointToPoint( zero3, target ); ok( b.equals( one3 ), "Passed!" ); // front of the ray - var c = a.closestPointToPoint( new THREE.Vector3( 0, 0, 50 ) ); + var c = a.closestPointToPoint( new THREE.Vector3( 0, 0, 50 ), target ); ok( c.equals( new THREE.Vector3( 1, 1, 50 ) ), "Passed!" ); // exactly on the ray - var d = a.closestPointToPoint( one3 ); + var d = a.closestPointToPoint( one3, target ); ok( d.equals( one3 ), "Passed!" ); }); @@ -2159,34 +2179,35 @@ declare function equal(a: T, b: T, desc?: string): void; var a0 = new THREE.Ray( zero3.clone(), new THREE.Vector3( 0, 0, -1 ) ); // ray a1 origin located at ( 1, 1, 1 ) and points left in negative-x direction var a1 = new THREE.Ray( one3.clone(), new THREE.Vector3( -1, 0, 0 ) ); + var target = new THREE.Vector3(); // sphere (radius of 2) located behind ray a0, should result in null var b = new THREE.Sphere( new THREE.Vector3( 0, 0, 3 ), 2 ); - ok( a0.intersectSphere( b ) === null, "Passed!" ); + ok( a0.intersectSphere( b, target ) === null, "Passed!" ); // sphere (radius of 2) located in front of, but too far right of ray a0, should result in null var b = new THREE.Sphere( new THREE.Vector3( 3, 0, -1 ), 2 ); - ok( a0.intersectSphere( b ) === null, "Passed!" ); + ok( a0.intersectSphere( b, target ) === null, "Passed!" ); // sphere (radius of 2) located below ray a1, should result in null var b = new THREE.Sphere( new THREE.Vector3( 1, -2, 1 ), 2 ); - ok( a1.intersectSphere( b ) === null, "Passed!" ); + ok( a1.intersectSphere( b, target ) === null, "Passed!" ); // sphere (radius of 1) located to the left of ray a1, should result in intersection at 0, 1, 1 var b = new THREE.Sphere( new THREE.Vector3( -1, 1, 1 ), 1 ); - ok( a1.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 1, 1 ) ) < TOL, "Passed!" ); + ok( a1.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 1, 1 ) ) < TOL, "Passed!" ); // sphere (radius of 1) located in front of ray a0, should result in intersection at 0, 0, -1 var b = new THREE.Sphere( new THREE.Vector3( 0, 0, -2 ), 1 ); - ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" ); + ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" ); // sphere (radius of 2) located in front & right of ray a0, should result in intersection at 0, 0, -1, or left-most edge of sphere var b = new THREE.Sphere( new THREE.Vector3( 2, 0, -1 ), 2 ); - ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" ); + ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" ); // same situation as above, but move the sphere a fraction more to the right, and ray a0 should now just miss var b = new THREE.Sphere( new THREE.Vector3( 2.01, 0, -1 ), 2 ); - ok( a0.intersectSphere( b ) === null, "Passed!" ); + ok( a0.intersectSphere( b, target ) === null, "Passed!" ); // following tests are for situations where the ray origin is inside the sphere @@ -2194,19 +2215,19 @@ declare function equal(a: T, b: T, desc?: string): void; // is behind ray a0. Therefore, second exit point on back of sphere will be returned: 0, 0, -1 // thus keeping the intersection point always in front of the ray. var b = new THREE.Sphere( zero3.clone(), 1 ); - ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" ); + ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -1 ) ) < TOL, "Passed!" ); // sphere (radius of 4) center located behind ray a0 origin / sphere surrounds the ray origin, so the first intersect point 0, 0, 5, // is behind ray a0. Therefore, second exit point on back of sphere will be returned: 0, 0, -3 // thus keeping the intersection point always in front of the ray. var b = new THREE.Sphere( new THREE.Vector3( 0, 0, 1 ), 4 ); - ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -3 ) ) < TOL, "Passed!" ); + ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -3 ) ) < TOL, "Passed!" ); // sphere (radius of 4) center located in front of ray a0 origin / sphere surrounds the ray origin, so the first intersect point 0, 0, 3, // is behind ray a0. Therefore, second exit point on back of sphere will be returned: 0, 0, -5 // thus keeping the intersection point always in front of the ray. var b = new THREE.Sphere( new THREE.Vector3( 0, 0, -1 ), 4 ); - ok( a0.intersectSphere( b ).distanceTo( new THREE.Vector3( 0, 0, -5 ) ) < TOL, "Passed!" ); + ok( a0.intersectSphere( b, target ).distanceTo( new THREE.Vector3( 0, 0, -5 ) ) < TOL, "Passed!" ); }); @@ -2236,26 +2257,27 @@ declare function equal(a: T, b: T, desc?: string): void; test( "intersectPlane", function() { var a = new THREE.Ray( one3.clone(), new THREE.Vector3( 0, 0, 1 ) ); + var target = new THREE.Vector3(); // parallel plane behind var b = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 0, 0, 1 ), new THREE.Vector3( 1, 1, -1 ) ); - ok( a.intersectPlane( b ) === null, "Passed!" ); + ok( a.intersectPlane( b, target ) === null, "Passed!" ); // parallel plane coincident with origin var c = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 0, 0, 1 ), new THREE.Vector3( 1, 1, 0 ) ); - ok( a.intersectPlane( c ) === null, "Passed!" ); + ok( a.intersectPlane( c, target ) === null, "Passed!" ); // parallel plane infront var d = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 0, 0, 1 ), new THREE.Vector3( 1, 1, 1 ) ); - ok( a.intersectPlane( d ).equals( a.origin ), "Passed!" ); + ok( a.intersectPlane( d, target ).equals( a.origin ), "Passed!" ); // perpendical ray that overlaps exactly var e = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 1, 0, 0 ), one3 ); - ok( a.intersectPlane( e ).equals( a.origin ), "Passed!" ); + ok( a.intersectPlane( e, target ).equals( a.origin ), "Passed!" ); // perpendical ray that doesn't overlap var f = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 1, 0, 0 ), zero3 ); - ok( a.intersectPlane( f ) === null, "Passed!" ); + ok( a.intersectPlane( f, target ) === null, "Passed!" ); }); @@ -2324,36 +2346,37 @@ declare function equal(a: T, b: T, desc?: string): void; var TOL = 0.0001; var box = new THREE.Box3( new THREE.Vector3( -1, -1, -1 ), new THREE.Vector3( 1, 1, 1 ) ); + var target = new THREE.Vector3(); var a = new THREE.Ray( new THREE.Vector3( -2, 0, 0 ), new THREE.Vector3( 1, 0, 0) ); //ray should intersect box at -1,0,0 ok( a.intersectsBox(box) === true, "Passed!" ); - ok( a.intersectBox(box).distanceTo( new THREE.Vector3( -1, 0, 0 ) ) < TOL, "Passed!" ); + ok( a.intersectBox(box, target).distanceTo( new THREE.Vector3( -1, 0, 0 ) ) < TOL, "Passed!" ); var b = new THREE.Ray( new THREE.Vector3( -2, 0, 0 ), new THREE.Vector3( -1, 0, 0) ); //ray is point away from box, it should not intersect ok( b.intersectsBox(box) === false, "Passed!" ); - ok( b.intersectBox(box) === null, "Passed!" ); + ok( b.intersectBox(box, target) === null, "Passed!" ); var c = new THREE.Ray( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0) ); // ray is inside box, should return exit point ok( c.intersectsBox(box) === true, "Passed!" ); - ok( c.intersectBox(box).distanceTo( new THREE.Vector3( 1, 0, 0 ) ) < TOL, "Passed!" ); + ok( c.intersectBox(box, target).distanceTo( new THREE.Vector3( 1, 0, 0 ) ) < TOL, "Passed!" ); var d = new THREE.Ray( new THREE.Vector3( 0, 2, 1 ), new THREE.Vector3( 0, -1, -1).normalize() ); //tilted ray should intersect box at 0,1,0 ok( d.intersectsBox(box) === true, "Passed!" ); - ok( d.intersectBox(box).distanceTo( new THREE.Vector3( 0, 1, 0 ) ) < TOL, "Passed!" ); + ok( d.intersectBox(box, target).distanceTo( new THREE.Vector3( 0, 1, 0 ) ) < TOL, "Passed!" ); var e = new THREE.Ray( new THREE.Vector3( 1, -2, 1 ), new THREE.Vector3( 0, 1, 0).normalize() ); //handle case where ray is coplanar with one of the boxes side - box in front of ray ok( e.intersectsBox(box) === true, "Passed!" ); - ok( e.intersectBox(box).distanceTo( new THREE.Vector3( 1, -1, 1 ) ) < TOL, "Passed!" ); + ok( e.intersectBox(box, target).distanceTo( new THREE.Vector3( 1, -1, 1 ) ) < TOL, "Passed!" ); var f = new THREE.Ray( new THREE.Vector3( 1, -2, 0 ), new THREE.Vector3( 0, -1, 0).normalize() ); //handle case where ray is coplanar with one of the boxes side - box behind ray ok( f.intersectsBox(box) === false, "Passed!" ); - ok( f.intersectBox(box) == null, "Passed!" ); + ok( f.intersectBox(box, target) == null, "Passed!" ); }); @@ -2425,18 +2448,20 @@ declare function equal(a: T, b: T, desc?: string): void; test( "clampPoint", function() { var a = new THREE.Sphere( one3.clone(), 1 ); + var target = new THREE.Vector3(); - ok( a.clampPoint( new THREE.Vector3( 1, 1, 3 ) ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" ); - ok( a.clampPoint( new THREE.Vector3( 1, 1, -3 ) ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" ); + ok( a.clampPoint( new THREE.Vector3( 1, 1, 3 ), target ).equals( new THREE.Vector3( 1, 1, 2 ) ), "Passed!" ); + ok( a.clampPoint( new THREE.Vector3( 1, 1, -3 ), target ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" ); }); test( "getBoundingBox", function() { var a = new THREE.Sphere( one3.clone(), 1 ); + var target = new THREE.Box3(); - ok( a.getBoundingBox().equals( new THREE.Box3( zero3, two3 ) ), "Passed!" ); + ok( a.getBoundingBox( target ).equals( new THREE.Box3( zero3, two3 ) ), "Passed!" ); a.set( zero3, 0 ) - ok( a.getBoundingBox().equals( new THREE.Box3( zero3, zero3 ) ), "Passed!" ); + ok( a.getBoundingBox( target ).equals( new THREE.Box3( zero3, zero3 ) ), "Passed!" ); }); test( "applyMatrix4", function() { @@ -2444,7 +2469,7 @@ declare function equal(a: T, b: T, desc?: string): void; var m = new THREE.Matrix4().makeTranslation( 1, -2, 1 ); - ok( a.clone().applyMatrix4( m ).getBoundingBox().equals( a.getBoundingBox().applyMatrix4( m ) ), "Passed!" ); + ok( a.clone().applyMatrix4( m ).getBoundingBox( new THREE.Box3() ).equals( a.getBoundingBox( new THREE.Box3() ).applyMatrix4( m ) ), "Passed!" ); }); test( "translate", function() { @@ -2505,88 +2530,92 @@ declare function equal(a: T, b: T, desc?: string): void; }); - test( "area", function() { + test( "getArea", function() { var a = new THREE.Triangle(); - ok( a.area() == 0, "Passed!" ); + ok( a.getArea() == 0, "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) ); - ok( a.area() == 0.5, "Passed!" ); + ok( a.getArea() == 0.5, "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) ); - ok( a.area() == 2, "Passed!" ); + ok( a.getArea() == 2, "Passed!" ); // colinear triangle. a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 3, 0, 0 ) ); - ok( a.area() == 0, "Passed!" ); + ok( a.getArea() == 0, "Passed!" ); }); - test( "midpoint", function() { + test( "getMidpoint", function() { var a = new THREE.Triangle(); + var target = new THREE.Vector3(); - ok( a.midpoint().equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); + ok( a.getMidpoint( target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) ); - ok( a.midpoint().equals( new THREE.Vector3( 1/3, 1/3, 0 ) ), "Passed!" ); + ok( a.getMidpoint( target ).equals( new THREE.Vector3( 1/3, 1/3, 0 ) ), "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) ); - ok( a.midpoint().equals( new THREE.Vector3( 2/3, 0, 2/3 ) ), "Passed!" ); + ok( a.getMidpoint( target ).equals( new THREE.Vector3( 2/3, 0, 2/3 ) ), "Passed!" ); }); - test( "normal", function() { + test( "getNormal", function() { var a = new THREE.Triangle(); + var target = new THREE.Vector3(); - ok( a.normal().equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); + ok( a.getNormal( target ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) ); - ok( a.normal().equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" ); + ok( a.getNormal( target ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) ); - ok( a.normal().equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); + ok( a.getNormal( target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); }); - test( "plane", function() { + test( "getPlane", function() { var a = new THREE.Triangle(); + var target = new THREE.Vector3(); // artificial normal is created in this case. - ok( a.plane().distanceToPoint( a.a ) == 0, "Passed!" ); - ok( a.plane().distanceToPoint( a.b ) == 0, "Passed!" ); - ok( a.plane().distanceToPoint( a.c ) == 0, "Passed!" ); - ok( a.plane().normal.equals( a.normal() ), "Passed!" ); + ok( a.getPlane( target ).distanceToPoint( a.a ) == 0, "Passed!" ); + ok( a.getPlane( target ).distanceToPoint( a.b ) == 0, "Passed!" ); + ok( a.getPlane( target ).distanceToPoint( a.c ) == 0, "Passed!" ); + ok( a.getPlane( target ).normal.equals( a.getNormal( new THREE.Vector3() ) ), "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) ); - ok( a.plane().distanceToPoint( a.a ) == 0, "Passed!" ); - ok( a.plane().distanceToPoint( a.b ) == 0, "Passed!" ); - ok( a.plane().distanceToPoint( a.c ) == 0, "Passed!" ); - ok( a.plane().normal.equals( a.normal() ), "Passed!" ); + ok( a.getPlane( target ).distanceToPoint( a.a ) == 0, "Passed!" ); + ok( a.getPlane( target ).distanceToPoint( a.b ) == 0, "Passed!" ); + ok( a.getPlane( target ).distanceToPoint( a.c ) == 0, "Passed!" ); + ok( a.getPlane( target ).normal.equals( a.getNormal( new THREE.Vector3() ) ), "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) ); - ok( a.plane().distanceToPoint( a.a ) == 0, "Passed!" ); - ok( a.plane().distanceToPoint( a.b ) == 0, "Passed!" ); - ok( a.plane().distanceToPoint( a.c ) == 0, "Passed!" ); - ok( a.plane().normal.clone().normalize().equals( a.normal() ), "Passed!" ); + ok( a.getPlane( target ).distanceToPoint( a.a ) == 0, "Passed!" ); + ok( a.getPlane( target ).distanceToPoint( a.b ) == 0, "Passed!" ); + ok( a.getPlane( target ).distanceToPoint( a.c ) == 0, "Passed!" ); + ok( a.getPlane( target ).normal.clone().normalize().equals( a.getNormal( new THREE.Vector3() ) ), "Passed!" ); }); - test( "barycoordFromPoint", function() { + test( "getBarycoord", function() { var a = new THREE.Triangle(); + var target = new THREE.Vector3(); var bad = new THREE.Vector3( -2, -1, -1 ); - ok( a.barycoordFromPoint( a.a ).equals( bad ), "Passed!" ); - ok( a.barycoordFromPoint( a.b ).equals( bad ), "Passed!" ); - ok( a.barycoordFromPoint( a.c ).equals( bad ), "Passed!" ); + ok( a.getBarycoord( a.a, target ).equals( bad ), "Passed!" ); + ok( a.getBarycoord( a.b, target ).equals( bad ), "Passed!" ); + ok( a.getBarycoord( a.c, target ).equals( bad ), "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) ); - ok( a.barycoordFromPoint( a.a ).equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" ); - ok( a.barycoordFromPoint( a.b ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); - ok( a.barycoordFromPoint( a.c ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" ); - ok( a.barycoordFromPoint( a.midpoint() ).distanceTo( new THREE.Vector3( 1/3, 1/3, 1/3 ) ) < 0.0001, "Passed!" ); + ok( a.getBarycoord( a.a, target ).equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" ); + ok( a.getBarycoord( a.b, target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); + ok( a.getBarycoord( a.c, target ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" ); + ok( a.getBarycoord( a.getMidpoint( new THREE.Vector3() ), target ).distanceTo( new THREE.Vector3( 1/3, 1/3, 1/3 ) ) < 0.0001, "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) ); - ok( a.barycoordFromPoint( a.a ).equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" ); - ok( a.barycoordFromPoint( a.b ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); - ok( a.barycoordFromPoint( a.c ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" ); - ok( a.barycoordFromPoint( a.midpoint() ).distanceTo( new THREE.Vector3( 1/3, 1/3, 1/3 ) ) < 0.0001, "Passed!" ); + ok( a.getBarycoord( a.a, target ).equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" ); + ok( a.getBarycoord( a.b, target ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" ); + ok( a.getBarycoord( a.c, target ).equals( new THREE.Vector3( 0, 0, 1 ) ), "Passed!" ); + ok( a.getBarycoord( a.getMidpoint( new THREE.Vector3() ), target ).distanceTo( new THREE.Vector3( 1/3, 1/3, 1/3 ) ) < 0.0001, "Passed!" ); }); test( "containsPoint", function() { @@ -2600,14 +2629,14 @@ declare function equal(a: T, b: T, desc?: string): void; ok( a.containsPoint( a.a ), "Passed!" ); ok( a.containsPoint( a.b ), "Passed!" ); ok( a.containsPoint( a.c ), "Passed!" ); - ok( a.containsPoint( a.midpoint() ), "Passed!" ); + ok( a.containsPoint( a.getMidpoint( new THREE.Vector3() ) ), "Passed!" ); ok( ! a.containsPoint( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" ); a = new THREE.Triangle( new THREE.Vector3( 2, 0, 0 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 2 ) ); ok( a.containsPoint( a.a ), "Passed!" ); ok( a.containsPoint( a.b ), "Passed!" ); ok( a.containsPoint( a.c ), "Passed!" ); - ok( a.containsPoint( a.midpoint() ), "Passed!" ); + ok( a.containsPoint( a.getMidpoint( new THREE.Vector3() ) ), "Passed!" ); ok( ! a.containsPoint( new THREE.Vector3( -1, -1, -1 ) ), "Passed!" ); }); @@ -2714,6 +2743,14 @@ declare function equal(a: T, b: T, desc?: string): void; ok( b.y == -y, "Passed!" ); }); + test( "applyMatrix3", function () { + var a = new THREE.Vector2( x, y ); + var m = new THREE.Matrix3().set( 2, 3, 5, 7, 11, 13, 17, 19, 23 ); + + a.applyMatrix3( m ); + ok( a.x == 18, "Passed!" ); + ok( a.y == 60, "Passed!" ); + }); test( "min/max/clamp", function() { var a = new THREE.Vector2( x, y ); @@ -2869,6 +2906,15 @@ declare function equal(a: T, b: T, desc?: string): void; ok( b.equals( a ), "Passed!" ); }); + test( "fromBufferAttribute", function() { + var a = new THREE.Vector2(); + var attr = new THREE.BufferAttribute( new Float32Array( [ 1, 2, 3, 4 ] ), 2 ); + + a.fromBufferAttribute( attr, 0 ); + ok( a.x == 1, "Passed!" ); + ok( a.y == 2, "Passed!" ); + }); + // -------------------------------------------- Vector3 test( "constructor", function() { var a = new THREE.Vector3(); diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 31c8cbebe0..5317e38396 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -448,7 +448,7 @@ export class Camera extends Object3D { */ projectionMatrix: Matrix4; - getWorldDirection(optionalTarget?: Vector3): Vector3; + getWorldDirection(target: Vector3): Vector3; } @@ -687,7 +687,6 @@ export class BufferAttribute { copyAt(index1: number, attribute: BufferAttribute, index2: number): BufferAttribute; copyArray(array: ArrayLike): BufferAttribute; copyColorsArray(colors: {r: number, g: number, b: number}[]): BufferAttribute; - copyIndicesArray(indices: {a: number, b: number, c: number}[]): BufferAttribute; copyVector2sArray(vectors: {x: number, y: number}[]): BufferAttribute; copyVector3sArray(vectors: {x: number, y: number, z: number}[]): BufferAttribute; copyVector4sArray(vectors: {x: number, y: number, z: number, w: number}[]): BufferAttribute; @@ -868,7 +867,7 @@ export class BufferGeometry extends EventDispatcher { scale(x: number, y: number, z: number): BufferGeometry; lookAt(v: Vector3): void; - center(): Vector3; + center(): BufferGeometry; setFromObject(object: Object3D): BufferGeometry; setFromPoints(points: Vector3[]): BufferGeometry; @@ -1343,7 +1342,7 @@ export class Geometry extends EventDispatcher { fromBufferGeometry(geometry: BufferGeometry): Geometry; - center(): Vector3; + center(): Geometry; normalize(): Geometry; @@ -1368,8 +1367,6 @@ export class Geometry extends EventDispatcher { */ computeMorphNormals(): void; - computeLineDistances(): void; - /** * Computes bounding box of the geometry, updating {@link Geometry.boundingBox} attribute. */ @@ -1782,11 +1779,10 @@ export class Object3D extends EventDispatcher { getObjectByProperty( name: string, value: string ): Object3D; - getWorldPosition(optionalTarget?: Vector3): Vector3; - getWorldQuaternion(optionalTarget?: Quaternion): Quaternion; - getWorldRotation(optionalTarget?: Euler): Euler; - getWorldScale(optionalTarget?: Vector3): Vector3; - getWorldDirection(optionalTarget?: Vector3): Vector3; + getWorldPosition(target: Vector3): Vector3; + getWorldQuaternion(target: Quaternion): Quaternion; + getWorldScale(target: Vector3): Vector3; + getWorldDirection(target: Vector3): Vector3; raycast(raycaster: Raycaster, intersects: any): void; @@ -3088,8 +3084,8 @@ export class Box2 { copy(box: this): this; makeEmpty(): Box2; isEmpty(): boolean; - getCenter(optionalTarget?: Vector2): Vector2; - getSize(optionalTarget?: Vector2): Vector2; + getCenter(target: Vector2): Vector2; + getSize(target: Vector2): Vector2; expandByPoint(point: Vector2): Box2; expandByVector(vector: Vector2): Box2; expandByScalar(scalar: number): Box2; @@ -3097,7 +3093,7 @@ export class Box2 { containsBox(box: Box2): boolean; getParameter(point: Vector2): Vector2; intersectsBox(box: Box2): boolean; - clampPoint(point: Vector2, optionalTarget?: Vector2): Vector2; + clampPoint(point: Vector2, target: Vector2): Vector2; distanceToPoint(point: Vector2): number; intersect(box: Box2): Box2; union(box: Box2): Box2; @@ -3128,8 +3124,8 @@ export class Box3 { copy(box: this): this; makeEmpty(): Box3; isEmpty(): boolean; - getCenter(optionalTarget?: Vector3): Vector3; - getSize(optionalTarget?: Vector3): Vector3; + getCenter(target: Vector3): Vector3; + getSize(target: Vector3): Vector3; expandByPoint(point: Vector3): Box3; expandByVector(vector: Vector3): Box3; expandByScalar(scalar: number): Box3; @@ -3140,9 +3136,9 @@ export class Box3 { intersectsBox(box: Box3): boolean; intersectsSphere(sphere: Sphere): boolean; intersectsPlane(plane: Plane): boolean; - clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3; + clampPoint(point: Vector3, target: Vector3): Vector3; distanceToPoint(point: Vector3): number; - getBoundingSphere(optionalTarget?: Sphere): Sphere; + getBoundingSphere(target: Sphere): Sphere; intersect(box: Box3): Box3; union(box: Box3): Box3; applyMatrix4(matrix: Matrix4): Box3; @@ -3499,13 +3495,13 @@ export class Line3 { set(start?: Vector3, end?: Vector3): Line3; clone(): this; copy(line: this): this; - getCenter(optionalTarget?: Vector3): Vector3; - delta(optionalTarget?: Vector3): Vector3; + getCenter(target: Vector3): Vector3; + delta(target: Vector3): Vector3; distanceSq(): number; distance(): number; - at(t: number, optionalTarget?: Vector3): Vector3; + at(t: number, target: Vector3): Vector3; closestPointToPointParameter(point: Vector3, clampToLine?: boolean): number; - closestPointToPoint(point: Vector3, clampToLine?: boolean, optionalTarget?: Vector3): Vector3; + closestPointToPoint(point: Vector3, clampToLine: boolean, target: Vector3): Vector3; applyMatrix4(matrix: Matrix4): Line3; equals(line: Line3): boolean; } @@ -3943,12 +3939,12 @@ export class Plane { negate(): Plane; distanceToPoint(point: Vector3): number; distanceToSphere(sphere: Sphere): number; - projectPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - orthoPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - intersectLine(line: Line3, optionalTarget?: Vector3): Vector3; + projectPoint(point: Vector3, target: Vector3): Vector3; + orthoPoint(point: Vector3, target: Vector3): Vector3; + intersectLine(line: Line3, target: Vector3): Vector3; intersectsLine(line: Line3): boolean; intersectsBox(box: Box3): boolean; - coplanarPoint(optionalTarget?: boolean): Vector3; + coplanarPoint(target: Vector3): Vector3; applyMatrix4(matrix: Matrix4, optionalNormalMatrix?: Matrix3): Plane; translate(offset: Vector3): Plane; equals(plane: Plane): boolean; @@ -4106,21 +4102,21 @@ export class Ray { set(origin: Vector3, direction: Vector3): Ray; clone(): this; copy(ray: this): this; - at(t: number, optionalTarget?: Vector3): Vector3; + at(t: number, target: Vector3): Vector3; lookAt(v: Vector3): Vector3; recast(t: number): Ray; - closestPointToPoint(point: Vector3, optionalTarget?: Vector3): Vector3; + closestPointToPoint(point: Vector3, target: Vector3): Vector3; distanceToPoint(point: Vector3): number; distanceSqToPoint(point: Vector3): number; distanceSqToSegment(v0: Vector3, v1: Vector3, optionalPointOnRay?: Vector3, optionalPointOnSegment?: Vector3): number; - intersectSphere(sphere: Sphere, optionalTarget?: Vector3): Vector3; + intersectSphere(sphere: Sphere, target: Vector3): Vector3; intersectsSphere(sphere: Sphere): boolean; distanceToPlane(plane: Plane): number; - intersectPlane(plane: Plane, optionalTarget?: Vector3): Vector3; + intersectPlane(plane: Plane, target: Vector3): Vector3; intersectsPlane(plane: Plane): boolean; - intersectBox(box: Box3, optionalTarget?: Vector3): Vector3; + intersectBox(box: Box3, target: Vector3): Vector3; intersectsBox(box: Box3): boolean; - intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, optionalTarget?: Vector3): Vector3; + intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, target: Vector3): Vector3; applyMatrix4(matrix4: Matrix4): Ray; equals(ray: Ray): boolean; @@ -4156,8 +4152,8 @@ export class Sphere { intersectsSphere(sphere: Sphere): boolean; intersectsBox(box: Box3): boolean; intersectsPlane(plane: Plane): boolean; - clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - getBoundingBox(optionalTarget?: Box3): Box3; + clampPoint(point: Vector3, target: Vector3): Vector3; + getBoundingBox(target: Box3): Box3; applyMatrix4(matrix: Matrix4): Sphere; translate(offset: Vector3): Sphere; equals(sphere: Sphere): boolean; @@ -4180,17 +4176,17 @@ export class Triangle { setFromPointsAndIndices(points: Vector3[], i0: number, i1: number, i2: number): Triangle; clone(): this; copy(triangle: this): this; - area(): number; - midpoint(optionalTarget?: Vector3): Vector3; - normal(optionalTarget?: Vector3): Vector3; - plane(optionalTarget?: Vector3): Plane; - barycoordFromPoint(point: Vector3, optionalTarget?: Vector3): Vector3; + getArea(): number; + getMidpoint(target: Vector3): Vector3; + getNormal(target: Vector3): Vector3; + getPlane(target: Vector3): Plane; + getBarycoord(point: Vector3, target: Vector3): Vector3; containsPoint(point: Vector3): boolean; - closestPointToPoint(point: Vector3, optionalTarget?: Vector3): Vector3; + closestPointToPoint(point: Vector3, target: Vector3): Vector3; equals(triangle: Triangle): boolean; - static normal(a: Vector3, b: Vector3, c: Vector3, optionalTarget?: Vector3): Vector3; - static barycoordFromPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3, optionalTarget: Vector3): Vector3; + static getNormal(a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3; + static getBarycoord(point: Vector3, a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3; static containsPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3): boolean; } @@ -4323,6 +4319,9 @@ export class Vector2 implements Vector { */ set(x: number, y: number): Vector2; + /** + * Sets the x and y values of this vector both equal to scalar. + */ setScalar(scalar: number): Vector2; /** @@ -4339,11 +4338,11 @@ export class Vector2 implements Vector { * Sets a component of this vector. */ setComponent(index: number, value: number): void; - /** * Gets a component of this vector. */ getComponent(index: number): number; + /** * Clones this vector. */ @@ -4357,29 +4356,44 @@ export class Vector2 implements Vector { * Adds v to this vector. */ add(v: Vector2): Vector2; - + /** + * Adds the scalar value s to this vector's x and y values. + */ + addScalar(s: number): Vector2; /** * Sets this vector to a + b. */ - addScalar(s: number): Vector2; addVectors(a: Vector2, b: Vector2): Vector2; - addScaledVector( v: Vector2, s: number ): Vector2; + /** + * Adds the multiple of v and s to this vector. + */ + addScaledVector(v: Vector2, s: number): Vector2; + /** * Subtracts v from this vector. - */ + */ sub(v: Vector2): Vector2; - + /** + * Subtracts s from this vector's x and y components. + */ + subScalar(s: number): Vector2; /** * Sets this vector to a - b. */ subVectors(a: Vector2, b: Vector2): Vector2; + /** + * Multiplies this vector by v. + */ multiply(v: Vector2): Vector2; /** * Multiplies this vector by scalar s. */ multiplyScalar(scalar: number): Vector2; + /** + * Divides this vector by v. + */ divide(v: Vector2): Vector2; /** * Divides this vector by scalar s. @@ -4387,15 +4401,57 @@ export class Vector2 implements Vector { */ divideScalar(s: number): Vector2; - min(v: Vector2): Vector2; + /** + * Multiplies this vector (with an implicit 1 as the 3rd component) by m. + */ + applyMatrix3(m: Matrix3): Vector2; + /** + * If this vector's x or y value is greater than v's x or y value, replace that value with the corresponding min value. + */ + min(v: Vector2): Vector2; + /** + * If this vector's x or y value is less than v's x or y value, replace that value with the corresponding max value. + */ max(v: Vector2): Vector2; + + /** + * If this vector's x or y value is greater than the max vector's x or y value, it is replaced by the corresponding value. + * If this vector's x or y value is less than the min vector's x or y value, it is replaced by the corresponding value. + * @param min the minimum x and y values. + * @param max the maximum x and y values in the desired range. + */ clamp(min: Vector2, max: Vector2): Vector2; + /** + * If this vector's x or y values are greater than the max value, they are replaced by the max value. + * If this vector's x or y values are less than the min value, they are replaced by the min value. + * @param min the minimum value the components will be clamped to. + * @param max the maximum value the components will be clamped to. + */ clampScalar(min: number, max: number): Vector2; + /** + * If this vector's length is greater than the max value, it is replaced by the max value. + * If this vector's length is less than the min value, it is replaced by the min value. + * @param min the minimum value the length will be clamped to. + * @param max the maximum value the length will be clamped to. + */ clampLength(min: number, max: number): Vector2; + + /** + * The components of the vector are rounded down to the nearest integer value. + */ floor(): Vector2; + /** + * The x and y components of the vector are rounded up to the nearest integer value. + */ ceil(): Vector2; + /** + * The components of the vector are rounded to the nearest integer value. + */ round(): Vector2; + /** + * The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value. + */ roundToZero(): Vector2; /** @@ -4437,12 +4493,10 @@ export class Vector2 implements Vector { * Computes distance of this vector to v. */ distanceTo(v: Vector2): number; - /** * Computes squared distance of this vector to v. */ distanceToSquared(v: Vector2): number; - /** * @deprecated Use {@link Vector2#manhattanDistanceTo .manhattanDistanceTo()} instead. */ @@ -4453,8 +4507,18 @@ export class Vector2 implements Vector { */ setLength(length: number): Vector2; + /** + * Linearly interpolates between this vector and v, where alpha is the distance along the line - alpha = 0 will be this vector, and alpha = 1 will be v. + * @param v vector to interpolate towards. + * @param alpha interpolation factor in the closed interval [0, 1]. + */ lerp(v: Vector2, alpha: number): Vector2; - + /** + * Sets this vector to be the vector linearly interpolated between v1 and v2 where alpha is the distance along the line connecting the two vectors - alpha = 0 will be v1, and alpha = 1 will be v2. + * @param v1 the starting vector. + * @param v2 vector to interpolate towards. + * @param alpha interpolation factor in the closed interval [0, 1]. + */ lerpVectors(v1: Vector2, v2: Vector2, alpha: number): Vector2; /** @@ -4462,13 +4526,32 @@ export class Vector2 implements Vector { */ equals(v: Vector2): boolean; - fromArray(xy: number[], offset?: number): Vector2; + /** + * Sets this vector's x value to be array[offset] and y value to be array[offset + 1]. + * @param array the source array. + * @param offset (optional) offset into the array. Default is 0. + */ + fromArray(array: number[], offset?: number): Vector2; + /** + * Returns an array [x, y], or copies x and y into the provided array. + * @param array (optional) array to store the vector to. If this is not provided, a new array will be created. + * @param offset (optional) optional offset into the array. + */ + toArray(array?: number[], offset?: number): number[]; - toArray(xy?: number[], offset?: number): number[]; + /** + * Sets this vector's x and y values from the attribute. + * @param attribute the source attribute. + * @param index index in the attribute. + */ + fromBufferAttribute(attribute: BufferAttribute, index: number): Vector2; - fromBufferAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector2; - - rotateAround( center: Vector2, angle: number ): Vector2; + /** + * Rotates the vector around center by angle radians. + * @param center the point around which to rotate. + * @param angle the angle to rotate, in radians. + */ + rotateAround(center: Vector2, angle: number): Vector2; /** * Computes the Manhattan length of this vector. @@ -5285,7 +5368,6 @@ export class WebGLRenderer implements Renderer { }; render: { calls: number; - vertices: number; faces: number; points: number; }; @@ -5399,13 +5481,6 @@ export class WebGLRenderer implements Renderer { */ render(scene: Scene, camera: Camera, renderTarget?: RenderTarget, forceClear?: boolean): void; - /** - * Used for setting the gl frontFace, cullFace states in the GPU, thus enabling/disabling face culling when rendering. - * If cullFace is false, culling will be disabled. - * @param cullFace "back", "front", "front_and_back", or false. - * @param frontFace "ccw" or "cw - */ - setFaceCulling(cullFace?: CullFace, frontFace?: FrontFaceDirection): void; /** * @deprecated */ @@ -5648,12 +5723,15 @@ export let ShaderChunk: { lightmap_fragment: string; lightmap_pars_fragment: string; lights_lambert_vertex: string; - lights_pars: string; + lights_pars_begin: string; + lights_pars_map: string; lights_phong_fragment: string; lights_phong_pars_fragment: string; lights_physical_fragment: string; lights_physical_pars_fragment: string; - lights_template: string; + lights_fragment_begin: string; + lights_fragment_maps: string; + lights_fragment_end: string; logdepthbuf_fragment: string; logdepthbuf_pars_fragment: string; logdepthbuf_pars_vertex: string; @@ -5677,7 +5755,8 @@ export let ShaderChunk: { morphtarget_vertex: string; normal_flip: string; normal_frag: string; - normal_fragment: string; + normal_fragment_begin: string; + normal_fragment_maps: string; normal_vert: string; normalmap_pars_fragment: string; packing: string; @@ -6034,8 +6113,6 @@ export class WebGLShadowMap { autoUpdate: boolean; needsUpdate: boolean; type: ShadowMapType; - renderReverseSided: boolean; - renderSingleSided: boolean; render(scene: Scene, camera: Camera): void; @@ -6913,6 +6990,18 @@ export class ExtrudeGeometry extends Geometry { addShape(shape: Shape, options?: any): void; } +export class ExtrudeBufferGeometry extends BufferGeometry { + constructor(shapes?: Shape[], options?: any); + + static WorldUVGenerator: { + generateTopUV(geometry: Geometry, vertices: number[], indexA: number, indexB: number, indexC: number): Vector2[]; + generateSideWallUV(geometry: Geometry, vertices: number[], indexA: number, indexB: number, indexC: number, indexD: number): Vector2[]; + }; + + addShapeList(shapes: Shape[], options?: any): void; + addShape(shape: Shape, options?: any): void; +} + export class IcosahedronBufferGeometry extends PolyhedronBufferGeometry { constructor(radius?: number, detail?: number); } @@ -7103,6 +7192,7 @@ export interface TextGeometryParameters { bevelEnabled?: boolean; bevelThickness?: number; bevelSize?: number; + bevelSegments?: number; } export class TextGeometry extends ExtrudeGeometry { @@ -7116,6 +7206,22 @@ export class TextGeometry extends ExtrudeGeometry { bevelEnabled: boolean; bevelThickness: number; bevelSize: number; + bevelSegments: number; + }; +} + +export class TextBufferGeometry extends ExtrudeBufferGeometry { + constructor(text: string, parameters?: TextGeometryParameters); + + parameters: { + font: Font; + size: number; + height: number; + curveSegments: number; + bevelEnabled: boolean; + bevelThickness: number; + bevelSize: number; + bevelSegments: number; }; } diff --git a/types/tiny-slider-react/index.d.ts b/types/tiny-slider-react/index.d.ts index b509595f81..9cf22beab7 100644 --- a/types/tiny-slider-react/index.d.ts +++ b/types/tiny-slider-react/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.6 import * as React from "react"; -interface CommonOptions { +export interface CommonOptions { /** * The initial index of the slider. * @defaultValue 0 diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 3fbd57283a..6b82dd6b65 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -260,6 +260,7 @@ declare module 'twit' { long?: number, follow?: boolean, include_email?: boolean, + cursor?: number, } export interface PromiseResponse { data: Response, diff --git a/types/twix/index.d.ts b/types/twix/index.d.ts index 8ca402e8e6..5b37054eb9 100644 --- a/types/twix/index.d.ts +++ b/types/twix/index.d.ts @@ -80,6 +80,7 @@ export interface Twix { asDuration(period: string): Duration; isValid(): boolean; + toDate(): Date; } export interface TwixStatic { diff --git a/types/uglify-js/index.d.ts b/types/uglify-js/index.d.ts index d9410070a9..cab53cb4db 100644 --- a/types/uglify-js/index.d.ts +++ b/types/uglify-js/index.d.ts @@ -1,429 +1,212 @@ -// Type definitions for UglifyJS 2 v2.6.1 +// Type definitions for UglifyJS 3.0 // Project: https://github.com/mishoo/UglifyJS2 -// Definitions by: Tanguy Krotoff +// Definitions by: Alan Agius , Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - - -import * as MOZ_SourceMap from 'source-map'; - -declare namespace UglifyJS { - interface Tokenizer { - /** - * The type of this token. - * Can be "num", "string", "regexp", "operator", "punc", "atom", "name", "keyword", "comment1" or "comment2". - * "comment1" and "comment2" are for single-line, respectively multi-line comments. - */ - type: string; - - /** - * The name of the file where this token originated from. Useful when compressing multiple files at once to generate the proper source map. - */ - file: string; - - /** - * The "value" of the token. - * That's additional information and depends on the token type: "num", "string" and "regexp" tokens you get their literal value. - * - For "operator" you get the operator. - * - For "punc" it's the punctuation sign (parens, comma, semicolon etc). - * - For "atom", "name" and "keyword" it's the name of the identifier - * - For comments it's the body of the comment (excluding the initial "//" and "/*". - */ - value: string; - - /** - * The line number of this token in the original code. - * 1-based index. - */ - line: number; - - /** - * The column number of this token in the original code. - * 0-based index. - */ - col: number; - - /** - * Short for "newline before", it's a boolean that tells us whether there was a newline before this node in the original source. It helps for automatic semicolon insertion. - * For multi-line comments in particular this will be set to true if there either was a newline before this comment, or * * if this comment contains a newline. - */ - nlb: boolean; - - /** - * This doesn't apply for comment tokens, but for all other token types it will be an array of comment tokens that were found before. - */ - comments_before: string[]; - } - - interface AST_Node { - // The first token of this node - start: AST_Node; - - // The last token of this node - end: AST_Node; - - transform(tt: TreeTransformer): AST_Toplevel; - } - - interface AST_Toplevel extends AST_Node { - // UglifyJS contains a scope analyzer which figures out variable/function definitions, references etc. - // You need to call it manually before compression or mangling. - // The figure_out_scope method is defined only on the AST_Toplevel node. - figure_out_scope(): void; - - // Get names that are optimized for GZip compression (names will be generated using the most frequent characters first) - compute_char_frequency(): void; - - mangle_names(): void; - - print(stream: OutputStream): void; - - print_to_string(options?: BeautifierOptions): string; - } - - interface MinifyOptions { - spidermonkey?: boolean; - outSourceMap?: string; - sourceRoot?: string; - inSourceMap?: string; - fromString?: boolean; - warnings?: boolean; - mangle?: Object; - output?: MinifyOutput, - compress?: Object; - } - - interface MinifyOutput { - code: string; - map: string; - } - - function minify(files: string | Array, options?: MinifyOptions): MinifyOutput; - - - interface ParseOptions { - // Default is false - strict?: boolean; - - // Input file name, default is null - filename?: string; - - // Default is null - toplevel?: AST_Toplevel; - } - - /** - * The parser creates a custom abstract syntax tree given a piece of JavaScript code. - * Perhaps you should read about the AST first. - */ - function parse(code: string, options?: ParseOptions): AST_Toplevel; - - - interface BeautifierOptions { - /** - * Start indentation on every line (only when `beautify`) - */ - indent_start?: number; - - /** - * Indentation level (only when `beautify`) - */ - indent_level?: number; - - /** - * Quote all keys in object literals? - */ - quote_keys?: boolean; - - /** - * Add a space after colon signs? - */ - space_colon?: boolean; - - /** - * Output ASCII-safe? (encodes Unicode characters as ASCII) - */ - ascii_only?: boolean; - - /** - * Escape " boolean; - - /** - * UglifyJS provides a TreeWalker object and every node has a walk method that given a walker will apply your visitor to each node in the tree. - * Your visitor can return a non-falsy value in order to prevent descending the current node. - */ - function TreeWalker(visitor: visitor): TreeWalker; - - - // TODO - interface TreeTransformer extends TreeWalker { - } - - /** - * The tree transformer is a special case of a tree walker. - * In fact it even inherits from TreeWalker and you can use the same methods, but initialization and visitor protocol are a bit different. - */ - function TreeTransformer(before: visitor, after: visitor): TreeTransformer; +// TypeScript Version: 2.2 + +import { RawSourceMap } from 'source-map'; +export interface ParseOptions { + /** Support top level `return` statements */ + bare_returns?: boolean; + html5_comments?: boolean; + /** Support `#!command` as the first line */ + shebang: boolean; } -export = UglifyJS; +export interface CompressOptions { + /** Replace `arguments[index]` with function parameter name whenever possible. */ + arguments?: boolean; + /** Various optimizations for boolean context, for example `!!a ? b : c → a ? b : c` */ + booleans?: boolean; + /** Collapse single-use non-constant variables, side effects permitting. */ + collapse_vars?: boolean; + /** Apply certain optimizations to binary nodes, e.g. `!(a <= b) → a > b,` attempts to negate binary nodes, e.g. `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc */ + comparisons?: boolean; + /** Apply optimizations for `if-s` and conditional expressions. */ + conditionals?: boolean; + /** Remove unreachable code */ + dead_code?: boolean; + /** + * Pass `true` to discard calls to console.* functions. + * If you wish to drop a specific function call such as `console.info` and/or retain side effects from function + * arguments after dropping the function call then use `pure_funcs` instead. + */ + drop_console?: boolean; + /** Remove `debugger;` statements */ + drop_debugger?: boolean; + /** Attempt to evaluate constant expressions */ + evaluate?: boolean; + /** Pass `true` to preserve completion values from terminal statements without `return`, e.g. in bookmarklets. */ + expression?: boolean; + global_defs?: object; + /** hoist function declarations */ + hoist_funs?: boolean; + /** + * Hoist properties from constant object and array literals into regular variables subject to a set of constraints. + * For example: `var o={p:1, q:2}; f(o.p, o.q);` is converted to `f(1, 2);`. Note: `hoist_props` works best with mangle enabled, + * the compress option passes set to 2 or higher, and the compress option toplevel enabled. + */ + hoist_props?: boolean; + /** Hoist var declarations (this is `false` by default because it seems to increase the size of the output in general) */ + hoist_vars?: boolean; + /** Optimizations for if/return and if/continue */ + if_return?: boolean; + /** + * Inline calls to function with simple/return statement + * - false -- same as `Disabled` + * - `Disabled` -- disabled inlining + * - `SimpleFunctions` -- inline simple functions + * - `WithArguments` -- inline functions with arguments + * - `WithArgumentsAndVariables` -- inline functions with arguments and variables + * - true -- same as `WithArgumentsAndVariables` + */ + inline?: boolean | InlineFunctions; + /** join consecutive `var` statements */ + join_vars?: boolean; + /** Prevents the compressor from discarding unused function arguments. You need this for code which relies on `Function.length` */ + keep_fargs?: boolean; + /** Pass true to prevent the compressor from discarding function names. Useful for code relying on `Function.prototype.name`. */ + keep_fnames?: boolean; + /** Pass true to prevent Infinity from being compressed into `1/0`, which may cause performance issues on `Chrome` */ + keep_infinity?: boolean; + /** Optimizations for `do`, `while` and `for` loops when we can statically determine the condition. */ + loops?: boolean; + /** negate `Immediately-Called Function Expressions` where the return value is discarded, to avoid the parens that the code generator would insert. */ + negate_iife?: boolean; + /** The maximum number of times to run compress. In some cases more than one pass leads to further compressed code. Keep in mind more passes will take more time. */ + passes?: number; + /** Rewrite property access using the dot notation, for example `foo["bar"]` to `foo.bar` */ + properties?: boolean; + /** + * An array of names and UglifyJS will assume that those functions do not produce side effects. + * DANGER: will not check if the name is redefined in scope. + * An example case here, for instance `var q = Math.floor(a/b)`. + * If variable q is not used elsewhere, UglifyJS will drop it, but will still keep the `Math.floor(a/b)`, + * not knowing what it does. You can pass `pure_funcs: [ 'Math.floor' ]` to let it know that this function + * won't produce any side effect, in which case the whole statement would get discarded. The current + * implementation adds some overhead (compression will be slower). + */ + pure_funcs?: string[]; + pure_getters?: boolean | 'strict'; + /** + * Allows single-use functions to be inlined as function expressions when permissible allowing further optimization. + * Enabled by default. Option depends on reduce_vars being enabled. Some code runs faster in the Chrome V8 engine if + * this option is disabled. Does not negatively impact other major browsers. + */ + reduce_funcs?: boolean; + /** Improve optimization on variables assigned with and used as constant values. */ + reduce_vars?: boolean; + sequences?: boolean; + /** Pass false to disable potentially dropping functions marked as "pure". */ + side_effects?: boolean; + /** De-duplicate and remove unreachable `switch` branches. */ + switches?: boolean; + /** Drop unreferenced functions ("funcs") and/or variables ("vars") in the top level scope (false by default, true to drop both unreferenced functions and variables) */ + toplevel?: boolean; + /** Prevent specific toplevel functions and variables from unused removal (can be array, comma-separated, RegExp or function. Implies toplevel) */ + top_retain?: boolean; + typeofs?: boolean; + unsafe?: boolean; + /** Compress expressions like a `<= b` assuming none of the operands can be (coerced to) `NaN`. */ + unsafe_comps?: boolean; + /** Compress and mangle `Function(args, code)` when both args and code are string literals. */ + unsafe_Function?: boolean; + /** Optimize numerical expressions like `2 * x * 3` into `6 * x`, which may give imprecise floating point results. */ + unsafe_math?: boolean; + /** Optimize expressions like `Array.prototype.slice.call(a)` into `[].slice.call(a)` */ + unsafe_proto?: boolean; + /** Enable substitutions of variables with `RegExp` values the same way as if they are constants. */ + unsafe_regexp?: boolean; + unsafe_undefined?: boolean; + unused?: boolean; + /** display warnings when dropping unreachable code or unused declarations etc. */ + warnings?: boolean; +} + +export enum InlineFunctions { + Disabled = 0, + SimpleFunctions = 1, + WithArguments = 2, + WithArgumentsAndVariables = 3 +} +export interface MangleOptions { + /** Pass true to mangle names visible in scopes where `eval` or with are used. */ + eval?: boolean; + /** Pass true to not mangle function names. Useful for code relying on `Function.prototype.name`. */ + keep_fnames?: boolean; + /** Pass an array of identifiers that should be excluded from mangling. Example: `["foo", "bar"]`. */ + reserved?: string[]; + /** Pass true to mangle names declared in the top level scope. */ + toplevel?: boolean; + properties?: boolean | ManglePropertiesOptions; +} + +export interface ManglePropertiesOptions { + /** Use true to allow the mangling of builtin DOM properties. Not recommended to override this setting. */ + builtins?: boolean; + /** Mangle names with the original name still present. Pass an empty string "" to enable, or a non-empty string to set the debug suffix. */ + debug?: boolean; + /** Only mangle unquoted property names */ + keep_quoted?: boolean; + /** Pass a RegExp literal to only mangle property names matching the regular expression. */ + regex?: RegExp; + /** Do not mangle property names listed in the reserved array */ + reserved?: string[]; +} + +export interface OutputOptions { + ascii_only?: boolean; + beautify?: boolean; + braces?: boolean; + comments?: boolean | 'all' | 'some' | RegExp; + indent_level?: number; + indent_start?: boolean; + inline_script?: boolean; + keep_quoted_props?: boolean; + max_line_len?: boolean; + preamble?: string; + preserve_line?: boolean; + quote_keys?: boolean; + quote_style?: OutputQuoteStyle; + semicolons?: boolean; + shebang?: boolean; + webkit?: boolean; + width?: number; + wrap_iife?: boolean; +} + +export enum OutputQuoteStyle { + PreferDouble = 0, + AlwaysSingle = 1, + AlwaysDouble = 2, + AlwaysOriginal = 3 +} + +export interface MinifyOptions { + /** Pass true to return compressor warnings in result.warnings. Use the value `verbose` for more detailed warnings. */ + warnings?: boolean | 'verbose'; + parse?: ParseOptions; + compress?: boolean | CompressOptions; + mangle?: boolean | MangleOptions; + output?: OutputOptions; + sourceMap?: boolean | SourceMapOptions; + toplevel?: boolean; + nameCache?: object; + ie8?: boolean; + keep_fnames?: boolean; +} + +export interface MinifyOutput { + error?: Error; + code: string; + map: string; +} + +export interface SourceMapOptions { + filename?: string; + url?: string | 'inline'; + root?: string; + content?: RawSourceMap; +} + +export function minify(files: string | string[] | { [file: string]: string }, options?: MinifyOptions): MinifyOutput; diff --git a/types/uglify-js/tsconfig.json b/types/uglify-js/tsconfig.json index 314b32b709..07451065ee 100644 --- a/types/uglify-js/tsconfig.json +++ b/types/uglify-js/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "uglify-js-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/uglify-js/tslint.json b/types/uglify-js/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/uglify-js/tslint.json +++ b/types/uglify-js/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/uglify-js/uglify-js-tests.ts b/types/uglify-js/uglify-js-tests.ts index 19233bf7ad..6b146ab0e7 100644 --- a/types/uglify-js/uglify-js-tests.ts +++ b/types/uglify-js/uglify-js-tests.ts @@ -1,72 +1,36 @@ /// -import * as UglifyJS from 'uglify-js'; -import * as fs from 'fs'; +import { OutputQuoteStyle, minify } from 'uglify-js'; -var result = UglifyJS.minify("/path/to/file.js"); -console.log(result.code); // minified output -// if you need to pass code instead of file name -var result = UglifyJS.minify("var b = function () {};", {fromString: true}); +let code: any; -var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ]); -console.log(result.code); +code = { + "file1.js": "function add(first, second) { return first + second; }", + "file2.js": "console.log(add(1 + 2, 3 + 4));" +}; -var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { - outSourceMap: "out.js.map" -}); -console.log(result.code); // minified output -console.log(result.map); +minify(code); -var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { - outSourceMap: "out.js.map", - sourceRoot: "http://example.com/src" +code = "function add(first, second) { return first + second; }"; +minify(code); + +minify(code, { + output: { + quote_style: OutputQuoteStyle.AlwaysDouble + } }); -var result = UglifyJS.minify("compiled.js", { - inSourceMap: "compiled.js.map", - outSourceMap: "minified.js.map" +minify(code, { + warnings: 'verbose', + mangle: { + properties: { + regex: /reg/ + } + }, + sourceMap: { + filename: 'foo.map' + }, + compress: { + arguments: true + } }); -// same as before, it returns `code` and `map` - -const my_source_map_string = 'sourceMap'; -var result = UglifyJS.minify("compiled.js", { - inSourceMap: JSON.parse(my_source_map_string), - outSourceMap: "minified.js.map" -}); - -var toplevel_ast = UglifyJS.parse(code, {}); - -var toplevel: UglifyJS.AST_Toplevel = null; -const files = ['file1', 'file2']; -files.forEach(function(file){ - var code = fs.readFileSync(file, "utf8"); - toplevel = UglifyJS.parse(code, { - filename: file, - toplevel: toplevel - }); -}); - -toplevel.figure_out_scope() - -var compressor = UglifyJS.Compressor({}); -var compressed_ast = toplevel.transform(compressor); - -compressed_ast.figure_out_scope(); -compressed_ast.compute_char_frequency(); -compressed_ast.mangle_names(); - -var stream = UglifyJS.OutputStream({}); -compressed_ast.print(stream); -var code = stream.toString(); // this is your minified code - -var code = compressed_ast.print_to_string({}); - -var source_map = UglifyJS.SourceMap({}); -var stream = UglifyJS.OutputStream({ - //... - source_map: source_map -}); -compressed_ast.print(stream); - -var code = stream.toString(); -var map = source_map.toString(); // json output for your source map diff --git a/types/uglify-js/v2/index.d.ts b/types/uglify-js/v2/index.d.ts new file mode 100644 index 0000000000..d9410070a9 --- /dev/null +++ b/types/uglify-js/v2/index.d.ts @@ -0,0 +1,429 @@ +// Type definitions for UglifyJS 2 v2.6.1 +// Project: https://github.com/mishoo/UglifyJS2 +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + + +import * as MOZ_SourceMap from 'source-map'; + +declare namespace UglifyJS { + interface Tokenizer { + /** + * The type of this token. + * Can be "num", "string", "regexp", "operator", "punc", "atom", "name", "keyword", "comment1" or "comment2". + * "comment1" and "comment2" are for single-line, respectively multi-line comments. + */ + type: string; + + /** + * The name of the file where this token originated from. Useful when compressing multiple files at once to generate the proper source map. + */ + file: string; + + /** + * The "value" of the token. + * That's additional information and depends on the token type: "num", "string" and "regexp" tokens you get their literal value. + * - For "operator" you get the operator. + * - For "punc" it's the punctuation sign (parens, comma, semicolon etc). + * - For "atom", "name" and "keyword" it's the name of the identifier + * - For comments it's the body of the comment (excluding the initial "//" and "/*". + */ + value: string; + + /** + * The line number of this token in the original code. + * 1-based index. + */ + line: number; + + /** + * The column number of this token in the original code. + * 0-based index. + */ + col: number; + + /** + * Short for "newline before", it's a boolean that tells us whether there was a newline before this node in the original source. It helps for automatic semicolon insertion. + * For multi-line comments in particular this will be set to true if there either was a newline before this comment, or * * if this comment contains a newline. + */ + nlb: boolean; + + /** + * This doesn't apply for comment tokens, but for all other token types it will be an array of comment tokens that were found before. + */ + comments_before: string[]; + } + + interface AST_Node { + // The first token of this node + start: AST_Node; + + // The last token of this node + end: AST_Node; + + transform(tt: TreeTransformer): AST_Toplevel; + } + + interface AST_Toplevel extends AST_Node { + // UglifyJS contains a scope analyzer which figures out variable/function definitions, references etc. + // You need to call it manually before compression or mangling. + // The figure_out_scope method is defined only on the AST_Toplevel node. + figure_out_scope(): void; + + // Get names that are optimized for GZip compression (names will be generated using the most frequent characters first) + compute_char_frequency(): void; + + mangle_names(): void; + + print(stream: OutputStream): void; + + print_to_string(options?: BeautifierOptions): string; + } + + interface MinifyOptions { + spidermonkey?: boolean; + outSourceMap?: string; + sourceRoot?: string; + inSourceMap?: string; + fromString?: boolean; + warnings?: boolean; + mangle?: Object; + output?: MinifyOutput, + compress?: Object; + } + + interface MinifyOutput { + code: string; + map: string; + } + + function minify(files: string | Array, options?: MinifyOptions): MinifyOutput; + + + interface ParseOptions { + // Default is false + strict?: boolean; + + // Input file name, default is null + filename?: string; + + // Default is null + toplevel?: AST_Toplevel; + } + + /** + * The parser creates a custom abstract syntax tree given a piece of JavaScript code. + * Perhaps you should read about the AST first. + */ + function parse(code: string, options?: ParseOptions): AST_Toplevel; + + + interface BeautifierOptions { + /** + * Start indentation on every line (only when `beautify`) + */ + indent_start?: number; + + /** + * Indentation level (only when `beautify`) + */ + indent_level?: number; + + /** + * Quote all keys in object literals? + */ + quote_keys?: boolean; + + /** + * Add a space after colon signs? + */ + space_colon?: boolean; + + /** + * Output ASCII-safe? (encodes Unicode characters as ASCII) + */ + ascii_only?: boolean; + + /** + * Escape " boolean; + + /** + * UglifyJS provides a TreeWalker object and every node has a walk method that given a walker will apply your visitor to each node in the tree. + * Your visitor can return a non-falsy value in order to prevent descending the current node. + */ + function TreeWalker(visitor: visitor): TreeWalker; + + + // TODO + interface TreeTransformer extends TreeWalker { + } + + /** + * The tree transformer is a special case of a tree walker. + * In fact it even inherits from TreeWalker and you can use the same methods, but initialization and visitor protocol are a bit different. + */ + function TreeTransformer(before: visitor, after: visitor): TreeTransformer; +} + +export = UglifyJS; diff --git a/types/uglify-js/v2/package.json b/types/uglify-js/v2/package.json new file mode 100644 index 0000000000..100334a89f --- /dev/null +++ b/types/uglify-js/v2/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "source-map": "^0.6.1" + } +} diff --git a/types/uglify-js/v2/tsconfig.json b/types/uglify-js/v2/tsconfig.json new file mode 100644 index 0000000000..1f63939ac8 --- /dev/null +++ b/types/uglify-js/v2/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "uglify-js": ["uglify-js/v2"] + } + }, + "files": [ + "index.d.ts", + "uglify-js-tests.ts" + ] +} diff --git a/types/uglify-js/v2/tslint.json b/types/uglify-js/v2/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/uglify-js/v2/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} diff --git a/types/uglify-js/v2/uglify-js-tests.ts b/types/uglify-js/v2/uglify-js-tests.ts new file mode 100644 index 0000000000..19233bf7ad --- /dev/null +++ b/types/uglify-js/v2/uglify-js-tests.ts @@ -0,0 +1,72 @@ +/// + +import * as UglifyJS from 'uglify-js'; +import * as fs from 'fs'; + +var result = UglifyJS.minify("/path/to/file.js"); +console.log(result.code); // minified output +// if you need to pass code instead of file name +var result = UglifyJS.minify("var b = function () {};", {fromString: true}); + +var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ]); +console.log(result.code); + +var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { + outSourceMap: "out.js.map" +}); +console.log(result.code); // minified output +console.log(result.map); + +var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { + outSourceMap: "out.js.map", + sourceRoot: "http://example.com/src" +}); + +var result = UglifyJS.minify("compiled.js", { + inSourceMap: "compiled.js.map", + outSourceMap: "minified.js.map" +}); +// same as before, it returns `code` and `map` + +const my_source_map_string = 'sourceMap'; +var result = UglifyJS.minify("compiled.js", { + inSourceMap: JSON.parse(my_source_map_string), + outSourceMap: "minified.js.map" +}); + +var toplevel_ast = UglifyJS.parse(code, {}); + +var toplevel: UglifyJS.AST_Toplevel = null; +const files = ['file1', 'file2']; +files.forEach(function(file){ + var code = fs.readFileSync(file, "utf8"); + toplevel = UglifyJS.parse(code, { + filename: file, + toplevel: toplevel + }); +}); + +toplevel.figure_out_scope() + +var compressor = UglifyJS.Compressor({}); +var compressed_ast = toplevel.transform(compressor); + +compressed_ast.figure_out_scope(); +compressed_ast.compute_char_frequency(); +compressed_ast.mangle_names(); + +var stream = UglifyJS.OutputStream({}); +compressed_ast.print(stream); +var code = stream.toString(); // this is your minified code + +var code = compressed_ast.print_to_string({}); + +var source_map = UglifyJS.SourceMap({}); +var stream = UglifyJS.OutputStream({ + //... + source_map: source_map +}); +compressed_ast.print(stream); + +var code = stream.toString(); +var map = source_map.toString(); // json output for your source map diff --git a/types/uglifyjs-webpack-plugin/index.d.ts b/types/uglifyjs-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..fbbb42f3a8 --- /dev/null +++ b/types/uglifyjs-webpack-plugin/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for uglifyjs-webpack-plugin 1.1 +// Project: https://github.com/webpack-contrib/uglifyjs-webpack-plugin +// Definitions by: Rene Vajkay +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Plugin } from 'webpack'; + +export = UglifyJsPlugin; + +declare class UglifyJsPlugin extends Plugin { + constructor(options?: UglifyJsPlugin.UglifyJsPluginOptions); +} + +declare namespace UglifyJsPlugin { + interface UglifyJsPluginOptions { + test?: RegExp | RegExp[]; + include?: RegExp | RegExp[]; + exclude?: RegExp | RegExp[]; + cache?: boolean | string; + parallel?: boolean | number; + sourceMap?: boolean; + uglifyOptions?: UglifyJsOptions; + extractComments?: boolean | RegExp | ((node: object, comment: string) => boolean) | ExtractCommentsOptions; + warningsFilter?: (source: string) => boolean; + } + + interface UglifyJsOptions { + ie8?: boolean; + ecma?: number; + parse?: object; + mangle?: boolean | object; + output?: object; + compress?: boolean | object; + warnings?: boolean; + toplevel?: boolean; + nameCache?: object; + keep_classnames?: boolean; + keep_fnames?: boolean; + safari10?: boolean; + } + + interface ExtractCommentsOptions { + condition?: RegExp | ((node: object, comment: string) => boolean); + filename?: string | ((originalFileName: string) => string); + banner?: boolean | string | ((fileName: string) => string); + } +} diff --git a/types/uglifyjs-webpack-plugin/tsconfig.json b/types/uglifyjs-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..793c9d3ca0 --- /dev/null +++ b/types/uglifyjs-webpack-plugin/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "uglifyjs-webpack-plugin-tests.ts" + ] +} diff --git a/types/uglifyjs-webpack-plugin/tslint.json b/types/uglifyjs-webpack-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/uglifyjs-webpack-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/uglifyjs-webpack-plugin/uglifyjs-webpack-plugin-tests.ts b/types/uglifyjs-webpack-plugin/uglifyjs-webpack-plugin-tests.ts new file mode 100644 index 0000000000..593d31a345 --- /dev/null +++ b/types/uglifyjs-webpack-plugin/uglifyjs-webpack-plugin-tests.ts @@ -0,0 +1,18 @@ +import * as webpack from "webpack"; +import * as UglifyjsWebpackPlugin from "uglifyjs-webpack-plugin"; + +const compiler = webpack({ + plugins: [ + new UglifyjsWebpackPlugin(), + ], +}); + +const compilerOptions = webpack({ + plugins: [ + new UglifyjsWebpackPlugin({ + cache: false, + parallel: true, + sourceMap: true, + }), + ], +}); diff --git a/types/ui-grid/index.d.ts b/types/ui-grid/index.d.ts index 7bf551c59f..748dda3bf9 100644 --- a/types/ui-grid/index.d.ts +++ b/types/ui-grid/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for ui-grid // Project: http://www.ui-grid.info/ -// Definitions by: Ben Tesser , Joe Skeen +// Definitions by: Ben Tesser +// Joe Skeen +// Peter Bojanczyk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -3545,6 +3547,8 @@ declare namespace uiGrid { export interface IGridColumnOf { /** Column definition */ colDef: uiGrid.IColumnDefOf; + /** Default sort on this column */ + defaultSort?: ISortInfo; /** * Column name that will be shown in the header. * If displayName is not provided then one is generated using the name. @@ -3683,6 +3687,8 @@ declare namespace uiGrid { * @default false */ cellTooltip?: boolean | string | ICellTooltipGetter; + /** Default object of sort information */ + defaultSort?: ISortInfo; /** * Column name that will be shown in the header. * If displayName is not provided then one is generated using the name. diff --git a/types/ui-grid/ui-grid-tests.ts b/types/ui-grid/ui-grid-tests.ts index 06f18384a5..e1d49a481d 100644 --- a/types/ui-grid/ui-grid-tests.ts +++ b/types/ui-grid/ui-grid-tests.ts @@ -22,6 +22,11 @@ columnDef.cellTooltip = 'blah'; columnDef.cellTooltip = function (gridRow: uiGrid.IGridRow, gridCol: uiGrid.IGridColumn) { return `${gridRow.entity.unknownProperty}-${gridCol.displayName}`; }; +columnDef.defaultSort = { + direction: 'ASC', + ignoreSort: false, + priority: 1 +}; columnDef.displayName = 'Jumper'; columnDef.enableColumnMenu = false; columnDef.enableColumnMenus = false; diff --git a/types/unzipper/index.d.ts b/types/unzipper/index.d.ts index 99ece81913..5af7bbddf7 100644 --- a/types/unzipper/index.d.ts +++ b/types/unzipper/index.d.ts @@ -97,7 +97,8 @@ export interface CentralDirectory { } export class ParseOptions { - verbose: boolean; + verbose?: boolean; + path?: string; // more options? } diff --git a/types/urijs/index.d.ts b/types/urijs/index.d.ts index 61f1887948..08c0611414 100644 --- a/types/urijs/index.d.ts +++ b/types/urijs/index.d.ts @@ -13,6 +13,7 @@ declare namespace uri { absoluteTo(path: URI): URI; addFragment(fragment: string): URI; addQuery(qry: string): URI; + addQuery(qry: string, value:any): URI; addQuery(qry: Object): URI; addSearch(qry: string): URI; addSearch(key: string, value:any): URI; @@ -238,8 +239,30 @@ declare namespace uri { type URITemplateCallback = (keyName: string) => URITemplateValue; type URITemplateInput = { [key: string]: URITemplateValue | URITemplateCallback } | URITemplateCallback; + type URITemplateLiteral = string; + interface URITemplateVariable { + name: string; + explode: boolean; + maxLength?: number; + } + + interface URITemplateExpression { + expression: string; + operator: string; + variables: ReadonlyArray; + } + + type URITemplatePart = URITemplateLiteral | URITemplateExpression; + interface URITemplate { expand(data: URITemplateInput, opts?: Object) : URI; + parse(): this; + + /** + * @description The parsed parts of the URI Template. Only present after calling + * `parse()` first. + */ + parts?: ReadonlyArray; } interface URITemplateStatic { diff --git a/types/urijs/urijs-tests.ts b/types/urijs/urijs-tests.ts index 231879b94d..fc9911d274 100644 --- a/types/urijs/urijs-tests.ts +++ b/types/urijs/urijs-tests.ts @@ -32,6 +32,12 @@ URI('').setQuery('foo', 'bar'); URI('').setQuery({ foo: 'bar' }); URI('').setSearch('foo', 'bar'); URI('').setSearch({ foo: 'bar' }); +URI('http://example.org/foo/hello.html').addQuery('foo'); +URI('http://example.org/foo/hello.html').addQuery('foo', 'bar'); +URI('http://example.org/foo/hello.html').addQuery({ foo: 'bar' }); +URI('http://example.org/foo/hello.html').addSearch('foo'); +URI('http://example.org/foo/hello.html').addSearch('foo', 'bar'); +URI('http://example.org/foo/hello.html').addSearch({ foo: 'bar' }); var uri: uri.URI = $('a').uri(); @@ -103,6 +109,9 @@ URI('http://user:pass@example.org:80/foo/bar.html').equals( }) ); +const template = URITemplate('/items/{?page,count}'); +template.parse() === template; + /* Tests for hasSearch(), hasQuery() From: http://medialize.github.io/URI.js/docs.html#search-has diff --git a/types/vinyl-fs/vinyl-fs-tests.ts b/types/vinyl-fs/vinyl-fs-tests.ts index 9aa9a02513..6cecf42f47 100644 --- a/types/vinyl-fs/vinyl-fs-tests.ts +++ b/types/vinyl-fs/vinyl-fs-tests.ts @@ -13,7 +13,10 @@ import File = require('vinyl'); // const spies = require('./spy'); declare const spies: any; -import 'mocha'; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; // TODO: These aren't useful as types tests since they take `any`. declare const should: ShouldStatic; diff --git a/types/vinyl/v0/vinyl-tests.ts b/types/vinyl/v0/vinyl-tests.ts index 27ea92a283..8c7de1ea52 100644 --- a/types/vinyl/v0/vinyl-tests.ts +++ b/types/vinyl/v0/vinyl-tests.ts @@ -1,9 +1,12 @@ -/// - import File = require('vinyl'); import Stream = require('stream'); import fs = require('fs'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + declare var fakeStream: NodeJS.ReadWriteStream; // TODO: These aren't useful as types tests since they take `any`. diff --git a/types/vinyl/vinyl-tests.ts b/types/vinyl/vinyl-tests.ts index 77ef5d6d1b..bd059b0427 100644 --- a/types/vinyl/vinyl-tests.ts +++ b/types/vinyl/vinyl-tests.ts @@ -1,5 +1,3 @@ -/// - import * as fs from 'fs'; import * as path from 'path'; import expect = require('expect'); @@ -8,6 +6,11 @@ const cloneable = require('cloneable-readable'); import File = require('vinyl'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + /** * Custom and private properties needed for tests. * diff --git a/types/vis/index.d.ts b/types/vis/index.d.ts index e7ca718dab..c0b33b27aa 100644 --- a/types/vis/index.d.ts +++ b/types/vis/index.d.ts @@ -1793,6 +1793,12 @@ export interface NodeOptions { strokeWidth?: number, // px strokeColor?: string, align?: string, + vadjust?: string, + multi?: string, + bold?: string | FontOptions, + ital?: string | FontOptions, + boldital?: string | FontOptions, + mono?: string | FontOptions, }; group?: string; @@ -1881,6 +1887,12 @@ export interface EdgeOptions { strokeWidth?: number, // px strokeColor?: string, align?: string, + vadjust?: string, + multi?: string, + bold?: string | FontOptions, + ital?: string | FontOptions, + boldital?: string | FontOptions, + mono?: string | FontOptions, }; from?: number | string; @@ -1923,6 +1935,14 @@ export interface EdgeOptions { width?: number; } +export interface FontOptions { + color?: string; + size?: number; + face?: string; + mod?: string; + vadjust?: string; +} + export interface OptionsScaling { min?: number; max?: number; diff --git a/types/webdriverio/index.d.ts b/types/webdriverio/index.d.ts index 8020be7957..235760d47b 100644 --- a/types/webdriverio/index.d.ts +++ b/types/webdriverio/index.d.ts @@ -464,8 +464,8 @@ declare namespace WebdriverIO { run(): Promise; } - class ErrorHandler { - constructor(type: string, msg: string | number); + class ErrorHandler extends Error { + constructor(type: string, msg: string | number, details?: string); } function multiremote(options: MultiRemoteOptions): Client; diff --git a/types/webdriverio/webdriverio-tests.ts b/types/webdriverio/webdriverio-tests.ts index 4a078ef6e9..56dc3ddfda 100644 --- a/types/webdriverio/webdriverio-tests.ts +++ b/types/webdriverio/webdriverio-tests.ts @@ -1,8 +1,11 @@ -/// - import * as webdriverio from "webdriverio"; import { assert } from "chai"; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe("webdriver.io page", () => { it("should have the right title - the good old callback way", () => { assert.equal( diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 2277ec2867..8c93019f24 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -421,6 +421,8 @@ declare namespace webpack { include?: Condition | Condition[]; /** A Condition matched with the resource. */ resource?: Condition | Condition[]; + /** A Condition matched with the resource query. */ + resourceQuery?: Condition | Condition[]; /** A condition matched with the issuer */ issuer?: Condition | Condition[]; /** @@ -551,7 +553,7 @@ declare namespace webpack { /** Give chunks created a name (chunks with equal name are merged) */ name?: boolean | string | ((...args: any[]) => any); /** Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks) */ - cacheGroups?: false | string | ((...args: any[]) => any) | RegExp | CacheGroupsOptions; + cacheGroups?: false | string | ((...args: any[]) => any) | RegExp | { [key: string]: CacheGroupsOptions }; } interface RuntimeChunkOptions { /** The name or name factory for the runtime chunks. */ diff --git a/types/webpack/v3/webpack-tests.ts b/types/webpack/v3/webpack-tests.ts index f56dbb84b6..513895dac2 100644 --- a/types/webpack/v3/webpack-tests.ts +++ b/types/webpack/v3/webpack-tests.ts @@ -368,7 +368,7 @@ plugin = new webpack.optimize.UglifyJsPlugin({ }); plugin = new webpack.optimize.UglifyJsPlugin({ mangle: { - except: ['$super', '$', 'exports', 'require'] + reserved: ['$super', '$', 'exports', 'require'] } }); plugin = new webpack.optimize.UglifyJsPlugin({ diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index 8fe0ab1e4d..4ce24fb25d 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -145,6 +145,15 @@ rule = { loader: "babel-loader" }; +rule = { + test: /\.css$/, + resourceQuery: /module/, + loader: 'css-loader', + options: { + modules: true + } +}; + declare const require: any; declare const path: any; configuration = { @@ -262,7 +271,7 @@ plugin = new webpack.optimize.UglifyJsPlugin({ }); plugin = new webpack.optimize.UglifyJsPlugin({ mangle: { - except: ['$super', '$', 'exports', 'require'] + reserved: ['$super', '$', 'exports', 'require'] } }); plugin = new webpack.optimize.UglifyJsPlugin({ @@ -582,6 +591,22 @@ configuration = { } }; +configuration = { + mode: "production", + optimization: { + splitChunks: { + cacheGroups: { + vendor: { + chunks: "initial", + test: "node_modules", + name: "vendor", + enforce: true + } + } + } + }, +}; + plugin = new webpack.SplitChunksPlugin({ chunks: "async", minChunks: 2 }); class SingleEntryDependency extends webpack.compilation.Dependency {} diff --git a/types/webvr-api/index.d.ts b/types/webvr-api/index.d.ts index afebeda0a9..72fea2097b 100644 --- a/types/webvr-api/index.d.ts +++ b/types/webvr-api/index.d.ts @@ -162,6 +162,11 @@ interface VRFrameData { readonly timestamp: number; } +declare var VRFrameData: { + prototype: VRFrameData + new(): VRFrameData +} + interface VRPose { readonly angularAcceleration: Float32Array | null; readonly angularVelocity: Float32Array | null; diff --git a/types/wpapi/index.d.ts b/types/wpapi/index.d.ts new file mode 100644 index 0000000000..9f1d81e531 --- /dev/null +++ b/types/wpapi/index.d.ts @@ -0,0 +1,533 @@ +// Type definitions for wpapi 1.1 +// Project: https://github.com/wp-api/node-wpapi +// Definitions by: Guo Yunhe +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export = WPAPI; + +/** + * REST API Client for WordPress + * + * @see http://wp-api.org/node-wpapi/api-reference/wpapi/1.1.2/WPAPI.html + */ +declare class WPAPI { + /** + * Construct a REST API client instance object to create + * + * @param options An options hash to configure the instance + */ + constructor(options?: WPAPI.WPAPIOptions); + + /** + * Take an arbitrary WordPress site, deduce the WP REST API root endpoint, + * query that endpoint, and parse the response JSON. Use the returned JSON + * response to instantiate a WPAPI instance bound to the provided site. + * + * @param url A URL within a REST API-enabled WordPress website + */ + static discover(url: string): Promise; + + /** Start a request against /categories endpoint */ + categories(): WPAPI.WPRequest; + + /** Start a request against /comments endpoints */ + comments(): WPAPI.WPRequest; + + /** Start a request against /media endpoints */ + media(): WPAPI.WPRequest; + + /** Start a request against /pages endpoints */ + pages(): WPAPI.WPRequest; + + /** Start a request against /posts endpoints */ + posts(): WPAPI.WPRequest; + + /** Start a request against /settings endpoints */ + settings(): WPAPI.WPRequest; + + /** Start a request against /statuses endpoints */ + statuses(): WPAPI.WPRequest; + + /** Start a request against /tags endpoints */ + tags(): WPAPI.WPRequest; + + /** Start a request against /taxonomies endpoints */ + taxonomies(): WPAPI.WPRequest; + + /** Start a request against /types endpoints */ + types(): WPAPI.WPRequest; + + /** Start a request against /users endpoints */ + users(): WPAPI.WPRequest; + + /** + * Set the authentication to use for a WPAPI site handler instance. Accepts + * basic HTTP authentication credentials (string username & password) or a + * Nonce (for cookie authentication) by default; may be overloaded to accept + * OAuth credentials in the future. + * + * @param credentials An authentication credentials object + */ + auth(credentials?: WPAPI.Credentials): WPAPI; + + /** + * Deduce request methods from a provided API root JSON response object's + * routes dictionary, and assign those methods to the current instance. If + * no routes dictionary is provided then the instance will be bootstrapped + * with route handlers for the default API endpoints only. + * + * This method is called automatically during WPAPI instance creation. + * + * @param routes The "routes" object from the JSON object returned from the + * root API endpoint of a WP site, which should be a dictionary of route + * definition objects keyed by the route's regex pattern + */ + bootstrap(routes: WPAPI.Routes): WPAPI; + + /** + * Access API endpoint handlers from a particular API namespace object + * + * @param namespace A namespace string + */ + namespace(namespace: string): WPAPI; + + /** + * Create and return a handler for an arbitrary WP REST API endpoint. + * + * @param namespace A namespace string, e.g. 'myplugin/v1' + * @param restBase A REST route string, e.g. '/author/(?P\d+)' + * @param options An (optional) options object + */ + registerRoute( + namespace: string, + restBase: string, + options?: WPAPI.RegisterRouteOptions + ): WPAPI.WPRequestFactory; + + /** + * Set the default headers to use for all HTTP requests created from this + * WPAPI site instance. Accepts a header name and its associated value as + * two strings, or multiple headers as an object of name-value pairs. + * + * @param headers + */ + setHeaders(headers: WPAPI.HTTPHeaders): WPAPI; + + /** + * Convenience method for making a new WPAPI instance + * + * @param endpoint The URI for a WP-API endpoint + * @param routes The "routes" object from the JSON object returned from the + * root API endpoint of a WP site, which should be a dictionary of route + * definition objects keyed by the route's regex pattern + */ + site(endpoint: string, routes: WPAPI.Routes): WPAPI; + + /** + * Set custom transport methods to use when making HTTP requests against the + * API. + * + * Pass an object with a function for one or many of "get", "post", "put", + * "delete" and "head" and that function will be called when making that + * type of request. The provided transport functions should take a WPRequest + * handler instance (e.g. the result of a wp.posts()... chain or any other + * chaining request handler) as their first argument; a data object as their + * second argument (for POST, PUT and DELETE requests); and an optional + * callback as their final argument. Transport methods should invoke the + * callback with the response data (or error, as appropriate), and should + * also return a Promise. + * + * @param transport A dictionary of HTTP transport methods + */ + transport(transport: WPAPI.Transport): WPAPI; + + /** + * Generate a query against an arbitrary path on the current endpoint. This + * is useful for requesting resources at custom WP-API endpoints, such as + * WooCommerce's /products. + * + * @param relativePath An endpoint-relative path to which to bind the request + */ + root(relativePath?: string): WPAPI.WPRequest; + + /** + * Generate a request against a completely arbitrary endpoint, with no + * assumptions about or mutation of path, filtering, or query parameters. + * This request is not restricted to the endpoint specified during WPAPI + * object instantiation. + * + * @param url The URL to request + */ + url(url: string): WPAPI.WPRequest; + + /** + * An API client can define its parameter methods, like .authors(), .cart(), + * .products(). They are usually decided by WPAPI namespaces configuration + * object. They have WPRequest return type. + */ + [customRoutesMethod: string]: any; +} + +/*~ If you want to expose types from your module as well, you can + *~ place them in this block. + */ +declare namespace WPAPI { + /** + * The base WordPress API request + * + * @see http://wp-api.org/node-wpapi/api-reference/wpapi/1.1.2/WPRequest.html + */ + class WPRequest { + /** + * WPRequest is the base API request object constructor + * + * @param options A hash of options for the WPRequest instance + */ + constructor(options: WPAPIOptions); + + /** + * Set a request to use authentication, and optionally provide auth + * credentials. If auth credentials were already specified when the WPAPI + * instance was created, calling .auth on the request chain will set + * that request to use the existing credentials. + * + * @param credentials An authentication credentials object + */ + auth(credentials?: Credentials): WPRequest; + + /** + * Set the context of the request. Used primarily to expose private + * values on a request object by setting the context to "edit". + * + * @param context The context to set on the request + */ + context(context: string): WPRequest; + + /** + * Create the specified resource with the provided data + * + * This is the public interface for creating POST requests + * + * @param data The data for the POST request + * @param callback A callback to invoke with the results of the POST + * request + */ + create(data: any, callback?: WPRequestCallback): Promise; + + /** + * Delete the specified resource + * + * @param data Data to send along with the DELETE request + * @param callback A callback to invoke with the results of the DELETE + * request + */ + delete(data?: any, callback?: WPRequestCallback): Promise; + + /** + * Convenience wrapper for .context( 'edit' ) + */ + edit(): WPRequest; + + /** + * Return embedded resources as part of the response payload. + */ + embed(): WPRequest; + + /** + * Exclude specific resource IDs in the response collection. + * + * @param ids An ID or array of IDs to exclude + */ + exclude(ids: number | number[]): WPRequest; + + /** + * Specify a file or a file buffer to attach to the request, for use + * when creating a new Media item + * + * @param file A path to a file (in Node) or an file object (Node or + * Browser) to attach to the request + * @param name An (optional) filename to use for the file + */ + file(file: string | File, name?: string): WPRequest; + + /** + * Get the headers for the specified resource + * + * @param callback A callback to invoke with the results of the HEAD + * request + */ + get(callback?: WPRequestCallback): Promise; + + /** + * Set the id of resource. + * + * @param id An ID of item + */ + id(id: number): WPRequest; + + /** + * Include specific resource IDs in the response collection. + * + * @param ids An ID or array of IDs to include + */ + include(ids: number | number[]): WPRequest; + + /** + * Set the namespace of the request, e.g. to specify the API root for + * routes registered by wp core v2 ("wp/v2") or by any given plugin. Any + * previously- set namespace will be overwritten by subsequent calls to + * the method. + * + * @param namespace A namespace string, e.g. "wp/v2" + */ + namespace(namespace: string): WPRequest; + + /** + * Set an arbitrary offset to retrieve items from a specific point in a + * collection. + * + * @param offsetNumber The number of items by which to offset the response + */ + offset(offsetNumber: number): WPRequest; + + /** + * Change the sort direction of a returned collection + * + * @param direction The order to use when sorting the response + */ + order(direction: "asc" | "desc"): WPRequest; + + /** + * Order a collection by a specific field + * + * @param field The field by which to order the response + */ + orderby(field: string): WPRequest; + + /** + * Set the pagination of a request. Use in conjunction with .perPage() + * for explicit pagination handling. (The number of pages in a response + * can be retrieved from the response's _paging.totalPages property.) + * + * @param pageNumber The page number of results to retrieve + */ + page(pageNumber: number): WPRequest; + + /** + * Set a parameter to render into the final query URI. + * + * @param props The name of the parameter to set, or an object containing + * parameter keys and their corresponding values + * @param value The value of the parameter being set + */ + param( + props: string | { [name: string]: string | number | any[] }, + value?: string | number | any[] + ): WPRequest; + + /** + * Set the number of items to be returned in a page of responses. + * + * @param itemsPerPage The number of items to return in one page of + * results + */ + perPage(itemsPerPage: number): WPRequest; + + /** + * Filter results to those matching the specified search terms. + * + * @param searchString A string to search for within post content + */ + search(searchString: string): WPRequest; + + /** + * Specify one or more headers to send with the dispatched HTTP request. + * + * @param headers The name of the header to set, or an object of header + * names and their associated string values + * @param value The value of the header being set + */ + setHeaders( + headers: string | { [name: string]: string }, + value?: string + ): WPRequest; + + /** + * Set a component of the resource URL itself (as opposed to a query + * parameter) + * + * If a path component has already been set at this level, throw an + * error: requests are meant to be transient, so any re-writing of a + * previously-set path part value is likely to be a mistake. + * + * @param level A "level" of the path to set, e.g. "1" or "2" + * @param value The value to set at that path part level + */ + setPathPart(level: number | string, value: number | string): WPRequest; + + /** + * Query a collection for members with a specific slug. + * + * @param slug A post slug (slug), e.g. "hello-world" + */ + slug(slug: string): WPRequest; + + /** + * Calling .then on a query chain will invoke the query as a GET and + * return a promise + * + * @param successCallback A callback to handle the data returned from + * the GET request + * @param failureCallback A callback to handle any errors encountered + * by the request + */ + then( + successCallback?: (data: any) => void, + failureCallback?: (error: Error) => void + ): Promise; + + /** + * Parse the request into a WordPress API request URI string + */ + toString(): string; + + /** + * Update the specified resource with the provided data + * + * This is the public interface for creating PATCH requests + * + * @param data The data for the PATCH request + * @param callback A callback to invoke with the results of the PATCH + * request + */ + update(data: any, callback?: WPRequestCallback): Promise; + + /** + * Validate whether the specified path parts are valid for this endpoint + * + * "Path parts" are non-query-string URL segments, like "some" "path" in + * the URL mydomain.com/some/path?and=a&query=string&too. Because a well + * -formed path is necessary to execute a successful API request, we + * throw an error if the user has omitted a value (such as /some/[missing + * component]/url) or has provided a path part value that does not match + * the regular expression the API uses to goven that segment. + */ + validatePath(): WPRequest; + + /** + * A request can define its parameter methods, like .id(), .date(), + * .author(). They are usually decided by WPAPI routes configuration + * object. + */ + [customParamsMethod: string]: any; + } + + interface WPAPIOptions extends Credentials { + /** The URI for a WP-API endpoint */ + endpoint: string; + /** + * A dictionary of API routes with which to bootstrap the WPAPI instance: + * the instance will be initialized with default routes only if this + * property is omitted + */ + routes?: Routes; + /** + * An optional dictionary of HTTP transport methods (.get, .post, .put, + * .delete, .head) to use instead of the defaults, e.g. to use a + * different HTTP library than superagent + */ + transport?: Transport; + } + + interface WPRequestOptions extends Credentials { + /** The URI for a WP-API endpoint */ + endpoint: string; + /** + * An dictionary of HTTP transport methods (.get, .post, .put, + * .delete, .head) to use instead of the defaults, e.g. to use a + * different HTTP library than superagent + */ + transport?: Transport; + } + + type WPRequestFactory = () => WPRequest; + + type WPRequestCallback = (error: Error, data: any) => void; + + /** Authentication credentials */ + interface Credentials { + /** A WP-API Basic HTTP Authentication username */ + username?: string; + /** A WP-API Basic HTTP Authentication password */ + password?: string; + /** A WP nonce for use with cookie authentication */ + nonce?: string; + } + + interface Transport { + get?: TransportFunction; + post?: TransportFunction; + put?: TransportFunction; + delete?: TransportFunction; + head?: TransportFunction; + } + + type TransportFunction = ( + wpreq: WPRequest, + cb?: WPRequestCallback + ) => Promise; + + interface Routes { + [path: string]: Route; + } + + interface Route { + namespace: string; + methods: HTTPMethod[]; + endpoints: HTTPEndpoint[]; + _links?: { + self: string; + }; + } + + type HTTPMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; + + interface HTTPEndpoint { + methods: HTTPMethod[]; + args: { + [arg: string]: HTTPArgument; + }; + } + + interface HTTPArgument { + required: boolean; + default?: string | number; + enum?: string[]; + description?: string; + type?: HTTPArgumentType; + items?: { + type: HTTPArgumentType; + }; + } + + type HTTPArgumentType = + | "string" + | "integer" + | "number" + | "boolean" + | "object" + | "array"; + + interface HTTPHeaders { + [key: string]: string; + } + + interface RegisterRouteOptions { + params?: string[]; + methods?: HTTPMethod[]; + mixins?: { + [key: string]: (val: any) => any; + }; + } +} diff --git a/types/wpapi/tsconfig.json b/types/wpapi/tsconfig.json new file mode 100644 index 0000000000..789edd9ee4 --- /dev/null +++ b/types/wpapi/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "wpapi-tests.ts"] +} diff --git a/types/wpapi/tslint.json b/types/wpapi/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/wpapi/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/wpapi/wpapi-tests.ts b/types/wpapi/wpapi-tests.ts new file mode 100644 index 0000000000..a06908d94e --- /dev/null +++ b/types/wpapi/wpapi-tests.ts @@ -0,0 +1,103 @@ +// Initialize the client +import * as WPAPI from "wpapi"; + +const wp = new WPAPI({ endpoint: "http://src.wordpress-develop.dev/wp-json" }); + +// Callbacks +wp.posts().get((err: Error, data: any) => { + if (err) { + // handle err + } + // do something with the returned posts +}); + +// Promises +wp + .posts() + .then((data: any) => { + // do something with the returned posts + }) + .catch((err: Error) => { + // handle error + }); + +// Auto-discover +const apiPromise = WPAPI.discover("http://my-site.com"); +apiPromise.then(site => { + // If default routes were detected, they are now available + site.posts().then((posts: any[]) => {}); // etc + + // If custom routes were detected, they can be accessed via .namespace() + // Custom routes have different methods to generate requests, so .authors() + // does not necessarily exist. You have use force type or 'as + // Request' + (site.namespace("myplugin/v1").authors() as WPAPI.WPRequest).then( + (authors: any[]) => { + /* ... */ + } + ); + + // Namespaces can be saved out to variables: + const myplugin = site.namespace("myplugin/v1"); + myplugin + .authors() + .id(7) + .then((author: any) => { + /* ... */ + }); +}); + +// Authenticating with Auto-Discovery +const apiPromise2 = WPAPI.discover("http://my-site.com").then(site => { + return site.auth({ + username: "admin", + password: "always use secure passwords" + }); +}); + +apiPromise2.then(site => { + // site is now configured to use authentication +}); + +// You must authenticate to be able to POST (create) a post +const wp2 = new WPAPI({ + endpoint: "http://your-site.com/wp-json", + // This assumes you are using basic auth, as described further below + username: "someusername", + password: "password" +}); +wp2 + .posts() + .create({ + // "title" and "content" are the only required properties + title: "Your Post Title", + content: "Your post content", + // Post will be created as a draft by default if a specific "status" + // is not specified + status: "publish" + }) + .then((response: any) => { + // "response" will hold all properties of your newly-created post, + // including the unique `id` the post was assigned on creation + }); + +// You must authenticate to be able to PUT (update) a post +// .id() must be used to specify the post we are updating +wp2 + .posts() + .id(2501) + .update({ + // Update the title + title: "A Better Title", + // Set the post live (assuming it was "draft" before) + status: "publish" + }) + .then((response: any) => {}); + +// Custom routes + +const site = new WPAPI({ endpoint: "http://www.yoursite.com/wp-json" }); +const myCustomResource = site.registerRoute("myplugin/v1", "/author/(?P)"); +myCustomResource() + .id(17) + .then((response: any) => {}); // => myplugin/v1/author/17 diff --git a/types/wrap-ansi/index.d.ts b/types/wrap-ansi/index.d.ts index fcbdd756e2..1a1ed41cf8 100644 --- a/types/wrap-ansi/index.d.ts +++ b/types/wrap-ansi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for wrap-ansi v2.0.0 +// Type definitions for wrap-ansi v3.0.0 // Project: https://www.npmjs.com/package/wrap-ansi // Definitions by: Klaus Reimer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,7 +12,7 @@ * @param options By default the wrap is soft, meaning long words may extend past the column width. Setting * this to true will make it hard wrap at the column width. */ -declare function wrapAnsi(input: string, columns: number, options?: { hard?: boolean }): string; +declare function wrapAnsi(input: string, columns: number, options?: { hard?: boolean; trim?: boolean; wordWrap?: boolean; }): string; declare namespace wrapAnsi {} diff --git a/types/wrap-ansi/v2/index.d.ts b/types/wrap-ansi/v2/index.d.ts new file mode 100644 index 0000000000..fcbdd756e2 --- /dev/null +++ b/types/wrap-ansi/v2/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for wrap-ansi v2.0.0 +// Project: https://www.npmjs.com/package/wrap-ansi +// Definitions by: Klaus Reimer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +/** + * Wrap words to the specified column width. + * + * @param input String with ANSI escape codes. Like one styled by chalk. + * @param columns Number of columns to wrap the text to. + * @param options By default the wrap is soft, meaning long words may extend past the column width. Setting + * this to true will make it hard wrap at the column width. + */ +declare function wrapAnsi(input: string, columns: number, options?: { hard?: boolean }): string; + +declare namespace wrapAnsi {} + +export = wrapAnsi; + diff --git a/types/wrap-ansi/v2/tsconfig.json b/types/wrap-ansi/v2/tsconfig.json new file mode 100644 index 0000000000..52f19a07de --- /dev/null +++ b/types/wrap-ansi/v2/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "wrap-ansi": ["wrap-ansi/v2"] + } + }, + "files": [ + "index.d.ts", + "wrap-ansi-tests.ts" + ] +} diff --git a/types/wrap-ansi/v2/tslint.json b/types/wrap-ansi/v2/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/wrap-ansi/v2/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} diff --git a/types/wrap-ansi/v2/wrap-ansi-tests.ts b/types/wrap-ansi/v2/wrap-ansi-tests.ts new file mode 100644 index 0000000000..e5ba8c294f --- /dev/null +++ b/types/wrap-ansi/v2/wrap-ansi-tests.ts @@ -0,0 +1,8 @@ + + +import wrapAnsi = require("wrap-ansi"); + +wrapAnsi("input", 80) === "output"; +wrapAnsi("input", 80, {}) === "output"; +wrapAnsi("input", 80, { hard: true }) === "output"; +wrapAnsi("input", 80, { hard: false }) === "output"; diff --git a/types/wrap-ansi/wrap-ansi-tests.ts b/types/wrap-ansi/wrap-ansi-tests.ts index e5ba8c294f..49e1b64efe 100644 --- a/types/wrap-ansi/wrap-ansi-tests.ts +++ b/types/wrap-ansi/wrap-ansi-tests.ts @@ -6,3 +6,7 @@ wrapAnsi("input", 80) === "output"; wrapAnsi("input", 80, {}) === "output"; wrapAnsi("input", 80, { hard: true }) === "output"; wrapAnsi("input", 80, { hard: false }) === "output"; +wrapAnsi("input", 80, { trim: true }) === "output"; +wrapAnsi("input", 80, { trim: false }) === "output"; +wrapAnsi("input", 80, { wordWrap: true }) === "output"; +wrapAnsi("input", 80, { wordWrap: false }) === "output"; diff --git a/types/yazl/index.d.ts b/types/yazl/index.d.ts new file mode 100644 index 0000000000..45288eaad5 --- /dev/null +++ b/types/yazl/index.d.ts @@ -0,0 +1,46 @@ +// Type definitions for yazl 2.4 +// Project: https://github.com/thejoshwolfe/yazl +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +import { Readable, Writable } from 'stream'; +import { Buffer } from 'buffer'; + +export interface Options { + mtime: Date; + mode: number; + compress: boolean; + forceZip64Format: boolean; +} + +export interface ReadStreamOptions extends Options { + size: number; +} + +export interface DirectoryOptions { + mtime: Date; + mode: number; +} + +export interface EndOptions { + forceZip64Format: boolean; +} + +export interface DosDateTime { + date: number; + time: number; +} + +export class ZipFile { + addFile(realPath: string, metadataPath: string, options?: Partial): void; + outputStream: Writable; + addReadStream(input: Readable, metadataPath: string, options?: Partial): void; + addBuffer(buffer: Buffer, metadataPath: string, options?: Partial): void; + end(optoins?: EndOptions, finalSizeCallback?: () => void): void; + + addEmptyDirectory(metadataPath: string, options?: Partial): void; + dateToDosDateTime(jsDate: Date): DosDateTime; +} diff --git a/types/yazl/tsconfig.json b/types/yazl/tsconfig.json new file mode 100644 index 0000000000..124a83ec4d --- /dev/null +++ b/types/yazl/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "yazl-tests.ts" + ] +} diff --git a/types/yazl/tslint.json b/types/yazl/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/yazl/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/yazl/yazl-tests.ts b/types/yazl/yazl-tests.ts new file mode 100644 index 0000000000..dfc5cd3c27 --- /dev/null +++ b/types/yazl/yazl-tests.ts @@ -0,0 +1,22 @@ +import { ZipFile } from "yazl"; +import fs = require('fs'); + +const zipfile = new ZipFile(); +zipfile.addFile("file1.txt", "file1.txt"); +// (add only files, not directories) +zipfile.addFile("path/to/file.txt", "path/in/zipfile.txt"); +// pipe() can be called any time after the constructor +zipfile.outputStream.pipe(fs.createWriteStream("output.zip")).on("close", () => { + console.log("done"); +}); +// alternate apis for adding files: +zipfile.addReadStream(process.stdin, "stdin.txt", { + mtime: new Date(), + mode: parseInt("0100664", 8), // -rw-rw-r-- +}); +zipfile.addBuffer(new Buffer("hello"), "hello.txt", { + mtime: new Date(), + mode: parseInt("0100664", 8), // -rw-rw-r-- +}); +// call end() after all the files have been added +zipfile.end(); diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index e6dc35c1ea..c8c3f2dda4 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -46,6 +46,7 @@ export interface Schema { default(value?: any): this; nullable(isNullable: boolean): this; required(message?: string): this; + notRequired(): this; typeError(message?: string): this; oneOf(arrayOfValues: any[], message?: string): this; notOneOf(arrayOfValues: any[], message?: string): this; diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index 9dd02ced73..0c0aa04c47 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -100,6 +100,7 @@ mixed.default(() => ({ number: 5})); mixed.default(); mixed.nullable(true); mixed.required(); +mixed.notRequired(); // $ExpectType MixedSchema mixed.typeError('type error'); mixed.oneOf(['hello', 'world'], 'message'); mixed.notOneOf(['hello', 'world'], 'message'); diff --git a/types/zapier-platform-core/index.d.ts b/types/zapier-platform-core/index.d.ts index 525421abbf..474de4f0fd 100644 --- a/types/zapier-platform-core/index.d.ts +++ b/types/zapier-platform-core/index.d.ts @@ -15,7 +15,7 @@ export const version: string; export interface HttpRequestOptions { url?: string; - method?: "POST" | "GET" | "OPTIONS" | "HEAD" | "DELETE" | "PATCH"; + method?: "POST" | "GET" | "OPTIONS" | "HEAD" | "DELETE" | "PATCH" | "PUT"; body?: string | Buffer | NodeJS.ReadableStream | object | null; headers?: { [name: string]: string }; json?: object | any[] | null;