From 52d0fb07b21c20ec437665c3cfbea89cbe6f9029 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 3 Sep 2017 12:38:18 -0700 Subject: [PATCH 001/314] adding types for relay-runtime --- types/relay-runtime/index.d.ts | 1102 +++++++++++++++++++++++++++++ types/relay-runtime/tsconfig.json | 26 + 2 files changed, 1128 insertions(+) create mode 100644 types/relay-runtime/index.d.ts create mode 100644 types/relay-runtime/tsconfig.json diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts new file mode 100644 index 0000000000..7e57ef036b --- /dev/null +++ b/types/relay-runtime/index.d.ts @@ -0,0 +1,1102 @@ +/// + +declare namespace __Relay.Common { + /** + * SOURCE: + * Relay 1.3.0 + * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js + */ + // ~~~~~~~~~~~~~~~~~~~~~ + // Util + // ~~~~~~~~~~~~~~~~~~~~~ + type Maybe = T | void; + + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayConcreteNode = any; + type RelayMutationTransaction = any; + type RelayMutationRequest = any; + type RelayQueryRequest = any; + type ConcreteFragment = any; + type ConcreteBatch = any; + type ConcreteFragmentDefinition = Object; + type ConcreteOperationDefinition = Object; + + /** + * FIXME: RelayContainer used to be typed with ReactClass, but + * ReactClass is broken and allows for access to any property. For example + * ReactClass.getFragment('foo') is valid even though ReactClass has no + * such getFragment() type definition. When ReactClass is fixed this causes a + * lot of errors in Relay code since methods like getFragment() are used often + * but have no definition in Relay's types. Suppressing for now. + */ + export type RelayContainer = any; + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayQL + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayQL = ( + strings: Array, + ...substitutions: Array + ) => Common.RelayConcreteNode; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayModernGraphQLTag + // ~~~~~~~~~~~~~~~~~~~~~ + type GeneratedNodeMap = {[key: string]: GraphQLTaggedNode}; + type GraphQLTaggedNode = + (() => ConcreteFragment | ConcreteBatch) | + { + modern: () => ConcreteFragment | ConcreteBatch, + classic: (relayQL: RelayQL) => + | ConcreteFragmentDefinition + | ConcreteOperationDefinition, + }; + // ~~~~~~~~~~~~~~~~~~~~~ + // General Usage + // ~~~~~~~~~~~~~~~~~~~~~ + export type DataID = string; + export type Variables = {[name: string]: any}; + export type Uploadable = File | Blob; + export type UploadableMap = {[key: string]: Uploadable}; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayNetworkTypes + // Version: Relay 1.3.0 + // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js + // ~~~~~~~~~~~~~~~~~~~~~ + + export type LegacyObserver = { + onCompleted?: (() => void) | void, + onError?: ((error: Error) => void) | void, + onNext?: ((data: T) => void) | void, + }; + export type PayloadError = { + message: string, + locations?: Array<{ + line: number, + column: number, + }>, + }; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayStoreTypes + // Version: Relay 1.3.0 + // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/store/RelayStoreTypes.js + // ~~~~~~~~~~~~~~~~~~~~~ + /** + * A function that receives a proxy over the store and may trigger side-effects + * (indirectly) by calling `set*` methods on the store or its record proxies. + */ + export type StoreUpdater = (store: RecordSourceProxy) => void; + + /** + * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in + * order to easily access the root fields of a query/mutation as well as a + * second argument of the response object of the mutation. + */ + export type SelectorStoreUpdater = ( + store: RecordSourceSelectorProxy, + // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is + // inconvenient to access deeply in product code. + data: any, // FLOW FIXME + ) => void; + + /** + * Extends the RecordSourceProxy interface with methods for accessing the root + * fields of a Selector. + */ + export interface RecordSourceSelectorProxy { + create(dataID: DataID, typeName: string): RecordProxy, + delete(dataID: DataID): void, + get(dataID: DataID): RecordProxy | void, + getRoot(): RecordProxy, + getRootField(fieldName: string): RecordProxy | void, + getPluralRootField(fieldName: string): RecordProxy[] | void, + } + + export interface RecordProxy { + copyFieldsFrom(source: RecordProxy): void, + getDataID(): DataID, + getLinkedRecord(name: string, args?: Variables | void): RecordProxy | void, + getLinkedRecords(name: string, args?: Variables | void): (RecordProxy | void)[] | void, + getOrCreateLinkedRecord( + name: string, + typeName: string, + args?: Variables | void, + ): RecordProxy, + getType(): string, + getValue(name: string, args?: Variables | void): any, + setLinkedRecord( + record: RecordProxy, + name: string, + args?: Variables | void, + ): RecordProxy, + setLinkedRecords( + records: (RecordProxy | void)[] | void, + name: string, + args?: Variables | void, + ): RecordProxy, + setValue(value: any, name: string, args?: Variables | void): RecordProxy, + } + + export interface RecordSourceProxy { + create(dataID: DataID, typeName: string): RecordProxy, + delete(dataID: DataID): void, + get(dataID: DataID): (RecordProxy | void)[] | void, + getRoot(): RecordProxy, + } + + export type HandleFieldPayload = { + // The arguments that were fetched. + args: Variables, + // The __id of the record containing the source/handle field. + dataID: DataID, + // The (storage) key at which the original server data was written. + fieldKey: string, + // The name of the handle. + handle: string, + // The (storage) key at which the handle's data should be written by the + // handler. + handleKey: string, + }; + + export type Handler = { + update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload) => void, + }; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCombinedEnvironmentTypes + // Version: Relay 1.3.0 + // File: https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js + // ~~~~~~~~~~~~~~~~~~~~~ + /** + * Settings for how a query response may be cached. + * + * - `force`: causes a query to be issued unconditionally, irrespective of the + * state of any configured response cache. + * - `poll`: causes a query to live update by polling at the specified interval + in milliseconds. (This value will be passed to setTimeout.) + */ + export type CacheConfig = { + force?: boolean | void, + poll?: number | void, + }; + + /** + * Represents any resource that must be explicitly disposed of. The most common + * use-case is as a return value for subscriptions, where calling `dispose()` + * would cancel the subscription. + */ + export type Disposable = { + dispose(): void, + }; + + + /** + * Arbitrary data e.g. received by a container as props. + */ + export type Props = {[key: string]: any}; + + /* + * An individual cached graph object. + */ + export type Record = {[key: string]: any}; + + /** + * A collection of records keyed by id. + */ + export type RecordMap = {[dataID: string]: Record | void}; + + /** + * A selector defines the starting point for a traversal into the graph for the + * purposes of targeting a subgraph. + */ + export type CSelector = { + dataID: DataID, + node: TNode, + variables: Variables, + }; + + /** + * A representation of a selector and its results at a particular point in time. + */ + export type CSnapshot = CSelector & { + data: SelectorData | void, + seenRecords: RecordMap, + }; + + /** + * The results of a selector given a store/RecordSource. + */ + export type SelectorData = {[key: string]: any}; + + /** + * The results of reading the results of a FragmentMap given some input + * `Props`. + */ + export type FragmentSpecResults = {[key: string]: any}; + + /** + * A utility for resolving and subscribing to the results of a fragment spec + * (key -> fragment mapping) given some "props" that determine the root ID + * and variables to use when reading each fragment. When props are changed via + * `setProps()`, the resolver will update its results and subscriptions + * accordingly. Internally, the resolver: + * - Converts the fragment map & props map into a map of `Selector`s. + * - Removes any resolvers for any props that became null. + * - Creates resolvers for any props that became non-null. + * - Updates resolvers with the latest props. + */ + export interface FragmentSpecResolver { + /** + * Stop watching for changes to the results of the fragments. + */ + dispose(): void, + + /** + * Get the current results. + */ + resolve(): FragmentSpecResults, + + /** + * Update the resolver with new inputs. Call `resolve()` to get the updated + * results. + */ + setProps(props: Props): void, + + /** + * Override the variables used to read the results of the fragments. Call + * `resolve()` to get the updated results. + */ + setVariables(variables: Variables): void, + } + + export type CFragmentMap = {[key: string]: TFragment}; + + /** + * An operation selector describes a specific instance of a GraphQL operation + * with variables applied. + * + * - `root`: a selector intended for processing server results or retaining + * response data in the store. + * - `fragment`: a selector intended for use in reading or subscribing to + * the results of the the operation. + */ + export type COperationSelector = { + fragment: CSelector, + node: TOperation, + root: CSelector, + variables: Variables, + }; + + /** + * The public API of Relay core. Represents an encapsulated environment with its + * own in-memory cache. + */ + export interface CEnvironment< + TEnvironment, + TFragment, + TGraphQLTaggedNode, + TNode, + TOperation, + TPayload, + > { + /** + * Read the results of a selector from in-memory records in the store. + */ + lookup(selector: CSelector): CSnapshot, + + /** + * Subscribe to changes to the results of a selector. The callback is called + * when data has been committed to the store that would cause the results of + * the snapshot's selector to change. + */ + subscribe( + snapshot: CSnapshot, + callback: (snapshot: CSnapshot) => void, + ): Disposable, + + /** + * Ensure that all the records necessary to fulfill the given selector are + * retained in-memory. The records will not be eligible for garbage collection + * until the returned reference is disposed. + * + * Note: This is a no-op in the classic core. + */ + retain(selector: CSelector): Disposable, + + /** + * Send a query to the server with request/response semantics: the query will + * either complete successfully (calling `onNext` and `onCompleted`) or fail + * (calling `onError`). + * + * Note: Most applications should use `streamQuery` in order to + * optionally receive updated information over time, should that feature be + * supported by the network/server. A good rule of thumb is to use this method + * if you would otherwise immediately dispose the `streamQuery()` + * after receving the first `onNext` result. + */ + sendQuery(config: { + cacheConfig?: CacheConfig | void, + onCompleted?: Maybe<() => void>, + onError?: Maybe<(error: Error) => void>, + onNext?: Maybe<(payload: TPayload) => void>, + operation: COperationSelector, + }): Disposable, + + /** + * Send a query to the server with request/subscription semantics: one or more + * responses may be returned (via `onNext`) over time followed by either + * the request completing (`onCompleted`) or an error (`onError`). + * + * Networks/servers that support subscriptions may choose to hold the + * subscription open indefinitely such that `onCompleted` is not called. + */ + streamQuery(config: { + cacheConfig?: Maybe, + onCompleted?: Maybe<() => void>, + onError?: Maybe<(error: Error) => void>, + onNext?: Maybe<(payload: TPayload) => void>, + operation: COperationSelector, + }): Disposable, + + unstable_internal: CUnstableEnvironmentCore< + TEnvironment, + TFragment, + TGraphQLTaggedNode, + TNode, + TOperation + >, + } + + export interface CUnstableEnvironmentCore< + TEnvironment, + TFragment, + TGraphQLTaggedNode, + TNode, + TOperation, + > { + /** + * Create an instance of a FragmentSpecResolver. + * + * TODO: The FragmentSpecResolver *can* be implemented via the other methods + * defined here, so this could be moved out of core. It's convenient to have + * separate implementations until the experimental core is in OSS. + */ + createFragmentSpecResolver: ( + context: CRelayContext, + containerName: string, + fragments: CFragmentMap, + props: Props, + callback: () => void, + ) => FragmentSpecResolver, + + /** + * Creates an instance of an OperationSelector given an operation definition + * (see `getOperation`) and the variables to apply. The input variables are + * filtered to exclude variables that do not matche defined arguments on the + * operation, and default values are populated for null values. + */ + createOperationSelector: ( + operation: TOperation, + variables: Variables, + ) => COperationSelector, + + /** + * Given a graphql`...` tagged template, extract a fragment definition usable + * by this version of Relay core. Throws if the value is not a fragment. + */ + getFragment: (node: TGraphQLTaggedNode) => TFragment, + + /** + * Given a graphql`...` tagged template, extract an operation definition + * usable by this version of Relay core. Throws if the value is not an + * operation. + */ + getOperation: (node: TGraphQLTaggedNode) => TOperation, + + /** + * Determine if two selectors are equal (represent the same selection). Note + * that this function returns `false` when the two queries/fragments are + * different objects, even if they select the same fields. + */ + areEqualSelectors: (a: CSelector, b: CSelector) => boolean, + + /** + * Given the result `item` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment for that item. + * + * Example: + * + * Given two fragments as follows: + * + * ``` + * fragment Parent on User { + * id + * ...Child + * } + * fragment Child on User { + * name + * } + * ``` + * + * And given some object `parent` that is the results of `Parent` for id "4", + * the results of `Child` can be accessed by first getting a selector and then + * using that selector to `lookup()` the results against the environment: + * + * ``` + * const childSelector = getSelector(queryVariables, Child, parent); + * const childData = environment.lookup(childSelector).data; + * ``` + */ + getSelector: ( + operationVariables: Variables, + fragment: TFragment, + prop: any, + ) => CSelector | void, + + /** + * Given the result `items` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment on those + * items. This is similar to `getSelector` but for "plural" fragments that + * expect an array of results and therefore return an array of selectors. + */ + getSelectorList: ( + operationVariables: Variables, + fragment: TFragment, + props: Array, + ) => Array> | void, + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the selectors for those fragments from the results. + * + * The canonical use-case for this function are Relay Containers, which + * use this function to convert (props, fragments) into selectors so that they + * can read the results to pass to the inner component. + */ + getSelectorsFromObject: ( + operationVariables: Variables, + fragments: CFragmentMap, + props: Props, + ) => {[key: string]: Maybe<(CSelector | Array>)>}, + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts a mapping of keys -> id(s) of the results. + * + * Similar to `getSelectorsFromObject()`, this function can be useful in + * determining the "identity" of the props passed to a component. + */ + getDataIDsFromObject: ( + fragments: CFragmentMap, + props: Props, + ) => {[key: string]: Maybe<(DataID | Array)>}, + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the merged variables that would be in scope for those + * fragments/results. + * + * This can be useful in determing what varaibles were used to fetch the data + * for a Relay container, for example. + */ + getVariablesFromObject: ( + operationVariables: Variables, + fragments: CFragmentMap, + props: Props, + ) => Variables, + } + + /** + * The type of the `relay` property set on React context by the React/Relay + * integration layer (e.g. QueryRenderer, FragmentContainer, etc). + */ + export type CRelayContext = { + environment: TEnvironment, + variables: Variables, + }; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayTypes + /** + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js + */ + // ~~~~~~~~~~~~~~~~~~~~~ + export type RerunParam = { + param: string, + import: string, + max_runs: number, + }; + + export type RelayMutationConfig = + | { + type: 'FIELDS_CHANGE', + fieldIDs: {[fieldName: string]: DataID | Array}, + } + | { + type: 'RANGE_ADD', + parentName?: string, + parentID?: string, + connectionInfo?: Array<{ + key: string, + filters?: Variables, + rangeBehavior: string, + }>, + connectionName?: string, + edgeName: string, + rangeBehaviors?: RangeBehaviors, + } + | { + type: 'NODE_DELETE', + parentName?: string, + parentID?: string, + connectionName?: string, + deletedIDFieldName: string, + } + | { + type: 'RANGE_DELETE', + parentName?: string, + parentID?: string, + connectionKeys?: Array<{ + key: string, + filters?: Variables, + }>, + connectionName?: string, + deletedIDFieldName: string | Array, + pathToConnection: Array, + } + | { + type: 'REQUIRED_CHILDREN', + children: Array, + }; + + export type RelayMutationTransactionCommitCallbacks = { + onFailure?: RelayMutationTransactionCommitFailureCallback, + onSuccess?: RelayMutationTransactionCommitSuccessCallback, + }; + export type RelayMutationTransactionCommitFailureCallback = ( + transaction: RelayMutationTransaction, + preventAutoRollback: () => void, + ) => void; + export type RelayMutationTransactionCommitSuccessCallback = (response: { + [key: string]: Object, + }) => void; + export type NetworkLayer = { + sendMutation(request: RelayMutationRequest): Promise | void, + sendQueries(requests: Array): Promise | void, + supports(...options: Array): boolean, + }; + export type QueryResult = { + error?: Error | void, + ref_params?: {[name: string]: any} | void, + response: QueryPayload, + }; + export type ReadyState = { + aborted: boolean, + done: boolean, + error: Error | void, + events: Array, + ready: boolean, + stale: boolean, + }; + type RelayContainerErrorEventType = + | 'CACHE_RESTORE_FAILED' + | 'NETWORK_QUERY_ERROR'; + type RelayContainerLoadingEventType = + | 'ABORT' + | 'CACHE_RESTORED_REQUIRED' + | 'CACHE_RESTORE_START' + | 'NETWORK_QUERY_RECEIVED_ALL' + | 'NETWORK_QUERY_RECEIVED_REQUIRED' + | 'NETWORK_QUERY_START' + | 'STORE_FOUND_ALL' + | 'STORE_FOUND_REQUIRED'; + export type ReadyStateChangeCallback = (readyState: ReadyState) => void; + export type ReadyStateEvent = { + type: RelayContainerLoadingEventType | RelayContainerErrorEventType, + error?: Error, + }; + export type Abortable = { + abort(): void, + }; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayInternalTypes + /** + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js + */ + // ~~~~~~~~~~~~~~~~~~~~~ + export type QueryPayload = {[key: string]: any}; + export type RelayQuerySet = {[queryName: string]: any}; + type RangeBehaviorsFunction = (connectionArgs: { + [argName: string]: any, + }) => 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; + type RangeBehaviorsObject = { + [key: string]: 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; + }; + export type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; + } + + + + +declare namespace __Relay.Runtime { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayDebugger = any; + type OptimisticUpdate = any; + type OperationSelector = Common.COperationSelector; + type Selector = Common.CSelector; + type PayloadData = any; + type Snapshot = Common.CSnapshot; + type RelayResponsePayload = any; + type MutableRecordSource = RecordSource; + + /** + * A function that returns an Observable representing the response of executing + * a GraphQL operation. + */ + type ExecuteFunction = ( + operation: Object, + variables: Common.Variables, + cacheConfig: Common.CacheConfig, + uploadables?: Common.UploadableMap | void, + ) => Promise; + type RelayNetwork = { + execute: ExecuteFunction, + }; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayDefaultHandlerProvider + // ~~~~~~~~~~~~~~~~~~~~~ + type HandlerProvider = (name: string) => Common.Handler | void; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayModernEnvironment + // ~~~~~~~~~~~~~~~~~~~~~ + type EnvironmentConfig = { + configName?: string, + handlerProvider?: HandlerProvider, + network: Network, + store: Store, + }; + class Environment { + constructor (config: EnvironmentConfig); + getStore(): Store; + getDebugger(): RelayDebugger; + applyUpdate(optimisticUpdate: OptimisticUpdate): Common.Disposable; + revertUpdate(update: OptimisticUpdate): void; + replaceUpdate(update: OptimisticUpdate, newUpdate: OptimisticUpdate): void; + applyMutation(config: { + operation: OperationSelector, + optimisticUpdater?: Common.SelectorStoreUpdater, + optimisticResponse?: Object, + }): Common.Disposable; + check(readSelector: Selector): boolean; + commitPayload( + operationSelector: OperationSelector, + payload: PayloadData, + ): void; + commitUpdate(updater: Common.StoreUpdater): void; + lookup(readSelector: Selector): Snapshot; + subscribe( + snapshot: Snapshot, + callback: (snapshot: Snapshot) => void, + ): Common.Disposable; + retain(selector: Selector): Common.Disposable; + execute(config: { + operation: OperationSelector, + cacheConfig?: Common.CacheConfig | void, + updater?: Common.SelectorStoreUpdater | void, + }): RelayObservable; + executeMutation(config: { + operation: OperationSelector, + optimisticUpdater?: Common.SelectorStoreUpdater | void, + optimisticResponse?: Object | void, + updater?: Common.SelectorStoreUpdater | void, + uploadables?: Common.UploadableMap | void, + }): RelayObservable; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayInMemoryRecordSource + // ~~~~~~~~~~~~~~~~~~~~~ + type Record = {[key: string]: any}; + type RecordMap = {[dataID: string]: Record | void}; + + // ~~~~~~~~~~~~~~~~~~~~~ + // Network + // ~~~~~~~~~~~~~~~~~~~~~ + interface Network { + /** + * Creates an implementation of the `Network` interface defined in + * `RelayNetworkTypes` given `fetch` and `subscribe` functions. + */ + create: (fetchFn: any, subscribeFn: any) => RelayNetwork; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // Network + // ~~~~~~~~~~~~~~~~~~~~~ + class RecordSource { + constructor(records?: RecordMap); + clear(): void; + delete(dataID: Common.DataID): void; + get(dataID: Common.DataID): Record | void; + getRecordIDs(): Common.DataID[]; + getStatus(dataID: Common.DataID): 'EXISTENT' | 'NONEXISTENT' | 'UNKNOWN'; + has(dataID: Common.DataID): boolean; + load( + dataID: Common.DataID, + callback: (error: Error | void, record: Record | void) => void, + ): void; + remove(dataID: Common.DataID): void; + set(dataID: Common.DataID, record: Record): void; + size(): number; + toJSON(): RecordMap; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // ModernStore + // ~~~~~~~~~~~~~~~~~~~~~ + class Store { + constructor(source: RecordSource); + getSource(): MutableRecordSource; + check(selector: Selector): boolean; + retain(selector: Selector): Common.Disposable; + lookup(selector: Selector): Snapshot; + notify(): void; + publish(source: RecordSource): void; + subscribe( + snapshot: Snapshot, + callback: (snapshot: Snapshot) => void, + ): Common.Disposable; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayRecordSourceInspector + // ~~~~~~~~~~~~~~~~~~~~~ + /** + * An internal class to provide a console-friendly string representation of a + * Record. + */ + class RecordSummary { + id: Common.DataID; + type: string | void; + static createFromRecord(id: Common.DataID, record: any): RecordSummary; + constructor(id: Common.DataID, type: string | void); + toString(): string; + } + /** + * Internal class for inspecting a single Record. + */ + class RecordInspector { + constructor(sourceInspector: RelayRecordSourceInspector, record: Record); + /** + * Get the cache id of the given record. For types that implement the `Node` + * interface (or that have an `id`) this will be `id`, for other types it will be + * a synthesized identifier based on the field path from the nearest ancestor + * record that does have an `id`. + */ + getDataID(): Common.DataID; + + /** + * Returns a list of the fields that have been fetched on the current record. + */ + getFields(): Array; + + /** + * Returns the type of the record. + */ + getType(): string; + + /** + * Returns a copy of the internal representation of the record. + */ + inspect(): any; + + /** + * Returns the value of a scalar field. May throw if the given field is + * present but not actually scalar. + */ + getValue(name: string, args?: Common.Variables | void): any; + + /** + * Returns an inspector for the given scalar "linked" field (a field whose + * value is another Record instead of a scalar). May throw if the field is + * present but not a scalar linked record. + */ + getLinkedRecord(name: string, args?: Common.Variables | void): RecordInspector | void; + + /** + * Returns an array of inspectors for the given plural "linked" field (a field + * whose value is an array of Records instead of a scalar). May throw if the + * field is present but not a plural linked record. + */ + getLinkedRecords(name: string, args?: Common.Variables | void): RecordInspector[] | void; + } + + class RelayRecordSourceInspector { + constructor(source: RecordSource); + static getForEnvironment(environment: Environment): RelayRecordSourceInspector; + /** + * Returns an inspector for the record with the given id, or null/undefined if + * that record is deleted/unfetched. + */ + get(dataID: Common.DataID): RecordInspector | void; + /** + * Returns a list of ": " for each record in the store that has an + * `id`. + */ + getNodes(): Array; + /** + * Returns a list of ": " for all records in the store including + * those that do not have an `id`. + */ + getRecords(): Array; + + /** + * Returns an inspector for the synthesized "root" object, allowing access to + * e.g. the `viewer` object or the results of other fields on the "Query" + * type. + */ + getRoot(): RecordInspector; + } + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayObservable + // ~~~~~~~~~~~~~~~~~~~~~ + type Subscription = { + unsubscribe: () => void, + readonly closed: boolean, + }; + type Observer = { + start?: ((subscription: Subscription) => any) | void, + next?: ((nextThing: T) => any) | void, + error?: ((error: Error) => any) | void, + complete?: (() => any) | void, + unsubscribe?: ((subscription: Subscription) => any) | void, + }; + type Source = () => any; + interface Subscribable { + subscribe(observer: Observer): Subscription, + } + export type ObservableFromValue = RelayObservable | Promise | T; + class RelayObservable implements Subscribable { + _source: Source; + + constructor(source: Source); + + /** + * When an unhandled error is detected, it is reported to the host environment + * (the ESObservable spec refers to this method as "HostReportErrors()"). + * + * The default implementation in development builds re-throws errors in a + * separate frame, and from production builds does nothing (swallowing + * uncaught errors). + * + * Called during application initialization, this method allows + * application-specific handling of uncaught errors. Allowing, for example, + * integration with error logging or developer tools. + */ + static onUnhandledError(callback: (error: Error) => any): void; + + /** + * Accepts various kinds of data sources, and always returns a RelayObservable + * useful for accepting the result of a user-provided FetchFunction. + */ + static from(obj: ObservableFromValue): RelayObservable; + + /** + * Creates a RelayObservable, given a function which expects a legacy + * Relay Observer as the last argument and which returns a Disposable. + * + * To support migration to Observable, the function may ignore the + * legacy Relay observer and directly return an Observable instead. + */ + static fromLegacy( + callback: (legacyObserver: Common.LegacyObserver) => Common.Disposable | RelayObservable, + ): RelayObservable; + + /** + * Returns a new Observable which returns the same values as this one, but + * modified so that the provided Observer is called to perform a side-effects + * for all events emitted by the source. + * + * Any errors that are thrown in the side-effect Observer are unhandled, and + * do not affect the source Observable or its Observer. + * + * This is useful for when debugging your Observables or performing other + * side-effects such as logging or performance monitoring. + */ + do(observer: Observer): RelayObservable; + + /** + * Returns a new Observable which returns the same values as this one, but + * modified so that the finally callback is performed after completion, + * whether normal or due to error or unsubscription. + * + * This is useful for cleanup such as resource finalization. + */ + finally(fn: () => any): RelayObservable; + + /** + * Returns a new Observable which is identical to this one, unless this + * Observable completes before yielding any values, in which case the new + * Observable will yield the values from the alternate Observable. + * + * If this Observable does yield values, the alternate is never subscribed to. + * + * This is useful for scenarios where values may come from multiple sources + * which should be tried in order, i.e. from a cache before a network. + */ + ifEmpty(alternate: RelayObservable): RelayObservable; + + /** + * Observable's primary API: returns an unsubscribable Subscription to the + * source of this Observable. + */ + subscribe(observer: Observer): Subscription; + + /** + * Supports subscription of a legacy Relay Observer, returning a Disposable. + */ + subscribeLegacy(legacyObserver: Common.LegacyObserver): Common.Disposable; + + /** + * Returns a new Observerable where each value has been transformed by + * the mapping function. + */ + map(fn: (thing: T) => U): RelayObservable; + + /** + * Returns a new Observable where each value is replaced with a new Observable + * by the mapping function, the results of which returned as a single + * concattenated Observable. + */ + concatMap(fn: (thing: T) => ObservableFromValue): RelayObservable; + + /** + * Returns a new Observable which first mirrors this Observable, then when it + * completes, waits for `pollInterval` milliseconds before re-subscribing to + * this Observable again, looping in this manner until unsubscribed. + * + * The returned Observable never completes. + */ + poll(pollInterval: number): RelayObservable; + + /** + * Returns a Promise which resolves when this Observable yields a first value + * or when it completes with no value. + */ + toPromise(): Promise; + } + + + // ~~~~~~~~~~~~~~~~~~~~~ + // commitLocalUpdate + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + type commitLocalUpdate = ( + environment: Environment, + updater: Common.StoreUpdater, + ) => void; + + // ~~~~~~~~~~~~~~~~~~~~~ + // commitRelayModernMutation + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + type MutationConfig = { + configs?: Array, + mutation: Common.GraphQLTaggedNode, + variables: Common.Variables, + uploadables?: Common.UploadableMap, + onCompleted?: (response: T, errors: Array | void) => void, + onError?: (error?: Error) => void, + optimisticUpdater?: Common.SelectorStoreUpdater | void, + optimisticResponse?: Object, + updater?: Common.SelectorStoreUpdater | void, + }; + type commitRelayModernMutation = ( + environment: Environment, + config: MutationConfig, + ) => Common.Disposable; + + // ~~~~~~~~~~~~~~~~~~~~~ + // applyRelayModernOptimisticMutation + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + type OptimisticMutationConfig = { + configs?: Array, + mutation: Common.GraphQLTaggedNode, + variables: Common.Variables, + optimisticUpdater?: Common.SelectorStoreUpdater, + optimisticResponse?: Object, + }; + + // ~~~~~~~~~~~~~~~~~~~~~ + // fetchRelayModernQuery + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + /** + * A helper function to fetch the results of a query. Note that results for + * fragment spreads are masked: fields must be explicitly listed in the query in + * order to be accessible in the result object. + * + * NOTE: This module is primarily intended for integrating with classic APIs. + * Most product code should use a Renderer or Container. + * + * TODO(t16875667): The return type should be `Promise`, but + * that's not really helpful as `SelectorData` is essentially just `mixed`. We + * can probably leverage generated flow types here to return the real expected + * shape. + */ + function fetchRelayModernQuery( + environment: any, // FIXME - $FlowFixMe in facebook source code + taggedNode: Common.GraphQLTaggedNode, + variables: Common.Variables, + cacheConfig?: Common.CacheConfig | void, + ): Promise; // FIXME - $FlowFixMe in facebook source code + + + // ~~~~~~~~~~~~~~~~~~~~~ + // requestRelaySubscription + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + export type GraphQLSubscriptionConfig = { + configs?: Array, + subscription: Common.GraphQLTaggedNode, + variables: Common.Variables, + onCompleted?: () => void, + onError?: (error: Error) => void, + onNext?: (response: Object | void) => void, + updater?: (store: Common.RecordSourceSelectorProxy) => void, + }; + type requestRelaySubscription = ( + environment: Environment, + config: GraphQLSubscriptionConfig, + ) => Common.Disposable; + } + + declare module 'relay-runtime' { + export import Environment = __Relay.Runtime.Environment; + export import Network = __Relay.Runtime.Network; + export import RecordSource = __Relay.Runtime.RecordSource; + export import Store = __Relay.Runtime.Store; + export import Observable = __Relay.Runtime.RelayObservable; + // note RecordSourceInspector is only available in dev environment + export import RecordSourceInspector = __Relay.Runtime.RelayRecordSourceInspector; + } diff --git a/types/relay-runtime/tsconfig.json b/types/relay-runtime/tsconfig.json new file mode 100644 index 0000000000..8224ba918b --- /dev/null +++ b/types/relay-runtime/tsconfig.json @@ -0,0 +1,26 @@ +{ + "files": [ + "index.d.ts", + "relay-runtime-tests.tsx" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true, + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} From ce1d72c1e6b606954f15dfa411d7d8e33130c06e Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 3 Sep 2017 12:38:59 -0700 Subject: [PATCH 002/314] removing reference path --- types/relay-runtime/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 7e57ef036b..961ff8b181 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -1,5 +1,3 @@ -/// - declare namespace __Relay.Common { /** * SOURCE: From 26b04cb2c68a685f6605965db941de0711a6d1fd Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 3 Sep 2017 12:39:58 -0700 Subject: [PATCH 003/314] adding info to top of relay-runtime definitions --- types/relay-runtime/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 961ff8b181..ee11757a25 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -1,3 +1,9 @@ +// Type definitions for react-relay 1.3.0 +// Project: https://github.com/facebook/relay +// Definitions by: Matt Martin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.5 + declare namespace __Relay.Common { /** * SOURCE: From 21915dba1385a03531175945a7b7a5a9a5c68d9b Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 3 Sep 2017 12:52:17 -0700 Subject: [PATCH 004/314] adding new relay files but haven't configged file paths yet --- types/react-relay/index.d.ts | 268 +++++++++++++++++++++++++++++++- types/react-relay/tsconfig.json | 2 +- types/relay-runtime/index.d.ts | 2 +- 3 files changed, 267 insertions(+), 5 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 4f9f49e5e7..6bedf10030 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -1,10 +1,272 @@ -// Type definitions for react-relay 0.9.2 +// Type definitions for react-relay 1.3.0 // Project: https://github.com/facebook/relay // Definitions by: Johannes Schickling +// Matt Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.5 -declare module "react-relay" { +/// +/// + +//////////////////////////// +// RELAY MODERN TYPES +/////////////////////////// + +declare namespace __Relay.Modern { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type ConcreteFragment = any; + type ConcreteBatch = any; + type ConcreteFragmentDefinition = Object; + type ConcreteOperationDefinition = Object; + type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayQL + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayQL = ( + strings: Array, + ...substitutions: Array + ) => Common.RelayConcreteNode; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayModernGraphQLTag + // ~~~~~~~~~~~~~~~~~~~~~ + type GeneratedNodeMap = {[key: string]: GraphQLTaggedNode}; + type GraphQLTaggedNode = + | (() => ConcreteFragment | ConcreteBatch) + | { + modern: () => ConcreteFragment | ConcreteBatch, + classic: (relayQL: RelayQL) => + | ConcreteFragmentDefinition + | ConcreteOperationDefinition, + }; + /** + * Runtime function to correspond to the `graphql` tagged template function. + * All calls to this function should be transformed by the plugin. + */ + function graphql(strings: Array): GraphQLTaggedNode; + + // ~~~~~~~~~~~~~~~~~~~~~ + // ReactRelayQueryRenderer + // ~~~~~~~~~~~~~~~~~~~~~ + type QueryRendererProps = { + cacheConfig?: __Relay.Common.CacheConfig | void, + environment: __Relay.Runtime.Environment | any, + query: GraphQLTaggedNode, + render: (readyState: ReadyState) => React.ReactElement | void, + variables: Common.Variables, + rerunParamExperimental?: Common.RerunParam, + }; + export type ReadyState = { + error: Error | void, + props: Object | void, + retry: (() => void) | void, + }; + type QueryRendererState = { + readyState: ReadyState, + }; + class ReactRelayQueryRenderer extends React.Component {} + + // ~~~~~~~~~~~~~~~~~~~~~ + // createFragmentContainer + // ~~~~~~~~~~~~~~~~~~~~~ + function createFragmentContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + ): ReactBaseComponent; + + // ~~~~~~~~~~~~~~~~~~~~~ + // createPaginationContainer + // ~~~~~~~~~~~~~~~~~~~~~ + type PageInfo = { + endCursor: string | void, + hasNextPage: boolean, + hasPreviousPage: boolean, + startCursor: string | void, + }; + type ConnectionData = { + edges?: any[], + pageInfo?: PageInfo | void, + }; + type FragmentVariablesGetter = ( + prevVars: Common.Variables, + totalCount: number, + ) => Common.Variables; + type ConnectionConfig = { + direction?: 'backward' | 'forward', + getConnectionFromProps?: (props: Object) => ConnectionData | void, + getFragmentVariables?: FragmentVariablesGetter, + getVariables: ( + props: Object, + paginationInfo: {count: number, cursor: string | void}, + fragmentVariables: Common.Variables, + ) => Common.Variables, + query: GraphQLTaggedNode, + }; + function createPaginationContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + connectionConfig: ConnectionConfig, + ): ReactBaseComponent; + + // ~~~~~~~~~~~~~~~~~~~~~ + // createFragmentContainer + // ~~~~~~~~~~~~~~~~~~~~~ + function createRefetchContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + taggedNode: GraphQLTaggedNode, + ): ReactBaseComponent; +} + + + +//////////////////////////// +// RELAY CLASSIC TYPES +/////////////////////////// +// note: the namespace here is really for use inside of +// relay-compat; the module declaration below +// uses the old, pre-existing types +declare namespace __Relay.Classic { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type StoreReaderData = any; + type StoreReaderOptions = any; + type RelayStoreData = any; + type RelayQuery = { Fragment: any; Node: any; Root: any;}; + + // ~~~~~~~~~~~~~~~~~~~~~ + // Environment + // ~~~~~~~~~~~~~~~~~~~~~ + type FragmentResolver = { + dispose(): void, + resolve( + fragment: RelayQuery["Fragment"], + dataIDs: Common.DataID | Array, + ): (StoreReaderData | Array) | void, + }; + interface RelayEnvironmentInterface { + forceFetch( + querySet: Common.RelayQuerySet, + onReadyStateChange: Common.ReadyStateChangeCallback, + ): Common.Abortable, + getFragmentResolver( + fragment: RelayQuery["Fragment"], + onNext: () => void, + ): FragmentResolver, + getStoreData(): RelayStoreData, + primeCache( + querySet: Common.RelayQuerySet, + onReadyStateChange: Common.ReadyStateChangeCallback, + ): Common.Abortable, + read( + node: RelayQuery["Node"], + dataID: Common.DataID, + options?: StoreReaderOptions, + ): StoreReaderData | void, + readQuery( + root: RelayQuery["Root"], + options?: StoreReaderOptions, + ): Array | void, + } + } + +//////////////////////////// +// RELAY COMPAT TYPES +/////////////////////////// + +declare namespace __Relay.Compat { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type ConcreteFragment = any; + type ConcreteBatch = any; + type ConcreteFragmentDefinition = Object; + type ConcreteOperationDefinition = Object; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // Util + // ~~~~~~~~~~~~~~~~~~~~~ + type getFragment = (q: string, v?: Common.Variables) => string; + interface ComponentWithFragment extends React.ComponentClass { + getFragment: getFragment; + } + interface StatelessWithFragment extends React.StatelessComponent { + getFragment: getFragment; + } + type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; + type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; + type RelayClassicEnvironment = Classic.RelayEnvironmentInterface; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCompatTypes + // ~~~~~~~~~~~~~~~~~~~~~ + type CompatEnvironment = Runtime.Environment | RelayClassicEnvironment; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCompatMutations + // ~~~~~~~~~~~~~~~~~~~~~ + function commitUpdate( + environment: CompatEnvironment, + config: Runtime.MutationConfig, + ): Common.Disposable; + function applyUpdate( + environment: CompatEnvironment, + config: Runtime.OptimisticMutationConfig, + ): Common.Disposable; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCompatContainer + // ~~~~~~~~~~~~~~~~~~~~~ + export type GeneratedNodeMap = {[key: string]: Modern.GraphQLTaggedNode}; + function createContainer( + Component: ReactBaseComponent, + fragmentSpec: Modern.GraphQLTaggedNode | GeneratedNodeMap, + ): ReactFragmentComponent; + + // ~~~~~~~~~~~~~~~~~~~~~ + // injectDefaultVariablesProvider + // ~~~~~~~~~~~~~~~~~~~~~ + type VariablesProvider = () => Common.Variables; + function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; +} + + +//////////////////////////// +// MODULES +/////////////////////////// + +declare module 'react-relay' { + export import QueryRenderer = __Relay.Modern.ReactRelayQueryRenderer; + export import createFragmentContainer = __Relay.Modern.createFragmentContainer; + export import createPaginationContainer = __Relay.Modern.createPaginationContainer; + export import createRefetchContainer = __Relay.Modern.createRefetchContainer; + export import graphql = __Relay.Modern.graphql; + + export import commitLocalUpdate = __Relay.Runtime.commitLocalUpdate; + export import commitMutation = __Relay.Runtime.commitRelayModernMutation; + export import fetchQuery = __Relay.Runtime.fetchRelayModernQuery; + export import requestSubscription = __Relay.Runtime.requestRelaySubscription; +} + +declare module 'react-relay/compat' { + export import applyOptimisticMutation = __Relay.Compat.applyUpdate; + export import commitMutation = __Relay.Compat.commitUpdate; + export import createFragmentContainer = __Relay.Compat.createContainer; + export import createPaginationContainer = __Relay.Compat.createContainer; + export import createRefetchContainer = __Relay.Compat.createContainer; + export import injectDefaultVariablesProvider = __Relay.Compat.injectDefaultVariablesProvider; + export import QueryRenderer = __Relay.Modern.ReactRelayQueryRenderer; + export import graphql = __Relay.Modern.graphql; + export import fetchQuery = __Relay.Runtime.fetchRelayModernQuery; + } + + +declare module "react-relay/classic" { import * as React from "react"; type ClientMutationID = string; diff --git a/types/react-relay/tsconfig.json b/types/react-relay/tsconfig.json index 90680fbafc..5d225c2016 100644 --- a/types/react-relay/tsconfig.json +++ b/types/react-relay/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-relay-tests.tsx" ] -} \ No newline at end of file +} diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index ee11757a25..848cf15927 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-relay 1.3.0 +// Type definitions for relay-runtime 1.3.0 // Project: https://github.com/facebook/relay // Definitions by: Matt Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From df16535a8cdb39ac8cd4a12424fad5ad74405d20 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sat, 9 Sep 2017 15:44:07 -1000 Subject: [PATCH 005/314] relay-runtime tests in place --- types/react-relay/index.d.ts | 46 +++++----- .../react-relay/react-relay-classic-tests.tsx | 92 +++++++++++++++++++ .../react-relay/react-relay-compat-tests.tsx | 0 types/react-relay/react-relay-tests.tsx | 92 ------------------- types/react-relay/tsconfig.json | 4 +- types/relay-runtime/index.d.ts | 57 +++++++++--- types/relay-runtime/relay-runtime-tests.tsx | 66 +++++++++++++ 7 files changed, 227 insertions(+), 130 deletions(-) create mode 100644 types/react-relay/react-relay-classic-tests.tsx create mode 100644 types/react-relay/react-relay-compat-tests.tsx create mode 100644 types/relay-runtime/relay-runtime-tests.tsx diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 6bedf10030..2541d7aa20 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -25,10 +25,10 @@ declare namespace __Relay.Modern { // ~~~~~~~~~~~~~~~~~~~~~ // RelayQL // ~~~~~~~~~~~~~~~~~~~~~ - type RelayQL = ( + export function RelayQL( strings: Array, ...substitutions: Array - ) => Common.RelayConcreteNode; + ): Common.RelayConcreteNode; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernGraphQLTag @@ -38,7 +38,7 @@ declare namespace __Relay.Modern { | (() => ConcreteFragment | ConcreteBatch) | { modern: () => ConcreteFragment | ConcreteBatch, - classic: (relayQL: RelayQL) => + classic: (relayQL: typeof RelayQL) => | ConcreteFragmentDefinition | ConcreteOperationDefinition, }; @@ -46,7 +46,7 @@ declare namespace __Relay.Modern { * Runtime function to correspond to the `graphql` tagged template function. * All calls to this function should be transformed by the plugin. */ - function graphql(strings: Array): GraphQLTaggedNode; + function graphql(strings: Array | TemplateStringsArray): GraphQLTaggedNode; // ~~~~~~~~~~~~~~~~~~~~~ // ReactRelayQueryRenderer @@ -72,7 +72,7 @@ declare namespace __Relay.Modern { // ~~~~~~~~~~~~~~~~~~~~~ // createFragmentContainer // ~~~~~~~~~~~~~~~~~~~~~ - function createFragmentContainer( + export function createFragmentContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, ): ReactBaseComponent; @@ -90,14 +90,14 @@ declare namespace __Relay.Modern { edges?: any[], pageInfo?: PageInfo | void, }; - type FragmentVariablesGetter = ( + export function FragmentVariablesGetter( prevVars: Common.Variables, totalCount: number, - ) => Common.Variables; + ): Common.Variables; type ConnectionConfig = { direction?: 'backward' | 'forward', getConnectionFromProps?: (props: Object) => ConnectionData | void, - getFragmentVariables?: FragmentVariablesGetter, + getFragmentVariables?: typeof FragmentVariablesGetter, getVariables: ( props: Object, paginationInfo: {count: number, cursor: string | void}, @@ -105,7 +105,7 @@ declare namespace __Relay.Modern { ) => Common.Variables, query: GraphQLTaggedNode, }; - function createPaginationContainer( + export function createPaginationContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, connectionConfig: ConnectionConfig, @@ -114,7 +114,7 @@ declare namespace __Relay.Modern { // ~~~~~~~~~~~~~~~~~~~~~ // createFragmentContainer // ~~~~~~~~~~~~~~~~~~~~~ - function createRefetchContainer( + export function createRefetchContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, taggedNode: GraphQLTaggedNode, @@ -191,30 +191,30 @@ declare namespace __Relay.Compat { // ~~~~~~~~~~~~~~~~~~~~~ // Util // ~~~~~~~~~~~~~~~~~~~~~ - type getFragment = (q: string, v?: Common.Variables) => string; + export function getFragment(q: string, v?: Common.Variables): string; interface ComponentWithFragment extends React.ComponentClass { - getFragment: getFragment; + getFragment: typeof getFragment; } interface StatelessWithFragment extends React.StatelessComponent { - getFragment: getFragment; + getFragment: typeof getFragment; } type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; - type RelayClassicEnvironment = Classic.RelayEnvironmentInterface; + export type RelayClassicEnvironment = Classic.RelayEnvironmentInterface; // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatTypes // ~~~~~~~~~~~~~~~~~~~~~ - type CompatEnvironment = Runtime.Environment | RelayClassicEnvironment; + export type CompatEnvironment = Runtime.Environment | RelayClassicEnvironment; // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatMutations // ~~~~~~~~~~~~~~~~~~~~~ - function commitUpdate( + export function commitUpdate( environment: CompatEnvironment, config: Runtime.MutationConfig, ): Common.Disposable; - function applyUpdate( + export function applyUpdate( environment: CompatEnvironment, config: Runtime.OptimisticMutationConfig, ): Common.Disposable; @@ -223,7 +223,7 @@ declare namespace __Relay.Compat { // RelayCompatContainer // ~~~~~~~~~~~~~~~~~~~~~ export type GeneratedNodeMap = {[key: string]: Modern.GraphQLTaggedNode}; - function createContainer( + export function createContainer( Component: ReactBaseComponent, fragmentSpec: Modern.GraphQLTaggedNode | GeneratedNodeMap, ): ReactFragmentComponent; @@ -232,7 +232,7 @@ declare namespace __Relay.Compat { // injectDefaultVariablesProvider // ~~~~~~~~~~~~~~~~~~~~~ type VariablesProvider = () => Common.Variables; - function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; + export function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; } @@ -339,10 +339,10 @@ declare module "react-relay/classic" { supports(...options: string[]): boolean } - function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass - function injectNetworkLayer(networkLayer: RelayNetworkLayer): any - function isContainer(component: React.ComponentClass): boolean - function QL(...args: any[]): string + export function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass + export function injectNetworkLayer(networkLayer: RelayNetworkLayer): any + export function isContainer(component: React.ComponentClass): boolean + export function QL(...args: any[]): string class Route { constructor(params?: RelayVariables) diff --git a/types/react-relay/react-relay-classic-tests.tsx b/types/react-relay/react-relay-classic-tests.tsx new file mode 100644 index 0000000000..f231381817 --- /dev/null +++ b/types/react-relay/react-relay-classic-tests.tsx @@ -0,0 +1,92 @@ +import * as React from "react"; +import * as Relay from "react-relay/classic"; + +interface Props { + text: string + userId: string +} + +interface Response { +} + +export default class AddTweetMutation extends Relay.Mutation { + + getMutation () { + return Relay.QL`mutation{addTweet}` + } + + getFatQuery () { + return Relay.QL` + fragment on AddTweetPayload { + tweetEdge + user + } + ` + } + + getConfigs () { + return [{ + type: "RANGE_ADD", + parentName: "user", + parentID: this.props.userId, + connectionName: "tweets", + edgeName: "tweetEdge", + rangeBehaviors: { + "": "append", + }, + }] + } + + getVariables () { + return this.props + } +} + +interface ArtworkProps { + artwork: { + title: string + }, + relay: Relay.RelayProp, +} + +class Artwork extends React.Component { + render() { + return ( + + {this.props.artwork.title} + + ) + } +} + +const ArtworkContainer = Relay.createContainer(Artwork, { + fragments: { + artwork: () => Relay.QL` + fragment on Artwork { + title + } + ` + } +}) + +class StubbedArtwork extends React.Component { + render() { + const props = { + artwork: { title: "CHAMPAGNE FORMICA FLAG" }, + relay: { + route: { + name: "champagne" + }, + variables: { + artworkID: "champagne-formica-flag", + }, + setVariables: () => {}, + forceFetch: () => {}, + hasOptimisticUpdate: () => false, + getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, + commitUpdate: () => {}, + } + } + return + } +} diff --git a/types/react-relay/react-relay-compat-tests.tsx b/types/react-relay/react-relay-compat-tests.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/react-relay-tests.tsx index 90425156cc..e69de29bb2 100644 --- a/types/react-relay/react-relay-tests.tsx +++ b/types/react-relay/react-relay-tests.tsx @@ -1,92 +0,0 @@ -import * as React from "react" -import * as Relay from "react-relay" - -interface Props { - text: string - userId: string -} - -interface Response { -} - -export default class AddTweetMutation extends Relay.Mutation { - - getMutation () { - return Relay.QL`mutation{addTweet}` - } - - getFatQuery () { - return Relay.QL` - fragment on AddTweetPayload { - tweetEdge - user - } - ` - } - - getConfigs () { - return [{ - type: "RANGE_ADD", - parentName: "user", - parentID: this.props.userId, - connectionName: "tweets", - edgeName: "tweetEdge", - rangeBehaviors: { - "": "append", - }, - }] - } - - getVariables () { - return this.props - } -} - -interface ArtworkProps { - artwork: { - title: string - }, - relay: Relay.RelayProp, -} - -class Artwork extends React.Component { - render() { - return ( - - {this.props.artwork.title} - - ) - } -} - -const ArtworkContainer = Relay.createContainer(Artwork, { - fragments: { - artwork: () => Relay.QL` - fragment on Artwork { - title - } - ` - } -}) - -class StubbedArtwork extends React.Component { - render() { - const props = { - artwork: { title: "CHAMPAGNE FORMICA FLAG" }, - relay: { - route: { - name: "champagne" - }, - variables: { - artworkID: "champagne-formica-flag", - }, - setVariables: () => {}, - forceFetch: () => {}, - hasOptimisticUpdate: () => false, - getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, - commitUpdate: () => {}, - } - } - return - } -} diff --git a/types/react-relay/tsconfig.json b/types/react-relay/tsconfig.json index 5d225c2016..825d91a0c2 100644 --- a/types/react-relay/tsconfig.json +++ b/types/react-relay/tsconfig.json @@ -19,6 +19,8 @@ }, "files": [ "index.d.ts", - "react-relay-tests.tsx" + "react-relay-tests.tsx", + "react-relay-classic-tests.tsx", + "react-relay-compat-tests.tsx" ] } diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 848cf15927..b54688f080 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -27,6 +27,7 @@ declare namespace __Relay.Common { type ConcreteFragmentDefinition = Object; type ConcreteOperationDefinition = Object; + /** * FIXME: RelayContainer used to be typed with ReactClass, but * ReactClass is broken and allows for access to any property. For example @@ -83,6 +84,31 @@ declare namespace __Relay.Common { column: number, }>, }; + /** + * A function that executes a GraphQL operation with request/response semantics. + * + * May return an Observable or Promise of a raw server response. + */ + export function FetchFunction( + operation: ConcreteBatch, + variables: Variables, + cacheConfig: CacheConfig, + uploadables?: Common.UploadableMap, + ): Runtime.ObservableFromValue; + + /** + * A function that executes a GraphQL subscription operation, returning one or + * more raw server responses over time. + * + * May return an Observable, otherwise must call the callbacks found in the + * fourth parameter. + */ + export type SubscribeFunction = ( + operation: ConcreteBatch, + variables: Variables, + cacheConfig: CacheConfig, + observer: LegacyObserver, + ) => Runtime.RelayObservable | Disposable; // ~~~~~~~~~~~~~~~~~~~~~ @@ -166,10 +192,11 @@ declare namespace __Relay.Common { // handler. handleKey: string, }; - - export type Handler = { - update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload) => void, + interface IHandler { + update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload): void; + [functionName: string]: Function; }; + export const Handler: IHandler; // ~~~~~~~~~~~~~~~~~~~~~ @@ -685,14 +712,14 @@ declare namespace __Relay.Runtime { // ~~~~~~~~~~~~~~~~~~~~~ // RelayDefaultHandlerProvider // ~~~~~~~~~~~~~~~~~~~~~ - type HandlerProvider = (name: string) => Common.Handler | void; + export function HandlerProvider(name: string): Common.Handler | void; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernEnvironment // ~~~~~~~~~~~~~~~~~~~~~ type EnvironmentConfig = { configName?: string, - handlerProvider?: HandlerProvider, + handlerProvider?: typeof HandlerProvider, network: Network, store: Store, }; @@ -743,12 +770,12 @@ declare namespace __Relay.Runtime { // ~~~~~~~~~~~~~~~~~~~~~ // Network // ~~~~~~~~~~~~~~~~~~~~~ - interface Network { - /** - * Creates an implementation of the `Network` interface defined in - * `RelayNetworkTypes` given `fetch` and `subscribe` functions. - */ - create: (fetchFn: any, subscribeFn: any) => RelayNetwork; + class Network { + /** + * Creates an implementation of the `Network` interface defined in + * `RelayNetworkTypes` given `fetch` and `subscribe` functions. + */ + static create(fetchFn: typeof Common.FetchFunction, subscribeFn?: Common.SubscribeFunction): RelayNetwork; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -898,7 +925,7 @@ declare namespace __Relay.Runtime { interface Subscribable { subscribe(observer: Observer): Subscription, } - export type ObservableFromValue = RelayObservable | Promise | T; + type ObservableFromValue = RelayObservable | Promise | T; class RelayObservable implements Subscribable { _source: Source; @@ -1034,10 +1061,10 @@ declare namespace __Relay.Runtime { optimisticResponse?: Object, updater?: Common.SelectorStoreUpdater | void, }; - type commitRelayModernMutation = ( + function commitRelayModernMutation( environment: Environment, config: MutationConfig, - ) => Common.Disposable; + ): Common.Disposable; // ~~~~~~~~~~~~~~~~~~~~~ // applyRelayModernOptimisticMutation @@ -1103,4 +1130,6 @@ declare namespace __Relay.Runtime { export import Observable = __Relay.Runtime.RelayObservable; // note RecordSourceInspector is only available in dev environment export import RecordSourceInspector = __Relay.Runtime.RelayRecordSourceInspector; + export import ConnectionHandler = __Relay.Common.Handler; + export import ViewerHandler = __Relay.Common.Handler; } diff --git a/types/relay-runtime/relay-runtime-tests.tsx b/types/relay-runtime/relay-runtime-tests.tsx new file mode 100644 index 0000000000..609399f079 --- /dev/null +++ b/types/relay-runtime/relay-runtime-tests.tsx @@ -0,0 +1,66 @@ +import { + Environment, + Network, + RecordSource, + Store, +} from 'relay-runtime'; + +const source = new RecordSource(); +const store = new Store(source); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Network Layer +// ~~~~~~~~~~~~~~~~~~~~~ +// Define a function that fetches the results of an operation (query/mutation/etc) +// and returns its results as a Promise: +function fetchQuery( + operation: any, + variables: { [key: string]: string }, + cacheConfig: {}, +) { + return fetch('/graphql', { + method: 'POST', + headers: { + // Add authentication and other headers here + 'content-type': 'application/json' + }, + body: JSON.stringify({ + query: operation.text, // GraphQL text from input + variables, + }), + }).then(response => { + return response.json(); + }); +} + +// Create a network layer from the fetch function +const network = Network.create(fetchQuery); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Environment +// ~~~~~~~~~~~~~~~~~~~~~ +const environment = new Environment({ + handlerProvider, // Can omit. + network, + store, +}); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Handler Provider +// ~~~~~~~~~~~~~~~~~~~~~ + +import { + ConnectionHandler, + ViewerHandler, +} from 'relay-runtime'; + +function handlerProvider(handle: any) { + switch (handle) { + // Augment (or remove from) this list: + case 'connection': return ConnectionHandler; + case 'viewer': return ViewerHandler; + } + throw new Error( + `handlerProvider: No handler provided for ${handle}` + ); +} From 27b933935ee9924870bde294dd259d0e58107d1a Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sat, 9 Sep 2017 17:13:12 -1000 Subject: [PATCH 006/314] complete set of relay modern tests --- types/react-relay/index.d.ts | 52 +++- types/react-relay/react-relay-tests.tsx | 350 ++++++++++++++++++++++++ types/relay-runtime/index.d.ts | 48 ++-- 3 files changed, 425 insertions(+), 25 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 2541d7aa20..3b073666f9 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -22,6 +22,14 @@ declare namespace __Relay.Modern { type ConcreteOperationDefinition = Object; type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayProp + // ~~~~~~~~~~~~~~~~~~~~~ + // note: refetch and pagination containers augment this + export type RelayProp = { + environment: Runtime.Environment, + }; + // ~~~~~~~~~~~~~~~~~~~~~ // RelayQL // ~~~~~~~~~~~~~~~~~~~~~ @@ -46,14 +54,18 @@ declare namespace __Relay.Modern { * Runtime function to correspond to the `graphql` tagged template function. * All calls to this function should be transformed by the plugin. */ - function graphql(strings: Array | TemplateStringsArray): GraphQLTaggedNode; + interface IGraphql { + (strings: Array | TemplateStringsArray): GraphQLTaggedNode; + experimental: (strings: Array | TemplateStringsArray) => GraphQLTaggedNode; + } + export const graphql: IGraphql; // ~~~~~~~~~~~~~~~~~~~~~ // ReactRelayQueryRenderer // ~~~~~~~~~~~~~~~~~~~~~ type QueryRendererProps = { cacheConfig?: __Relay.Common.CacheConfig | void, - environment: __Relay.Runtime.Environment | any, + environment: __Relay.Runtime.Environment, query: GraphQLTaggedNode, render: (readyState: ReadyState) => React.ReactElement | void, variables: Common.Variables, @@ -61,7 +73,7 @@ declare namespace __Relay.Modern { }; export type ReadyState = { error: Error | void, - props: Object | void, + props: { [propName: string]: any } | void, retry: (() => void) | void, }; type QueryRendererState = { @@ -90,6 +102,20 @@ declare namespace __Relay.Modern { edges?: any[], pageInfo?: PageInfo | void, }; + export type RelayPaginationProp = RelayProp & { + hasMore: () => boolean, + isLoading: () => boolean, + loadMore: ( + pageSize: number, + callback: (error?: Error) => void, + options?: RefetchOptions, + ) => Common.Disposable | void, + refetchConnection: ( + totalCount: number, + callback: (error?: Error | void) => void, + refetchVariables?: Common.Variables | void, + ) => Common.Disposable | void, + }; export function FragmentVariablesGetter( prevVars: Common.Variables, totalCount: number, @@ -114,11 +140,26 @@ declare namespace __Relay.Modern { // ~~~~~~~~~~~~~~~~~~~~~ // createFragmentContainer // ~~~~~~~~~~~~~~~~~~~~~ + export type RefetchOptions = { + force?: boolean, + rerunParamExperimental?: Common.RerunParam, + }; + export type RelayRefetchProp = RelayProp & { + refetch: ( + refetchVariables: Common.Variables | ((fragmentVariables: Common.Variables) => Common.Variables), + renderVariables: Common.Variables | void, + callback?: (error: Error | void) => void, + options?: RefetchOptions, + ) => Common.Disposable, + }; export function createRefetchContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, taggedNode: GraphQLTaggedNode, ): ReactBaseComponent; + + + } @@ -251,6 +292,11 @@ declare module 'react-relay' { export import commitMutation = __Relay.Runtime.commitRelayModernMutation; export import fetchQuery = __Relay.Runtime.fetchRelayModernQuery; export import requestSubscription = __Relay.Runtime.requestRelaySubscription; + + // exported for convenience — not exports in the original module + export import RelayProp = __Relay.Modern.RelayProp; + export import RelayPaginationProp = __Relay.Modern.RelayPaginationProp; + export import RelayRefetchProp = __Relay.Modern.RelayRefetchProp; } declare module 'react-relay/compat' { diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/react-relay-tests.tsx index e69de29bb2..fb70b04118 100644 --- a/types/react-relay/react-relay-tests.tsx +++ b/types/react-relay/react-relay-tests.tsx @@ -0,0 +1,350 @@ +import * as React from "react"; +import { + Environment, + Network, + RecordSource, + Store, + ConnectionHandler, +} from 'relay-runtime'; +import { + graphql, + commitMutation, + createFragmentContainer, + createPaginationContainer, + createRefetchContainer, + requestSubscription, + QueryRenderer, + RelayPaginationProp, + RelayRefetchProp +} from "react-relay"; + + +//////////////////////////// +// ENVIRONMENT +/////////////////////////// +let network: __Relay.Runtime.RelayNetwork; +const source = new RecordSource(); +const store = new Store(source); +const modernEnvironment = new Environment({ network, store }); + + +//////////////////////////// +// QUERY RENDERER +/////////////////////////// +const MyQueryRenderer = (props: { name: string}) => ( + { + if (error) { + return
{error.message}
; + } else if (props) { + return
{props.name} is great!
; + } + return
Loading
; + }} + /> +); + +//////////////////////////// +// FRAGMENT CONTAINER +/////////////////////////// +const MyFragmentContainer = createFragmentContainer( + class TodoListView extends React.Component { + render() { + return
; + } + }, + { + item: graphql` + fragment TodoItem_item on Todo { + text + isComplete + } + `, + } +); + + +//////////////////////////// +// REFETCH CONTAINER +/////////////////////////// +interface IStory { id: string } +interface IFeedStoriesProps { + relay: RelayRefetchProp; + feed: { + stories: { edges: { node: IStory }[] } + } +} +class Story extends React.Component<{ story: IStory }, {}> {} +class FeedStories extends React.Component { + render() { + return ( +
+ {this.props.feed.stories.edges.map( + edge => + )} +
+ ); + } + + _loadMore() { + // Increments the number of stories being rendered by 10. + const refetchVariables = (fragmentVariables: {count: number }) => ({ + count: fragmentVariables.count + 10, + }); + this.props.relay.refetch(refetchVariables, null); + } + } + +const FeedRefetchContainer = createRefetchContainer( + FeedStories, + { + feed: graphql.experimental` + fragment FeedStories_feed on Feed + @argumentDefinitions( + count: {type: "Int", defaultValue: 10} + ) { + stories(first: $count) { + edges { + node { + id + ...Story_story + } + } + } + } + ` + }, + graphql.experimental` + query FeedStoriesRefetchQuery($count: Int) { + feed { + ...FeedStories_feed @arguments(count: $count) + } + } + `, + ); + + + +//////////////////////////// +// PAGINATION CONTAINER +/////////////////////////// +interface IFeedProps { + user: { feed: { edges: { node: IStory}[]}} + relay: RelayPaginationProp; +} +class Feed extends React.Component { + render() { + return (
+ {this.props.user.feed.edges.map( + edge => + )} +
); + } + + _loadMore() { + if (!this.props.relay.hasMore() || this.props.relay.isLoading()) { + return; + } + + this.props.relay.loadMore( + 10, // Fetch the next 10 feed items + e => { + console.log(e); + }, + ); + } +} + +const FeedPaginationContainer = createPaginationContainer( + Feed, + { + user: graphql` + fragment Feed_user on User { + feed( + first: $count + after: $cursor + orderby: $orderBy # other variables + ) @connection(key: "Feed_feed") { + edges { + node { + id + ...Story_story + } + } + } + } + `, + }, + { + direction: 'forward', + getConnectionFromProps(props: { user: {feed: any}}) { + return props.user && props.user.feed; + }, + getFragmentVariables(prevVars, totalCount) { + return { + ...prevVars, + count: totalCount, + }; + }, + getVariables(props, {count, cursor}, fragmentVariables) { + return { + count, + cursor, + // in most cases, for variables other than connection filters like + // `first`, `after`, etc. you may want to use the previous values. + orderBy: fragmentVariables.orderBy, + }; + }, + query: graphql` + query FeedPaginationQuery( + $count: Int! + $cursor: String + $orderby: String! + ) { + user { + # You could reference the fragment defined previously. + ...Feed_user + } + } + ` + } +); + + +//////////////////////////// +// MUTATIONS +/////////////////////////// + +const mutation = graphql` +mutation MarkReadNotificationMutation( + $input: MarkReadNotificationData! +) { + markReadNotification(data: $input) { + notification { + seenState + } + } +} +`; + +const optimisticResponse = { + markReadNotification: { + notification: { + seenState: 'SEEN', + }, + }, +}; + +const configs = [{ + type: 'NODE_DELETE' as 'NODE_DELETE', + deletedIDFieldName: 'destroyedShipId', +}, { + type: 'RANGE_ADD' as 'RANGE_ADD', + parentID: 'shipId', + connectionInfo: [{ + key: 'AddShip_ships', + rangeBehavior: 'append', + }], + edgeName: 'newShipEdge', +}, { + type: 'RANGE_DELETE' as 'RANGE_DELETE', + parentID: 'todoId', + connectionKeys: [{ + key: 'RemoveTags_tags', + rangeBehavior: 'append', + }], + pathToConnection: ['todo', 'tags'], + deletedIDFieldName: 'removedTagId' +}]; + +function markNotificationAsRead(source: string, storyID: string) { + const variables = { + input: { + source, + storyID, + }, + }; + + commitMutation( + modernEnvironment, + { + configs, + mutation, + optimisticResponse, + variables, + onCompleted: (response, errors) => { + console.log('Response received from server.') + }, + onError: err => console.error(err), + }, + ); +} + + + +//////////////////////////// +// SUBSCRIPTIONS +/////////////////////////// + +const subscription = graphql` + subscription MarkReadNotificationSubscription( + $storyID: ID! + ) { + markReadNotification(storyID: $storyID) { + notification { + seenState + } + } + } +`; + +const variables = { + storyID: '123', +}; + +requestSubscription( + modernEnvironment, // see Environment docs + { + subscription, + variables, + // optional but recommended: + onCompleted: () => {}, + onError: error => console.error(error), + // example of a custom updater + updater: store => { + // Get the notification + const rootField = store.getRootField('markReadNotification'); + const notification = !!rootField && rootField.getLinkedRecord('notification'); + // Add it to a connection + const viewer = store.getRoot().getLinkedRecord('viewer'); + const notifications = + ConnectionHandler.getConnection(viewer, 'notifications'); + const edge = ConnectionHandler.createEdge( + store, + notifications, + notification, + '', + ); + ConnectionHandler.insertEdgeAfter(notifications, edge); + }, + } +); diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index b54688f080..cc60e34add 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -193,9 +193,9 @@ declare namespace __Relay.Common { handleKey: string, }; interface IHandler { - update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload): void; + update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload) => void; [functionName: string]: Function; - }; + } export const Handler: IHandler; @@ -566,48 +566,52 @@ declare namespace __Relay.Common { import: string, max_runs: number, }; - - export type RelayMutationConfig = - | { + interface FIELDS_CHANGE { type: 'FIELDS_CHANGE', fieldIDs: {[fieldName: string]: DataID | Array}, - } - | { + } + interface RANGE_ADD { type: 'RANGE_ADD', parentName?: string, parentID?: string, connectionInfo?: Array<{ - key: string, - filters?: Variables, - rangeBehavior: string, + key: string, + filters?: Variables, + rangeBehavior: string, }>, connectionName?: string, edgeName: string, rangeBehaviors?: RangeBehaviors, - } - | { + } + interface NODE_DELETE { type: 'NODE_DELETE', parentName?: string, parentID?: string, connectionName?: string, deletedIDFieldName: string, - } - | { + } + interface RANGE_DELETE { type: 'RANGE_DELETE', parentName?: string, parentID?: string, connectionKeys?: Array<{ - key: string, - filters?: Variables, + key: string, + filters?: Variables, }>, connectionName?: string, deletedIDFieldName: string | Array, pathToConnection: Array, - } - | { + } + interface REQUIRED_CHILDREN { type: 'REQUIRED_CHILDREN', children: Array, - }; + } + export type RelayMutationConfig = + FIELDS_CHANGE | + RANGE_ADD | + NODE_DELETE | + RANGE_DELETE | + REQUIRED_CHILDREN; export type RelayMutationTransactionCommitCallbacks = { onFailure?: RelayMutationTransactionCommitFailureCallback, @@ -712,7 +716,7 @@ declare namespace __Relay.Runtime { // ~~~~~~~~~~~~~~~~~~~~~ // RelayDefaultHandlerProvider // ~~~~~~~~~~~~~~~~~~~~~ - export function HandlerProvider(name: string): Common.Handler | void; + export function HandlerProvider(name: string): typeof Common.Handler | void; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernEnvironment @@ -1116,10 +1120,10 @@ declare namespace __Relay.Runtime { onNext?: (response: Object | void) => void, updater?: (store: Common.RecordSourceSelectorProxy) => void, }; - type requestRelaySubscription = ( + export function requestRelaySubscription( environment: Environment, config: GraphQLSubscriptionConfig, - ) => Common.Disposable; + ): Common.Disposable; } declare module 'relay-runtime' { From 99e85e6f62166d61e6b5e113a3e9f87be04fbe0a Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sat, 9 Sep 2017 17:17:54 -1000 Subject: [PATCH 007/314] apparently DT only allows one test file per directory --- .../react-relay/react-relay-classic-tests.tsx | 92 ----------- .../react-relay/react-relay-compat-tests.tsx | 0 types/react-relay/react-relay-tests.tsx | 153 +++++++++++++++--- 3 files changed, 127 insertions(+), 118 deletions(-) delete mode 100644 types/react-relay/react-relay-classic-tests.tsx delete mode 100644 types/react-relay/react-relay-compat-tests.tsx diff --git a/types/react-relay/react-relay-classic-tests.tsx b/types/react-relay/react-relay-classic-tests.tsx deleted file mode 100644 index f231381817..0000000000 --- a/types/react-relay/react-relay-classic-tests.tsx +++ /dev/null @@ -1,92 +0,0 @@ -import * as React from "react"; -import * as Relay from "react-relay/classic"; - -interface Props { - text: string - userId: string -} - -interface Response { -} - -export default class AddTweetMutation extends Relay.Mutation { - - getMutation () { - return Relay.QL`mutation{addTweet}` - } - - getFatQuery () { - return Relay.QL` - fragment on AddTweetPayload { - tweetEdge - user - } - ` - } - - getConfigs () { - return [{ - type: "RANGE_ADD", - parentName: "user", - parentID: this.props.userId, - connectionName: "tweets", - edgeName: "tweetEdge", - rangeBehaviors: { - "": "append", - }, - }] - } - - getVariables () { - return this.props - } -} - -interface ArtworkProps { - artwork: { - title: string - }, - relay: Relay.RelayProp, -} - -class Artwork extends React.Component { - render() { - return ( - - {this.props.artwork.title} - - ) - } -} - -const ArtworkContainer = Relay.createContainer(Artwork, { - fragments: { - artwork: () => Relay.QL` - fragment on Artwork { - title - } - ` - } -}) - -class StubbedArtwork extends React.Component { - render() { - const props = { - artwork: { title: "CHAMPAGNE FORMICA FLAG" }, - relay: { - route: { - name: "champagne" - }, - variables: { - artworkID: "champagne-formica-flag", - }, - setVariables: () => {}, - forceFetch: () => {}, - hasOptimisticUpdate: () => false, - getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, - commitUpdate: () => {}, - } - } - return - } -} diff --git a/types/react-relay/react-relay-compat-tests.tsx b/types/react-relay/react-relay-compat-tests.tsx deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/react-relay-tests.tsx index fb70b04118..86ec270627 100644 --- a/types/react-relay/react-relay-tests.tsx +++ b/types/react-relay/react-relay-tests.tsx @@ -6,6 +6,13 @@ import { Store, ConnectionHandler, } from 'relay-runtime'; + + + + +//////////////////////////// +// RELAY MODERN TESTS +/////////////////////////// import { graphql, commitMutation, @@ -19,18 +26,18 @@ import { } from "react-relay"; -//////////////////////////// -// ENVIRONMENT -/////////////////////////// +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern Environment +// ~~~~~~~~~~~~~~~~~~~~~ let network: __Relay.Runtime.RelayNetwork; const source = new RecordSource(); const store = new Store(source); const modernEnvironment = new Environment({ network, store }); -//////////////////////////// -// QUERY RENDERER -/////////////////////////// +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern QueryRenderer +// ~~~~~~~~~~~~~~~~~~~~~ const MyQueryRenderer = (props: { name: string}) => ( ( /> ); -//////////////////////////// -// FRAGMENT CONTAINER -/////////////////////////// +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern FragmentContainer +// ~~~~~~~~~~~~~~~~~~~~~ const MyFragmentContainer = createFragmentContainer( class TodoListView extends React.Component { render() { @@ -75,9 +82,9 @@ const MyFragmentContainer = createFragmentContainer( ); -//////////////////////////// -// REFETCH CONTAINER -/////////////////////////// +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern RefetchContainer +// ~~~~~~~~~~~~~~~~~~~~~ interface IStory { id: string } interface IFeedStoriesProps { relay: RelayRefetchProp; @@ -140,9 +147,9 @@ const FeedRefetchContainer = createRefetchContainer( -//////////////////////////// -// PAGINATION CONTAINER -/////////////////////////// +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern PaginationContainer +// ~~~~~~~~~~~~~~~~~~~~~ interface IFeedProps { user: { feed: { edges: { node: IStory}[]}} relay: RelayPaginationProp; @@ -230,10 +237,9 @@ const FeedPaginationContainer = createPaginationContainer( ); -//////////////////////////// -// MUTATIONS -/////////////////////////// - +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern Mutations +// ~~~~~~~~~~~~~~~~~~~~~ const mutation = graphql` mutation MarkReadNotificationMutation( $input: MarkReadNotificationData! @@ -300,11 +306,9 @@ function markNotificationAsRead(source: string, storyID: string) { } - -//////////////////////////// -// SUBSCRIPTIONS -/////////////////////////// - +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern Subscriptions +// ~~~~~~~~~~~~~~~~~~~~~ const subscription = graphql` subscription MarkReadNotificationSubscription( $storyID: ID! @@ -316,11 +320,9 @@ const subscription = graphql` } } `; - const variables = { storyID: '123', }; - requestSubscription( modernEnvironment, // see Environment docs { @@ -348,3 +350,102 @@ requestSubscription( }, } ); + + + + +//////////////////////////// +// RELAY-CLASSIC TESTS +/////////////////////////// + +import * as Relay from "react-relay/classic"; + +interface Props { + text: string + userId: string +} + +interface Response { +} + +export default class AddTweetMutation extends Relay.Mutation { + + getMutation () { + return Relay.QL`mutation{addTweet}` + } + + getFatQuery () { + return Relay.QL` + fragment on AddTweetPayload { + tweetEdge + user + } + ` + } + + getConfigs () { + return [{ + type: "RANGE_ADD", + parentName: "user", + parentID: this.props.userId, + connectionName: "tweets", + edgeName: "tweetEdge", + rangeBehaviors: { + "": "append", + }, + }] + } + + getVariables () { + return this.props + } +} + +interface ArtworkProps { + artwork: { + title: string + }, + relay: Relay.RelayProp, +} + +class Artwork extends React.Component { + render() { + return ( + + {this.props.artwork.title} + + ) + } +} + +const ArtworkContainer = Relay.createContainer(Artwork, { + fragments: { + artwork: () => Relay.QL` + fragment on Artwork { + title + } + ` + } +}) + +class StubbedArtwork extends React.Component { + render() { + const props = { + artwork: { title: "CHAMPAGNE FORMICA FLAG" }, + relay: { + route: { + name: "champagne" + }, + variables: { + artworkID: "champagne-formica-flag", + }, + setVariables: () => {}, + forceFetch: () => {}, + hasOptimisticUpdate: () => false, + getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, + commitUpdate: () => {}, + } + } + return + } +} From 80d08efbc7ae438d8774fce275dd9ee071ea26b8 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sat, 9 Sep 2017 17:22:01 -1000 Subject: [PATCH 008/314] updating tsconfig --- types/react-relay/tsconfig.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/react-relay/tsconfig.json b/types/react-relay/tsconfig.json index 825d91a0c2..5d225c2016 100644 --- a/types/react-relay/tsconfig.json +++ b/types/react-relay/tsconfig.json @@ -19,8 +19,6 @@ }, "files": [ "index.d.ts", - "react-relay-tests.tsx", - "react-relay-classic-tests.tsx", - "react-relay-compat-tests.tsx" + "react-relay-tests.tsx" ] } From 4a30f049202025b0bc1ed28857015dd91dbab261 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sat, 9 Sep 2017 17:31:16 -1000 Subject: [PATCH 009/314] removing Object and trying to eliminate unnecessary Function usage --- types/react-relay/index.d.ts | 12 ++++++------ types/relay-runtime/index.d.ts | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 3b073666f9..072496d849 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -18,8 +18,8 @@ declare namespace __Relay.Modern { // ~~~~~~~~~~~~~~~~~~~~~ type ConcreteFragment = any; type ConcreteBatch = any; - type ConcreteFragmentDefinition = Object; - type ConcreteOperationDefinition = Object; + type ConcreteFragmentDefinition = object; + type ConcreteOperationDefinition = object; type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; // ~~~~~~~~~~~~~~~~~~~~~ @@ -122,10 +122,10 @@ declare namespace __Relay.Modern { ): Common.Variables; type ConnectionConfig = { direction?: 'backward' | 'forward', - getConnectionFromProps?: (props: Object) => ConnectionData | void, + getConnectionFromProps?: (props: object) => ConnectionData | void, getFragmentVariables?: typeof FragmentVariablesGetter, getVariables: ( - props: Object, + props: {[propName: string]: any }, paginationInfo: {count: number, cursor: string | void}, fragmentVariables: Common.Variables, ) => Common.Variables, @@ -225,8 +225,8 @@ declare namespace __Relay.Compat { // ~~~~~~~~~~~~~~~~~~~~~ type ConcreteFragment = any; type ConcreteBatch = any; - type ConcreteFragmentDefinition = Object; - type ConcreteOperationDefinition = Object; + type ConcreteFragmentDefinition = object; + type ConcreteOperationDefinition = object; // ~~~~~~~~~~~~~~~~~~~~~ diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index cc60e34add..09c456b980 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -24,8 +24,8 @@ declare namespace __Relay.Common { type RelayQueryRequest = any; type ConcreteFragment = any; type ConcreteBatch = any; - type ConcreteFragmentDefinition = Object; - type ConcreteOperationDefinition = Object; + type ConcreteFragmentDefinition = object; + type ConcreteOperationDefinition = object; /** @@ -622,7 +622,7 @@ declare namespace __Relay.Common { preventAutoRollback: () => void, ) => void; export type RelayMutationTransactionCommitSuccessCallback = (response: { - [key: string]: Object, + [key: string]: any, }) => void; export type NetworkLayer = { sendMutation(request: RelayMutationRequest): Promise | void, @@ -693,9 +693,9 @@ declare namespace __Relay.Runtime { type RelayDebugger = any; type OptimisticUpdate = any; type OperationSelector = Common.COperationSelector; - type Selector = Common.CSelector; + type Selector = Common.CSelector; type PayloadData = any; - type Snapshot = Common.CSnapshot; + type Snapshot = Common.CSnapshot; type RelayResponsePayload = any; type MutableRecordSource = RecordSource; @@ -704,7 +704,7 @@ declare namespace __Relay.Runtime { * a GraphQL operation. */ type ExecuteFunction = ( - operation: Object, + operation: object, variables: Common.Variables, cacheConfig: Common.CacheConfig, uploadables?: Common.UploadableMap | void, @@ -737,7 +737,7 @@ declare namespace __Relay.Runtime { applyMutation(config: { operation: OperationSelector, optimisticUpdater?: Common.SelectorStoreUpdater, - optimisticResponse?: Object, + optimisticResponse?: object, }): Common.Disposable; check(readSelector: Selector): boolean; commitPayload( @@ -759,7 +759,7 @@ declare namespace __Relay.Runtime { executeMutation(config: { operation: OperationSelector, optimisticUpdater?: Common.SelectorStoreUpdater | void, - optimisticResponse?: Object | void, + optimisticResponse?: object | void, updater?: Common.SelectorStoreUpdater | void, uploadables?: Common.UploadableMap | void, }): RelayObservable; @@ -1062,7 +1062,7 @@ declare namespace __Relay.Runtime { onCompleted?: (response: T, errors: Array | void) => void, onError?: (error?: Error) => void, optimisticUpdater?: Common.SelectorStoreUpdater | void, - optimisticResponse?: Object, + optimisticResponse?: object, updater?: Common.SelectorStoreUpdater | void, }; function commitRelayModernMutation( @@ -1079,7 +1079,7 @@ declare namespace __Relay.Runtime { mutation: Common.GraphQLTaggedNode, variables: Common.Variables, optimisticUpdater?: Common.SelectorStoreUpdater, - optimisticResponse?: Object, + optimisticResponse?: object, }; // ~~~~~~~~~~~~~~~~~~~~~ @@ -1117,7 +1117,7 @@ declare namespace __Relay.Runtime { variables: Common.Variables, onCompleted?: () => void, onError?: (error: Error) => void, - onNext?: (response: Object | void) => void, + onNext?: (response: object | void) => void, updater?: (store: Common.RecordSourceSelectorProxy) => void, }; export function requestRelaySubscription( From b6a411db2a68e170d7c9467218b0cae582a0fffd Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sat, 9 Sep 2017 17:45:37 -1000 Subject: [PATCH 010/314] moving things inline with the dt generator script and downgrading typescript version to acceptable 2.4 --- types/react-relay/index.d.ts | 5 ++--- types/react-relay/tsconfig.json | 2 +- types/react-relay/tslint.json | 1 + types/relay-runtime/index.d.ts | 2 +- types/relay-runtime/tsconfig.json | 15 +++++++-------- types/relay-runtime/tslint.json | 1 + 6 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 types/react-relay/tslint.json create mode 100644 types/relay-runtime/tslint.json diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 072496d849..de3def9a00 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -1,9 +1,8 @@ // Type definitions for react-relay 1.3.0 // Project: https://github.com/facebook/relay -// Definitions by: Johannes Schickling -// Matt Martin +// Definitions by: Johannes Schickling , Matt Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.5 +// TypeScript Version: 2.4 /// /// diff --git a/types/react-relay/tsconfig.json b/types/react-relay/tsconfig.json index 5d225c2016..9cabc08c4a 100644 --- a/types/react-relay/tsconfig.json +++ b/types/react-relay/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/react-relay/tslint.json b/types/react-relay/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-relay/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 09c456b980..5e86ed0681 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/facebook/relay // Definitions by: Matt Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.5 +// TypeScript Version: 2.4 declare namespace __Relay.Common { /** diff --git a/types/relay-runtime/tsconfig.json b/types/relay-runtime/tsconfig.json index 8224ba918b..dd77fca0e4 100644 --- a/types/relay-runtime/tsconfig.json +++ b/types/relay-runtime/tsconfig.json @@ -1,8 +1,4 @@ { - "files": [ - "index.d.ts", - "relay-runtime-tests.tsx" - ], "compilerOptions": { "module": "commonjs", "lib": [ @@ -13,14 +9,17 @@ "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", - "jsx": "react", - "experimentalDecorators": true, - "forceConsistentCasingInFileNames": true, "typeRoots": [ "../" ], "types": [], "noEmit": true, + "jsx": "react", + "experimentalDecorators": true, "forceConsistentCasingInFileNames": true - } + }, + "files": [ + "index.d.ts", + "relay-runtime-tests.tsx" + ] } diff --git a/types/relay-runtime/tslint.json b/types/relay-runtime/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/relay-runtime/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 7f407c876e5c01bc293493bc78004215bb0eb106 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sat, 9 Sep 2017 17:51:02 -1000 Subject: [PATCH 011/314] fixing a couple errors --- types/react-relay/index.d.ts | 2 +- types/react-relay/react-relay-tests.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index de3def9a00..a165229584 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -146,7 +146,7 @@ declare namespace __Relay.Modern { export type RelayRefetchProp = RelayProp & { refetch: ( refetchVariables: Common.Variables | ((fragmentVariables: Common.Variables) => Common.Variables), - renderVariables: Common.Variables | void, + renderVariables?: Common.Variables, callback?: (error: Error | void) => void, options?: RefetchOptions, ) => Common.Disposable, diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/react-relay-tests.tsx index 86ec270627..2b76bc7860 100644 --- a/types/react-relay/react-relay-tests.tsx +++ b/types/react-relay/react-relay-tests.tsx @@ -29,7 +29,7 @@ import { // ~~~~~~~~~~~~~~~~~~~~~ // Modern Environment // ~~~~~~~~~~~~~~~~~~~~~ -let network: __Relay.Runtime.RelayNetwork; +const network = {} as __Relay.Runtime.RelayNetwork; const source = new RecordSource(); const store = new Store(source); const modernEnvironment = new Environment({ network, store }); @@ -113,7 +113,7 @@ class FeedStories extends React.Component { const refetchVariables = (fragmentVariables: {count: number }) => ({ count: fragmentVariables.count + 10, }); - this.props.relay.refetch(refetchVariables, null); + this.props.relay.refetch(refetchVariables); } } @@ -442,7 +442,7 @@ class StubbedArtwork extends React.Component { setVariables: () => {}, forceFetch: () => {}, hasOptimisticUpdate: () => false, - getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, + getPendingTransactions: (): any => undefined, commitUpdate: () => {}, } } From 068231de36daefce9e14e7a3110e2eaf14ab3d08 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 10 Sep 2017 09:47:01 -1000 Subject: [PATCH 012/314] working my way through relay-runtime linting errors --- types/relay-runtime/index.d.ts | 2234 ++++++++++++++++---------------- 1 file changed, 1117 insertions(+), 1117 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 5e86ed0681..80ea0dcdea 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -4,1129 +4,1129 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -declare namespace __Relay.Common { - /** - * SOURCE: - * Relay 1.3.0 - * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js - */ - // ~~~~~~~~~~~~~~~~~~~~~ - // Util - // ~~~~~~~~~~~~~~~~~~~~~ - type Maybe = T | void; +declare namespace __Relay { + namespace Common { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type RelayConcreteNode = any; - type RelayMutationTransaction = any; - type RelayMutationRequest = any; - type RelayQueryRequest = any; - type ConcreteFragment = any; - type ConcreteBatch = any; - type ConcreteFragmentDefinition = object; - type ConcreteOperationDefinition = object; - - - /** - * FIXME: RelayContainer used to be typed with ReactClass, but - * ReactClass is broken and allows for access to any property. For example - * ReactClass.getFragment('foo') is valid even though ReactClass has no - * such getFragment() type definition. When ReactClass is fixed this causes a - * lot of errors in Relay code since methods like getFragment() are used often - * but have no definition in Relay's types. Suppressing for now. - */ - export type RelayContainer = any; - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayQL - // ~~~~~~~~~~~~~~~~~~~~~ - type RelayQL = ( - strings: Array, - ...substitutions: Array - ) => Common.RelayConcreteNode; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayModernGraphQLTag - // ~~~~~~~~~~~~~~~~~~~~~ - type GeneratedNodeMap = {[key: string]: GraphQLTaggedNode}; - type GraphQLTaggedNode = - (() => ConcreteFragment | ConcreteBatch) | - { - modern: () => ConcreteFragment | ConcreteBatch, - classic: (relayQL: RelayQL) => - | ConcreteFragmentDefinition - | ConcreteOperationDefinition, - }; - // ~~~~~~~~~~~~~~~~~~~~~ - // General Usage - // ~~~~~~~~~~~~~~~~~~~~~ - export type DataID = string; - export type Variables = {[name: string]: any}; - export type Uploadable = File | Blob; - export type UploadableMap = {[key: string]: Uploadable}; - - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayNetworkTypes - // Version: Relay 1.3.0 - // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js - // ~~~~~~~~~~~~~~~~~~~~~ - - export type LegacyObserver = { - onCompleted?: (() => void) | void, - onError?: ((error: Error) => void) | void, - onNext?: ((data: T) => void) | void, - }; - export type PayloadError = { - message: string, - locations?: Array<{ - line: number, - column: number, - }>, - }; - /** - * A function that executes a GraphQL operation with request/response semantics. - * - * May return an Observable or Promise of a raw server response. - */ - export function FetchFunction( - operation: ConcreteBatch, - variables: Variables, - cacheConfig: CacheConfig, - uploadables?: Common.UploadableMap, - ): Runtime.ObservableFromValue; - - /** - * A function that executes a GraphQL subscription operation, returning one or - * more raw server responses over time. - * - * May return an Observable, otherwise must call the callbacks found in the - * fourth parameter. - */ - export type SubscribeFunction = ( - operation: ConcreteBatch, - variables: Variables, - cacheConfig: CacheConfig, - observer: LegacyObserver, - ) => Runtime.RelayObservable | Disposable; - - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayStoreTypes - // Version: Relay 1.3.0 - // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/store/RelayStoreTypes.js - // ~~~~~~~~~~~~~~~~~~~~~ - /** - * A function that receives a proxy over the store and may trigger side-effects - * (indirectly) by calling `set*` methods on the store or its record proxies. - */ - export type StoreUpdater = (store: RecordSourceProxy) => void; - - /** - * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in - * order to easily access the root fields of a query/mutation as well as a - * second argument of the response object of the mutation. - */ - export type SelectorStoreUpdater = ( - store: RecordSourceSelectorProxy, - // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is - // inconvenient to access deeply in product code. - data: any, // FLOW FIXME - ) => void; - - /** - * Extends the RecordSourceProxy interface with methods for accessing the root - * fields of a Selector. - */ - export interface RecordSourceSelectorProxy { - create(dataID: DataID, typeName: string): RecordProxy, - delete(dataID: DataID): void, - get(dataID: DataID): RecordProxy | void, - getRoot(): RecordProxy, - getRootField(fieldName: string): RecordProxy | void, - getPluralRootField(fieldName: string): RecordProxy[] | void, - } - - export interface RecordProxy { - copyFieldsFrom(source: RecordProxy): void, - getDataID(): DataID, - getLinkedRecord(name: string, args?: Variables | void): RecordProxy | void, - getLinkedRecords(name: string, args?: Variables | void): (RecordProxy | void)[] | void, - getOrCreateLinkedRecord( - name: string, - typeName: string, - args?: Variables | void, - ): RecordProxy, - getType(): string, - getValue(name: string, args?: Variables | void): any, - setLinkedRecord( - record: RecordProxy, - name: string, - args?: Variables | void, - ): RecordProxy, - setLinkedRecords( - records: (RecordProxy | void)[] | void, - name: string, - args?: Variables | void, - ): RecordProxy, - setValue(value: any, name: string, args?: Variables | void): RecordProxy, - } - - export interface RecordSourceProxy { - create(dataID: DataID, typeName: string): RecordProxy, - delete(dataID: DataID): void, - get(dataID: DataID): (RecordProxy | void)[] | void, - getRoot(): RecordProxy, - } - - export type HandleFieldPayload = { - // The arguments that were fetched. - args: Variables, - // The __id of the record containing the source/handle field. - dataID: DataID, - // The (storage) key at which the original server data was written. - fieldKey: string, - // The name of the handle. - handle: string, - // The (storage) key at which the handle's data should be written by the - // handler. - handleKey: string, - }; - interface IHandler { - update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload) => void; - [functionName: string]: Function; - } - export const Handler: IHandler; - - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCombinedEnvironmentTypes - // Version: Relay 1.3.0 - // File: https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js - // ~~~~~~~~~~~~~~~~~~~~~ - /** - * Settings for how a query response may be cached. - * - * - `force`: causes a query to be issued unconditionally, irrespective of the - * state of any configured response cache. - * - `poll`: causes a query to live update by polling at the specified interval - in milliseconds. (This value will be passed to setTimeout.) - */ - export type CacheConfig = { - force?: boolean | void, - poll?: number | void, - }; - - /** - * Represents any resource that must be explicitly disposed of. The most common - * use-case is as a return value for subscriptions, where calling `dispose()` - * would cancel the subscription. - */ - export type Disposable = { - dispose(): void, - }; - - - /** - * Arbitrary data e.g. received by a container as props. - */ - export type Props = {[key: string]: any}; - - /* - * An individual cached graph object. - */ - export type Record = {[key: string]: any}; - - /** - * A collection of records keyed by id. - */ - export type RecordMap = {[dataID: string]: Record | void}; - - /** - * A selector defines the starting point for a traversal into the graph for the - * purposes of targeting a subgraph. - */ - export type CSelector = { - dataID: DataID, - node: TNode, - variables: Variables, - }; - - /** - * A representation of a selector and its results at a particular point in time. - */ - export type CSnapshot = CSelector & { - data: SelectorData | void, - seenRecords: RecordMap, - }; - - /** - * The results of a selector given a store/RecordSource. - */ - export type SelectorData = {[key: string]: any}; - - /** - * The results of reading the results of a FragmentMap given some input - * `Props`. - */ - export type FragmentSpecResults = {[key: string]: any}; - - /** - * A utility for resolving and subscribing to the results of a fragment spec - * (key -> fragment mapping) given some "props" that determine the root ID - * and variables to use when reading each fragment. When props are changed via - * `setProps()`, the resolver will update its results and subscriptions - * accordingly. Internally, the resolver: - * - Converts the fragment map & props map into a map of `Selector`s. - * - Removes any resolvers for any props that became null. - * - Creates resolvers for any props that became non-null. - * - Updates resolvers with the latest props. - */ - export interface FragmentSpecResolver { - /** - * Stop watching for changes to the results of the fragments. - */ - dispose(): void, - - /** - * Get the current results. - */ - resolve(): FragmentSpecResults, - - /** - * Update the resolver with new inputs. Call `resolve()` to get the updated - * results. - */ - setProps(props: Props): void, - - /** - * Override the variables used to read the results of the fragments. Call - * `resolve()` to get the updated results. - */ - setVariables(variables: Variables): void, - } - - export type CFragmentMap = {[key: string]: TFragment}; - - /** - * An operation selector describes a specific instance of a GraphQL operation - * with variables applied. - * - * - `root`: a selector intended for processing server results or retaining - * response data in the store. - * - `fragment`: a selector intended for use in reading or subscribing to - * the results of the the operation. - */ - export type COperationSelector = { - fragment: CSelector, - node: TOperation, - root: CSelector, - variables: Variables, - }; - - /** - * The public API of Relay core. Represents an encapsulated environment with its - * own in-memory cache. - */ - export interface CEnvironment< - TEnvironment, - TFragment, - TGraphQLTaggedNode, - TNode, - TOperation, - TPayload, - > { - /** - * Read the results of a selector from in-memory records in the store. - */ - lookup(selector: CSelector): CSnapshot, - - /** - * Subscribe to changes to the results of a selector. The callback is called - * when data has been committed to the store that would cause the results of - * the snapshot's selector to change. - */ - subscribe( - snapshot: CSnapshot, - callback: (snapshot: CSnapshot) => void, - ): Disposable, - - /** - * Ensure that all the records necessary to fulfill the given selector are - * retained in-memory. The records will not be eligible for garbage collection - * until the returned reference is disposed. - * - * Note: This is a no-op in the classic core. - */ - retain(selector: CSelector): Disposable, - - /** - * Send a query to the server with request/response semantics: the query will - * either complete successfully (calling `onNext` and `onCompleted`) or fail - * (calling `onError`). - * - * Note: Most applications should use `streamQuery` in order to - * optionally receive updated information over time, should that feature be - * supported by the network/server. A good rule of thumb is to use this method - * if you would otherwise immediately dispose the `streamQuery()` - * after receving the first `onNext` result. - */ - sendQuery(config: { - cacheConfig?: CacheConfig | void, - onCompleted?: Maybe<() => void>, - onError?: Maybe<(error: Error) => void>, - onNext?: Maybe<(payload: TPayload) => void>, - operation: COperationSelector, - }): Disposable, - - /** - * Send a query to the server with request/subscription semantics: one or more - * responses may be returned (via `onNext`) over time followed by either - * the request completing (`onCompleted`) or an error (`onError`). - * - * Networks/servers that support subscriptions may choose to hold the - * subscription open indefinitely such that `onCompleted` is not called. - */ - streamQuery(config: { - cacheConfig?: Maybe, - onCompleted?: Maybe<() => void>, - onError?: Maybe<(error: Error) => void>, - onNext?: Maybe<(payload: TPayload) => void>, - operation: COperationSelector, - }): Disposable, - - unstable_internal: CUnstableEnvironmentCore< - TEnvironment, - TFragment, - TGraphQLTaggedNode, - TNode, - TOperation - >, - } - - export interface CUnstableEnvironmentCore< - TEnvironment, - TFragment, - TGraphQLTaggedNode, - TNode, - TOperation, - > { - /** - * Create an instance of a FragmentSpecResolver. - * - * TODO: The FragmentSpecResolver *can* be implemented via the other methods - * defined here, so this could be moved out of core. It's convenient to have - * separate implementations until the experimental core is in OSS. - */ - createFragmentSpecResolver: ( - context: CRelayContext, - containerName: string, - fragments: CFragmentMap, - props: Props, - callback: () => void, - ) => FragmentSpecResolver, - - /** - * Creates an instance of an OperationSelector given an operation definition - * (see `getOperation`) and the variables to apply. The input variables are - * filtered to exclude variables that do not matche defined arguments on the - * operation, and default values are populated for null values. - */ - createOperationSelector: ( - operation: TOperation, - variables: Variables, - ) => COperationSelector, - - /** - * Given a graphql`...` tagged template, extract a fragment definition usable - * by this version of Relay core. Throws if the value is not a fragment. - */ - getFragment: (node: TGraphQLTaggedNode) => TFragment, - - /** - * Given a graphql`...` tagged template, extract an operation definition - * usable by this version of Relay core. Throws if the value is not an - * operation. - */ - getOperation: (node: TGraphQLTaggedNode) => TOperation, - - /** - * Determine if two selectors are equal (represent the same selection). Note - * that this function returns `false` when the two queries/fragments are - * different objects, even if they select the same fields. - */ - areEqualSelectors: (a: CSelector, b: CSelector) => boolean, - - /** - * Given the result `item` from a parent that fetched `fragment`, creates a - * selector that can be used to read the results of that fragment for that item. - * - * Example: - * - * Given two fragments as follows: - * - * ``` - * fragment Parent on User { - * id - * ...Child - * } - * fragment Child on User { - * name - * } - * ``` - * - * And given some object `parent` that is the results of `Parent` for id "4", - * the results of `Child` can be accessed by first getting a selector and then - * using that selector to `lookup()` the results against the environment: - * - * ``` - * const childSelector = getSelector(queryVariables, Child, parent); - * const childData = environment.lookup(childSelector).data; - * ``` - */ - getSelector: ( - operationVariables: Variables, - fragment: TFragment, - prop: any, - ) => CSelector | void, - - /** - * Given the result `items` from a parent that fetched `fragment`, creates a - * selector that can be used to read the results of that fragment on those - * items. This is similar to `getSelector` but for "plural" fragments that - * expect an array of results and therefore return an array of selectors. - */ - getSelectorList: ( - operationVariables: Variables, - fragment: TFragment, - props: Array, - ) => Array> | void, - - /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts the selectors for those fragments from the results. - * - * The canonical use-case for this function are Relay Containers, which - * use this function to convert (props, fragments) into selectors so that they - * can read the results to pass to the inner component. - */ - getSelectorsFromObject: ( - operationVariables: Variables, - fragments: CFragmentMap, - props: Props, - ) => {[key: string]: Maybe<(CSelector | Array>)>}, - - /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts a mapping of keys -> id(s) of the results. - * - * Similar to `getSelectorsFromObject()`, this function can be useful in - * determining the "identity" of the props passed to a component. - */ - getDataIDsFromObject: ( - fragments: CFragmentMap, - props: Props, - ) => {[key: string]: Maybe<(DataID | Array)>}, - - /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts the merged variables that would be in scope for those - * fragments/results. - * - * This can be useful in determing what varaibles were used to fetch the data - * for a Relay container, for example. - */ - getVariablesFromObject: ( - operationVariables: Variables, - fragments: CFragmentMap, - props: Props, - ) => Variables, - } - - /** - * The type of the `relay` property set on React context by the React/Relay - * integration layer (e.g. QueryRenderer, FragmentContainer, etc). - */ - export type CRelayContext = { - environment: TEnvironment, - variables: Variables, - }; - - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayTypes - /** - * Version: Relay 1.3.0 - * File: - * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js - */ - // ~~~~~~~~~~~~~~~~~~~~~ - export type RerunParam = { - param: string, - import: string, - max_runs: number, - }; - interface FIELDS_CHANGE { - type: 'FIELDS_CHANGE', - fieldIDs: {[fieldName: string]: DataID | Array}, - } - interface RANGE_ADD { - type: 'RANGE_ADD', - parentName?: string, - parentID?: string, - connectionInfo?: Array<{ - key: string, - filters?: Variables, - rangeBehavior: string, - }>, - connectionName?: string, - edgeName: string, - rangeBehaviors?: RangeBehaviors, - } - interface NODE_DELETE { - type: 'NODE_DELETE', - parentName?: string, - parentID?: string, - connectionName?: string, - deletedIDFieldName: string, - } - interface RANGE_DELETE { - type: 'RANGE_DELETE', - parentName?: string, - parentID?: string, - connectionKeys?: Array<{ - key: string, - filters?: Variables, - }>, - connectionName?: string, - deletedIDFieldName: string | Array, - pathToConnection: Array, - } - interface REQUIRED_CHILDREN { - type: 'REQUIRED_CHILDREN', - children: Array, - } - export type RelayMutationConfig = - FIELDS_CHANGE | - RANGE_ADD | - NODE_DELETE | - RANGE_DELETE | - REQUIRED_CHILDREN; - - export type RelayMutationTransactionCommitCallbacks = { - onFailure?: RelayMutationTransactionCommitFailureCallback, - onSuccess?: RelayMutationTransactionCommitSuccessCallback, - }; - export type RelayMutationTransactionCommitFailureCallback = ( - transaction: RelayMutationTransaction, - preventAutoRollback: () => void, - ) => void; - export type RelayMutationTransactionCommitSuccessCallback = (response: { - [key: string]: any, - }) => void; - export type NetworkLayer = { - sendMutation(request: RelayMutationRequest): Promise | void, - sendQueries(requests: Array): Promise | void, - supports(...options: Array): boolean, - }; - export type QueryResult = { - error?: Error | void, - ref_params?: {[name: string]: any} | void, - response: QueryPayload, - }; - export type ReadyState = { - aborted: boolean, - done: boolean, - error: Error | void, - events: Array, - ready: boolean, - stale: boolean, - }; - type RelayContainerErrorEventType = - | 'CACHE_RESTORE_FAILED' - | 'NETWORK_QUERY_ERROR'; - type RelayContainerLoadingEventType = - | 'ABORT' - | 'CACHE_RESTORED_REQUIRED' - | 'CACHE_RESTORE_START' - | 'NETWORK_QUERY_RECEIVED_ALL' - | 'NETWORK_QUERY_RECEIVED_REQUIRED' - | 'NETWORK_QUERY_START' - | 'STORE_FOUND_ALL' - | 'STORE_FOUND_REQUIRED'; - export type ReadyStateChangeCallback = (readyState: ReadyState) => void; - export type ReadyStateEvent = { - type: RelayContainerLoadingEventType | RelayContainerErrorEventType, - error?: Error, - }; - export type Abortable = { - abort(): void, - }; - - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayInternalTypes - /** - * Version: Relay 1.3.0 - * File: - * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js - */ - // ~~~~~~~~~~~~~~~~~~~~~ - export type QueryPayload = {[key: string]: any}; - export type RelayQuerySet = {[queryName: string]: any}; - type RangeBehaviorsFunction = (connectionArgs: { - [argName: string]: any, - }) => 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; - type RangeBehaviorsObject = { - [key: string]: 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; - }; - export type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; - } - - - - -declare namespace __Relay.Runtime { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type RelayDebugger = any; - type OptimisticUpdate = any; - type OperationSelector = Common.COperationSelector; - type Selector = Common.CSelector; - type PayloadData = any; - type Snapshot = Common.CSnapshot; - type RelayResponsePayload = any; - type MutableRecordSource = RecordSource; - - /** - * A function that returns an Observable representing the response of executing - * a GraphQL operation. - */ - type ExecuteFunction = ( - operation: object, - variables: Common.Variables, - cacheConfig: Common.CacheConfig, - uploadables?: Common.UploadableMap | void, - ) => Promise; - type RelayNetwork = { - execute: ExecuteFunction, - }; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayDefaultHandlerProvider - // ~~~~~~~~~~~~~~~~~~~~~ - export function HandlerProvider(name: string): typeof Common.Handler | void; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayModernEnvironment - // ~~~~~~~~~~~~~~~~~~~~~ - type EnvironmentConfig = { - configName?: string, - handlerProvider?: typeof HandlerProvider, - network: Network, - store: Store, - }; - class Environment { - constructor (config: EnvironmentConfig); - getStore(): Store; - getDebugger(): RelayDebugger; - applyUpdate(optimisticUpdate: OptimisticUpdate): Common.Disposable; - revertUpdate(update: OptimisticUpdate): void; - replaceUpdate(update: OptimisticUpdate, newUpdate: OptimisticUpdate): void; - applyMutation(config: { - operation: OperationSelector, - optimisticUpdater?: Common.SelectorStoreUpdater, - optimisticResponse?: object, - }): Common.Disposable; - check(readSelector: Selector): boolean; - commitPayload( - operationSelector: OperationSelector, - payload: PayloadData, - ): void; - commitUpdate(updater: Common.StoreUpdater): void; - lookup(readSelector: Selector): Snapshot; - subscribe( - snapshot: Snapshot, - callback: (snapshot: Snapshot) => void, - ): Common.Disposable; - retain(selector: Selector): Common.Disposable; - execute(config: { - operation: OperationSelector, - cacheConfig?: Common.CacheConfig | void, - updater?: Common.SelectorStoreUpdater | void, - }): RelayObservable; - executeMutation(config: { - operation: OperationSelector, - optimisticUpdater?: Common.SelectorStoreUpdater | void, - optimisticResponse?: object | void, - updater?: Common.SelectorStoreUpdater | void, - uploadables?: Common.UploadableMap | void, - }): RelayObservable; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayInMemoryRecordSource - // ~~~~~~~~~~~~~~~~~~~~~ - type Record = {[key: string]: any}; - type RecordMap = {[dataID: string]: Record | void}; - - // ~~~~~~~~~~~~~~~~~~~~~ - // Network - // ~~~~~~~~~~~~~~~~~~~~~ - class Network { /** - * Creates an implementation of the `Network` interface defined in - * `RelayNetworkTypes` given `fetch` and `subscribe` functions. + * SOURCE: + * Relay 1.3.0 + * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js + */ + // ~~~~~~~~~~~~~~~~~~~~~ + // Util + // ~~~~~~~~~~~~~~~~~~~~~ + type Maybe = T | void; + + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayConcreteNode = any; + type RelayMutationTransaction = any; + type RelayMutationRequest = any; + type RelayQueryRequest = any; + type ConcreteFragment = any; + type ConcreteBatch = any; + type ConcreteFragmentDefinition = object; + type ConcreteOperationDefinition = object; + + + /** + * FIXME: RelayContainer used to be typed with ReactClass, but + * ReactClass is broken and allows for access to any property. For example + * ReactClass.getFragment('foo') is valid even though ReactClass has no + * such getFragment() type definition. When ReactClass is fixed this causes a + * lot of errors in Relay code since methods like getFragment() are used often + * but have no definition in Relay's types. Suppressing for now. */ - static create(fetchFn: typeof Common.FetchFunction, subscribeFn?: Common.SubscribeFunction): RelayNetwork; + export type RelayContainer = any; + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayQL + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayQL = ( + strings: string[], + ...substitutions: any[] + ) => Common.RelayConcreteNode; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayModernGraphQLTag + // ~~~~~~~~~~~~~~~~~~~~~ + type GeneratedNodeMap = { [key: string]: GraphQLTaggedNode }; + type GraphQLTaggedNode = + (() => ConcreteFragment | ConcreteBatch) | + { + modern: () => ConcreteFragment | ConcreteBatch, + classic: (relayQL: RelayQL) => + | ConcreteFragmentDefinition + | ConcreteOperationDefinition, + }; + // ~~~~~~~~~~~~~~~~~~~~~ + // General Usage + // ~~~~~~~~~~~~~~~~~~~~~ + export type DataID = string; + export type Variables = { [name: string]: any }; + export type Uploadable = File | Blob; + export type UploadableMap = { [key: string]: Uploadable }; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayNetworkTypes + // Version: Relay 1.3.0 + // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js + // ~~~~~~~~~~~~~~~~~~~~~ + + export type LegacyObserver = { + onCompleted?: (() => void) | void, + onError?: ((error: Error) => void) | void, + onNext?: ((data: T) => void) | void, + }; + export type PayloadError = { + message: string, + locations?: Array<{ + line: number, + column: number, + }>, + }; + /** + * A function that executes a GraphQL operation with request/response semantics. + * + * May return an Observable or Promise of a raw server response. + */ + export function FetchFunction( + operation: ConcreteBatch, + variables: Variables, + cacheConfig: CacheConfig, + uploadables?: Common.UploadableMap, + ): Runtime.ObservableFromValue; + + /** + * A function that executes a GraphQL subscription operation, returning one or + * more raw server responses over time. + * + * May return an Observable, otherwise must call the callbacks found in the + * fourth parameter. + */ + export type SubscribeFunction = ( + operation: ConcreteBatch, + variables: Variables, + cacheConfig: CacheConfig, + observer: LegacyObserver, + ) => Runtime.RelayObservable | Disposable; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayStoreTypes + // Version: Relay 1.3.0 + // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/store/RelayStoreTypes.js + // ~~~~~~~~~~~~~~~~~~~~~ + /** + * A function that receives a proxy over the store and may trigger side-effects + * (indirectly) by calling `set*` methods on the store or its record proxies. + */ + export type StoreUpdater = (store: RecordSourceProxy) => void; + + /** + * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in + * order to easily access the root fields of a query/mutation as well as a + * second argument of the response object of the mutation. + */ + export type SelectorStoreUpdater = ( + store: RecordSourceSelectorProxy, + // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is + // inconvenient to access deeply in product code. + data: any, // FLOW FIXME + ) => void; + + /** + * Extends the RecordSourceProxy interface with methods for accessing the root + * fields of a Selector. + */ + export interface RecordSourceSelectorProxy { + create(dataID: DataID, typeName: string): RecordProxy, + delete(dataID: DataID): void, + get(dataID: DataID): RecordProxy | void, + getRoot(): RecordProxy, + getRootField(fieldName: string): RecordProxy | void, + getPluralRootField(fieldName: string): RecordProxy[] | void, + } + + export interface RecordProxy { + copyFieldsFrom(source: RecordProxy): void, + getDataID(): DataID, + getLinkedRecord(name: string, args?: Variables | void): RecordProxy | void, + getLinkedRecords(name: string, args?: Variables | void): Array | void, + getOrCreateLinkedRecord( + name: string, + typeName: string, + args?: Variables | void, + ): RecordProxy, + getType(): string, + getValue(name: string, args?: Variables | void): any, + setLinkedRecord( + record: RecordProxy, + name: string, + args?: Variables | void, + ): RecordProxy, + setLinkedRecords( + records: (RecordProxy | void)[] | void, + name: string, + args?: Variables | void, + ): RecordProxy, + setValue(value: any, name: string, args?: Variables | void): RecordProxy, + } + + export interface RecordSourceProxy { + create(dataID: DataID, typeName: string): RecordProxy, + delete(dataID: DataID): void, + get(dataID: DataID): (RecordProxy | void)[] | void, + getRoot(): RecordProxy, + } + + export type HandleFieldPayload = { + // The arguments that were fetched. + args: Variables, + // The __id of the record containing the source/handle field. + dataID: DataID, + // The (storage) key at which the original server data was written. + fieldKey: string, + // The name of the handle. + handle: string, + // The (storage) key at which the handle's data should be written by the + // handler. + handleKey: string, + }; + interface IHandler { + update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload) => void; + [functionName: string]: (...args: any[]) => any; + } + export const Handler: IHandler; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCombinedEnvironmentTypes + // Version: Relay 1.3.0 + // File: https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js + // ~~~~~~~~~~~~~~~~~~~~~ + /** + * Settings for how a query response may be cached. + * + * - `force`: causes a query to be issued unconditionally, irrespective of the + * state of any configured response cache. + * - `poll`: causes a query to live update by polling at the specified interval + in milliseconds. (This value will be passed to setTimeout.) + */ + export type CacheConfig = { + force?: boolean | void, + poll?: number | void, + }; + + /** + * Represents any resource that must be explicitly disposed of. The most common + * use-case is as a return value for subscriptions, where calling `dispose()` + * would cancel the subscription. + */ + export type Disposable = { + dispose(): void, + }; + + + /** + * Arbitrary data e.g. received by a container as props. + */ + export type Props = { [key: string]: any }; + + /* + * An individual cached graph object. + */ + export type Record = { [key: string]: any }; + + /** + * A collection of records keyed by id. + */ + export type RecordMap = { [dataID: string]: Record | void }; + + /** + * A selector defines the starting point for a traversal into the graph for the + * purposes of targeting a subgraph. + */ + export type CSelector = { + dataID: DataID, + node: TNode, + variables: Variables, + }; + + /** + * A representation of a selector and its results at a particular point in time. + */ + export type CSnapshot = CSelector & { + data: SelectorData | void, + seenRecords: RecordMap, + }; + + /** + * The results of a selector given a store/RecordSource. + */ + export type SelectorData = { [key: string]: any }; + + /** + * The results of reading the results of a FragmentMap given some input + * `Props`. + */ + export type FragmentSpecResults = { [key: string]: any }; + + /** + * A utility for resolving and subscribing to the results of a fragment spec + * (key -> fragment mapping) given some "props" that determine the root ID + * and variables to use when reading each fragment. When props are changed via + * `setProps()`, the resolver will update its results and subscriptions + * accordingly. Internally, the resolver: + * - Converts the fragment map & props map into a map of `Selector`s. + * - Removes any resolvers for any props that became null. + * - Creates resolvers for any props that became non-null. + * - Updates resolvers with the latest props. + */ + export interface FragmentSpecResolver { + /** + * Stop watching for changes to the results of the fragments. + */ + dispose(): void, + + /** + * Get the current results. + */ + resolve(): FragmentSpecResults, + + /** + * Update the resolver with new inputs. Call `resolve()` to get the updated + * results. + */ + setProps(props: Props): void, + + /** + * Override the variables used to read the results of the fragments. Call + * `resolve()` to get the updated results. + */ + setVariables(variables: Variables): void, + } + + export type CFragmentMap = { [key: string]: TFragment }; + + /** + * An operation selector describes a specific instance of a GraphQL operation + * with variables applied. + * + * - `root`: a selector intended for processing server results or retaining + * response data in the store. + * - `fragment`: a selector intended for use in reading or subscribing to + * the results of the the operation. + */ + export type COperationSelector = { + fragment: CSelector, + node: TOperation, + root: CSelector, + variables: Variables, + }; + + /** + * The public API of Relay core. Represents an encapsulated environment with its + * own in-memory cache. + */ + export interface CEnvironment< + TEnvironment, + TFragment, + TGraphQLTaggedNode, + TNode, + TOperation, + TPayload, + > { + /** + * Read the results of a selector from in-memory records in the store. + */ + lookup(selector: CSelector): CSnapshot, + + /** + * Subscribe to changes to the results of a selector. The callback is called + * when data has been committed to the store that would cause the results of + * the snapshot's selector to change. + */ + subscribe( + snapshot: CSnapshot, + callback: (snapshot: CSnapshot) => void, + ): Disposable, + + /** + * Ensure that all the records necessary to fulfill the given selector are + * retained in-memory. The records will not be eligible for garbage collection + * until the returned reference is disposed. + * + * Note: This is a no-op in the classic core. + */ + retain(selector: CSelector): Disposable, + + /** + * Send a query to the server with request/response semantics: the query will + * either complete successfully (calling `onNext` and `onCompleted`) or fail + * (calling `onError`). + * + * Note: Most applications should use `streamQuery` in order to + * optionally receive updated information over time, should that feature be + * supported by the network/server. A good rule of thumb is to use this method + * if you would otherwise immediately dispose the `streamQuery()` + * after receving the first `onNext` result. + */ + sendQuery(config: { + cacheConfig?: CacheConfig | void, + onCompleted?: Maybe<() => void>, + onError?: Maybe<(error: Error) => void>, + onNext?: Maybe<(payload: TPayload) => void>, + operation: COperationSelector, + }): Disposable, + + /** + * Send a query to the server with request/subscription semantics: one or more + * responses may be returned (via `onNext`) over time followed by either + * the request completing (`onCompleted`) or an error (`onError`). + * + * Networks/servers that support subscriptions may choose to hold the + * subscription open indefinitely such that `onCompleted` is not called. + */ + streamQuery(config: { + cacheConfig?: Maybe, + onCompleted?: Maybe<() => void>, + onError?: Maybe<(error: Error) => void>, + onNext?: Maybe<(payload: TPayload) => void>, + operation: COperationSelector, + }): Disposable, + + unstable_internal: CUnstableEnvironmentCore< + TEnvironment, + TFragment, + TGraphQLTaggedNode, + TNode, + TOperation + >, + } + + export interface CUnstableEnvironmentCore< + TEnvironment, + TFragment, + TGraphQLTaggedNode, + TNode, + TOperation, + > { + /** + * Create an instance of a FragmentSpecResolver. + * + * TODO: The FragmentSpecResolver *can* be implemented via the other methods + * defined here, so this could be moved out of core. It's convenient to have + * separate implementations until the experimental core is in OSS. + */ + createFragmentSpecResolver: ( + context: CRelayContext, + containerName: string, + fragments: CFragmentMap, + props: Props, + callback: () => void, + ) => FragmentSpecResolver, + + /** + * Creates an instance of an OperationSelector given an operation definition + * (see `getOperation`) and the variables to apply. The input variables are + * filtered to exclude variables that do not matche defined arguments on the + * operation, and default values are populated for null values. + */ + createOperationSelector: ( + operation: TOperation, + variables: Variables, + ) => COperationSelector, + + /** + * Given a graphql`...` tagged template, extract a fragment definition usable + * by this version of Relay core. Throws if the value is not a fragment. + */ + getFragment: (node: TGraphQLTaggedNode) => TFragment, + + /** + * Given a graphql`...` tagged template, extract an operation definition + * usable by this version of Relay core. Throws if the value is not an + * operation. + */ + getOperation: (node: TGraphQLTaggedNode) => TOperation, + + /** + * Determine if two selectors are equal (represent the same selection). Note + * that this function returns `false` when the two queries/fragments are + * different objects, even if they select the same fields. + */ + areEqualSelectors: (a: CSelector, b: CSelector) => boolean, + + /** + * Given the result `item` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment for that item. + * + * Example: + * + * Given two fragments as follows: + * + * ``` + * fragment Parent on User { + * id + * ...Child + * } + * fragment Child on User { + * name + * } + * ``` + * + * And given some object `parent` that is the results of `Parent` for id "4", + * the results of `Child` can be accessed by first getting a selector and then + * using that selector to `lookup()` the results against the environment: + * + * ``` + * const childSelector = getSelector(queryVariables, Child, parent); + * const childData = environment.lookup(childSelector).data; + * ``` + */ + getSelector: ( + operationVariables: Variables, + fragment: TFragment, + prop: any, + ) => CSelector | void, + + /** + * Given the result `items` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment on those + * items. This is similar to `getSelector` but for "plural" fragments that + * expect an array of results and therefore return an array of selectors. + */ + getSelectorList: ( + operationVariables: Variables, + fragment: TFragment, + props: any[], + ) => Array> | void, + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the selectors for those fragments from the results. + * + * The canonical use-case for this function are Relay Containers, which + * use this function to convert (props, fragments) into selectors so that they + * can read the results to pass to the inner component. + */ + getSelectorsFromObject: ( + operationVariables: Variables, + fragments: CFragmentMap, + props: Props, + ) => { [key: string]: Maybe<(CSelector | Array>)> }, + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts a mapping of keys -> id(s) of the results. + * + * Similar to `getSelectorsFromObject()`, this function can be useful in + * determining the "identity" of the props passed to a component. + */ + getDataIDsFromObject: ( + fragments: CFragmentMap, + props: Props, + ) => { [key: string]: Maybe<(DataID | Array)> }, + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the merged variables that would be in scope for those + * fragments/results. + * + * This can be useful in determing what varaibles were used to fetch the data + * for a Relay container, for example. + */ + getVariablesFromObject: ( + operationVariables: Variables, + fragments: CFragmentMap, + props: Props, + ) => Variables, + } + + /** + * The type of the `relay` property set on React context by the React/Relay + * integration layer (e.g. QueryRenderer, FragmentContainer, etc). + */ + export type CRelayContext = { + environment: TEnvironment, + variables: Variables, + }; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayTypes + /** + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js + */ + // ~~~~~~~~~~~~~~~~~~~~~ + export type RerunParam = { + param: string, + import: string, + max_runs: number, + }; + interface FIELDS_CHANGE { + type: 'FIELDS_CHANGE', + fieldIDs: { [fieldName: string]: DataID | Array }, + } + interface RANGE_ADD { + type: 'RANGE_ADD', + parentName?: string, + parentID?: string, + connectionInfo?: Array<{ + key: string, + filters?: Variables, + rangeBehavior: string, + }>, + connectionName?: string, + edgeName: string, + rangeBehaviors?: RangeBehaviors, + } + interface NODE_DELETE { + type: 'NODE_DELETE', + parentName?: string, + parentID?: string, + connectionName?: string, + deletedIDFieldName: string, + } + interface RANGE_DELETE { + type: 'RANGE_DELETE', + parentName?: string, + parentID?: string, + connectionKeys?: Array<{ + key: string, + filters?: Variables, + }>, + connectionName?: string, + deletedIDFieldName: string | string[], + pathToConnection: string[], + } + interface REQUIRED_CHILDREN { + type: 'REQUIRED_CHILDREN', + children: Array, + } + export type RelayMutationConfig = + FIELDS_CHANGE | + RANGE_ADD | + NODE_DELETE | + RANGE_DELETE | + REQUIRED_CHILDREN; + + export type RelayMutationTransactionCommitCallbacks = { + onFailure?: RelayMutationTransactionCommitFailureCallback, + onSuccess?: RelayMutationTransactionCommitSuccessCallback, + }; + export type RelayMutationTransactionCommitFailureCallback = ( + transaction: RelayMutationTransaction, + preventAutoRollback: () => void, + ) => void; + export type RelayMutationTransactionCommitSuccessCallback = (response: { + [key: string]: any, + }) => void; + export type NetworkLayer = { + sendMutation(request: RelayMutationRequest): Promise | void, + sendQueries(requests: Array): Promise | void, + supports(...options: string[]): boolean, + }; + export type QueryResult = { + error?: Error | void, + ref_params?: { [name: string]: any } | void, + response: QueryPayload, + }; + export type ReadyState = { + aborted: boolean, + done: boolean, + error: Error | void, + events: Array, + ready: boolean, + stale: boolean, + }; + type RelayContainerErrorEventType = + | 'CACHE_RESTORE_FAILED' + | 'NETWORK_QUERY_ERROR'; + type RelayContainerLoadingEventType = + | 'ABORT' + | 'CACHE_RESTORED_REQUIRED' + | 'CACHE_RESTORE_START' + | 'NETWORK_QUERY_RECEIVED_ALL' + | 'NETWORK_QUERY_RECEIVED_REQUIRED' + | 'NETWORK_QUERY_START' + | 'STORE_FOUND_ALL' + | 'STORE_FOUND_REQUIRED'; + export type ReadyStateChangeCallback = (readyState: ReadyState) => void; + export type ReadyStateEvent = { + type: RelayContainerLoadingEventType | RelayContainerErrorEventType, + error?: Error, + }; + export type Abortable = { + abort(): void, + }; + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayInternalTypes + /** + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js + */ + // ~~~~~~~~~~~~~~~~~~~~~ + export type QueryPayload = { [key: string]: any }; + export type RelayQuerySet = { [queryName: string]: any }; + type RangeBehaviorsFunction = (connectionArgs: { + [argName: string]: any, + }) => 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; + type RangeBehaviorsObject = { + [key: string]: 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; + }; + export type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; } - // ~~~~~~~~~~~~~~~~~~~~~ - // Network - // ~~~~~~~~~~~~~~~~~~~~~ - class RecordSource { - constructor(records?: RecordMap); - clear(): void; - delete(dataID: Common.DataID): void; - get(dataID: Common.DataID): Record | void; - getRecordIDs(): Common.DataID[]; - getStatus(dataID: Common.DataID): 'EXISTENT' | 'NONEXISTENT' | 'UNKNOWN'; - has(dataID: Common.DataID): boolean; - load( - dataID: Common.DataID, - callback: (error: Error | void, record: Record | void) => void, - ): void; - remove(dataID: Common.DataID): void; - set(dataID: Common.DataID, record: Record): void; - size(): number; - toJSON(): RecordMap; + namespace Runtime { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayDebugger = any; + type OptimisticUpdate = any; + type OperationSelector = Common.COperationSelector; + type Selector = Common.CSelector; + type PayloadData = any; + type Snapshot = Common.CSnapshot; + type RelayResponsePayload = any; + type MutableRecordSource = RecordSource; + + /** + * A function that returns an Observable representing the response of executing + * a GraphQL operation. + */ + type ExecuteFunction = ( + operation: object, + variables: Common.Variables, + cacheConfig: Common.CacheConfig, + uploadables?: Common.UploadableMap | void, + ) => Promise; + type RelayNetwork = { + execute: ExecuteFunction, + }; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayDefaultHandlerProvider + // ~~~~~~~~~~~~~~~~~~~~~ + export function HandlerProvider(name: string): typeof Common.Handler | void; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayModernEnvironment + // ~~~~~~~~~~~~~~~~~~~~~ + type EnvironmentConfig = { + configName?: string, + handlerProvider?: typeof HandlerProvider, + network: Network, + store: Store, + }; + class Environment { + constructor(config: EnvironmentConfig); + getStore(): Store; + getDebugger(): RelayDebugger; + applyUpdate(optimisticUpdate: OptimisticUpdate): Common.Disposable; + revertUpdate(update: OptimisticUpdate): void; + replaceUpdate(update: OptimisticUpdate, newUpdate: OptimisticUpdate): void; + applyMutation(config: { + operation: OperationSelector, + optimisticUpdater?: Common.SelectorStoreUpdater, + optimisticResponse?: object, + }): Common.Disposable; + check(readSelector: Selector): boolean; + commitPayload( + operationSelector: OperationSelector, + payload: PayloadData, + ): void; + commitUpdate(updater: Common.StoreUpdater): void; + lookup(readSelector: Selector): Snapshot; + subscribe( + snapshot: Snapshot, + callback: (snapshot: Snapshot) => void, + ): Common.Disposable; + retain(selector: Selector): Common.Disposable; + execute(config: { + operation: OperationSelector, + cacheConfig?: Common.CacheConfig | void, + updater?: Common.SelectorStoreUpdater | void, + }): RelayObservable; + executeMutation(config: { + operation: OperationSelector, + optimisticUpdater?: Common.SelectorStoreUpdater | void, + optimisticResponse?: object | void, + updater?: Common.SelectorStoreUpdater | void, + uploadables?: Common.UploadableMap | void, + }): RelayObservable; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayInMemoryRecordSource + // ~~~~~~~~~~~~~~~~~~~~~ + type Record = { [key: string]: any }; + type RecordMap = { [dataID: string]: Record | void }; + + // ~~~~~~~~~~~~~~~~~~~~~ + // Network + // ~~~~~~~~~~~~~~~~~~~~~ + class Network { + /** + * Creates an implementation of the `Network` interface defined in + * `RelayNetworkTypes` given `fetch` and `subscribe` functions. + */ + static create(fetchFn: typeof Common.FetchFunction, subscribeFn?: Common.SubscribeFunction): RelayNetwork; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // Network + // ~~~~~~~~~~~~~~~~~~~~~ + class RecordSource { + constructor(records?: RecordMap); + clear(): void; + delete(dataID: Common.DataID): void; + get(dataID: Common.DataID): Record | void; + getRecordIDs(): Common.DataID[]; + getStatus(dataID: Common.DataID): 'EXISTENT' | 'NONEXISTENT' | 'UNKNOWN'; + has(dataID: Common.DataID): boolean; + load( + dataID: Common.DataID, + callback: (error: Error | void, record: Record | void) => void, + ): void; + remove(dataID: Common.DataID): void; + set(dataID: Common.DataID, record: Record): void; + size(): number; + toJSON(): RecordMap; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // ModernStore + // ~~~~~~~~~~~~~~~~~~~~~ + class Store { + constructor(source: RecordSource); + getSource(): MutableRecordSource; + check(selector: Selector): boolean; + retain(selector: Selector): Common.Disposable; + lookup(selector: Selector): Snapshot; + notify(): void; + publish(source: RecordSource): void; + subscribe( + snapshot: Snapshot, + callback: (snapshot: Snapshot) => void, + ): Common.Disposable; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayRecordSourceInspector + // ~~~~~~~~~~~~~~~~~~~~~ + /** + * An internal class to provide a console-friendly string representation of a + * Record. + */ + class RecordSummary { + id: Common.DataID; + type: string | void; + static createFromRecord(id: Common.DataID, record: any): RecordSummary; + constructor(id: Common.DataID, type: string | void); + toString(): string; + } + /** + * Internal class for inspecting a single Record. + */ + class RecordInspector { + constructor(sourceInspector: RelayRecordSourceInspector, record: Record); + /** + * Get the cache id of the given record. For types that implement the `Node` + * interface (or that have an `id`) this will be `id`, for other types it will be + * a synthesized identifier based on the field path from the nearest ancestor + * record that does have an `id`. + */ + getDataID(): Common.DataID; + + /** + * Returns a list of the fields that have been fetched on the current record. + */ + getFields(): string[]; + + /** + * Returns the type of the record. + */ + getType(): string; + + /** + * Returns a copy of the internal representation of the record. + */ + inspect(): any; + + /** + * Returns the value of a scalar field. May throw if the given field is + * present but not actually scalar. + */ + getValue(name: string, args?: Common.Variables | void): any; + + /** + * Returns an inspector for the given scalar "linked" field (a field whose + * value is another Record instead of a scalar). May throw if the field is + * present but not a scalar linked record. + */ + getLinkedRecord(name: string, args?: Common.Variables | void): RecordInspector | void; + + /** + * Returns an array of inspectors for the given plural "linked" field (a field + * whose value is an array of Records instead of a scalar). May throw if the + * field is present but not a plural linked record. + */ + getLinkedRecords(name: string, args?: Common.Variables | void): RecordInspector[] | void; + } + + class RelayRecordSourceInspector { + constructor(source: RecordSource); + static getForEnvironment(environment: Environment): RelayRecordSourceInspector; + /** + * Returns an inspector for the record with the given id, or null/undefined if + * that record is deleted/unfetched. + */ + get(dataID: Common.DataID): RecordInspector | void; + /** + * Returns a list of ": " for each record in the store that has an + * `id`. + */ + getNodes(): Array; + /** + * Returns a list of ": " for all records in the store including + * those that do not have an `id`. + */ + getRecords(): Array; + + /** + * Returns an inspector for the synthesized "root" object, allowing access to + * e.g. the `viewer` object or the results of other fields on the "Query" + * type. + */ + getRoot(): RecordInspector; + } + + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayObservable + // ~~~~~~~~~~~~~~~~~~~~~ + type Subscription = { + unsubscribe: () => void, + readonly closed: boolean, + }; + type Observer = { + start?: ((subscription: Subscription) => any) | void, + next?: ((nextThing: T) => any) | void, + error?: ((error: Error) => any) | void, + complete?: (() => any) | void, + unsubscribe?: ((subscription: Subscription) => any) | void, + }; + type Source = () => any; + interface Subscribable { + subscribe(observer: Observer): Subscription, + } + type ObservableFromValue = RelayObservable | Promise | T; + class RelayObservable implements Subscribable { + _source: Source; + + constructor(source: Source); + + /** + * When an unhandled error is detected, it is reported to the host environment + * (the ESObservable spec refers to this method as "HostReportErrors()"). + * + * The default implementation in development builds re-throws errors in a + * separate frame, and from production builds does nothing (swallowing + * uncaught errors). + * + * Called during application initialization, this method allows + * application-specific handling of uncaught errors. Allowing, for example, + * integration with error logging or developer tools. + */ + static onUnhandledError(callback: (error: Error) => any): void; + + /** + * Accepts various kinds of data sources, and always returns a RelayObservable + * useful for accepting the result of a user-provided FetchFunction. + */ + static from(obj: ObservableFromValue): RelayObservable; + + /** + * Creates a RelayObservable, given a function which expects a legacy + * Relay Observer as the last argument and which returns a Disposable. + * + * To support migration to Observable, the function may ignore the + * legacy Relay observer and directly return an Observable instead. + */ + static fromLegacy( + callback: (legacyObserver: Common.LegacyObserver) => Common.Disposable | RelayObservable, + ): RelayObservable; + + /** + * Returns a new Observable which returns the same values as this one, but + * modified so that the provided Observer is called to perform a side-effects + * for all events emitted by the source. + * + * Any errors that are thrown in the side-effect Observer are unhandled, and + * do not affect the source Observable or its Observer. + * + * This is useful for when debugging your Observables or performing other + * side-effects such as logging or performance monitoring. + */ + do(observer: Observer): RelayObservable; + + /** + * Returns a new Observable which returns the same values as this one, but + * modified so that the finally callback is performed after completion, + * whether normal or due to error or unsubscription. + * + * This is useful for cleanup such as resource finalization. + */ + finally(fn: () => any): RelayObservable; + + /** + * Returns a new Observable which is identical to this one, unless this + * Observable completes before yielding any values, in which case the new + * Observable will yield the values from the alternate Observable. + * + * If this Observable does yield values, the alternate is never subscribed to. + * + * This is useful for scenarios where values may come from multiple sources + * which should be tried in order, i.e. from a cache before a network. + */ + ifEmpty(alternate: RelayObservable): RelayObservable; + + /** + * Observable's primary API: returns an unsubscribable Subscription to the + * source of this Observable. + */ + subscribe(observer: Observer): Subscription; + + /** + * Supports subscription of a legacy Relay Observer, returning a Disposable. + */ + subscribeLegacy(legacyObserver: Common.LegacyObserver): Common.Disposable; + + /** + * Returns a new Observerable where each value has been transformed by + * the mapping function. + */ + map(fn: (thing: T) => U): RelayObservable; + + /** + * Returns a new Observable where each value is replaced with a new Observable + * by the mapping function, the results of which returned as a single + * concattenated Observable. + */ + concatMap(fn: (thing: T) => ObservableFromValue): RelayObservable; + + /** + * Returns a new Observable which first mirrors this Observable, then when it + * completes, waits for `pollInterval` milliseconds before re-subscribing to + * this Observable again, looping in this manner until unsubscribed. + * + * The returned Observable never completes. + */ + poll(pollInterval: number): RelayObservable; + + /** + * Returns a Promise which resolves when this Observable yields a first value + * or when it completes with no value. + */ + toPromise(): Promise; + } + + + // ~~~~~~~~~~~~~~~~~~~~~ + // commitLocalUpdate + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + type commitLocalUpdate = ( + environment: Environment, + updater: Common.StoreUpdater, + ) => void; + + // ~~~~~~~~~~~~~~~~~~~~~ + // commitRelayModernMutation + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + type MutationConfig = { + configs?: Array, + mutation: Common.GraphQLTaggedNode, + variables: Common.Variables, + uploadables?: Common.UploadableMap, + onCompleted?: (response: T, errors: Array | void) => void, + onError?: (error?: Error) => void, + optimisticUpdater?: Common.SelectorStoreUpdater | void, + optimisticResponse?: object, + updater?: Common.SelectorStoreUpdater | void, + }; + function commitRelayModernMutation( + environment: Environment, + config: MutationConfig, + ): Common.Disposable; + + // ~~~~~~~~~~~~~~~~~~~~~ + // applyRelayModernOptimisticMutation + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + type OptimisticMutationConfig = { + configs?: Array, + mutation: Common.GraphQLTaggedNode, + variables: Common.Variables, + optimisticUpdater?: Common.SelectorStoreUpdater, + optimisticResponse?: object, + }; + + // ~~~~~~~~~~~~~~~~~~~~~ + // fetchRelayModernQuery + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + /** + * A helper function to fetch the results of a query. Note that results for + * fragment spreads are masked: fields must be explicitly listed in the query in + * order to be accessible in the result object. + * + * NOTE: This module is primarily intended for integrating with classic APIs. + * Most product code should use a Renderer or Container. + * + * TODO(t16875667): The return type should be `Promise`, but + * that's not really helpful as `SelectorData` is essentially just `mixed`. We + * can probably leverage generated flow types here to return the real expected + * shape. + */ + function fetchRelayModernQuery( + environment: any, // FIXME - $FlowFixMe in facebook source code + taggedNode: Common.GraphQLTaggedNode, + variables: Common.Variables, + cacheConfig?: Common.CacheConfig | void, + ): Promise; // FIXME - $FlowFixMe in facebook source code + + + // ~~~~~~~~~~~~~~~~~~~~~ + // requestRelaySubscription + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + export type GraphQLSubscriptionConfig = { + configs?: Array, + subscription: Common.GraphQLTaggedNode, + variables: Common.Variables, + onCompleted?: () => void, + onError?: (error: Error) => void, + onNext?: (response: object | void) => void, + updater?: (store: Common.RecordSourceSelectorProxy) => void, + }; + export function requestRelaySubscription( + environment: Environment, + config: GraphQLSubscriptionConfig, + ): Common.Disposable; } +} - // ~~~~~~~~~~~~~~~~~~~~~ - // ModernStore - // ~~~~~~~~~~~~~~~~~~~~~ - class Store { - constructor(source: RecordSource); - getSource(): MutableRecordSource; - check(selector: Selector): boolean; - retain(selector: Selector): Common.Disposable; - lookup(selector: Selector): Snapshot; - notify(): void; - publish(source: RecordSource): void; - subscribe( - snapshot: Snapshot, - callback: (snapshot: Snapshot) => void, - ): Common.Disposable; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayRecordSourceInspector - // ~~~~~~~~~~~~~~~~~~~~~ - /** - * An internal class to provide a console-friendly string representation of a - * Record. - */ - class RecordSummary { - id: Common.DataID; - type: string | void; - static createFromRecord(id: Common.DataID, record: any): RecordSummary; - constructor(id: Common.DataID, type: string | void); - toString(): string; - } - /** - * Internal class for inspecting a single Record. - */ - class RecordInspector { - constructor(sourceInspector: RelayRecordSourceInspector, record: Record); - /** - * Get the cache id of the given record. For types that implement the `Node` - * interface (or that have an `id`) this will be `id`, for other types it will be - * a synthesized identifier based on the field path from the nearest ancestor - * record that does have an `id`. - */ - getDataID(): Common.DataID; - - /** - * Returns a list of the fields that have been fetched on the current record. - */ - getFields(): Array; - - /** - * Returns the type of the record. - */ - getType(): string; - - /** - * Returns a copy of the internal representation of the record. - */ - inspect(): any; - - /** - * Returns the value of a scalar field. May throw if the given field is - * present but not actually scalar. - */ - getValue(name: string, args?: Common.Variables | void): any; - - /** - * Returns an inspector for the given scalar "linked" field (a field whose - * value is another Record instead of a scalar). May throw if the field is - * present but not a scalar linked record. - */ - getLinkedRecord(name: string, args?: Common.Variables | void): RecordInspector | void; - - /** - * Returns an array of inspectors for the given plural "linked" field (a field - * whose value is an array of Records instead of a scalar). May throw if the - * field is present but not a plural linked record. - */ - getLinkedRecords(name: string, args?: Common.Variables | void): RecordInspector[] | void; - } - - class RelayRecordSourceInspector { - constructor(source: RecordSource); - static getForEnvironment(environment: Environment): RelayRecordSourceInspector; - /** - * Returns an inspector for the record with the given id, or null/undefined if - * that record is deleted/unfetched. - */ - get(dataID: Common.DataID): RecordInspector | void; - /** - * Returns a list of ": " for each record in the store that has an - * `id`. - */ - getNodes(): Array; - /** - * Returns a list of ": " for all records in the store including - * those that do not have an `id`. - */ - getRecords(): Array; - - /** - * Returns an inspector for the synthesized "root" object, allowing access to - * e.g. the `viewer` object or the results of other fields on the "Query" - * type. - */ - getRoot(): RecordInspector; - } - - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayObservable - // ~~~~~~~~~~~~~~~~~~~~~ - type Subscription = { - unsubscribe: () => void, - readonly closed: boolean, - }; - type Observer = { - start?: ((subscription: Subscription) => any) | void, - next?: ((nextThing: T) => any) | void, - error?: ((error: Error) => any) | void, - complete?: (() => any) | void, - unsubscribe?: ((subscription: Subscription) => any) | void, - }; - type Source = () => any; - interface Subscribable { - subscribe(observer: Observer): Subscription, - } - type ObservableFromValue = RelayObservable | Promise | T; - class RelayObservable implements Subscribable { - _source: Source; - - constructor(source: Source); - - /** - * When an unhandled error is detected, it is reported to the host environment - * (the ESObservable spec refers to this method as "HostReportErrors()"). - * - * The default implementation in development builds re-throws errors in a - * separate frame, and from production builds does nothing (swallowing - * uncaught errors). - * - * Called during application initialization, this method allows - * application-specific handling of uncaught errors. Allowing, for example, - * integration with error logging or developer tools. - */ - static onUnhandledError(callback: (error: Error) => any): void; - - /** - * Accepts various kinds of data sources, and always returns a RelayObservable - * useful for accepting the result of a user-provided FetchFunction. - */ - static from(obj: ObservableFromValue): RelayObservable; - - /** - * Creates a RelayObservable, given a function which expects a legacy - * Relay Observer as the last argument and which returns a Disposable. - * - * To support migration to Observable, the function may ignore the - * legacy Relay observer and directly return an Observable instead. - */ - static fromLegacy( - callback: (legacyObserver: Common.LegacyObserver) => Common.Disposable | RelayObservable, - ): RelayObservable; - - /** - * Returns a new Observable which returns the same values as this one, but - * modified so that the provided Observer is called to perform a side-effects - * for all events emitted by the source. - * - * Any errors that are thrown in the side-effect Observer are unhandled, and - * do not affect the source Observable or its Observer. - * - * This is useful for when debugging your Observables or performing other - * side-effects such as logging or performance monitoring. - */ - do(observer: Observer): RelayObservable; - - /** - * Returns a new Observable which returns the same values as this one, but - * modified so that the finally callback is performed after completion, - * whether normal or due to error or unsubscription. - * - * This is useful for cleanup such as resource finalization. - */ - finally(fn: () => any): RelayObservable; - - /** - * Returns a new Observable which is identical to this one, unless this - * Observable completes before yielding any values, in which case the new - * Observable will yield the values from the alternate Observable. - * - * If this Observable does yield values, the alternate is never subscribed to. - * - * This is useful for scenarios where values may come from multiple sources - * which should be tried in order, i.e. from a cache before a network. - */ - ifEmpty(alternate: RelayObservable): RelayObservable; - - /** - * Observable's primary API: returns an unsubscribable Subscription to the - * source of this Observable. - */ - subscribe(observer: Observer): Subscription; - - /** - * Supports subscription of a legacy Relay Observer, returning a Disposable. - */ - subscribeLegacy(legacyObserver: Common.LegacyObserver): Common.Disposable; - - /** - * Returns a new Observerable where each value has been transformed by - * the mapping function. - */ - map(fn: (thing: T) => U): RelayObservable; - - /** - * Returns a new Observable where each value is replaced with a new Observable - * by the mapping function, the results of which returned as a single - * concattenated Observable. - */ - concatMap(fn: (thing: T) => ObservableFromValue): RelayObservable; - - /** - * Returns a new Observable which first mirrors this Observable, then when it - * completes, waits for `pollInterval` milliseconds before re-subscribing to - * this Observable again, looping in this manner until unsubscribed. - * - * The returned Observable never completes. - */ - poll(pollInterval: number): RelayObservable; - - /** - * Returns a Promise which resolves when this Observable yields a first value - * or when it completes with no value. - */ - toPromise(): Promise; - } - - - // ~~~~~~~~~~~~~~~~~~~~~ - // commitLocalUpdate - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - type commitLocalUpdate = ( - environment: Environment, - updater: Common.StoreUpdater, - ) => void; - - // ~~~~~~~~~~~~~~~~~~~~~ - // commitRelayModernMutation - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - type MutationConfig = { - configs?: Array, - mutation: Common.GraphQLTaggedNode, - variables: Common.Variables, - uploadables?: Common.UploadableMap, - onCompleted?: (response: T, errors: Array | void) => void, - onError?: (error?: Error) => void, - optimisticUpdater?: Common.SelectorStoreUpdater | void, - optimisticResponse?: object, - updater?: Common.SelectorStoreUpdater | void, - }; - function commitRelayModernMutation( - environment: Environment, - config: MutationConfig, - ): Common.Disposable; - - // ~~~~~~~~~~~~~~~~~~~~~ - // applyRelayModernOptimisticMutation - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - type OptimisticMutationConfig = { - configs?: Array, - mutation: Common.GraphQLTaggedNode, - variables: Common.Variables, - optimisticUpdater?: Common.SelectorStoreUpdater, - optimisticResponse?: object, - }; - - // ~~~~~~~~~~~~~~~~~~~~~ - // fetchRelayModernQuery - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - /** - * A helper function to fetch the results of a query. Note that results for - * fragment spreads are masked: fields must be explicitly listed in the query in - * order to be accessible in the result object. - * - * NOTE: This module is primarily intended for integrating with classic APIs. - * Most product code should use a Renderer or Container. - * - * TODO(t16875667): The return type should be `Promise`, but - * that's not really helpful as `SelectorData` is essentially just `mixed`. We - * can probably leverage generated flow types here to return the real expected - * shape. - */ - function fetchRelayModernQuery( - environment: any, // FIXME - $FlowFixMe in facebook source code - taggedNode: Common.GraphQLTaggedNode, - variables: Common.Variables, - cacheConfig?: Common.CacheConfig | void, - ): Promise; // FIXME - $FlowFixMe in facebook source code - - - // ~~~~~~~~~~~~~~~~~~~~~ - // requestRelaySubscription - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - export type GraphQLSubscriptionConfig = { - configs?: Array, - subscription: Common.GraphQLTaggedNode, - variables: Common.Variables, - onCompleted?: () => void, - onError?: (error: Error) => void, - onNext?: (response: object | void) => void, - updater?: (store: Common.RecordSourceSelectorProxy) => void, - }; - export function requestRelaySubscription( - environment: Environment, - config: GraphQLSubscriptionConfig, - ): Common.Disposable; - } - - declare module 'relay-runtime' { +declare module 'relay-runtime' { export import Environment = __Relay.Runtime.Environment; export import Network = __Relay.Runtime.Network; export import RecordSource = __Relay.Runtime.RecordSource; @@ -1136,4 +1136,4 @@ declare namespace __Relay.Runtime { export import RecordSourceInspector = __Relay.Runtime.RelayRecordSourceInspector; export import ConnectionHandler = __Relay.Common.Handler; export import ViewerHandler = __Relay.Common.Handler; - } +} From 9d699082b64288589c646f6033bae0b724a78fd6 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 10 Sep 2017 10:05:01 -1000 Subject: [PATCH 013/314] continuing to fix linting errors --- types/relay-runtime/index.d.ts | 177 ++++++++++++++++----------------- 1 file changed, 84 insertions(+), 93 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 80ea0dcdea..5904a6067c 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -11,7 +11,7 @@ declare namespace __Relay { * SOURCE: * Relay 1.3.0 * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js - */ + */ // ~~~~~~~~~~~~~~~~~~~~~ // Util // ~~~~~~~~~~~~~~~~~~~~~ @@ -29,7 +29,6 @@ declare namespace __Relay { type ConcreteFragmentDefinition = object; type ConcreteOperationDefinition = object; - /** * FIXME: RelayContainer used to be typed with ReactClass, but * ReactClass is broken and allows for access to any property. For example @@ -39,18 +38,19 @@ declare namespace __Relay { * but have no definition in Relay's types. Suppressing for now. */ export type RelayContainer = any; + // ~~~~~~~~~~~~~~~~~~~~~ // RelayQL // ~~~~~~~~~~~~~~~~~~~~~ type RelayQL = ( strings: string[], ...substitutions: any[] - ) => Common.RelayConcreteNode; + ) => RelayConcreteNode; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernGraphQLTag // ~~~~~~~~~~~~~~~~~~~~~ - type GeneratedNodeMap = { [key: string]: GraphQLTaggedNode }; + interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode } type GraphQLTaggedNode = (() => ConcreteFragment | ConcreteBatch) | { @@ -63,10 +63,9 @@ declare namespace __Relay { // General Usage // ~~~~~~~~~~~~~~~~~~~~~ export type DataID = string; - export type Variables = { [name: string]: any }; + export interface Variables { [name: string]: any } export type Uploadable = File | Blob; - export type UploadableMap = { [key: string]: Uploadable }; - + export interface UploadableMap { [key: string]: Uploadable } // ~~~~~~~~~~~~~~~~~~~~~ // RelayNetworkTypes @@ -74,18 +73,18 @@ declare namespace __Relay { // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js // ~~~~~~~~~~~~~~~~~~~~~ - export type LegacyObserver = { + export interface LegacyObserver { onCompleted?: (() => void) | void, onError?: ((error: Error) => void) | void, onNext?: ((data: T) => void) | void, - }; - export type PayloadError = { + } + export interface PayloadError { message: string, locations?: Array<{ line: number, column: number, }>, - }; + } /** * A function that executes a GraphQL operation with request/response semantics. * @@ -95,7 +94,7 @@ declare namespace __Relay { operation: ConcreteBatch, variables: Variables, cacheConfig: CacheConfig, - uploadables?: Common.UploadableMap, + uploadables?: UploadableMap, ): Runtime.ObservableFromValue; /** @@ -112,7 +111,6 @@ declare namespace __Relay { observer: LegacyObserver, ) => Runtime.RelayObservable | Disposable; - // ~~~~~~~~~~~~~~~~~~~~~ // RelayStoreTypes // Version: Relay 1.3.0 @@ -125,10 +123,10 @@ declare namespace __Relay { export type StoreUpdater = (store: RecordSourceProxy) => void; /** - * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in - * order to easily access the root fields of a query/mutation as well as a - * second argument of the response object of the mutation. - */ + * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in + * order to easily access the root fields of a query/mutation as well as a + * second argument of the response object of the mutation. + */ export type SelectorStoreUpdater = ( store: RecordSourceSelectorProxy, // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is @@ -167,7 +165,7 @@ declare namespace __Relay { args?: Variables | void, ): RecordProxy, setLinkedRecords( - records: (RecordProxy | void)[] | void, + records: Array | void, name: string, args?: Variables | void, ): RecordProxy, @@ -177,11 +175,11 @@ declare namespace __Relay { export interface RecordSourceProxy { create(dataID: DataID, typeName: string): RecordProxy, delete(dataID: DataID): void, - get(dataID: DataID): (RecordProxy | void)[] | void, + get(dataID: DataID): Array | void, getRoot(): RecordProxy, } - export type HandleFieldPayload = { + export interface HandleFieldPayload { // The arguments that were fetched. args: Variables, // The __id of the record containing the source/handle field. @@ -193,13 +191,12 @@ declare namespace __Relay { // The (storage) key at which the handle's data should be written by the // handler. handleKey: string, - }; - interface IHandler { + } + interface HandlerInterface { update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload) => void; [functionName: string]: (...args: any[]) => any; } - export const Handler: IHandler; - + export const Handler: HandlerInterface; // ~~~~~~~~~~~~~~~~~~~~~ // RelayCombinedEnvironmentTypes @@ -212,47 +209,46 @@ declare namespace __Relay { * - `force`: causes a query to be issued unconditionally, irrespective of the * state of any configured response cache. * - `poll`: causes a query to live update by polling at the specified interval - in milliseconds. (This value will be passed to setTimeout.) + * in milliseconds. (This value will be passed to setTimeout.) */ - export type CacheConfig = { + export interface CacheConfig { force?: boolean | void, poll?: number | void, - }; + } /** * Represents any resource that must be explicitly disposed of. The most common * use-case is as a return value for subscriptions, where calling `dispose()` * would cancel the subscription. */ - export type Disposable = { + export interface Disposable { dispose(): void, - }; - + } /** * Arbitrary data e.g. received by a container as props. */ - export type Props = { [key: string]: any }; + export interface Props { [key: string]: any } /* * An individual cached graph object. */ - export type Record = { [key: string]: any }; + export interface Record { [key: string]: any } /** * A collection of records keyed by id. */ - export type RecordMap = { [dataID: string]: Record | void }; + export interface RecordMap { [dataID: string]: Record | void } /** * A selector defines the starting point for a traversal into the graph for the * purposes of targeting a subgraph. */ - export type CSelector = { + export interface CSelector { dataID: DataID, node: TNode, variables: Variables, - }; + } /** * A representation of a selector and its results at a particular point in time. @@ -265,13 +261,13 @@ declare namespace __Relay { /** * The results of a selector given a store/RecordSource. */ - export type SelectorData = { [key: string]: any }; + export interface SelectorData { [key: string]: any } /** * The results of reading the results of a FragmentMap given some input * `Props`. */ - export type FragmentSpecResults = { [key: string]: any }; + export interface FragmentSpecResults { [key: string]: any } /** * A utility for resolving and subscribing to the results of a fragment spec @@ -308,7 +304,7 @@ declare namespace __Relay { setVariables(variables: Variables): void, } - export type CFragmentMap = { [key: string]: TFragment }; + export interface CFragmentMap { [key: string]: TFragment } /** * An operation selector describes a specific instance of a GraphQL operation @@ -319,12 +315,12 @@ declare namespace __Relay { * - `fragment`: a selector intended for use in reading or subscribing to * the results of the the operation. */ - export type COperationSelector = { + export interface COperationSelector { fragment: CSelector, node: TOperation, root: CSelector, variables: Variables, - }; + } /** * The public API of Relay core. Represents an encapsulated environment with its @@ -528,7 +524,7 @@ declare namespace __Relay { getDataIDsFromObject: ( fragments: CFragmentMap, props: Props, - ) => { [key: string]: Maybe<(DataID | Array)> }, + ) => { [key: string]: Maybe<(DataID | DataID[])> }, /** * Given a mapping of keys -> results and a mapping of keys -> fragments, @@ -549,11 +545,10 @@ declare namespace __Relay { * The type of the `relay` property set on React context by the React/Relay * integration layer (e.g. QueryRenderer, FragmentContainer, etc). */ - export type CRelayContext = { + export interface CRelayContext { environment: TEnvironment, variables: Variables, - }; - + } // ~~~~~~~~~~~~~~~~~~~~~ // RelayTypes @@ -561,16 +556,16 @@ declare namespace __Relay { * Version: Relay 1.3.0 * File: * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js - */ + */ // ~~~~~~~~~~~~~~~~~~~~~ - export type RerunParam = { + export interface RerunParam { param: string, import: string, max_runs: number, - }; + } interface FIELDS_CHANGE { type: 'FIELDS_CHANGE', - fieldIDs: { [fieldName: string]: DataID | Array }, + fieldIDs: { [fieldName: string]: DataID | DataID[] }, } interface RANGE_ADD { type: 'RANGE_ADD', @@ -606,7 +601,7 @@ declare namespace __Relay { } interface REQUIRED_CHILDREN { type: 'REQUIRED_CHILDREN', - children: Array, + children: RelayConcreteNode[], } export type RelayMutationConfig = FIELDS_CHANGE | @@ -615,10 +610,10 @@ declare namespace __Relay { RANGE_DELETE | REQUIRED_CHILDREN; - export type RelayMutationTransactionCommitCallbacks = { + export interface RelayMutationTransactionCommitCallbacks { onFailure?: RelayMutationTransactionCommitFailureCallback, onSuccess?: RelayMutationTransactionCommitSuccessCallback, - }; + } export type RelayMutationTransactionCommitFailureCallback = ( transaction: RelayMutationTransaction, preventAutoRollback: () => void, @@ -626,24 +621,24 @@ declare namespace __Relay { export type RelayMutationTransactionCommitSuccessCallback = (response: { [key: string]: any, }) => void; - export type NetworkLayer = { + export interface NetworkLayer { sendMutation(request: RelayMutationRequest): Promise | void, - sendQueries(requests: Array): Promise | void, + sendQueries(requests: RelayQueryRequest[]): Promise | void, supports(...options: string[]): boolean, - }; - export type QueryResult = { + } + export interface QueryResult { error?: Error | void, ref_params?: { [name: string]: any } | void, response: QueryPayload, - }; - export type ReadyState = { + } + export interface ReadyState { aborted: boolean, done: boolean, error: Error | void, - events: Array, + events: ReadyStateEvent[], ready: boolean, stale: boolean, - }; + } type RelayContainerErrorEventType = | 'CACHE_RESTORE_FAILED' | 'NETWORK_QUERY_ERROR'; @@ -661,10 +656,9 @@ declare namespace __Relay { type: RelayContainerLoadingEventType | RelayContainerErrorEventType, error?: Error, }; - export type Abortable = { + export interface Abortable { abort(): void, - }; - + } // ~~~~~~~~~~~~~~~~~~~~~ // RelayInternalTypes @@ -672,16 +666,16 @@ declare namespace __Relay { * Version: Relay 1.3.0 * File: * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js - */ + */ // ~~~~~~~~~~~~~~~~~~~~~ - export type QueryPayload = { [key: string]: any }; - export type RelayQuerySet = { [queryName: string]: any }; + export interface QueryPayload { [key: string]: any } + export interface RelayQuerySet { [queryName: string]: any } type RangeBehaviorsFunction = (connectionArgs: { [argName: string]: any, }) => 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; - type RangeBehaviorsObject = { + interface RangeBehaviorsObject { [key: string]: 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; - }; + } export type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; } @@ -708,9 +702,9 @@ declare namespace __Relay { cacheConfig: Common.CacheConfig, uploadables?: Common.UploadableMap | void, ) => Promise; - type RelayNetwork = { + interface RelayNetwork { execute: ExecuteFunction, - }; + } // ~~~~~~~~~~~~~~~~~~~~~ // RelayDefaultHandlerProvider @@ -720,12 +714,12 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernEnvironment // ~~~~~~~~~~~~~~~~~~~~~ - type EnvironmentConfig = { + interface EnvironmentConfig { configName?: string, handlerProvider?: typeof HandlerProvider, network: Network, store: Store, - }; + } class Environment { constructor(config: EnvironmentConfig); getStore(): Store; @@ -767,8 +761,8 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // RelayInMemoryRecordSource // ~~~~~~~~~~~~~~~~~~~~~ - type Record = { [key: string]: any }; - type RecordMap = { [dataID: string]: Record | void }; + interface Record { [key: string]: any } + interface RecordMap { [dataID: string]: Record | void } // ~~~~~~~~~~~~~~~~~~~~~ // Network @@ -835,7 +829,7 @@ declare namespace __Relay { } /** * Internal class for inspecting a single Record. - */ + */ class RecordInspector { constructor(sourceInspector: RelayRecordSourceInspector, record: Record); /** @@ -894,12 +888,12 @@ declare namespace __Relay { * Returns a list of ": " for each record in the store that has an * `id`. */ - getNodes(): Array; + getNodes(): RecordSummary[]; /** * Returns a list of ": " for all records in the store including * those that do not have an `id`. */ - getRecords(): Array; + getRecords(): RecordSummary[]; /** * Returns an inspector for the synthesized "root" object, allowing access to @@ -909,21 +903,20 @@ declare namespace __Relay { getRoot(): RecordInspector; } - // ~~~~~~~~~~~~~~~~~~~~~ // RelayObservable // ~~~~~~~~~~~~~~~~~~~~~ - type Subscription = { + interface Subscription { unsubscribe: () => void, readonly closed: boolean, - }; - type Observer = { + } + interface Observer { start?: ((subscription: Subscription) => any) | void, next?: ((nextThing: T) => any) | void, error?: ((error: Error) => any) | void, complete?: (() => any) | void, unsubscribe?: ((subscription: Subscription) => any) | void, - }; + } type Source = () => any; interface Subscribable { subscribe(observer: Observer): Subscription, @@ -1039,7 +1032,6 @@ declare namespace __Relay { toPromise(): Promise; } - // ~~~~~~~~~~~~~~~~~~~~~ // commitLocalUpdate // ~~~~~~~~~~~~~~~~~~~~~ @@ -1053,17 +1045,17 @@ declare namespace __Relay { // commitRelayModernMutation // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly - type MutationConfig = { - configs?: Array, + interface MutationConfig { + configs?: Common.RelayMutationConfig[], mutation: Common.GraphQLTaggedNode, variables: Common.Variables, uploadables?: Common.UploadableMap, - onCompleted?: (response: T, errors: Array | void) => void, + onCompleted?: (response: T, errors: Common.PayloadError[] | void) => void, onError?: (error?: Error) => void, optimisticUpdater?: Common.SelectorStoreUpdater | void, optimisticResponse?: object, updater?: Common.SelectorStoreUpdater | void, - }; + } function commitRelayModernMutation( environment: Environment, config: MutationConfig, @@ -1073,13 +1065,13 @@ declare namespace __Relay { // applyRelayModernOptimisticMutation // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly - type OptimisticMutationConfig = { - configs?: Array, + interface OptimisticMutationConfig { + configs?: Common.RelayMutationConfig[], mutation: Common.GraphQLTaggedNode, variables: Common.Variables, optimisticUpdater?: Common.SelectorStoreUpdater, optimisticResponse?: object, - }; + } // ~~~~~~~~~~~~~~~~~~~~~ // fetchRelayModernQuery @@ -1105,20 +1097,19 @@ declare namespace __Relay { cacheConfig?: Common.CacheConfig | void, ): Promise; // FIXME - $FlowFixMe in facebook source code - // ~~~~~~~~~~~~~~~~~~~~~ // requestRelaySubscription // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly - export type GraphQLSubscriptionConfig = { - configs?: Array, + export interface GraphQLSubscriptionConfig { + configs?: Common.RelayMutationConfig[], subscription: Common.GraphQLTaggedNode, variables: Common.Variables, onCompleted?: () => void, onError?: (error: Error) => void, onNext?: (response: object | void) => void, updater?: (store: Common.RecordSourceSelectorProxy) => void, - }; + } export function requestRelaySubscription( environment: Environment, config: GraphQLSubscriptionConfig, From e85628dc15f1c5f2c952b25b9e8033c869ccd4e9 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 10 Sep 2017 16:21:13 -1000 Subject: [PATCH 014/314] fixing all linting errors for relay-runtime --- types/relay-runtime/index.d.ts | 354 ++++++++++---------- types/relay-runtime/relay-runtime-tests.tsx | 17 +- 2 files changed, 185 insertions(+), 186 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 5904a6067c..4acab12c5b 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for relay-runtime 1.3.0 +// Type definitions for relay-runtime 1.3 // Project: https://github.com/facebook/relay // Definitions by: Matt Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -50,12 +50,14 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernGraphQLTag // ~~~~~~~~~~~~~~~~~~~~~ - interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode } + interface GeneratedNodeMap { + [key: string]: GraphQLTaggedNode; + } type GraphQLTaggedNode = (() => ConcreteFragment | ConcreteBatch) | { - modern: () => ConcreteFragment | ConcreteBatch, - classic: (relayQL: RelayQL) => + modern(): ConcreteFragment | ConcreteBatch, + classic(relayQL: RelayQL): | ConcreteFragmentDefinition | ConcreteOperationDefinition, }; @@ -63,9 +65,13 @@ declare namespace __Relay { // General Usage // ~~~~~~~~~~~~~~~~~~~~~ export type DataID = string; - export interface Variables { [name: string]: any } + export interface Variables { + [name: string]: any; + } export type Uploadable = File | Blob; - export interface UploadableMap { [key: string]: Uploadable } + export interface UploadableMap { + [key: string]: Uploadable; + } // ~~~~~~~~~~~~~~~~~~~~~ // RelayNetworkTypes @@ -74,16 +80,16 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ export interface LegacyObserver { - onCompleted?: (() => void) | void, - onError?: ((error: Error) => void) | void, - onNext?: ((data: T) => void) | void, + onCompleted?: (() => void) | void; + onError?: ((error: Error) => void) | void; + onNext?: ((data: T) => void) | void; } export interface PayloadError { - message: string, + message: string; locations?: Array<{ line: number, column: number, - }>, + }>; } /** * A function that executes a GraphQL operation with request/response semantics. @@ -139,61 +145,61 @@ declare namespace __Relay { * fields of a Selector. */ export interface RecordSourceSelectorProxy { - create(dataID: DataID, typeName: string): RecordProxy, - delete(dataID: DataID): void, - get(dataID: DataID): RecordProxy | void, - getRoot(): RecordProxy, - getRootField(fieldName: string): RecordProxy | void, - getPluralRootField(fieldName: string): RecordProxy[] | void, + create(dataID: DataID, typeName: string): RecordProxy; + delete(dataID: DataID): void; + get(dataID: DataID): RecordProxy | void; + getRoot(): RecordProxy; + getRootField(fieldName: string): RecordProxy | void; + getPluralRootField(fieldName: string): RecordProxy[] | void; } export interface RecordProxy { - copyFieldsFrom(source: RecordProxy): void, - getDataID(): DataID, - getLinkedRecord(name: string, args?: Variables | void): RecordProxy | void, - getLinkedRecords(name: string, args?: Variables | void): Array | void, + copyFieldsFrom(source: RecordProxy): void; + getDataID(): DataID; + getLinkedRecord(name: string, args?: Variables | void): RecordProxy | void; + getLinkedRecords(name: string, args?: Variables | void): Array | void; getOrCreateLinkedRecord( name: string, typeName: string, args?: Variables | void, - ): RecordProxy, - getType(): string, - getValue(name: string, args?: Variables | void): any, + ): RecordProxy; + getType(): string; + getValue(name: string, args?: Variables | void): any; setLinkedRecord( record: RecordProxy, name: string, args?: Variables | void, - ): RecordProxy, + ): RecordProxy; setLinkedRecords( records: Array | void, name: string, args?: Variables | void, - ): RecordProxy, - setValue(value: any, name: string, args?: Variables | void): RecordProxy, + ): RecordProxy; + setValue(value: any, name: string, args?: Variables | void): RecordProxy; } export interface RecordSourceProxy { - create(dataID: DataID, typeName: string): RecordProxy, - delete(dataID: DataID): void, - get(dataID: DataID): Array | void, - getRoot(): RecordProxy, + create(dataID: DataID, typeName: string): RecordProxy; + delete(dataID: DataID): void; + get(dataID: DataID): Array | void; + getRoot(): RecordProxy; } export interface HandleFieldPayload { // The arguments that were fetched. - args: Variables, + args: Variables; // The __id of the record containing the source/handle field. - dataID: DataID, + dataID: DataID; // The (storage) key at which the original server data was written. - fieldKey: string, - // The name of the handle. - handle: string, + fieldKey: string; + // The name of the handle + handle: string; // The (storage) key at which the handle's data should be written by the - // handler. - handleKey: string, + // handler + handleKey: string; } interface HandlerInterface { - update: (store: RecordSourceProxy, fieldPayload: HandleFieldPayload) => void; + update(store: RecordSourceProxy, fieldPayload: HandleFieldPayload): void; [functionName: string]: (...args: any[]) => any; } export const Handler: HandlerInterface; @@ -212,8 +218,8 @@ declare namespace __Relay { * in milliseconds. (This value will be passed to setTimeout.) */ export interface CacheConfig { - force?: boolean | void, - poll?: number | void, + force?: boolean | void; + poll?: number | void; } /** @@ -222,32 +228,32 @@ declare namespace __Relay { * would cancel the subscription. */ export interface Disposable { - dispose(): void, + dispose(): void; } /** * Arbitrary data e.g. received by a container as props. */ - export interface Props { [key: string]: any } + export interface Props { [key: string]: any; } /* * An individual cached graph object. */ - export interface Record { [key: string]: any } + export interface Record { [key: string]: any; } /** * A collection of records keyed by id. */ - export interface RecordMap { [dataID: string]: Record | void } + export interface RecordMap { [dataID: string]: Record | void; } /** * A selector defines the starting point for a traversal into the graph for the * purposes of targeting a subgraph. */ export interface CSelector { - dataID: DataID, - node: TNode, - variables: Variables, + dataID: DataID; + node: TNode; + variables: Variables; } /** @@ -261,13 +267,13 @@ declare namespace __Relay { /** * The results of a selector given a store/RecordSource. */ - export interface SelectorData { [key: string]: any } + export interface SelectorData { [key: string]: any; } /** * The results of reading the results of a FragmentMap given some input * `Props`. */ - export interface FragmentSpecResults { [key: string]: any } + export interface FragmentSpecResults { [key: string]: any; } /** * A utility for resolving and subscribing to the results of a fragment spec @@ -284,27 +290,27 @@ declare namespace __Relay { /** * Stop watching for changes to the results of the fragments. */ - dispose(): void, + dispose(): void; /** * Get the current results. */ - resolve(): FragmentSpecResults, + resolve(): FragmentSpecResults; /** * Update the resolver with new inputs. Call `resolve()` to get the updated * results. */ - setProps(props: Props): void, + setProps(props: Props): void; /** * Override the variables used to read the results of the fragments. Call * `resolve()` to get the updated results. */ - setVariables(variables: Variables): void, + setVariables(variables: Variables): void; } - export interface CFragmentMap { [key: string]: TFragment } + export interface CFragmentMap { [key: string]: TFragment; } /** * An operation selector describes a specific instance of a GraphQL operation @@ -316,10 +322,10 @@ declare namespace __Relay { * the results of the the operation. */ export interface COperationSelector { - fragment: CSelector, - node: TOperation, - root: CSelector, - variables: Variables, + fragment: CSelector; + node: TOperation; + root: CSelector; + variables: Variables; } /** @@ -333,11 +339,11 @@ declare namespace __Relay { TNode, TOperation, TPayload, - > { + > { /** * Read the results of a selector from in-memory records in the store. */ - lookup(selector: CSelector): CSnapshot, + lookup(selector: CSelector): CSnapshot; /** * Subscribe to changes to the results of a selector. The callback is called @@ -347,7 +353,7 @@ declare namespace __Relay { subscribe( snapshot: CSnapshot, callback: (snapshot: CSnapshot) => void, - ): Disposable, + ): Disposable; /** * Ensure that all the records necessary to fulfill the given selector are @@ -356,7 +362,7 @@ declare namespace __Relay { * * Note: This is a no-op in the classic core. */ - retain(selector: CSelector): Disposable, + retain(selector: CSelector): Disposable; /** * Send a query to the server with request/response semantics: the query will @@ -375,7 +381,7 @@ declare namespace __Relay { onError?: Maybe<(error: Error) => void>, onNext?: Maybe<(payload: TPayload) => void>, operation: COperationSelector, - }): Disposable, + }): Disposable; /** * Send a query to the server with request/subscription semantics: one or more @@ -391,15 +397,15 @@ declare namespace __Relay { onError?: Maybe<(error: Error) => void>, onNext?: Maybe<(payload: TPayload) => void>, operation: COperationSelector, - }): Disposable, + }): Disposable; unstable_internal: CUnstableEnvironmentCore< - TEnvironment, - TFragment, - TGraphQLTaggedNode, - TNode, - TOperation - >, + TEnvironment, + TFragment, + TGraphQLTaggedNode, + TNode, + TOperation + >; } export interface CUnstableEnvironmentCore< @@ -408,7 +414,7 @@ declare namespace __Relay { TGraphQLTaggedNode, TNode, TOperation, - > { + > { /** * Create an instance of a FragmentSpecResolver. * @@ -416,13 +422,13 @@ declare namespace __Relay { * defined here, so this could be moved out of core. It's convenient to have * separate implementations until the experimental core is in OSS. */ - createFragmentSpecResolver: ( + createFragmentSpecResolver( context: CRelayContext, containerName: string, fragments: CFragmentMap, props: Props, callback: () => void, - ) => FragmentSpecResolver, + ): FragmentSpecResolver; /** * Creates an instance of an OperationSelector given an operation definition @@ -430,30 +436,30 @@ declare namespace __Relay { * filtered to exclude variables that do not matche defined arguments on the * operation, and default values are populated for null values. */ - createOperationSelector: ( + createOperationSelector( operation: TOperation, variables: Variables, - ) => COperationSelector, + ): COperationSelector; /** * Given a graphql`...` tagged template, extract a fragment definition usable * by this version of Relay core. Throws if the value is not a fragment. */ - getFragment: (node: TGraphQLTaggedNode) => TFragment, + getFragment(node: TGraphQLTaggedNode): TFragment; /** * Given a graphql`...` tagged template, extract an operation definition * usable by this version of Relay core. Throws if the value is not an * operation. */ - getOperation: (node: TGraphQLTaggedNode) => TOperation, + getOperation(node: TGraphQLTaggedNode): TOperation; /** * Determine if two selectors are equal (represent the same selection). Note * that this function returns `false` when the two queries/fragments are * different objects, even if they select the same fields. */ - areEqualSelectors: (a: CSelector, b: CSelector) => boolean, + areEqualSelectors(a: CSelector, b: CSelector): boolean; /** * Given the result `item` from a parent that fetched `fragment`, creates a @@ -482,11 +488,11 @@ declare namespace __Relay { * const childData = environment.lookup(childSelector).data; * ``` */ - getSelector: ( + getSelector( operationVariables: Variables, fragment: TFragment, prop: any, - ) => CSelector | void, + ): CSelector | void; /** * Given the result `items` from a parent that fetched `fragment`, creates a @@ -494,11 +500,11 @@ declare namespace __Relay { * items. This is similar to `getSelector` but for "plural" fragments that * expect an array of results and therefore return an array of selectors. */ - getSelectorList: ( + getSelectorList( operationVariables: Variables, fragment: TFragment, props: any[], - ) => Array> | void, + ): Array> | void; /** * Given a mapping of keys -> results and a mapping of keys -> fragments, @@ -508,11 +514,11 @@ declare namespace __Relay { * use this function to convert (props, fragments) into selectors so that they * can read the results to pass to the inner component. */ - getSelectorsFromObject: ( + getSelectorsFromObject( operationVariables: Variables, fragments: CFragmentMap, props: Props, - ) => { [key: string]: Maybe<(CSelector | Array>)> }, + ): { [key: string]: Maybe<(CSelector | Array>)> }; /** * Given a mapping of keys -> results and a mapping of keys -> fragments, @@ -521,10 +527,10 @@ declare namespace __Relay { * Similar to `getSelectorsFromObject()`, this function can be useful in * determining the "identity" of the props passed to a component. */ - getDataIDsFromObject: ( + getDataIDsFromObject( fragments: CFragmentMap, props: Props, - ) => { [key: string]: Maybe<(DataID | DataID[])> }, + ): { [key: string]: Maybe<(DataID | DataID[])> }; /** * Given a mapping of keys -> results and a mapping of keys -> fragments, @@ -534,11 +540,11 @@ declare namespace __Relay { * This can be useful in determing what varaibles were used to fetch the data * for a Relay container, for example. */ - getVariablesFromObject: ( + getVariablesFromObject( operationVariables: Variables, fragments: CFragmentMap, props: Props, - ) => Variables, + ): Variables; } /** @@ -546,8 +552,8 @@ declare namespace __Relay { * integration layer (e.g. QueryRenderer, FragmentContainer, etc). */ export interface CRelayContext { - environment: TEnvironment, - variables: Variables, + environment: TEnvironment; + variables: Variables; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -559,49 +565,49 @@ declare namespace __Relay { */ // ~~~~~~~~~~~~~~~~~~~~~ export interface RerunParam { - param: string, - import: string, - max_runs: number, + param: string; + import: string; + max_runs: number; } interface FIELDS_CHANGE { - type: 'FIELDS_CHANGE', - fieldIDs: { [fieldName: string]: DataID | DataID[] }, + type: 'FIELDS_CHANGE'; + fieldIDs: { [fieldName: string]: DataID | DataID[]; }; } interface RANGE_ADD { - type: 'RANGE_ADD', - parentName?: string, - parentID?: string, + type: 'RANGE_ADD'; + parentName?: string; + parentID?: string; connectionInfo?: Array<{ key: string, filters?: Variables, rangeBehavior: string, - }>, - connectionName?: string, - edgeName: string, - rangeBehaviors?: RangeBehaviors, + }>; + connectionName?: string; + edgeName: string; + rangeBehaviors?: RangeBehaviors; } interface NODE_DELETE { - type: 'NODE_DELETE', - parentName?: string, - parentID?: string, - connectionName?: string, - deletedIDFieldName: string, + type: 'NODE_DELETE'; + parentName?: string; + parentID?: string; + connectionName?: string; + deletedIDFieldName: string; } interface RANGE_DELETE { - type: 'RANGE_DELETE', - parentName?: string, - parentID?: string, + type: 'RANGE_DELETE'; + parentName?: string; + parentID?: string; connectionKeys?: Array<{ key: string, filters?: Variables, - }>, - connectionName?: string, - deletedIDFieldName: string | string[], - pathToConnection: string[], + }>; + connectionName?: string; + deletedIDFieldName: string | string[]; + pathToConnection: string[]; } interface REQUIRED_CHILDREN { - type: 'REQUIRED_CHILDREN', - children: RelayConcreteNode[], + type: 'REQUIRED_CHILDREN'; + children: RelayConcreteNode[]; } export type RelayMutationConfig = FIELDS_CHANGE | @@ -611,8 +617,8 @@ declare namespace __Relay { REQUIRED_CHILDREN; export interface RelayMutationTransactionCommitCallbacks { - onFailure?: RelayMutationTransactionCommitFailureCallback, - onSuccess?: RelayMutationTransactionCommitSuccessCallback, + onFailure?: RelayMutationTransactionCommitFailureCallback; + onSuccess?: RelayMutationTransactionCommitSuccessCallback; } export type RelayMutationTransactionCommitFailureCallback = ( transaction: RelayMutationTransaction, @@ -622,22 +628,22 @@ declare namespace __Relay { [key: string]: any, }) => void; export interface NetworkLayer { - sendMutation(request: RelayMutationRequest): Promise | void, - sendQueries(requests: RelayQueryRequest[]): Promise | void, - supports(...options: string[]): boolean, + sendMutation(request: RelayMutationRequest): Promise | void; + sendQueries(requests: RelayQueryRequest[]): Promise | void; + supports(...options: string[]): boolean; } export interface QueryResult { - error?: Error | void, - ref_params?: { [name: string]: any } | void, - response: QueryPayload, + error?: Error | void; + ref_params?: { [name: string]: any } | void; + response: QueryPayload; } export interface ReadyState { - aborted: boolean, - done: boolean, - error: Error | void, - events: ReadyStateEvent[], - ready: boolean, - stale: boolean, + aborted: boolean; + done: boolean; + error: Error | void; + events: ReadyStateEvent[]; + ready: boolean; + stale: boolean; } type RelayContainerErrorEventType = | 'CACHE_RESTORE_FAILED' @@ -652,12 +658,12 @@ declare namespace __Relay { | 'STORE_FOUND_ALL' | 'STORE_FOUND_REQUIRED'; export type ReadyStateChangeCallback = (readyState: ReadyState) => void; - export type ReadyStateEvent = { - type: RelayContainerLoadingEventType | RelayContainerErrorEventType, - error?: Error, - }; + export interface ReadyStateEvent { + type: RelayContainerLoadingEventType | RelayContainerErrorEventType; + error?: Error; + } export interface Abortable { - abort(): void, + abort(): void; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -668,8 +674,8 @@ declare namespace __Relay { * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js */ // ~~~~~~~~~~~~~~~~~~~~~ - export interface QueryPayload { [key: string]: any } - export interface RelayQuerySet { [queryName: string]: any } + export interface QueryPayload { [key: string]: any; } + export interface RelayQuerySet { [queryName: string]: any; } type RangeBehaviorsFunction = (connectionArgs: { [argName: string]: any, }) => 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; @@ -703,7 +709,7 @@ declare namespace __Relay { uploadables?: Common.UploadableMap | void, ) => Promise; interface RelayNetwork { - execute: ExecuteFunction, + execute: ExecuteFunction; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -715,10 +721,10 @@ declare namespace __Relay { // RelayModernEnvironment // ~~~~~~~~~~~~~~~~~~~~~ interface EnvironmentConfig { - configName?: string, - handlerProvider?: typeof HandlerProvider, - network: Network, - store: Store, + configName?: string; + handlerProvider?: typeof HandlerProvider; + network: Network; + store: Store; } class Environment { constructor(config: EnvironmentConfig); @@ -761,8 +767,8 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // RelayInMemoryRecordSource // ~~~~~~~~~~~~~~~~~~~~~ - interface Record { [key: string]: any } - interface RecordMap { [dataID: string]: Record | void } + interface Record { [key: string]: any; } + interface RecordMap { [dataID: string]: Record | void; } // ~~~~~~~~~~~~~~~~~~~~~ // Network @@ -907,19 +913,19 @@ declare namespace __Relay { // RelayObservable // ~~~~~~~~~~~~~~~~~~~~~ interface Subscription { - unsubscribe: () => void, - readonly closed: boolean, + unsubscribe(): void; + readonly closed: boolean; } interface Observer { - start?: ((subscription: Subscription) => any) | void, - next?: ((nextThing: T) => any) | void, - error?: ((error: Error) => any) | void, - complete?: (() => any) | void, - unsubscribe?: ((subscription: Subscription) => any) | void, + start?: ((subscription: Subscription) => any) | void; + next?: ((nextThing: T) => any) | void; + error?: ((error: Error) => any) | void; + complete?: (() => any) | void; + unsubscribe?: ((subscription: Subscription) => any) | void; } type Source = () => any; interface Subscribable { - subscribe(observer: Observer): Subscription, + subscribe(observer: Observer): Subscription; } type ObservableFromValue = RelayObservable | Promise | T; class RelayObservable implements Subscribable { @@ -1046,15 +1052,15 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly interface MutationConfig { - configs?: Common.RelayMutationConfig[], - mutation: Common.GraphQLTaggedNode, - variables: Common.Variables, - uploadables?: Common.UploadableMap, - onCompleted?: (response: T, errors: Common.PayloadError[] | void) => void, - onError?: (error?: Error) => void, - optimisticUpdater?: Common.SelectorStoreUpdater | void, - optimisticResponse?: object, - updater?: Common.SelectorStoreUpdater | void, + configs?: Common.RelayMutationConfig[]; + mutation: Common.GraphQLTaggedNode; + variables: Common.Variables; + uploadables?: Common.UploadableMap; + onCompleted?(response: T, errors: Common.PayloadError[] | void): void; + onError?(error?: Error): void; + optimisticUpdater?: Common.SelectorStoreUpdater | void; + optimisticResponse?: object; + updater?: Common.SelectorStoreUpdater | void; } function commitRelayModernMutation( environment: Environment, @@ -1066,11 +1072,11 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly interface OptimisticMutationConfig { - configs?: Common.RelayMutationConfig[], - mutation: Common.GraphQLTaggedNode, - variables: Common.Variables, - optimisticUpdater?: Common.SelectorStoreUpdater, - optimisticResponse?: object, + configs?: Common.RelayMutationConfig[]; + mutation: Common.GraphQLTaggedNode; + variables: Common.Variables; + optimisticUpdater?: Common.SelectorStoreUpdater; + optimisticResponse?: object; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -1102,13 +1108,13 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly export interface GraphQLSubscriptionConfig { - configs?: Common.RelayMutationConfig[], - subscription: Common.GraphQLTaggedNode, - variables: Common.Variables, - onCompleted?: () => void, - onError?: (error: Error) => void, - onNext?: (response: object | void) => void, - updater?: (store: Common.RecordSourceSelectorProxy) => void, + configs?: Common.RelayMutationConfig[]; + subscription: Common.GraphQLTaggedNode; + variables: Common.Variables; + onCompleted?(): void; + onError?(error: Error): void; + onNext?(response: object | void): void; + updater?(store: Common.RecordSourceSelectorProxy): void; } export function requestRelaySubscription( environment: Environment, diff --git a/types/relay-runtime/relay-runtime-tests.tsx b/types/relay-runtime/relay-runtime-tests.tsx index 609399f079..c6dd9c15a2 100644 --- a/types/relay-runtime/relay-runtime-tests.tsx +++ b/types/relay-runtime/relay-runtime-tests.tsx @@ -3,6 +3,8 @@ import { Network, RecordSource, Store, + ConnectionHandler, + ViewerHandler, } from 'relay-runtime'; const source = new RecordSource(); @@ -20,15 +22,11 @@ function fetchQuery( ) { return fetch('/graphql', { method: 'POST', - headers: { - // Add authentication and other headers here - 'content-type': 'application/json' - }, body: JSON.stringify({ - query: operation.text, // GraphQL text from input - variables, + query: operation.text, // GraphQL text from input + variables, }), - }).then(response => { + }).then((response: any) => { return response.json(); }); } @@ -49,11 +47,6 @@ const environment = new Environment({ // Handler Provider // ~~~~~~~~~~~~~~~~~~~~~ -import { - ConnectionHandler, - ViewerHandler, -} from 'relay-runtime'; - function handlerProvider(handle: any) { switch (handle) { // Augment (or remove from) this list: From c2ea2eb7c4c5ba8505c54fd46b7864b53b7f9a84 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 10 Sep 2017 16:36:14 -1000 Subject: [PATCH 015/314] starting in on the linting errors in react-relay --- types/react-relay/index.d.ts | 569 +++++++++++++++++------------------ 1 file changed, 280 insertions(+), 289 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index a165229584..eb940d296d 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -1,281 +1,274 @@ -// Type definitions for react-relay 1.3.0 +// Type definitions for react-relay 1.3 // Project: https://github.com/facebook/relay // Definitions by: Johannes Schickling , Matt Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -/// /// -//////////////////////////// -// RELAY MODERN TYPES -/////////////////////////// +declare namespace __Relay { -declare namespace __Relay.Modern { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type ConcreteFragment = any; - type ConcreteBatch = any; - type ConcreteFragmentDefinition = object; - type ConcreteOperationDefinition = object; - type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; + //////////////////////////// + // RELAY MODERN TYPES + /////////////////////////// + namespace Modern { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type ConcreteFragment = any; + type ConcreteBatch = any; + type ConcreteFragmentDefinition = object; + type ConcreteOperationDefinition = object; + type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayProp - // ~~~~~~~~~~~~~~~~~~~~~ - // note: refetch and pagination containers augment this - export type RelayProp = { - environment: Runtime.Environment, - }; + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayProp + // ~~~~~~~~~~~~~~~~~~~~~ + // note: refetch and pagination containers augment this + export interface RelayProp { + environment: Runtime.Environment; + } - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayQL - // ~~~~~~~~~~~~~~~~~~~~~ - export function RelayQL( - strings: Array, - ...substitutions: Array - ): Common.RelayConcreteNode; + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayQL + // ~~~~~~~~~~~~~~~~~~~~~ + export function RelayQL( + strings: string[], + ...substitutions: any[] + ): Common.RelayConcreteNode; - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayModernGraphQLTag - // ~~~~~~~~~~~~~~~~~~~~~ - type GeneratedNodeMap = {[key: string]: GraphQLTaggedNode}; - type GraphQLTaggedNode = - | (() => ConcreteFragment | ConcreteBatch) - | { - modern: () => ConcreteFragment | ConcreteBatch, - classic: (relayQL: typeof RelayQL) => - | ConcreteFragmentDefinition - | ConcreteOperationDefinition, - }; - /** - * Runtime function to correspond to the `graphql` tagged template function. - * All calls to this function should be transformed by the plugin. - */ - interface IGraphql { - (strings: Array | TemplateStringsArray): GraphQLTaggedNode; - experimental: (strings: Array | TemplateStringsArray) => GraphQLTaggedNode; - } - export const graphql: IGraphql; + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayModernGraphQLTag + // ~~~~~~~~~~~~~~~~~~~~~ + interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode; } + type GraphQLTaggedNode = + (() => ConcreteFragment | ConcreteBatch) + | { + modern(): ConcreteFragment | ConcreteBatch, + classic(relayQL: typeof RelayQL): + | ConcreteFragmentDefinition + | ConcreteOperationDefinition, + }; + /** + * Runtime function to correspond to the `graphql` tagged template function. + * All calls to this function should be transformed by the plugin. + */ + interface GraphqlInterface { + (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; + experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; + } + export const graphql: GraphqlInterface; - // ~~~~~~~~~~~~~~~~~~~~~ - // ReactRelayQueryRenderer - // ~~~~~~~~~~~~~~~~~~~~~ - type QueryRendererProps = { - cacheConfig?: __Relay.Common.CacheConfig | void, - environment: __Relay.Runtime.Environment, - query: GraphQLTaggedNode, - render: (readyState: ReadyState) => React.ReactElement | void, - variables: Common.Variables, - rerunParamExperimental?: Common.RerunParam, - }; - export type ReadyState = { - error: Error | void, - props: { [propName: string]: any } | void, - retry: (() => void) | void, - }; - type QueryRendererState = { - readyState: ReadyState, - }; - class ReactRelayQueryRenderer extends React.Component {} + // ~~~~~~~~~~~~~~~~~~~~~ + // ReactRelayQueryRenderer + // ~~~~~~~~~~~~~~~~~~~~~ + interface QueryRendererProps { + cacheConfig?: Common.CacheConfig | void; + environment: Runtime.Environment; + query: GraphQLTaggedNode; + render(readyState: ReadyState): React.ReactElement | void; + variables: Common.Variables; + rerunParamExperimental?: Common.RerunParam; + } + export interface ReadyState { + error: Error | void; + props: { [propName: string]: any } | void; + retry: (() => void) | void; + } + interface QueryRendererState { + readyState: ReadyState; + } + class ReactRelayQueryRenderer extends React.Component { } - // ~~~~~~~~~~~~~~~~~~~~~ - // createFragmentContainer - // ~~~~~~~~~~~~~~~~~~~~~ - export function createFragmentContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - ): ReactBaseComponent; + // ~~~~~~~~~~~~~~~~~~~~~ + // createFragmentContainer + // ~~~~~~~~~~~~~~~~~~~~~ + export function createFragmentContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + ): ReactBaseComponent; - // ~~~~~~~~~~~~~~~~~~~~~ - // createPaginationContainer - // ~~~~~~~~~~~~~~~~~~~~~ - type PageInfo = { - endCursor: string | void, - hasNextPage: boolean, - hasPreviousPage: boolean, - startCursor: string | void, - }; - type ConnectionData = { - edges?: any[], - pageInfo?: PageInfo | void, - }; - export type RelayPaginationProp = RelayProp & { - hasMore: () => boolean, - isLoading: () => boolean, - loadMore: ( - pageSize: number, - callback: (error?: Error) => void, - options?: RefetchOptions, - ) => Common.Disposable | void, - refetchConnection: ( + // ~~~~~~~~~~~~~~~~~~~~~ + // createPaginationContainer + // ~~~~~~~~~~~~~~~~~~~~~ + interface PageInfo { + endCursor: string | void; + hasNextPage: boolean; + hasPreviousPage: boolean; + startCursor: string | void; + } + interface ConnectionData { + edges?: any[]; + pageInfo?: PageInfo | void; + } + export type RelayPaginationProp = RelayProp & { + hasMore(): boolean, + isLoading(): boolean, + loadMore( + pageSize: number, + callback: (error?: Error) => void, + options?: RefetchOptions, + ): Common.Disposable | void, + refetchConnection( + totalCount: number, + callback: (error?: Error | void) => void, + refetchVariables?: Common.Variables | void, + ): Common.Disposable | void, + }; + export function FragmentVariablesGetter( + prevVars: Common.Variables, totalCount: number, - callback: (error?: Error | void) => void, - refetchVariables?: Common.Variables | void, - ) => Common.Disposable | void, - }; - export function FragmentVariablesGetter( - prevVars: Common.Variables, - totalCount: number, - ): Common.Variables; - type ConnectionConfig = { - direction?: 'backward' | 'forward', - getConnectionFromProps?: (props: object) => ConnectionData | void, - getFragmentVariables?: typeof FragmentVariablesGetter, - getVariables: ( - props: {[propName: string]: any }, - paginationInfo: {count: number, cursor: string | void}, - fragmentVariables: Common.Variables, - ) => Common.Variables, - query: GraphQLTaggedNode, - }; - export function createPaginationContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - connectionConfig: ConnectionConfig, - ): ReactBaseComponent; + ): Common.Variables; + interface ConnectionConfig { + direction?: 'backward' | 'forward'; + getConnectionFromProps?(props: object): ConnectionData | void; + getFragmentVariables?: typeof FragmentVariablesGetter; + getVariables( + props: { [propName: string]: any }, + paginationInfo: { count: number, cursor: string | void }, + fragmentVariables: Common.Variables, + ): Common.Variables; + query: GraphQLTaggedNode; + } + export function createPaginationContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + connectionConfig: ConnectionConfig, + ): ReactBaseComponent; - // ~~~~~~~~~~~~~~~~~~~~~ - // createFragmentContainer - // ~~~~~~~~~~~~~~~~~~~~~ - export type RefetchOptions = { - force?: boolean, - rerunParamExperimental?: Common.RerunParam, - }; - export type RelayRefetchProp = RelayProp & { - refetch: ( - refetchVariables: Common.Variables | ((fragmentVariables: Common.Variables) => Common.Variables), - renderVariables?: Common.Variables, - callback?: (error: Error | void) => void, - options?: RefetchOptions, - ) => Common.Disposable, - }; - export function createRefetchContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - taggedNode: GraphQLTaggedNode, - ): ReactBaseComponent; + // ~~~~~~~~~~~~~~~~~~~~~ + // createFragmentContainer + // ~~~~~~~~~~~~~~~~~~~~~ + export interface RefetchOptions { + force?: boolean; + rerunParamExperimental?: Common.RerunParam; + } + export type RelayRefetchProp = RelayProp & { + refetch( + refetchVariables: Common.Variables | ((fragmentVariables: Common.Variables) => Common.Variables), + renderVariables?: Common.Variables, + callback?: (error: Error | void) => void, + options?: RefetchOptions, + ): Common.Disposable, + }; + export function createRefetchContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + taggedNode: GraphQLTaggedNode, + ): ReactBaseComponent; + } + //////////////////////////// + // RELAY CLASSIC TYPES + /////////////////////////// + // note: the namespace here is really for use inside of + // relay-compat; the module declaration below + // uses the old, pre-existing types + namespace Classic { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type StoreReaderData = any; + type StoreReaderOptions = any; + type RelayStoreData = any; + interface RelayQuery { Fragment: any; Node: any; Root: any; } + // ~~~~~~~~~~~~~~~~~~~~~ + // Environment + // ~~~~~~~~~~~~~~~~~~~~~ + interface FragmentResolver { + dispose(): void; + resolve( + fragment: RelayQuery["Fragment"], + dataIDs: Common.DataID | Common.DataID[], + ): (StoreReaderData | StoreReaderData[]) | void; + } + interface RelayEnvironmentInterface { + forceFetch( + querySet: Common.RelayQuerySet, + onReadyStateChange: Common.ReadyStateChangeCallback, + ): Common.Abortable; + getFragmentResolver( + fragment: RelayQuery["Fragment"], + onNext: () => void, + ): FragmentResolver; + getStoreData(): RelayStoreData; + primeCache( + querySet: Common.RelayQuerySet, + onReadyStateChange: Common.ReadyStateChangeCallback, + ): Common.Abortable; + read( + node: RelayQuery["Node"], + dataID: Common.DataID, + options?: StoreReaderOptions, + ): StoreReaderData | void; + readQuery( + root: RelayQuery["Root"], + options?: StoreReaderOptions, + ): StoreReaderData[] | void; + } + } + //////////////////////////// + // RELAY COMPAT TYPES + /////////////////////////// + namespace Compat { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type ConcreteFragment = any; + type ConcreteBatch = any; + type ConcreteFragmentDefinition = object; + type ConcreteOperationDefinition = object; + + // ~~~~~~~~~~~~~~~~~~~~~ + // Util + // ~~~~~~~~~~~~~~~~~~~~~ + export function getFragment(q: string, v?: Common.Variables): string; + interface ComponentWithFragment extends React.ComponentClass { + getFragment: typeof getFragment; + } + interface StatelessWithFragment extends React.StatelessComponent { + getFragment: typeof getFragment; + } + type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; + type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; + export type RelayClassicEnvironment = Classic.RelayEnvironmentInterface; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCompatTypes + // ~~~~~~~~~~~~~~~~~~~~~ + export type CompatEnvironment = Runtime.Environment | RelayClassicEnvironment; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCompatMutations + // ~~~~~~~~~~~~~~~~~~~~~ + export function commitUpdate( + environment: CompatEnvironment, + config: Runtime.MutationConfig, + ): Common.Disposable; + export function applyUpdate( + environment: CompatEnvironment, + config: Runtime.OptimisticMutationConfig, + ): Common.Disposable; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCompatContainer + // ~~~~~~~~~~~~~~~~~~~~~ + export interface GeneratedNodeMap { [key: string]: Modern.GraphQLTaggedNode; } + export function createContainer( + Component: ReactBaseComponent, + fragmentSpec: Modern.GraphQLTaggedNode | GeneratedNodeMap, + ): ReactFragmentComponent; + + // ~~~~~~~~~~~~~~~~~~~~~ + // injectDefaultVariablesProvider + // ~~~~~~~~~~~~~~~~~~~~~ + type VariablesProvider = () => Common.Variables; + export function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; + } } - - -//////////////////////////// -// RELAY CLASSIC TYPES -/////////////////////////// -// note: the namespace here is really for use inside of -// relay-compat; the module declaration below -// uses the old, pre-existing types -declare namespace __Relay.Classic { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type StoreReaderData = any; - type StoreReaderOptions = any; - type RelayStoreData = any; - type RelayQuery = { Fragment: any; Node: any; Root: any;}; - - // ~~~~~~~~~~~~~~~~~~~~~ - // Environment - // ~~~~~~~~~~~~~~~~~~~~~ - type FragmentResolver = { - dispose(): void, - resolve( - fragment: RelayQuery["Fragment"], - dataIDs: Common.DataID | Array, - ): (StoreReaderData | Array) | void, - }; - interface RelayEnvironmentInterface { - forceFetch( - querySet: Common.RelayQuerySet, - onReadyStateChange: Common.ReadyStateChangeCallback, - ): Common.Abortable, - getFragmentResolver( - fragment: RelayQuery["Fragment"], - onNext: () => void, - ): FragmentResolver, - getStoreData(): RelayStoreData, - primeCache( - querySet: Common.RelayQuerySet, - onReadyStateChange: Common.ReadyStateChangeCallback, - ): Common.Abortable, - read( - node: RelayQuery["Node"], - dataID: Common.DataID, - options?: StoreReaderOptions, - ): StoreReaderData | void, - readQuery( - root: RelayQuery["Root"], - options?: StoreReaderOptions, - ): Array | void, - } - } - -//////////////////////////// -// RELAY COMPAT TYPES -/////////////////////////// - -declare namespace __Relay.Compat { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type ConcreteFragment = any; - type ConcreteBatch = any; - type ConcreteFragmentDefinition = object; - type ConcreteOperationDefinition = object; - - - // ~~~~~~~~~~~~~~~~~~~~~ - // Util - // ~~~~~~~~~~~~~~~~~~~~~ - export function getFragment(q: string, v?: Common.Variables): string; - interface ComponentWithFragment extends React.ComponentClass { - getFragment: typeof getFragment; - } - interface StatelessWithFragment extends React.StatelessComponent { - getFragment: typeof getFragment; - } - type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; - type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; - export type RelayClassicEnvironment = Classic.RelayEnvironmentInterface; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCompatTypes - // ~~~~~~~~~~~~~~~~~~~~~ - export type CompatEnvironment = Runtime.Environment | RelayClassicEnvironment; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCompatMutations - // ~~~~~~~~~~~~~~~~~~~~~ - export function commitUpdate( - environment: CompatEnvironment, - config: Runtime.MutationConfig, - ): Common.Disposable; - export function applyUpdate( - environment: CompatEnvironment, - config: Runtime.OptimisticMutationConfig, - ): Common.Disposable; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCompatContainer - // ~~~~~~~~~~~~~~~~~~~~~ - export type GeneratedNodeMap = {[key: string]: Modern.GraphQLTaggedNode}; - export function createContainer( - Component: ReactBaseComponent, - fragmentSpec: Modern.GraphQLTaggedNode | GeneratedNodeMap, - ): ReactFragmentComponent; - - // ~~~~~~~~~~~~~~~~~~~~~ - // injectDefaultVariablesProvider - // ~~~~~~~~~~~~~~~~~~~~~ - type VariablesProvider = () => Common.Variables; - export function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; -} - - //////////////////////////// // MODULES /////////////////////////// @@ -308,8 +301,7 @@ declare module 'react-relay/compat' { export import QueryRenderer = __Relay.Modern.ReactRelayQueryRenderer; export import graphql = __Relay.Modern.graphql; export import fetchQuery = __Relay.Runtime.fetchRelayModernQuery; - } - +} declare module "react-relay/classic" { import * as React from "react"; @@ -341,21 +333,22 @@ declare module "react-relay/classic" { } type RelayMutationStatus = - 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. - 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. - 'COLLISION_COMMIT_FAILED' | //Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, including this one, have been failed. Transaction can be recommitted or rolled back. - 'COMMITTING' | // Transaction is waiting for the server to respond. - 'COMMIT_FAILED'; + 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. + 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. + 'COLLISION_COMMIT_FAILED' | // Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, + // including this one, have been failed. Transaction can be recommitted or rolled back. + 'COMMITTING' | // Transaction is waiting for the server to respond. + 'COMMIT_FAILED'; class RelayMutationTransaction { - applyOptimistic(): RelayMutationTransaction; - commit(): RelayMutationTransaction | null; - recommit(): void; - rollback(): void; - getError(): Error; - getStatus(): RelayMutationStatus; - getHash(): string; - getID(): ClientMutationID; + applyOptimistic(): RelayMutationTransaction; + commit(): RelayMutationTransaction | null; + recommit(): void; + rollback(): void; + getError(): Error; + getStatus(): RelayMutationStatus; + getHash(): string; + getID(): ClientMutationID; } interface RelayMutationRequest { @@ -398,7 +391,7 @@ declare module "react-relay/classic" { * S is typically dynamic as it depends on the data the app is currently using, but it's possible to always * return some data in the payload using REQUIRED_CHILDREN which is where specifying S is the most useful. */ - class Mutation { + class Mutation { props: T constructor(props: T) @@ -416,19 +409,19 @@ declare module "react-relay/classic" { } interface Store { - commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any + commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any } - var Store: Store + const Store: Store - class RootContainer extends React.Component {} + class RootContainer extends React.Component { } - interface RootContainerProps extends React.Props{ + interface RootContainerProps extends React.Props { Component: RelayContainerClass route: Route renderLoading?(): JSX.Element renderFetched?(data: any): JSX.Element - renderFailure?(error: Error, retry: Function): JSX.Element + renderFailure?(error: Error, retry: (...args: any[]) => any): JSX.Element } type ReadyStateEvent = @@ -443,16 +436,14 @@ declare module "react-relay/classic" { 'STORE_FOUND_ALL' | 'STORE_FOUND_REQUIRED'; - interface OnReadyStateChange { - (readyState: { - ready: boolean, - done: boolean, - stale: boolean, - error?: Error, - events: Array, - aborted: boolean - }): void - } + type OnReadyStateChange = (readyState: { + ready: boolean, + done: boolean, + stale: boolean, + error?: Error, + events: ReadyStateEvent[], + aborted: boolean + }) => void interface RelayProp { readonly route: { name: string; }; // incomplete, also has params and queries @@ -462,6 +453,6 @@ declare module "react-relay/classic" { forceFetch(variables: any, onReadyStateChange?: OnReadyStateChange): void; hasOptimisticUpdate(record: any): boolean; getPendingTransactions(record: any): RelayMutationTransaction[]; - commitUpdate: (mutation: Mutation, callbacks?: StoreUpdateCallbacks) => any; + commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; } } From ea247c58854b918552c4f846d7280b9eac7f543e Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 10 Sep 2017 17:08:21 -1000 Subject: [PATCH 016/314] removing redundent exports from relay-runtime --- types/relay-runtime/index.d.ts | 103 ++++++++++++++++----------------- 1 file changed, 51 insertions(+), 52 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 4acab12c5b..382711209f 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -6,7 +6,6 @@ declare namespace __Relay { namespace Common { - /** * SOURCE: * Relay 1.3.0 @@ -37,7 +36,7 @@ declare namespace __Relay { * lot of errors in Relay code since methods like getFragment() are used often * but have no definition in Relay's types. Suppressing for now. */ - export type RelayContainer = any; + type RelayContainer = any; // ~~~~~~~~~~~~~~~~~~~~~ // RelayQL @@ -64,12 +63,12 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // General Usage // ~~~~~~~~~~~~~~~~~~~~~ - export type DataID = string; - export interface Variables { + type DataID = string; + interface Variables { [name: string]: any; } - export type Uploadable = File | Blob; - export interface UploadableMap { + type Uploadable = File | Blob; + interface UploadableMap { [key: string]: Uploadable; } @@ -79,12 +78,12 @@ declare namespace __Relay { // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js // ~~~~~~~~~~~~~~~~~~~~~ - export interface LegacyObserver { - onCompleted?: (() => void) | void; - onError?: ((error: Error) => void) | void; - onNext?: ((data: T) => void) | void; + interface LegacyObserver { + onCompleted?(): void; + onError?(error: Error): void; + onNext?(data: T): void; } - export interface PayloadError { + interface PayloadError { message: string; locations?: Array<{ line: number, @@ -96,7 +95,7 @@ declare namespace __Relay { * * May return an Observable or Promise of a raw server response. */ - export function FetchFunction( + function FetchFunction( operation: ConcreteBatch, variables: Variables, cacheConfig: CacheConfig, @@ -110,7 +109,7 @@ declare namespace __Relay { * May return an Observable, otherwise must call the callbacks found in the * fourth parameter. */ - export type SubscribeFunction = ( + type SubscribeFunction = ( operation: ConcreteBatch, variables: Variables, cacheConfig: CacheConfig, @@ -126,14 +125,14 @@ declare namespace __Relay { * A function that receives a proxy over the store and may trigger side-effects * (indirectly) by calling `set*` methods on the store or its record proxies. */ - export type StoreUpdater = (store: RecordSourceProxy) => void; + type StoreUpdater = (store: RecordSourceProxy) => void; /** * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in * order to easily access the root fields of a query/mutation as well as a * second argument of the response object of the mutation. */ - export type SelectorStoreUpdater = ( + type SelectorStoreUpdater = ( store: RecordSourceSelectorProxy, // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is // inconvenient to access deeply in product code. @@ -144,7 +143,7 @@ declare namespace __Relay { * Extends the RecordSourceProxy interface with methods for accessing the root * fields of a Selector. */ - export interface RecordSourceSelectorProxy { + interface RecordSourceSelectorProxy { create(dataID: DataID, typeName: string): RecordProxy; delete(dataID: DataID): void; get(dataID: DataID): RecordProxy | void; @@ -153,7 +152,7 @@ declare namespace __Relay { getPluralRootField(fieldName: string): RecordProxy[] | void; } - export interface RecordProxy { + interface RecordProxy { copyFieldsFrom(source: RecordProxy): void; getDataID(): DataID; getLinkedRecord(name: string, args?: Variables | void): RecordProxy | void; @@ -178,14 +177,14 @@ declare namespace __Relay { setValue(value: any, name: string, args?: Variables | void): RecordProxy; } - export interface RecordSourceProxy { + interface RecordSourceProxy { create(dataID: DataID, typeName: string): RecordProxy; delete(dataID: DataID): void; get(dataID: DataID): Array | void; getRoot(): RecordProxy; } - export interface HandleFieldPayload { + interface HandleFieldPayload { // The arguments that were fetched. args: Variables; // The __id of the record containing the source/handle field. @@ -202,7 +201,7 @@ declare namespace __Relay { update(store: RecordSourceProxy, fieldPayload: HandleFieldPayload): void; [functionName: string]: (...args: any[]) => any; } - export const Handler: HandlerInterface; + const Handler: HandlerInterface; // ~~~~~~~~~~~~~~~~~~~~~ // RelayCombinedEnvironmentTypes @@ -217,7 +216,7 @@ declare namespace __Relay { * - `poll`: causes a query to live update by polling at the specified interval * in milliseconds. (This value will be passed to setTimeout.) */ - export interface CacheConfig { + interface CacheConfig { force?: boolean | void; poll?: number | void; } @@ -227,30 +226,30 @@ declare namespace __Relay { * use-case is as a return value for subscriptions, where calling `dispose()` * would cancel the subscription. */ - export interface Disposable { + interface Disposable { dispose(): void; } /** * Arbitrary data e.g. received by a container as props. */ - export interface Props { [key: string]: any; } + interface Props { [key: string]: any; } /* * An individual cached graph object. */ - export interface Record { [key: string]: any; } + interface Record { [key: string]: any; } /** * A collection of records keyed by id. */ - export interface RecordMap { [dataID: string]: Record | void; } + interface RecordMap { [dataID: string]: Record | void; } /** * A selector defines the starting point for a traversal into the graph for the * purposes of targeting a subgraph. */ - export interface CSelector { + interface CSelector { dataID: DataID; node: TNode; variables: Variables; @@ -259,7 +258,7 @@ declare namespace __Relay { /** * A representation of a selector and its results at a particular point in time. */ - export type CSnapshot = CSelector & { + type CSnapshot = CSelector & { data: SelectorData | void, seenRecords: RecordMap, }; @@ -267,13 +266,13 @@ declare namespace __Relay { /** * The results of a selector given a store/RecordSource. */ - export interface SelectorData { [key: string]: any; } + interface SelectorData { [key: string]: any; } /** * The results of reading the results of a FragmentMap given some input * `Props`. */ - export interface FragmentSpecResults { [key: string]: any; } + interface FragmentSpecResults { [key: string]: any; } /** * A utility for resolving and subscribing to the results of a fragment spec @@ -286,7 +285,7 @@ declare namespace __Relay { * - Creates resolvers for any props that became non-null. * - Updates resolvers with the latest props. */ - export interface FragmentSpecResolver { + interface FragmentSpecResolver { /** * Stop watching for changes to the results of the fragments. */ @@ -310,7 +309,7 @@ declare namespace __Relay { setVariables(variables: Variables): void; } - export interface CFragmentMap { [key: string]: TFragment; } + interface CFragmentMap { [key: string]: TFragment; } /** * An operation selector describes a specific instance of a GraphQL operation @@ -321,7 +320,7 @@ declare namespace __Relay { * - `fragment`: a selector intended for use in reading or subscribing to * the results of the the operation. */ - export interface COperationSelector { + interface COperationSelector { fragment: CSelector; node: TOperation; root: CSelector; @@ -332,7 +331,7 @@ declare namespace __Relay { * The public API of Relay core. Represents an encapsulated environment with its * own in-memory cache. */ - export interface CEnvironment< + interface CEnvironment< TEnvironment, TFragment, TGraphQLTaggedNode, @@ -408,7 +407,7 @@ declare namespace __Relay { >; } - export interface CUnstableEnvironmentCore< + interface CUnstableEnvironmentCore< TEnvironment, TFragment, TGraphQLTaggedNode, @@ -551,7 +550,7 @@ declare namespace __Relay { * The type of the `relay` property set on React context by the React/Relay * integration layer (e.g. QueryRenderer, FragmentContainer, etc). */ - export interface CRelayContext { + interface CRelayContext { environment: TEnvironment; variables: Variables; } @@ -564,7 +563,7 @@ declare namespace __Relay { * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js */ // ~~~~~~~~~~~~~~~~~~~~~ - export interface RerunParam { + interface RerunParam { param: string; import: string; max_runs: number; @@ -609,35 +608,35 @@ declare namespace __Relay { type: 'REQUIRED_CHILDREN'; children: RelayConcreteNode[]; } - export type RelayMutationConfig = + type RelayMutationConfig = FIELDS_CHANGE | RANGE_ADD | NODE_DELETE | RANGE_DELETE | REQUIRED_CHILDREN; - export interface RelayMutationTransactionCommitCallbacks { + interface RelayMutationTransactionCommitCallbacks { onFailure?: RelayMutationTransactionCommitFailureCallback; onSuccess?: RelayMutationTransactionCommitSuccessCallback; } - export type RelayMutationTransactionCommitFailureCallback = ( + type RelayMutationTransactionCommitFailureCallback = ( transaction: RelayMutationTransaction, preventAutoRollback: () => void, ) => void; - export type RelayMutationTransactionCommitSuccessCallback = (response: { + type RelayMutationTransactionCommitSuccessCallback = (response: { [key: string]: any, }) => void; - export interface NetworkLayer { + interface NetworkLayer { sendMutation(request: RelayMutationRequest): Promise | void; sendQueries(requests: RelayQueryRequest[]): Promise | void; supports(...options: string[]): boolean; } - export interface QueryResult { + interface QueryResult { error?: Error | void; ref_params?: { [name: string]: any } | void; response: QueryPayload; } - export interface ReadyState { + interface ReadyState { aborted: boolean; done: boolean; error: Error | void; @@ -657,12 +656,12 @@ declare namespace __Relay { | 'NETWORK_QUERY_START' | 'STORE_FOUND_ALL' | 'STORE_FOUND_REQUIRED'; - export type ReadyStateChangeCallback = (readyState: ReadyState) => void; - export interface ReadyStateEvent { + type ReadyStateChangeCallback = (readyState: ReadyState) => void; + interface ReadyStateEvent { type: RelayContainerLoadingEventType | RelayContainerErrorEventType; error?: Error; } - export interface Abortable { + interface Abortable { abort(): void; } @@ -674,15 +673,15 @@ declare namespace __Relay { * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js */ // ~~~~~~~~~~~~~~~~~~~~~ - export interface QueryPayload { [key: string]: any; } - export interface RelayQuerySet { [queryName: string]: any; } + interface QueryPayload { [key: string]: any; } + interface RelayQuerySet { [queryName: string]: any; } type RangeBehaviorsFunction = (connectionArgs: { [argName: string]: any, }) => 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; interface RangeBehaviorsObject { [key: string]: 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; } - export type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; + type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; } namespace Runtime { @@ -715,7 +714,7 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // RelayDefaultHandlerProvider // ~~~~~~~~~~~~~~~~~~~~~ - export function HandlerProvider(name: string): typeof Common.Handler | void; + function HandlerProvider(name: string): typeof Common.Handler | void; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernEnvironment @@ -1107,7 +1106,7 @@ declare namespace __Relay { // requestRelaySubscription // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly - export interface GraphQLSubscriptionConfig { + interface GraphQLSubscriptionConfig { configs?: Common.RelayMutationConfig[]; subscription: Common.GraphQLTaggedNode; variables: Common.Variables; @@ -1116,7 +1115,7 @@ declare namespace __Relay { onNext?(response: object | void): void; updater?(store: Common.RecordSourceSelectorProxy): void; } - export function requestRelaySubscription( + function requestRelaySubscription( environment: Environment, config: GraphQLSubscriptionConfig, ): Common.Disposable; From ec92bbda49dd7175006dc2e3ce1b9d648bf4cf2c Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 10 Sep 2017 17:13:38 -1000 Subject: [PATCH 017/314] removing single module declare in relay-runtime --- types/relay-runtime/index.d.ts | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 382711209f..682a74882e 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 +// note: __Relay namespace is used so react-relay can access and inter-op declare namespace __Relay { namespace Common { /** @@ -1061,9 +1062,9 @@ declare namespace __Relay { optimisticResponse?: object; updater?: Common.SelectorStoreUpdater | void; } - function commitRelayModernMutation( + function commitRelayModernMutation( environment: Environment, - config: MutationConfig, + config: MutationConfig, ): Common.Disposable; // ~~~~~~~~~~~~~~~~~~~~~ @@ -1122,14 +1123,12 @@ declare namespace __Relay { } } -declare module 'relay-runtime' { - export import Environment = __Relay.Runtime.Environment; - export import Network = __Relay.Runtime.Network; - export import RecordSource = __Relay.Runtime.RecordSource; - export import Store = __Relay.Runtime.Store; - export import Observable = __Relay.Runtime.RelayObservable; - // note RecordSourceInspector is only available in dev environment - export import RecordSourceInspector = __Relay.Runtime.RelayRecordSourceInspector; - export import ConnectionHandler = __Relay.Common.Handler; - export import ViewerHandler = __Relay.Common.Handler; -} +export import Environment = __Relay.Runtime.Environment; +export import Network = __Relay.Runtime.Network; +export import RecordSource = __Relay.Runtime.RecordSource; +export import Store = __Relay.Runtime.Store; +export import Observable = __Relay.Runtime.RelayObservable; +// note RecordSourceInspector is only available in dev environment +export import RecordSourceInspector = __Relay.Runtime.RelayRecordSourceInspector; +export import ConnectionHandler = __Relay.Common.Handler; +export import ViewerHandler = __Relay.Common.Handler; From 38dd00d25ea48d0191589fd66f6a6a1f671bc2f9 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 10 Sep 2017 17:18:52 -1000 Subject: [PATCH 018/314] single declare module is needed to allow access from react-relay --- types/react-relay/index.d.ts | 2 +- types/relay-runtime/index.d.ts | 20 +++++++++++--------- types/relay-runtime/tslint.json | 5 ++++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index eb940d296d..a089d020c5 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -26,7 +26,7 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // note: refetch and pagination containers augment this export interface RelayProp { - environment: Runtime.Environment; + environment: __Relay.Runtime.Environment; } // ~~~~~~~~~~~~~~~~~~~~~ diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 682a74882e..b5c3b006f8 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -1123,12 +1123,14 @@ declare namespace __Relay { } } -export import Environment = __Relay.Runtime.Environment; -export import Network = __Relay.Runtime.Network; -export import RecordSource = __Relay.Runtime.RecordSource; -export import Store = __Relay.Runtime.Store; -export import Observable = __Relay.Runtime.RelayObservable; -// note RecordSourceInspector is only available in dev environment -export import RecordSourceInspector = __Relay.Runtime.RelayRecordSourceInspector; -export import ConnectionHandler = __Relay.Common.Handler; -export import ViewerHandler = __Relay.Common.Handler; +declare module 'relay-runtime' { + export import Environment = __Relay.Runtime.Environment; + export import Network = __Relay.Runtime.Network; + export import RecordSource = __Relay.Runtime.RecordSource; + export import Store = __Relay.Runtime.Store; + export import Observable = __Relay.Runtime.RelayObservable; + // note RecordSourceInspector is only available in dev environment + export import RecordSourceInspector = __Relay.Runtime.RelayRecordSourceInspector; + export import ConnectionHandler = __Relay.Common.Handler; + export import ViewerHandler = __Relay.Common.Handler; +} diff --git a/types/relay-runtime/tslint.json b/types/relay-runtime/tslint.json index 3db14f85ea..1fded7a528 100644 --- a/types/relay-runtime/tslint.json +++ b/types/relay-runtime/tslint.json @@ -1 +1,4 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "no-single-declare-module": false +} From 66af1890896bdb0ca54ecad2b219411efe35a6c8 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 10 Sep 2017 17:44:00 -1000 Subject: [PATCH 019/314] removing maybe util type --- types/relay-runtime/index.d.ts | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index b5c3b006f8..bddbc60600 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -12,11 +12,6 @@ declare namespace __Relay { * Relay 1.3.0 * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js */ - // ~~~~~~~~~~~~~~~~~~~~~ - // Util - // ~~~~~~~~~~~~~~~~~~~~~ - type Maybe = T | void; - // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix // ~~~~~~~~~~~~~~~~~~~~~ @@ -164,18 +159,18 @@ declare namespace __Relay { args?: Variables | void, ): RecordProxy; getType(): string; - getValue(name: string, args?: Variables | void): any; + getValue(name: string, args?: Variables): any; setLinkedRecord( record: RecordProxy, name: string, args?: Variables | void, ): RecordProxy; setLinkedRecords( - records: Array | void, + records: Array | undefined | null, name: string, - args?: Variables | void, + args?: Variables, ): RecordProxy; - setValue(value: any, name: string, args?: Variables | void): RecordProxy; + setValue(value: any, name: string, args?: Variables): RecordProxy; } interface RecordSourceProxy { @@ -377,9 +372,9 @@ declare namespace __Relay { */ sendQuery(config: { cacheConfig?: CacheConfig | void, - onCompleted?: Maybe<() => void>, - onError?: Maybe<(error: Error) => void>, - onNext?: Maybe<(payload: TPayload) => void>, + onCompleted?: () => void, + onError?: (error: Error) => void, + onNext?: (payload: TPayload) => void, operation: COperationSelector, }): Disposable; @@ -392,10 +387,10 @@ declare namespace __Relay { * subscription open indefinitely such that `onCompleted` is not called. */ streamQuery(config: { - cacheConfig?: Maybe, - onCompleted?: Maybe<() => void>, - onError?: Maybe<(error: Error) => void>, - onNext?: Maybe<(payload: TPayload) => void>, + cacheConfig?: CacheConfig, + onCompleted?: () => void, + onError?: (error: Error) => void, + onNext?: (payload: TPayload) => void, operation: COperationSelector, }): Disposable; @@ -518,7 +513,7 @@ declare namespace __Relay { operationVariables: Variables, fragments: CFragmentMap, props: Props, - ): { [key: string]: Maybe<(CSelector | Array>)> }; + ): { [key: string]: CSelector | Array> | null | undefined }; /** * Given a mapping of keys -> results and a mapping of keys -> fragments, @@ -530,7 +525,7 @@ declare namespace __Relay { getDataIDsFromObject( fragments: CFragmentMap, props: Props, - ): { [key: string]: Maybe<(DataID | DataID[])> }; + ): { [key: string]: DataID | DataID[] | null | undefined }; /** * Given a mapping of keys -> results and a mapping of keys -> fragments, @@ -1124,6 +1119,7 @@ declare namespace __Relay { } declare module 'relay-runtime' { + // tslint:disable strict-export-declare-modifiers export import Environment = __Relay.Runtime.Environment; export import Network = __Relay.Runtime.Network; export import RecordSource = __Relay.Runtime.RecordSource; From 8ce8311cdfd044761d6084626f61fd38d913fae7 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Mon, 11 Sep 2017 08:02:22 -1000 Subject: [PATCH 020/314] fixing a bunch of linting errors in relay-runtime --- types/relay-runtime/index.d.ts | 84 ++++++++++++++++----------------- types/relay-runtime/tslint.json | 3 +- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index bddbc60600..c107dca8e7 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -151,22 +151,22 @@ declare namespace __Relay { interface RecordProxy { copyFieldsFrom(source: RecordProxy): void; getDataID(): DataID; - getLinkedRecord(name: string, args?: Variables | void): RecordProxy | void; - getLinkedRecords(name: string, args?: Variables | void): Array | void; + getLinkedRecord(name: string, args?: Variables): RecordProxy | void; + getLinkedRecords(name: string, args?: Variables): Array | void; getOrCreateLinkedRecord( name: string, typeName: string, - args?: Variables | void, + args?: Variables, ): RecordProxy; getType(): string; getValue(name: string, args?: Variables): any; setLinkedRecord( record: RecordProxy, name: string, - args?: Variables | void, + args?: Variables, ): RecordProxy; setLinkedRecords( - records: Array | undefined | null, + records: Array | undefined | null, name: string, args?: Variables, ): RecordProxy; @@ -176,7 +176,7 @@ declare namespace __Relay { interface RecordSourceProxy { create(dataID: DataID, typeName: string): RecordProxy; delete(dataID: DataID): void; - get(dataID: DataID): Array | void; + get(dataID: DataID): Array | void; getRoot(): RecordProxy; } @@ -213,8 +213,8 @@ declare namespace __Relay { * in milliseconds. (This value will be passed to setTimeout.) */ interface CacheConfig { - force?: boolean | void; - poll?: number | void; + force?: boolean; + poll?: number; } /** @@ -239,7 +239,7 @@ declare namespace __Relay { /** * A collection of records keyed by id. */ - interface RecordMap { [dataID: string]: Record | void; } + interface RecordMap { [dataID: string]: Record | null | undefined; } /** * A selector defines the starting point for a traversal into the graph for the @@ -371,10 +371,10 @@ declare namespace __Relay { * after receving the first `onNext` result. */ sendQuery(config: { - cacheConfig?: CacheConfig | void, + cacheConfig?: CacheConfig, onCompleted?: () => void, - onError?: (error: Error) => void, - onNext?: (payload: TPayload) => void, + onError?(error: Error): void, + onNext?(payload: TPayload): void, operation: COperationSelector, }): Disposable; @@ -389,8 +389,8 @@ declare namespace __Relay { streamQuery(config: { cacheConfig?: CacheConfig, onCompleted?: () => void, - onError?: (error: Error) => void, - onNext?: (payload: TPayload) => void, + onError?(error: Error): void, + onNext?(payload: TPayload): void, operation: COperationSelector, }): Disposable; @@ -628,14 +628,14 @@ declare namespace __Relay { supports(...options: string[]): boolean; } interface QueryResult { - error?: Error | void; - ref_params?: { [name: string]: any } | void; + error?: Error; + ref_params?: { [name: string]: any }; response: QueryPayload; } interface ReadyState { aborted: boolean; done: boolean; - error: Error | void; + error: Error | null; events: ReadyStateEvent[]; ready: boolean; stale: boolean; @@ -701,7 +701,7 @@ declare namespace __Relay { operation: object, variables: Common.Variables, cacheConfig: Common.CacheConfig, - uploadables?: Common.UploadableMap | void, + uploadables?: Common.UploadableMap, ) => Promise; interface RelayNetwork { execute: ExecuteFunction; @@ -747,15 +747,15 @@ declare namespace __Relay { retain(selector: Selector): Common.Disposable; execute(config: { operation: OperationSelector, - cacheConfig?: Common.CacheConfig | void, - updater?: Common.SelectorStoreUpdater | void, + cacheConfig?: Common.CacheConfig, + updater?: Common.SelectorStoreUpdater, }): RelayObservable; executeMutation(config: { operation: OperationSelector, - optimisticUpdater?: Common.SelectorStoreUpdater | void, - optimisticResponse?: object | void, - updater?: Common.SelectorStoreUpdater | void, - uploadables?: Common.UploadableMap | void, + optimisticUpdater?: Common.SelectorStoreUpdater, + optimisticResponse?: object, + updater?: Common.SelectorStoreUpdater, + uploadables?: Common.UploadableMap, }): RelayObservable; } @@ -763,7 +763,7 @@ declare namespace __Relay { // RelayInMemoryRecordSource // ~~~~~~~~~~~~~~~~~~~~~ interface Record { [key: string]: any; } - interface RecordMap { [dataID: string]: Record | void; } + interface RecordMap { [dataID: string]: Record | null | undefined; } // ~~~~~~~~~~~~~~~~~~~~~ // Network @@ -789,7 +789,7 @@ declare namespace __Relay { has(dataID: Common.DataID): boolean; load( dataID: Common.DataID, - callback: (error: Error | void, record: Record | void) => void, + callback: (error: Error | null, record: Record | null) => void, ): void; remove(dataID: Common.DataID): void; set(dataID: Common.DataID, record: Record): void; @@ -823,9 +823,9 @@ declare namespace __Relay { */ class RecordSummary { id: Common.DataID; - type: string | void; + type: string | null | undefined; static createFromRecord(id: Common.DataID, record: any): RecordSummary; - constructor(id: Common.DataID, type: string | void); + constructor(id: Common.DataID, type: string | null | undefined); toString(): string; } /** @@ -860,21 +860,21 @@ declare namespace __Relay { * Returns the value of a scalar field. May throw if the given field is * present but not actually scalar. */ - getValue(name: string, args?: Common.Variables | void): any; + getValue(name: string, args?: Common.Variables): any; /** * Returns an inspector for the given scalar "linked" field (a field whose * value is another Record instead of a scalar). May throw if the field is * present but not a scalar linked record. */ - getLinkedRecord(name: string, args?: Common.Variables | void): RecordInspector | void; + getLinkedRecord(name: string, args?: Common.Variables): RecordInspector | void; /** * Returns an array of inspectors for the given plural "linked" field (a field * whose value is an array of Records instead of a scalar). May throw if the * field is present but not a plural linked record. */ - getLinkedRecords(name: string, args?: Common.Variables | void): RecordInspector[] | void; + getLinkedRecords(name: string, args?: Common.Variables): RecordInspector[] | void; } class RelayRecordSourceInspector { @@ -912,11 +912,11 @@ declare namespace __Relay { readonly closed: boolean; } interface Observer { - start?: ((subscription: Subscription) => any) | void; - next?: ((nextThing: T) => any) | void; - error?: ((error: Error) => any) | void; - complete?: (() => any) | void; - unsubscribe?: ((subscription: Subscription) => any) | void; + start?: (subscription: Subscription) => any; + next?: (nextThing: T) => any; + error?: (error: Error) => any; + complete?: () => any; + unsubscribe?: (subscription: Subscription) => any; } type Source = () => any; interface Subscribable { @@ -1030,7 +1030,7 @@ declare namespace __Relay { * Returns a Promise which resolves when this Observable yields a first value * or when it completes with no value. */ - toPromise(): Promise; + toPromise(): Promise; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -1051,11 +1051,11 @@ declare namespace __Relay { mutation: Common.GraphQLTaggedNode; variables: Common.Variables; uploadables?: Common.UploadableMap; - onCompleted?(response: T, errors: Common.PayloadError[] | void): void; + onCompleted?(response: T, errors: Common.PayloadError[] | null | undefined): void; onError?(error?: Error): void; optimisticUpdater?: Common.SelectorStoreUpdater | void; optimisticResponse?: object; - updater?: Common.SelectorStoreUpdater | void; + updater?: Common.SelectorStoreUpdater; } function commitRelayModernMutation( environment: Environment, @@ -1095,7 +1095,7 @@ declare namespace __Relay { environment: any, // FIXME - $FlowFixMe in facebook source code taggedNode: Common.GraphQLTaggedNode, variables: Common.Variables, - cacheConfig?: Common.CacheConfig | void, + cacheConfig?: Common.CacheConfig, ): Promise; // FIXME - $FlowFixMe in facebook source code // ~~~~~~~~~~~~~~~~~~~~~ @@ -1108,7 +1108,7 @@ declare namespace __Relay { variables: Common.Variables; onCompleted?(): void; onError?(error: Error): void; - onNext?(response: object | void): void; + onNext?(response: object | null | undefined): void; updater?(store: Common.RecordSourceSelectorProxy): void; } function requestRelaySubscription( @@ -1118,8 +1118,8 @@ declare namespace __Relay { } } +// tslint:disable no-single-declare-module strict-export-declare-modifiers declare module 'relay-runtime' { - // tslint:disable strict-export-declare-modifiers export import Environment = __Relay.Runtime.Environment; export import Network = __Relay.Runtime.Network; export import RecordSource = __Relay.Runtime.RecordSource; diff --git a/types/relay-runtime/tslint.json b/types/relay-runtime/tslint.json index 1fded7a528..f93cf8562a 100644 --- a/types/relay-runtime/tslint.json +++ b/types/relay-runtime/tslint.json @@ -1,4 +1,3 @@ { - "extends": "dtslint/dt.json", - "no-single-declare-module": false + "extends": "dtslint/dt.json" } From 7101bd194bb7f37063d924a3e103bfffed566ff6 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Mon, 11 Sep 2017 10:50:28 -1000 Subject: [PATCH 021/314] hopefully the last of relay-runtime linting errors --- types/relay-runtime/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index c107dca8e7..2bd9938b0c 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -255,7 +255,7 @@ declare namespace __Relay { * A representation of a selector and its results at a particular point in time. */ type CSnapshot = CSelector & { - data: SelectorData | void, + data: SelectorData | null | undefined, seenRecords: RecordMap, }; @@ -372,7 +372,7 @@ declare namespace __Relay { */ sendQuery(config: { cacheConfig?: CacheConfig, - onCompleted?: () => void, + onCompleted?(): void, onError?(error: Error): void, onNext?(payload: TPayload): void, operation: COperationSelector, @@ -388,7 +388,7 @@ declare namespace __Relay { */ streamQuery(config: { cacheConfig?: CacheConfig, - onCompleted?: () => void, + onCompleted?(): void, onError?(error: Error): void, onNext?(payload: TPayload): void, operation: COperationSelector, @@ -912,11 +912,11 @@ declare namespace __Relay { readonly closed: boolean; } interface Observer { - start?: (subscription: Subscription) => any; - next?: (nextThing: T) => any; - error?: (error: Error) => any; - complete?: () => any; - unsubscribe?: (subscription: Subscription) => any; + start?(subscription: Subscription): any; + next?(nextThing: T): any; + error?(error: Error): any; + complete?(): any; + unsubscribe?(subscription: Subscription): any; } type Source = () => any; interface Subscribable { @@ -1053,7 +1053,7 @@ declare namespace __Relay { uploadables?: Common.UploadableMap; onCompleted?(response: T, errors: Common.PayloadError[] | null | undefined): void; onError?(error?: Error): void; - optimisticUpdater?: Common.SelectorStoreUpdater | void; + optimisticUpdater?: Common.SelectorStoreUpdater; optimisticResponse?: object; updater?: Common.SelectorStoreUpdater; } From cafeccbaf51e72f8e23f51b1b01a12eb28675104 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Mon, 11 Sep 2017 11:00:47 -1000 Subject: [PATCH 022/314] cleaning up some linting errors in react-relay and its tests --- types/react-relay/index.d.ts | 81 ++++++++++++------------- types/react-relay/react-relay-tests.tsx | 76 ++++++++++------------- 2 files changed, 71 insertions(+), 86 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index a089d020c5..e41f39e4ae 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -26,7 +26,7 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // note: refetch and pagination containers augment this export interface RelayProp { - environment: __Relay.Runtime.Environment; + environment: Runtime.Environment; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -310,26 +310,26 @@ declare module "react-relay/classic" { /** Fragments are a hash of functions */ interface Fragments { - [query: string]: ((variables?: RelayVariables) => string) + [query: string]: ((variables?: RelayVariables) => string); } interface CreateContainerOpts { - initialVariables?: any - fragments: Fragments - prepareVariables?(prevVariables: RelayVariables): RelayVariables + initialVariables?: any; + fragments: Fragments; + prepareVariables?(prevVariables: RelayVariables): RelayVariables; } interface RelayVariables { - [name: string]: any + [name: string]: any; } /** add static getFragment method to the component constructor */ interface RelayContainerClass extends React.ComponentClass { - getFragment: ((q: string, v?: RelayVariables) => string) + getFragment: ((q: string, v?: RelayVariables) => string); } interface RelayQueryRequestResolve { - response: any + response: any; } type RelayMutationStatus = @@ -352,35 +352,34 @@ declare module "react-relay/classic" { } interface RelayMutationRequest { - getQueryString(): string - getVariables(): RelayVariables - resolve(result: RelayQueryRequestResolve): any - reject(errors: any): any + getQueryString(): string; + getVariables(): RelayVariables; + resolve(result: RelayQueryRequestResolve): any; + reject(errors: any): any; } interface RelayQueryRequest { - resolve(result: RelayQueryRequestResolve): any - reject(errors: any): any - - getQueryString(): string - getVariables(): RelayVariables - getID(): string - getDebugName(): string + resolve(result: RelayQueryRequestResolve): any; + reject(errors: any): any; + getQueryString(): string; + getVariables(): RelayVariables; + getID(): string; + getDebugName(): string; } interface RelayNetworkLayer { - supports(...options: string[]): boolean + supports(...options: string[]): boolean; } class DefaultNetworkLayer implements RelayNetworkLayer { - constructor(host: string, options?: any) - supports(...options: string[]): boolean + constructor(host: string, options?: any); + supports(...options: string[]): boolean; } - export function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass - export function injectNetworkLayer(networkLayer: RelayNetworkLayer): any - export function isContainer(component: React.ComponentClass): boolean - export function QL(...args: any[]): string + export function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass; + export function injectNetworkLayer(networkLayer: RelayNetworkLayer): any; + export function isContainer(component: React.ComponentClass): boolean; + export function QL(...args: any[]): string; class Route { constructor(params?: RelayVariables) @@ -392,36 +391,36 @@ declare module "react-relay/classic" { * return some data in the payload using REQUIRED_CHILDREN which is where specifying S is the most useful. */ class Mutation { - props: T + props: T; - constructor(props: T) - static getFragment(q: string): string + constructor(props: T); + static getFragment(q: string): string; } interface Transaction { - getError(): Error - Status(): number + getError(): Error; + Status(): number; } interface StoreUpdateCallbacks { - onFailure?(transaction: Transaction): any - onSuccess?(response: T): any + onFailure?(transaction: Transaction): any; + onSuccess?(response: T): any; } interface Store { - commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any + commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; } - const Store: Store + const Store: Store; class RootContainer extends React.Component { } interface RootContainerProps extends React.Props { - Component: RelayContainerClass - route: Route - renderLoading?(): JSX.Element - renderFetched?(data: any): JSX.Element - renderFailure?(error: Error, retry: (...args: any[]) => any): JSX.Element + Component: RelayContainerClass; + route: Route; + renderLoading?(): JSX.Element; + renderFetched?(data: any): JSX.Element; + renderFailure?(error: Error, retry: (...args: any[]) => any): JSX.Element; } type ReadyStateEvent = @@ -443,7 +442,7 @@ declare module "react-relay/classic" { error?: Error, events: ReadyStateEvent[], aborted: boolean - }) => void + }) => void; interface RelayProp { readonly route: { name: string; }; // incomplete, also has params and queries diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/react-relay-tests.tsx index 2b76bc7860..5bd7c6c964 100644 --- a/types/react-relay/react-relay-tests.tsx +++ b/types/react-relay/react-relay-tests.tsx @@ -7,9 +7,6 @@ import { ConnectionHandler, } from 'relay-runtime'; - - - //////////////////////////// // RELAY MODERN TESTS /////////////////////////// @@ -25,16 +22,17 @@ import { RelayRefetchProp } from "react-relay"; - // ~~~~~~~~~~~~~~~~~~~~~ // Modern Environment // ~~~~~~~~~~~~~~~~~~~~~ -const network = {} as __Relay.Runtime.RelayNetwork; +function fetchQuery(operation: any, variables: any, cacheConfig: {}) { + return fetch('/graphql'); +} +const network = Network.create(fetchQuery); const source = new RecordSource(); const store = new Store(source); const modernEnvironment = new Environment({ network, store }); - // ~~~~~~~~~~~~~~~~~~~~~ // Modern QueryRenderer // ~~~~~~~~~~~~~~~~~~~~~ @@ -81,19 +79,18 @@ const MyFragmentContainer = createFragmentContainer( } ); - // ~~~~~~~~~~~~~~~~~~~~~ // Modern RefetchContainer // ~~~~~~~~~~~~~~~~~~~~~ -interface IStory { id: string } -interface IFeedStoriesProps { +interface StoryInterface { id: string; } +interface FeedStoriesProps { relay: RelayRefetchProp; feed: { - stories: { edges: { node: IStory }[] } - } + stories: { edges: Array<{ node: StoryInterface }> } + }; } -class Story extends React.Component<{ story: IStory }, {}> {} -class FeedStories extends React.Component { +class Story extends React.Component<{ story: StoryInterface }, {}> {} +class FeedStories extends React.Component { render() { return (
@@ -145,16 +142,14 @@ const FeedRefetchContainer = createRefetchContainer( `, ); - - // ~~~~~~~~~~~~~~~~~~~~~ // Modern PaginationContainer // ~~~~~~~~~~~~~~~~~~~~~ -interface IFeedProps { - user: { feed: { edges: { node: IStory}[]}} +interface FeedProps { + user: { feed: { edges: Array<{ node: StoryInterface}>}}; relay: RelayPaginationProp; } -class Feed extends React.Component { +class Feed extends React.Component { render() { return (
{this.props.user.feed.edges.map( @@ -236,7 +231,6 @@ const FeedPaginationContainer = createPaginationContainer( } ); - // ~~~~~~~~~~~~~~~~~~~~~ // Modern Mutations // ~~~~~~~~~~~~~~~~~~~~~ @@ -298,14 +292,13 @@ function markNotificationAsRead(source: string, storyID: string) { optimisticResponse, variables, onCompleted: (response, errors) => { - console.log('Response received from server.') + console.log('Response received from server.'); }, onError: err => console.error(err), }, ); } - // ~~~~~~~~~~~~~~~~~~~~~ // Modern Subscriptions // ~~~~~~~~~~~~~~~~~~~~~ @@ -351,9 +344,6 @@ requestSubscription( } ); - - - //////////////////////////// // RELAY-CLASSIC TESTS /////////////////////////// @@ -361,29 +351,25 @@ requestSubscription( import * as Relay from "react-relay/classic"; interface Props { - text: string - userId: string + text: string; + userId: string; } -interface Response { -} - -export default class AddTweetMutation extends Relay.Mutation { - - getMutation () { - return Relay.QL`mutation{addTweet}` +export default class AddTweetMutation extends Relay.Mutation { + getMutation() { + return Relay.QL`mutation{addTweet}`; } - getFatQuery () { + getFatQuery() { return Relay.QL` fragment on AddTweetPayload { tweetEdge user } - ` + `; } - getConfigs () { + getConfigs() { return [{ type: "RANGE_ADD", parentName: "user", @@ -393,19 +379,19 @@ export default class AddTweetMutation extends Relay.Mutation { rangeBehaviors: { "": "append", }, - }] + }]; } - getVariables () { - return this.props + getVariables() { + return this.props; } } interface ArtworkProps { artwork: { title: string - }, - relay: Relay.RelayProp, + }; + relay: Relay.RelayProp; } class Artwork extends React.Component { @@ -414,7 +400,7 @@ class Artwork extends React.Component { {this.props.artwork.title} - ) + ); } } @@ -426,7 +412,7 @@ const ArtworkContainer = Relay.createContainer(Artwork, { } ` } -}) +}); class StubbedArtwork extends React.Component { render() { @@ -445,7 +431,7 @@ class StubbedArtwork extends React.Component { getPendingTransactions: (): any => undefined, commitUpdate: () => {}, } - } - return + }; + return ; } } From e1f651b9f3336dfc684459cd9a16ac749f6150fb Mon Sep 17 00:00:00 2001 From: voxmatt Date: Mon, 11 Sep 2017 11:11:36 -1000 Subject: [PATCH 023/314] more cleanup of lint errors --- types/react-relay/index.d.ts | 83 ++++++++++++------------- types/react-relay/react-relay-tests.tsx | 6 +- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index e41f39e4ae..cd43410727 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -7,7 +7,6 @@ /// declare namespace __Relay { - //////////////////////////// // RELAY MODERN TYPES /////////////////////////// @@ -25,14 +24,14 @@ declare namespace __Relay { // RelayProp // ~~~~~~~~~~~~~~~~~~~~~ // note: refetch and pagination containers augment this - export interface RelayProp { + interface RelayProp { environment: Runtime.Environment; } // ~~~~~~~~~~~~~~~~~~~~~ // RelayQL // ~~~~~~~~~~~~~~~~~~~~~ - export function RelayQL( + function RelayQL( strings: string[], ...substitutions: any[] ): Common.RelayConcreteNode; @@ -57,23 +56,23 @@ declare namespace __Relay { (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; } - export const graphql: GraphqlInterface; + const graphql: GraphqlInterface; // ~~~~~~~~~~~~~~~~~~~~~ // ReactRelayQueryRenderer // ~~~~~~~~~~~~~~~~~~~~~ interface QueryRendererProps { - cacheConfig?: Common.CacheConfig | void; + cacheConfig?: Common.CacheConfig; environment: Runtime.Environment; query: GraphQLTaggedNode; - render(readyState: ReadyState): React.ReactElement | void; + render(readyState: ReadyState): React.ReactElement | undefined | null; variables: Common.Variables; rerunParamExperimental?: Common.RerunParam; } - export interface ReadyState { - error: Error | void; - props: { [propName: string]: any } | void; - retry: (() => void) | void; + interface ReadyState { + error: Error | undefined | null; + props: { [propName: string]: any } | undefined | null; + retry?(): void; } interface QueryRendererState { readyState: ReadyState; @@ -83,7 +82,7 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // createFragmentContainer // ~~~~~~~~~~~~~~~~~~~~~ - export function createFragmentContainer( + function createFragmentContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, ): ReactBaseComponent; @@ -92,45 +91,45 @@ declare namespace __Relay { // createPaginationContainer // ~~~~~~~~~~~~~~~~~~~~~ interface PageInfo { - endCursor: string | void; + endCursor: string | undefined | null; hasNextPage: boolean; hasPreviousPage: boolean; - startCursor: string | void; + startCursor: string | undefined | null; } interface ConnectionData { edges?: any[]; - pageInfo?: PageInfo | void; + pageInfo?: PageInfo; } - export type RelayPaginationProp = RelayProp & { + type RelayPaginationProp = RelayProp & { hasMore(): boolean, isLoading(): boolean, loadMore( pageSize: number, callback: (error?: Error) => void, options?: RefetchOptions, - ): Common.Disposable | void, + ): Common.Disposable | undefined | null, refetchConnection( totalCount: number, - callback: (error?: Error | void) => void, - refetchVariables?: Common.Variables | void, - ): Common.Disposable | void, + callback: (error?: Error) => void, + refetchVariables?: Common.Variables, + ): Common.Disposable | undefined | null, }; - export function FragmentVariablesGetter( + function FragmentVariablesGetter( prevVars: Common.Variables, totalCount: number, ): Common.Variables; interface ConnectionConfig { direction?: 'backward' | 'forward'; - getConnectionFromProps?(props: object): ConnectionData | void; + getConnectionFromProps?(props: object): ConnectionData | undefined | null; getFragmentVariables?: typeof FragmentVariablesGetter; getVariables( props: { [propName: string]: any }, - paginationInfo: { count: number, cursor: string | void }, + paginationInfo: { count: number, cursor?: string }, fragmentVariables: Common.Variables, ): Common.Variables; query: GraphQLTaggedNode; } - export function createPaginationContainer( + function createPaginationContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, connectionConfig: ConnectionConfig, @@ -139,19 +138,19 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // createFragmentContainer // ~~~~~~~~~~~~~~~~~~~~~ - export interface RefetchOptions { + interface RefetchOptions { force?: boolean; rerunParamExperimental?: Common.RerunParam; } - export type RelayRefetchProp = RelayProp & { + type RelayRefetchProp = RelayProp & { refetch( refetchVariables: Common.Variables | ((fragmentVariables: Common.Variables) => Common.Variables), renderVariables?: Common.Variables, - callback?: (error: Error | void) => void, + callback?: (error?: Error) => void, options?: RefetchOptions, ): Common.Disposable, }; - export function createRefetchContainer( + function createRefetchContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, taggedNode: GraphQLTaggedNode, @@ -181,7 +180,7 @@ declare namespace __Relay { resolve( fragment: RelayQuery["Fragment"], dataIDs: Common.DataID | Common.DataID[], - ): (StoreReaderData | StoreReaderData[]) | void; + ): StoreReaderData | StoreReaderData[] | undefined | null; } interface RelayEnvironmentInterface { forceFetch( @@ -224,7 +223,7 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // Util // ~~~~~~~~~~~~~~~~~~~~~ - export function getFragment(q: string, v?: Common.Variables): string; + function getFragment(q: string, v?: Common.Variables): string; interface ComponentWithFragment extends React.ComponentClass { getFragment: typeof getFragment; } @@ -233,21 +232,21 @@ declare namespace __Relay { } type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; - export type RelayClassicEnvironment = Classic.RelayEnvironmentInterface; + type RelayClassicEnvironment = Classic.RelayEnvironmentInterface; // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatTypes // ~~~~~~~~~~~~~~~~~~~~~ - export type CompatEnvironment = Runtime.Environment | RelayClassicEnvironment; + type CompatEnvironment = Runtime.Environment | RelayClassicEnvironment; // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatMutations // ~~~~~~~~~~~~~~~~~~~~~ - export function commitUpdate( + function commitUpdate( environment: CompatEnvironment, - config: Runtime.MutationConfig, + config: Runtime.MutationConfig, ): Common.Disposable; - export function applyUpdate( + function applyUpdate( environment: CompatEnvironment, config: Runtime.OptimisticMutationConfig, ): Common.Disposable; @@ -255,8 +254,8 @@ declare namespace __Relay { // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatContainer // ~~~~~~~~~~~~~~~~~~~~~ - export interface GeneratedNodeMap { [key: string]: Modern.GraphQLTaggedNode; } - export function createContainer( + interface GeneratedNodeMap { [key: string]: Modern.GraphQLTaggedNode; } + function createContainer( Component: ReactBaseComponent, fragmentSpec: Modern.GraphQLTaggedNode | GeneratedNodeMap, ): ReactFragmentComponent; @@ -265,7 +264,7 @@ declare namespace __Relay { // injectDefaultVariablesProvider // ~~~~~~~~~~~~~~~~~~~~~ type VariablesProvider = () => Common.Variables; - export function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; + function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; } } @@ -376,10 +375,10 @@ declare module "react-relay/classic" { supports(...options: string[]): boolean; } - export function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass; - export function injectNetworkLayer(networkLayer: RelayNetworkLayer): any; - export function isContainer(component: React.ComponentClass): boolean; - export function QL(...args: any[]): string; + function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass; + function injectNetworkLayer(networkLayer: RelayNetworkLayer): any; + function isContainer(component: React.ComponentClass): boolean; + function QL(...args: any[]): string; class Route { constructor(params?: RelayVariables) @@ -447,7 +446,7 @@ declare module "react-relay/classic" { interface RelayProp { readonly route: { name: string; }; // incomplete, also has params and queries readonly variables: any; - readonly pendingVariables?: any | null; + readonly pendingVariables?: any; setVariables(variables: any, onReadyStateChange?: OnReadyStateChange): void; forceFetch(variables: any, onReadyStateChange?: OnReadyStateChange): void; hasOptimisticUpdate(record: any): boolean; diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/react-relay-tests.tsx index 5bd7c6c964..2b8e371ee2 100644 --- a/types/react-relay/react-relay-tests.tsx +++ b/types/react-relay/react-relay-tests.tsx @@ -89,8 +89,8 @@ interface FeedStoriesProps { stories: { edges: Array<{ node: StoryInterface }> } }; } -class Story extends React.Component<{ story: StoryInterface }, {}> {} -class FeedStories extends React.Component { +class Story extends React.Component<{ story: StoryInterface }> {} +class FeedStories extends React.Component { render() { return (
@@ -149,7 +149,7 @@ interface FeedProps { user: { feed: { edges: Array<{ node: StoryInterface}>}}; relay: RelayPaginationProp; } -class Feed extends React.Component { +class Feed extends React.Component { render() { return (
{this.props.user.feed.edges.map( From e90ca4bb3ec352283019eba8b6127abe7c091bd2 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Mon, 11 Sep 2017 11:17:03 -1000 Subject: [PATCH 024/314] I need these exports; put in a ts-lint disable line around them --- types/react-relay/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index cd43410727..ebb7fe714e 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -271,7 +271,7 @@ declare namespace __Relay { //////////////////////////// // MODULES /////////////////////////// - +// tslint:disable strict-export-declare-modifiers declare module 'react-relay' { export import QueryRenderer = __Relay.Modern.ReactRelayQueryRenderer; export import createFragmentContainer = __Relay.Modern.createFragmentContainer; @@ -301,6 +301,7 @@ declare module 'react-relay/compat' { export import graphql = __Relay.Modern.graphql; export import fetchQuery = __Relay.Runtime.fetchRelayModernQuery; } +// tslint:enable strict-export-declare-modifiers declare module "react-relay/classic" { import * as React from "react"; From 1bae0838318dd5afcb288601747adcd1d64a490a Mon Sep 17 00:00:00 2001 From: voxmatt Date: Mon, 11 Sep 2017 16:00:29 -1000 Subject: [PATCH 025/314] adding back in Renderer --- types/react-relay/index.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index ebb7fe714e..83b2890020 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -423,6 +423,26 @@ declare module "react-relay/classic" { renderFailure?(error: Error, retry: (...args: any[]) => any): JSX.Element; } + class Renderer extends React.Component { } + + interface RendererProps { + Container: RelayContainerClass; // Relay container that defines fragments and the view to render. + forceFetch?: boolean; // Whether to send a server request regardless of data available on the client. + queryConfig: Route; // `QueryConfig` or `Relay.Route` that defines the query roots. + environment: Store; // An instance of `Relay.Environment` or any object that implements the `RelayEnvironment` interface. + render?: RenderCallback; // Called to render when data requirements are being fulfilled. + onReadyStateChange?: OnReadyStateChange; + } + + interface RenderStateConfig { + props?: { [propName: string]: any }; + done: boolean; + error?: Error; + retry?(): void; + stale: boolean; + } + type RenderCallback = (renderState: RenderStateConfig) => any; + type ReadyStateEvent = 'ABORT' | 'CACHE_RESTORED_REQUIRED' | From dcc853211623616aabb57ce46912194e1bf7b2ce Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 1 Oct 2017 11:03:05 -0700 Subject: [PATCH 026/314] removing UMD style module structure from relay-runtime and moving new relay types to v1 folder --- types/react-relay/index.d.ts | 459 +--- types/react-relay/react-relay-tests.tsx | 393 +-- types/react-relay/tsconfig.json | 4 +- types/react-relay/v1/index.d.ts | 474 ++++ .../v1/lib/react-relay-classic.d.ts | 0 .../v1/lib/react-relay-compat.d.ts | 0 .../v1/lib/react-relay-modern.d.ts | 0 types/react-relay/v1/react-relay-tests.tsx | 437 ++++ types/react-relay/v1/tsconfig.json | 31 + types/react-relay/{ => v1}/tslint.json | 0 types/relay-runtime/index.d.ts | 2182 ++++++++--------- 11 files changed, 2129 insertions(+), 1851 deletions(-) create mode 100644 types/react-relay/v1/index.d.ts create mode 100644 types/react-relay/v1/lib/react-relay-classic.d.ts create mode 100644 types/react-relay/v1/lib/react-relay-compat.d.ts create mode 100644 types/react-relay/v1/lib/react-relay-modern.d.ts create mode 100644 types/react-relay/v1/react-relay-tests.tsx create mode 100644 types/react-relay/v1/tsconfig.json rename types/react-relay/{ => v1}/tslint.json (100%) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 83b2890020..4f9f49e5e7 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -1,385 +1,86 @@ -// Type definitions for react-relay 1.3 +// Type definitions for react-relay 0.9.2 // Project: https://github.com/facebook/relay -// Definitions by: Johannes Schickling , Matt Martin +// Definitions by: Johannes Schickling // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.3 -/// - -declare namespace __Relay { - //////////////////////////// - // RELAY MODERN TYPES - /////////////////////////// - namespace Modern { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type ConcreteFragment = any; - type ConcreteBatch = any; - type ConcreteFragmentDefinition = object; - type ConcreteOperationDefinition = object; - type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayProp - // ~~~~~~~~~~~~~~~~~~~~~ - // note: refetch and pagination containers augment this - interface RelayProp { - environment: Runtime.Environment; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayQL - // ~~~~~~~~~~~~~~~~~~~~~ - function RelayQL( - strings: string[], - ...substitutions: any[] - ): Common.RelayConcreteNode; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayModernGraphQLTag - // ~~~~~~~~~~~~~~~~~~~~~ - interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode; } - type GraphQLTaggedNode = - (() => ConcreteFragment | ConcreteBatch) - | { - modern(): ConcreteFragment | ConcreteBatch, - classic(relayQL: typeof RelayQL): - | ConcreteFragmentDefinition - | ConcreteOperationDefinition, - }; - /** - * Runtime function to correspond to the `graphql` tagged template function. - * All calls to this function should be transformed by the plugin. - */ - interface GraphqlInterface { - (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; - experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; - } - const graphql: GraphqlInterface; - - // ~~~~~~~~~~~~~~~~~~~~~ - // ReactRelayQueryRenderer - // ~~~~~~~~~~~~~~~~~~~~~ - interface QueryRendererProps { - cacheConfig?: Common.CacheConfig; - environment: Runtime.Environment; - query: GraphQLTaggedNode; - render(readyState: ReadyState): React.ReactElement | undefined | null; - variables: Common.Variables; - rerunParamExperimental?: Common.RerunParam; - } - interface ReadyState { - error: Error | undefined | null; - props: { [propName: string]: any } | undefined | null; - retry?(): void; - } - interface QueryRendererState { - readyState: ReadyState; - } - class ReactRelayQueryRenderer extends React.Component { } - - // ~~~~~~~~~~~~~~~~~~~~~ - // createFragmentContainer - // ~~~~~~~~~~~~~~~~~~~~~ - function createFragmentContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - ): ReactBaseComponent; - - // ~~~~~~~~~~~~~~~~~~~~~ - // createPaginationContainer - // ~~~~~~~~~~~~~~~~~~~~~ - interface PageInfo { - endCursor: string | undefined | null; - hasNextPage: boolean; - hasPreviousPage: boolean; - startCursor: string | undefined | null; - } - interface ConnectionData { - edges?: any[]; - pageInfo?: PageInfo; - } - type RelayPaginationProp = RelayProp & { - hasMore(): boolean, - isLoading(): boolean, - loadMore( - pageSize: number, - callback: (error?: Error) => void, - options?: RefetchOptions, - ): Common.Disposable | undefined | null, - refetchConnection( - totalCount: number, - callback: (error?: Error) => void, - refetchVariables?: Common.Variables, - ): Common.Disposable | undefined | null, - }; - function FragmentVariablesGetter( - prevVars: Common.Variables, - totalCount: number, - ): Common.Variables; - interface ConnectionConfig { - direction?: 'backward' | 'forward'; - getConnectionFromProps?(props: object): ConnectionData | undefined | null; - getFragmentVariables?: typeof FragmentVariablesGetter; - getVariables( - props: { [propName: string]: any }, - paginationInfo: { count: number, cursor?: string }, - fragmentVariables: Common.Variables, - ): Common.Variables; - query: GraphQLTaggedNode; - } - function createPaginationContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - connectionConfig: ConnectionConfig, - ): ReactBaseComponent; - - // ~~~~~~~~~~~~~~~~~~~~~ - // createFragmentContainer - // ~~~~~~~~~~~~~~~~~~~~~ - interface RefetchOptions { - force?: boolean; - rerunParamExperimental?: Common.RerunParam; - } - type RelayRefetchProp = RelayProp & { - refetch( - refetchVariables: Common.Variables | ((fragmentVariables: Common.Variables) => Common.Variables), - renderVariables?: Common.Variables, - callback?: (error?: Error) => void, - options?: RefetchOptions, - ): Common.Disposable, - }; - function createRefetchContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - taggedNode: GraphQLTaggedNode, - ): ReactBaseComponent; - } - - //////////////////////////// - // RELAY CLASSIC TYPES - /////////////////////////// - // note: the namespace here is really for use inside of - // relay-compat; the module declaration below - // uses the old, pre-existing types - namespace Classic { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type StoreReaderData = any; - type StoreReaderOptions = any; - type RelayStoreData = any; - interface RelayQuery { Fragment: any; Node: any; Root: any; } - - // ~~~~~~~~~~~~~~~~~~~~~ - // Environment - // ~~~~~~~~~~~~~~~~~~~~~ - interface FragmentResolver { - dispose(): void; - resolve( - fragment: RelayQuery["Fragment"], - dataIDs: Common.DataID | Common.DataID[], - ): StoreReaderData | StoreReaderData[] | undefined | null; - } - interface RelayEnvironmentInterface { - forceFetch( - querySet: Common.RelayQuerySet, - onReadyStateChange: Common.ReadyStateChangeCallback, - ): Common.Abortable; - getFragmentResolver( - fragment: RelayQuery["Fragment"], - onNext: () => void, - ): FragmentResolver; - getStoreData(): RelayStoreData; - primeCache( - querySet: Common.RelayQuerySet, - onReadyStateChange: Common.ReadyStateChangeCallback, - ): Common.Abortable; - read( - node: RelayQuery["Node"], - dataID: Common.DataID, - options?: StoreReaderOptions, - ): StoreReaderData | void; - readQuery( - root: RelayQuery["Root"], - options?: StoreReaderOptions, - ): StoreReaderData[] | void; - } - } - - //////////////////////////// - // RELAY COMPAT TYPES - /////////////////////////// - namespace Compat { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type ConcreteFragment = any; - type ConcreteBatch = any; - type ConcreteFragmentDefinition = object; - type ConcreteOperationDefinition = object; - - // ~~~~~~~~~~~~~~~~~~~~~ - // Util - // ~~~~~~~~~~~~~~~~~~~~~ - function getFragment(q: string, v?: Common.Variables): string; - interface ComponentWithFragment extends React.ComponentClass { - getFragment: typeof getFragment; - } - interface StatelessWithFragment extends React.StatelessComponent { - getFragment: typeof getFragment; - } - type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; - type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; - type RelayClassicEnvironment = Classic.RelayEnvironmentInterface; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCompatTypes - // ~~~~~~~~~~~~~~~~~~~~~ - type CompatEnvironment = Runtime.Environment | RelayClassicEnvironment; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCompatMutations - // ~~~~~~~~~~~~~~~~~~~~~ - function commitUpdate( - environment: CompatEnvironment, - config: Runtime.MutationConfig, - ): Common.Disposable; - function applyUpdate( - environment: CompatEnvironment, - config: Runtime.OptimisticMutationConfig, - ): Common.Disposable; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCompatContainer - // ~~~~~~~~~~~~~~~~~~~~~ - interface GeneratedNodeMap { [key: string]: Modern.GraphQLTaggedNode; } - function createContainer( - Component: ReactBaseComponent, - fragmentSpec: Modern.GraphQLTaggedNode | GeneratedNodeMap, - ): ReactFragmentComponent; - - // ~~~~~~~~~~~~~~~~~~~~~ - // injectDefaultVariablesProvider - // ~~~~~~~~~~~~~~~~~~~~~ - type VariablesProvider = () => Common.Variables; - function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; - } -} - -//////////////////////////// -// MODULES -/////////////////////////// -// tslint:disable strict-export-declare-modifiers -declare module 'react-relay' { - export import QueryRenderer = __Relay.Modern.ReactRelayQueryRenderer; - export import createFragmentContainer = __Relay.Modern.createFragmentContainer; - export import createPaginationContainer = __Relay.Modern.createPaginationContainer; - export import createRefetchContainer = __Relay.Modern.createRefetchContainer; - export import graphql = __Relay.Modern.graphql; - - export import commitLocalUpdate = __Relay.Runtime.commitLocalUpdate; - export import commitMutation = __Relay.Runtime.commitRelayModernMutation; - export import fetchQuery = __Relay.Runtime.fetchRelayModernQuery; - export import requestSubscription = __Relay.Runtime.requestRelaySubscription; - - // exported for convenience — not exports in the original module - export import RelayProp = __Relay.Modern.RelayProp; - export import RelayPaginationProp = __Relay.Modern.RelayPaginationProp; - export import RelayRefetchProp = __Relay.Modern.RelayRefetchProp; -} - -declare module 'react-relay/compat' { - export import applyOptimisticMutation = __Relay.Compat.applyUpdate; - export import commitMutation = __Relay.Compat.commitUpdate; - export import createFragmentContainer = __Relay.Compat.createContainer; - export import createPaginationContainer = __Relay.Compat.createContainer; - export import createRefetchContainer = __Relay.Compat.createContainer; - export import injectDefaultVariablesProvider = __Relay.Compat.injectDefaultVariablesProvider; - export import QueryRenderer = __Relay.Modern.ReactRelayQueryRenderer; - export import graphql = __Relay.Modern.graphql; - export import fetchQuery = __Relay.Runtime.fetchRelayModernQuery; -} -// tslint:enable strict-export-declare-modifiers - -declare module "react-relay/classic" { +declare module "react-relay" { import * as React from "react"; type ClientMutationID = string; /** Fragments are a hash of functions */ interface Fragments { - [query: string]: ((variables?: RelayVariables) => string); + [query: string]: ((variables?: RelayVariables) => string) } interface CreateContainerOpts { - initialVariables?: any; - fragments: Fragments; - prepareVariables?(prevVariables: RelayVariables): RelayVariables; + initialVariables?: any + fragments: Fragments + prepareVariables?(prevVariables: RelayVariables): RelayVariables } interface RelayVariables { - [name: string]: any; + [name: string]: any } /** add static getFragment method to the component constructor */ interface RelayContainerClass extends React.ComponentClass { - getFragment: ((q: string, v?: RelayVariables) => string); + getFragment: ((q: string, v?: RelayVariables) => string) } interface RelayQueryRequestResolve { - response: any; + response: any } type RelayMutationStatus = - 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. - 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. - 'COLLISION_COMMIT_FAILED' | // Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, - // including this one, have been failed. Transaction can be recommitted or rolled back. - 'COMMITTING' | // Transaction is waiting for the server to respond. - 'COMMIT_FAILED'; + 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. + 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. + 'COLLISION_COMMIT_FAILED' | //Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, including this one, have been failed. Transaction can be recommitted or rolled back. + 'COMMITTING' | // Transaction is waiting for the server to respond. + 'COMMIT_FAILED'; class RelayMutationTransaction { - applyOptimistic(): RelayMutationTransaction; - commit(): RelayMutationTransaction | null; - recommit(): void; - rollback(): void; - getError(): Error; - getStatus(): RelayMutationStatus; - getHash(): string; - getID(): ClientMutationID; + applyOptimistic(): RelayMutationTransaction; + commit(): RelayMutationTransaction | null; + recommit(): void; + rollback(): void; + getError(): Error; + getStatus(): RelayMutationStatus; + getHash(): string; + getID(): ClientMutationID; } interface RelayMutationRequest { - getQueryString(): string; - getVariables(): RelayVariables; - resolve(result: RelayQueryRequestResolve): any; - reject(errors: any): any; + getQueryString(): string + getVariables(): RelayVariables + resolve(result: RelayQueryRequestResolve): any + reject(errors: any): any } interface RelayQueryRequest { - resolve(result: RelayQueryRequestResolve): any; - reject(errors: any): any; - getQueryString(): string; - getVariables(): RelayVariables; - getID(): string; - getDebugName(): string; + resolve(result: RelayQueryRequestResolve): any + reject(errors: any): any + + getQueryString(): string + getVariables(): RelayVariables + getID(): string + getDebugName(): string } interface RelayNetworkLayer { - supports(...options: string[]): boolean; + supports(...options: string[]): boolean } class DefaultNetworkLayer implements RelayNetworkLayer { - constructor(host: string, options?: any); - supports(...options: string[]): boolean; + constructor(host: string, options?: any) + supports(...options: string[]): boolean } - function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass; - function injectNetworkLayer(networkLayer: RelayNetworkLayer): any; - function isContainer(component: React.ComponentClass): boolean; - function QL(...args: any[]): string; + function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass + function injectNetworkLayer(networkLayer: RelayNetworkLayer): any + function isContainer(component: React.ComponentClass): boolean + function QL(...args: any[]): string class Route { constructor(params?: RelayVariables) @@ -390,59 +91,39 @@ declare module "react-relay/classic" { * S is typically dynamic as it depends on the data the app is currently using, but it's possible to always * return some data in the payload using REQUIRED_CHILDREN which is where specifying S is the most useful. */ - class Mutation { - props: T; + class Mutation { + props: T - constructor(props: T); - static getFragment(q: string): string; + constructor(props: T) + static getFragment(q: string): string } interface Transaction { - getError(): Error; - Status(): number; + getError(): Error + Status(): number } interface StoreUpdateCallbacks { - onFailure?(transaction: Transaction): any; - onSuccess?(response: T): any; + onFailure?(transaction: Transaction): any + onSuccess?(response: T): any } interface Store { - commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; + commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any } - const Store: Store; + var Store: Store - class RootContainer extends React.Component { } + class RootContainer extends React.Component {} - interface RootContainerProps extends React.Props { - Component: RelayContainerClass; - route: Route; - renderLoading?(): JSX.Element; - renderFetched?(data: any): JSX.Element; - renderFailure?(error: Error, retry: (...args: any[]) => any): JSX.Element; + interface RootContainerProps extends React.Props{ + Component: RelayContainerClass + route: Route + renderLoading?(): JSX.Element + renderFetched?(data: any): JSX.Element + renderFailure?(error: Error, retry: Function): JSX.Element } - class Renderer extends React.Component { } - - interface RendererProps { - Container: RelayContainerClass; // Relay container that defines fragments and the view to render. - forceFetch?: boolean; // Whether to send a server request regardless of data available on the client. - queryConfig: Route; // `QueryConfig` or `Relay.Route` that defines the query roots. - environment: Store; // An instance of `Relay.Environment` or any object that implements the `RelayEnvironment` interface. - render?: RenderCallback; // Called to render when data requirements are being fulfilled. - onReadyStateChange?: OnReadyStateChange; - } - - interface RenderStateConfig { - props?: { [propName: string]: any }; - done: boolean; - error?: Error; - retry?(): void; - stale: boolean; - } - type RenderCallback = (renderState: RenderStateConfig) => any; - type ReadyStateEvent = 'ABORT' | 'CACHE_RESTORED_REQUIRED' | @@ -455,23 +136,25 @@ declare module "react-relay/classic" { 'STORE_FOUND_ALL' | 'STORE_FOUND_REQUIRED'; - type OnReadyStateChange = (readyState: { - ready: boolean, - done: boolean, - stale: boolean, - error?: Error, - events: ReadyStateEvent[], - aborted: boolean - }) => void; + interface OnReadyStateChange { + (readyState: { + ready: boolean, + done: boolean, + stale: boolean, + error?: Error, + events: Array, + aborted: boolean + }): void + } interface RelayProp { readonly route: { name: string; }; // incomplete, also has params and queries readonly variables: any; - readonly pendingVariables?: any; + readonly pendingVariables?: any | null; setVariables(variables: any, onReadyStateChange?: OnReadyStateChange): void; forceFetch(variables: any, onReadyStateChange?: OnReadyStateChange): void; hasOptimisticUpdate(record: any): boolean; getPendingTransactions(record: any): RelayMutationTransaction[]; - commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; + commitUpdate: (mutation: Mutation, callbacks?: StoreUpdateCallbacks) => any; } } diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/react-relay-tests.tsx index 2b8e371ee2..90425156cc 100644 --- a/types/react-relay/react-relay-tests.tsx +++ b/types/react-relay/react-relay-tests.tsx @@ -1,375 +1,30 @@ -import * as React from "react"; -import { - Environment, - Network, - RecordSource, - Store, - ConnectionHandler, -} from 'relay-runtime'; - -//////////////////////////// -// RELAY MODERN TESTS -/////////////////////////// -import { - graphql, - commitMutation, - createFragmentContainer, - createPaginationContainer, - createRefetchContainer, - requestSubscription, - QueryRenderer, - RelayPaginationProp, - RelayRefetchProp -} from "react-relay"; - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern Environment -// ~~~~~~~~~~~~~~~~~~~~~ -function fetchQuery(operation: any, variables: any, cacheConfig: {}) { - return fetch('/graphql'); -} -const network = Network.create(fetchQuery); -const source = new RecordSource(); -const store = new Store(source); -const modernEnvironment = new Environment({ network, store }); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern QueryRenderer -// ~~~~~~~~~~~~~~~~~~~~~ -const MyQueryRenderer = (props: { name: string}) => ( - { - if (error) { - return
{error.message}
; - } else if (props) { - return
{props.name} is great!
; - } - return
Loading
; - }} - /> -); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern FragmentContainer -// ~~~~~~~~~~~~~~~~~~~~~ -const MyFragmentContainer = createFragmentContainer( - class TodoListView extends React.Component { - render() { - return
; - } - }, - { - item: graphql` - fragment TodoItem_item on Todo { - text - isComplete - } - `, - } -); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern RefetchContainer -// ~~~~~~~~~~~~~~~~~~~~~ -interface StoryInterface { id: string; } -interface FeedStoriesProps { - relay: RelayRefetchProp; - feed: { - stories: { edges: Array<{ node: StoryInterface }> } - }; -} -class Story extends React.Component<{ story: StoryInterface }> {} -class FeedStories extends React.Component { - render() { - return ( -
- {this.props.feed.stories.edges.map( - edge => - )} -
- ); - } - - _loadMore() { - // Increments the number of stories being rendered by 10. - const refetchVariables = (fragmentVariables: {count: number }) => ({ - count: fragmentVariables.count + 10, - }); - this.props.relay.refetch(refetchVariables); - } - } - -const FeedRefetchContainer = createRefetchContainer( - FeedStories, - { - feed: graphql.experimental` - fragment FeedStories_feed on Feed - @argumentDefinitions( - count: {type: "Int", defaultValue: 10} - ) { - stories(first: $count) { - edges { - node { - id - ...Story_story - } - } - } - } - ` - }, - graphql.experimental` - query FeedStoriesRefetchQuery($count: Int) { - feed { - ...FeedStories_feed @arguments(count: $count) - } - } - `, - ); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern PaginationContainer -// ~~~~~~~~~~~~~~~~~~~~~ -interface FeedProps { - user: { feed: { edges: Array<{ node: StoryInterface}>}}; - relay: RelayPaginationProp; -} -class Feed extends React.Component { - render() { - return (
- {this.props.user.feed.edges.map( - edge => - )} -
); - } - - _loadMore() { - if (!this.props.relay.hasMore() || this.props.relay.isLoading()) { - return; - } - - this.props.relay.loadMore( - 10, // Fetch the next 10 feed items - e => { - console.log(e); - }, - ); - } -} - -const FeedPaginationContainer = createPaginationContainer( - Feed, - { - user: graphql` - fragment Feed_user on User { - feed( - first: $count - after: $cursor - orderby: $orderBy # other variables - ) @connection(key: "Feed_feed") { - edges { - node { - id - ...Story_story - } - } - } - } - `, - }, - { - direction: 'forward', - getConnectionFromProps(props: { user: {feed: any}}) { - return props.user && props.user.feed; - }, - getFragmentVariables(prevVars, totalCount) { - return { - ...prevVars, - count: totalCount, - }; - }, - getVariables(props, {count, cursor}, fragmentVariables) { - return { - count, - cursor, - // in most cases, for variables other than connection filters like - // `first`, `after`, etc. you may want to use the previous values. - orderBy: fragmentVariables.orderBy, - }; - }, - query: graphql` - query FeedPaginationQuery( - $count: Int! - $cursor: String - $orderby: String! - ) { - user { - # You could reference the fragment defined previously. - ...Feed_user - } - } - ` - } -); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern Mutations -// ~~~~~~~~~~~~~~~~~~~~~ -const mutation = graphql` -mutation MarkReadNotificationMutation( - $input: MarkReadNotificationData! -) { - markReadNotification(data: $input) { - notification { - seenState - } - } -} -`; - -const optimisticResponse = { - markReadNotification: { - notification: { - seenState: 'SEEN', - }, - }, -}; - -const configs = [{ - type: 'NODE_DELETE' as 'NODE_DELETE', - deletedIDFieldName: 'destroyedShipId', -}, { - type: 'RANGE_ADD' as 'RANGE_ADD', - parentID: 'shipId', - connectionInfo: [{ - key: 'AddShip_ships', - rangeBehavior: 'append', - }], - edgeName: 'newShipEdge', -}, { - type: 'RANGE_DELETE' as 'RANGE_DELETE', - parentID: 'todoId', - connectionKeys: [{ - key: 'RemoveTags_tags', - rangeBehavior: 'append', - }], - pathToConnection: ['todo', 'tags'], - deletedIDFieldName: 'removedTagId' -}]; - -function markNotificationAsRead(source: string, storyID: string) { - const variables = { - input: { - source, - storyID, - }, - }; - - commitMutation( - modernEnvironment, - { - configs, - mutation, - optimisticResponse, - variables, - onCompleted: (response, errors) => { - console.log('Response received from server.'); - }, - onError: err => console.error(err), - }, - ); -} - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern Subscriptions -// ~~~~~~~~~~~~~~~~~~~~~ -const subscription = graphql` - subscription MarkReadNotificationSubscription( - $storyID: ID! - ) { - markReadNotification(storyID: $storyID) { - notification { - seenState - } - } - } -`; -const variables = { - storyID: '123', -}; -requestSubscription( - modernEnvironment, // see Environment docs - { - subscription, - variables, - // optional but recommended: - onCompleted: () => {}, - onError: error => console.error(error), - // example of a custom updater - updater: store => { - // Get the notification - const rootField = store.getRootField('markReadNotification'); - const notification = !!rootField && rootField.getLinkedRecord('notification'); - // Add it to a connection - const viewer = store.getRoot().getLinkedRecord('viewer'); - const notifications = - ConnectionHandler.getConnection(viewer, 'notifications'); - const edge = ConnectionHandler.createEdge( - store, - notifications, - notification, - '', - ); - ConnectionHandler.insertEdgeAfter(notifications, edge); - }, - } -); - -//////////////////////////// -// RELAY-CLASSIC TESTS -/////////////////////////// - -import * as Relay from "react-relay/classic"; +import * as React from "react" +import * as Relay from "react-relay" interface Props { - text: string; - userId: string; + text: string + userId: string } -export default class AddTweetMutation extends Relay.Mutation { - getMutation() { - return Relay.QL`mutation{addTweet}`; +interface Response { +} + +export default class AddTweetMutation extends Relay.Mutation { + + getMutation () { + return Relay.QL`mutation{addTweet}` } - getFatQuery() { + getFatQuery () { return Relay.QL` fragment on AddTweetPayload { tweetEdge user } - `; + ` } - getConfigs() { + getConfigs () { return [{ type: "RANGE_ADD", parentName: "user", @@ -379,19 +34,19 @@ export default class AddTweetMutation extends Relay.Mutation { rangeBehaviors: { "": "append", }, - }]; + }] } - getVariables() { - return this.props; + getVariables () { + return this.props } } interface ArtworkProps { artwork: { title: string - }; - relay: Relay.RelayProp; + }, + relay: Relay.RelayProp, } class Artwork extends React.Component { @@ -400,7 +55,7 @@ class Artwork extends React.Component { {this.props.artwork.title} - ); + ) } } @@ -412,7 +67,7 @@ const ArtworkContainer = Relay.createContainer(Artwork, { } ` } -}); +}) class StubbedArtwork extends React.Component { render() { @@ -428,10 +83,10 @@ class StubbedArtwork extends React.Component { setVariables: () => {}, forceFetch: () => {}, hasOptimisticUpdate: () => false, - getPendingTransactions: (): any => undefined, + getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, commitUpdate: () => {}, } - }; - return ; + } + return } } diff --git a/types/react-relay/tsconfig.json b/types/react-relay/tsconfig.json index 9cabc08c4a..90680fbafc 100644 --- a/types/react-relay/tsconfig.json +++ b/types/react-relay/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, + "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ "../" @@ -21,4 +21,4 @@ "index.d.ts", "react-relay-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-relay/v1/index.d.ts b/types/react-relay/v1/index.d.ts new file mode 100644 index 0000000000..14c7bb756a --- /dev/null +++ b/types/react-relay/v1/index.d.ts @@ -0,0 +1,474 @@ +// Type definitions for react-relay 1.3 +// Project: https://github.com/facebook/relay +// Definitions by: Johannes Schickling , Matt Martin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import * as React from 'react'; +import { RelayCommonTypes, RelayRuntimeTypes } from 'relay-runtime'; + +//////////////////////////// +// RELAY MODERN TYPES +/////////////////////////// +export namespace RelayModernTypes { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type ConcreteFragment = any; + type ConcreteBatch = any; + type ConcreteFragmentDefinition = object; + type ConcreteOperationDefinition = object; + type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayProp + // ~~~~~~~~~~~~~~~~~~~~~ + // note: refetch and pagination containers augment this + interface RelayProp { + environment: RelayRuntimeTypes.Environment; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayQL + // ~~~~~~~~~~~~~~~~~~~~~ + function RelayQL( + strings: string[], + ...substitutions: any[] + ): RelayCommonTypes.RelayConcreteNode; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayModernGraphQLTag + // ~~~~~~~~~~~~~~~~~~~~~ + interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode; } + type GraphQLTaggedNode = + (() => ConcreteFragment | ConcreteBatch) + | { + modern(): ConcreteFragment | ConcreteBatch, + classic(relayQL: typeof RelayQL): + | ConcreteFragmentDefinition + | ConcreteOperationDefinition, + }; + /** + * Runtime function to correspond to the `graphql` tagged template function. + * All calls to this function should be transformed by the plugin. + */ + interface GraphqlInterface { + (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; + experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; + } + const graphql: GraphqlInterface; + + // ~~~~~~~~~~~~~~~~~~~~~ + // ReactRelayQueryRenderer + // ~~~~~~~~~~~~~~~~~~~~~ + interface QueryRendererProps { + cacheConfig?: RelayCommonTypes.CacheConfig; + environment: RelayRuntimeTypes.Environment; + query: GraphQLTaggedNode; + render(readyState: ReadyState): React.ReactElement | undefined | null; + variables: RelayCommonTypes.Variables; + rerunParamExperimental?: RelayCommonTypes.RerunParam; + } + interface ReadyState { + error: Error | undefined | null; + props: { [propName: string]: any } | undefined | null; + retry?(): void; + } + interface QueryRendererState { + readyState: ReadyState; + } + class ReactRelayQueryRenderer extends React.Component { } + + // ~~~~~~~~~~~~~~~~~~~~~ + // createFragmentContainer + // ~~~~~~~~~~~~~~~~~~~~~ + function createFragmentContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + ): ReactBaseComponent; + + // ~~~~~~~~~~~~~~~~~~~~~ + // createPaginationContainer + // ~~~~~~~~~~~~~~~~~~~~~ + interface PageInfo { + endCursor: string | undefined | null; + hasNextPage: boolean; + hasPreviousPage: boolean; + startCursor: string | undefined | null; + } + interface ConnectionData { + edges?: any[]; + pageInfo?: PageInfo; + } + type RelayPaginationProp = RelayProp & { + hasMore(): boolean, + isLoading(): boolean, + loadMore( + pageSize: number, + callback: (error?: Error) => void, + options?: RefetchOptions, + ): RelayCommonTypes.Disposable | undefined | null, + refetchConnection( + totalCount: number, + callback: (error?: Error) => void, + refetchVariables?: RelayCommonTypes.Variables, + ): RelayCommonTypes.Disposable | undefined | null, + }; + function FragmentVariablesGetter( + prevVars: RelayCommonTypes.Variables, + totalCount: number, + ): RelayCommonTypes.Variables; + interface ConnectionConfig { + direction?: 'backward' | 'forward'; + getConnectionFromProps?(props: object): ConnectionData | undefined | null; + getFragmentVariables?: typeof FragmentVariablesGetter; + getVariables( + props: { [propName: string]: any }, + paginationInfo: { count: number, cursor?: string }, + fragmentVariables: RelayCommonTypes.Variables, + ): RelayCommonTypes.Variables; + query: GraphQLTaggedNode; + } + function createPaginationContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + connectionConfig: ConnectionConfig, + ): ReactBaseComponent; + + // ~~~~~~~~~~~~~~~~~~~~~ + // createFragmentContainer + // ~~~~~~~~~~~~~~~~~~~~~ + interface RefetchOptions { + force?: boolean; + rerunParamExperimental?: RelayCommonTypes.RerunParam; + } + type RelayRefetchProp = RelayProp & { + refetch( + refetchVariables: RelayCommonTypes.Variables | ((fragmentVariables: RelayCommonTypes.Variables) => RelayCommonTypes.Variables), + renderVariables?: RelayCommonTypes.Variables, + callback?: (error?: Error) => void, + options?: RefetchOptions, + ): RelayCommonTypes.Disposable, + }; + function createRefetchContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + taggedNode: GraphQLTaggedNode, + ): ReactBaseComponent; +} + +//////////////////////////// +// RELAY CLASSIC TYPES +/////////////////////////// +// note: the namespace here is really for use inside of +// relay-compat; the module declaration below +// uses the old, pre-existing types +export namespace RelayClassicTypes { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type StoreReaderData = any; + type StoreReaderOptions = any; + type RelayStoreData = any; + interface RelayQuery { Fragment: any; Node: any; Root: any; } + + // ~~~~~~~~~~~~~~~~~~~~~ + // Environment + // ~~~~~~~~~~~~~~~~~~~~~ + interface FragmentResolver { + dispose(): void; + resolve( + fragment: RelayQuery["Fragment"], + dataIDs: RelayCommonTypes.DataID | RelayCommonTypes.DataID[], + ): StoreReaderData | StoreReaderData[] | undefined | null; + } + interface RelayEnvironmentInterface { + forceFetch( + querySet: RelayCommonTypes.RelayQuerySet, + onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback, + ): RelayCommonTypes.Abortable; + getFragmentResolver( + fragment: RelayQuery["Fragment"], + onNext: () => void, + ): FragmentResolver; + getStoreData(): RelayStoreData; + primeCache( + querySet: RelayCommonTypes.RelayQuerySet, + onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback, + ): RelayCommonTypes.Abortable; + read( + node: RelayQuery["Node"], + dataID: RelayCommonTypes.DataID, + options?: StoreReaderOptions, + ): StoreReaderData | void; + readQuery( + root: RelayQuery["Root"], + options?: StoreReaderOptions, + ): StoreReaderData[] | void; + } +} + +//////////////////////////// +// RELAY COMPAT TYPES +/////////////////////////// +export namespace RelayCompatTypes { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type ConcreteFragment = any; + type ConcreteBatch = any; + type ConcreteFragmentDefinition = object; + type ConcreteOperationDefinition = object; + + // ~~~~~~~~~~~~~~~~~~~~~ + // Util + // ~~~~~~~~~~~~~~~~~~~~~ + function getFragment(q: string, v?: RelayCommonTypes.Variables): string; + interface ComponentWithFragment extends React.ComponentClass { + getFragment: typeof getFragment; + } + interface StatelessWithFragment extends React.StatelessComponent { + getFragment: typeof getFragment; + } + type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; + type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; + type RelayClassicEnvironment = RelayClassicTypes.RelayEnvironmentInterface; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCompatTypes + // ~~~~~~~~~~~~~~~~~~~~~ + type CompatEnvironment = RelayRuntimeTypes.Environment | RelayClassicEnvironment; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCompatMutations + // ~~~~~~~~~~~~~~~~~~~~~ + function commitUpdate( + environment: CompatEnvironment, + config: RelayRuntimeTypes.MutationConfig, + ): RelayCommonTypes.Disposable; + function applyUpdate( + environment: CompatEnvironment, + config: RelayRuntimeTypes.OptimisticMutationConfig, + ): RelayCommonTypes.Disposable; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCompatContainer + // ~~~~~~~~~~~~~~~~~~~~~ + interface GeneratedNodeMap { [key: string]: RelayModernTypes.GraphQLTaggedNode; } + function createContainer( + Component: ReactBaseComponent, + fragmentSpec: RelayModernTypes.GraphQLTaggedNode | GeneratedNodeMap, + ): ReactFragmentComponent; + + // ~~~~~~~~~~~~~~~~~~~~~ + // injectDefaultVariablesProvider + // ~~~~~~~~~~~~~~~~~~~~~ + type VariablesProvider = () => RelayCommonTypes.Variables; + function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; +} + + +//////////////////////////// +// MODULES +/////////////////////////// +export import QueryRenderer = RelayModernTypes.ReactRelayQueryRenderer; +export import createFragmentContainer = RelayModernTypes.createFragmentContainer; +export import createPaginationContainer = RelayModernTypes.createPaginationContainer; +export import createRefetchContainer = RelayModernTypes.createRefetchContainer; +export import graphql = RelayModernTypes.graphql; + +export import commitLocalUpdate = RelayRuntimeTypes.commitLocalUpdate; +export import commitMutation = RelayRuntimeTypes.commitRelayModernMutation; +export import fetchQuery = RelayRuntimeTypes.fetchRelayModernQuery; +export import requestSubscription = RelayRuntimeTypes.requestRelaySubscription; + +// exported for convenience — not exports in the original module +export import RelayProp = RelayModernTypes.RelayProp; +export import RelayPaginationProp = RelayModernTypes.RelayPaginationProp; +export import RelayRefetchProp = RelayModernTypes.RelayRefetchProp; + +declare module 'react-relay/compat' { + export import applyOptimisticMutation = RelayCompatTypes.applyUpdate; + export import commitMutation = RelayCompatTypes.commitUpdate; + export import createFragmentContainer = RelayCompatTypes.createContainer; + export import createPaginationContainer = RelayCompatTypes.createContainer; + export import createRefetchContainer = RelayCompatTypes.createContainer; + export import injectDefaultVariablesProvider = RelayCompatTypes.injectDefaultVariablesProvider; + export import QueryRenderer = RelayModernTypes.ReactRelayQueryRenderer; + export import graphql = RelayModernTypes.graphql; + export import fetchQuery = RelayRuntimeTypes.fetchRelayModernQuery; +} +// tslint:enable strict-export-declare-modifiers + +declare module "react-relay/classic" { + import * as React from "react"; + + type ClientMutationID = string; + + /** Fragments are a hash of functions */ + interface Fragments { + [query: string]: ((variables?: RelayVariables) => string); + } + + interface CreateContainerOpts { + initialVariables?: any; + fragments: Fragments; + prepareVariables?(prevVariables: RelayVariables): RelayVariables; + } + + interface RelayVariables { + [name: string]: any; + } + + /** add static getFragment method to the component constructor */ + interface RelayContainerClass extends React.ComponentClass { + getFragment: ((q: string, v?: RelayVariables) => string); + } + + interface RelayQueryRequestResolve { + response: any; + } + + type RelayMutationStatus = + 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. + 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. + 'COLLISION_COMMIT_FAILED' | // Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, + // including this one, have been failed. Transaction can be recommitted or rolled back. + 'COMMITTING' | // Transaction is waiting for the server to respond. + 'COMMIT_FAILED'; + + class RelayMutationTransaction { + applyOptimistic(): RelayMutationTransaction; + commit(): RelayMutationTransaction | null; + recommit(): void; + rollback(): void; + getError(): Error; + getStatus(): RelayMutationStatus; + getHash(): string; + getID(): ClientMutationID; + } + + interface RelayMutationRequest { + getQueryString(): string; + getVariables(): RelayVariables; + resolve(result: RelayQueryRequestResolve): any; + reject(errors: any): any; + } + + interface RelayQueryRequest { + resolve(result: RelayQueryRequestResolve): any; + reject(errors: any): any; + getQueryString(): string; + getVariables(): RelayVariables; + getID(): string; + getDebugName(): string; + } + + interface RelayNetworkLayer { + supports(...options: string[]): boolean; + } + + class DefaultNetworkLayer implements RelayNetworkLayer { + constructor(host: string, options?: any); + supports(...options: string[]): boolean; + } + + function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass; + function injectNetworkLayer(networkLayer: RelayNetworkLayer): any; + function isContainer(component: React.ComponentClass): boolean; + function QL(...args: any[]): string; + + class Route { + constructor(params?: RelayVariables) + } + + /** + * Relay Mutation class, where T are the props it takes and S is the returned payload from Relay.Store.update. + * S is typically dynamic as it depends on the data the app is currently using, but it's possible to always + * return some data in the payload using REQUIRED_CHILDREN which is where specifying S is the most useful. + */ + class Mutation { + props: T; + + constructor(props: T); + static getFragment(q: string): string; + } + + interface Transaction { + getError(): Error; + Status(): number; + } + + interface StoreUpdateCallbacks { + onFailure?(transaction: Transaction): any; + onSuccess?(response: T): any; + } + + interface Store { + commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; + } + + const Store: Store; + + class RootContainer extends React.Component { } + + interface RootContainerProps extends React.Props { + Component: RelayContainerClass; + route: Route; + renderLoading?(): JSX.Element; + renderFetched?(data: any): JSX.Element; + renderFailure?(error: Error, retry: (...args: any[]) => any): JSX.Element; + } + + class Renderer extends React.Component { } + + interface RendererProps { + Container: RelayContainerClass; // Relay container that defines fragments and the view to render. + forceFetch?: boolean; // Whether to send a server request regardless of data available on the client. + queryConfig: Route; // `QueryConfig` or `Relay.Route` that defines the query roots. + environment: Store; // An instance of `Relay.Environment` or any object that implements the `RelayEnvironment` interface. + render?: RenderCallback; // Called to render when data requirements are being fulfilled. + onReadyStateChange?: OnReadyStateChange; + } + + interface RenderStateConfig { + props?: { [propName: string]: any }; + done: boolean; + error?: Error; + retry?(): void; + stale: boolean; + } + type RenderCallback = (renderState: RenderStateConfig) => any; + + type ReadyStateEvent = + 'ABORT' | + 'CACHE_RESTORED_REQUIRED' | + 'CACHE_RESTORE_FAILED' | + 'CACHE_RESTORE_START' | + 'NETWORK_QUERY_ERROR' | + 'NETWORK_QUERY_RECEIVED_ALL' | + 'NETWORK_QUERY_RECEIVED_REQUIRED' | + 'NETWORK_QUERY_START' | + 'STORE_FOUND_ALL' | + 'STORE_FOUND_REQUIRED'; + + type OnReadyStateChange = (readyState: { + ready: boolean, + done: boolean, + stale: boolean, + error?: Error, + events: ReadyStateEvent[], + aborted: boolean + }) => void; + + interface RelayProp { + readonly route: { name: string; }; // incomplete, also has params and queries + readonly variables: any; + readonly pendingVariables?: any; + setVariables(variables: any, onReadyStateChange?: OnReadyStateChange): void; + forceFetch(variables: any, onReadyStateChange?: OnReadyStateChange): void; + hasOptimisticUpdate(record: any): boolean; + getPendingTransactions(record: any): RelayMutationTransaction[]; + commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; + } +} diff --git a/types/react-relay/v1/lib/react-relay-classic.d.ts b/types/react-relay/v1/lib/react-relay-classic.d.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/react-relay/v1/lib/react-relay-compat.d.ts b/types/react-relay/v1/lib/react-relay-compat.d.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/react-relay/v1/lib/react-relay-modern.d.ts b/types/react-relay/v1/lib/react-relay-modern.d.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/react-relay/v1/react-relay-tests.tsx b/types/react-relay/v1/react-relay-tests.tsx new file mode 100644 index 0000000000..2b8e371ee2 --- /dev/null +++ b/types/react-relay/v1/react-relay-tests.tsx @@ -0,0 +1,437 @@ +import * as React from "react"; +import { + Environment, + Network, + RecordSource, + Store, + ConnectionHandler, +} from 'relay-runtime'; + +//////////////////////////// +// RELAY MODERN TESTS +/////////////////////////// +import { + graphql, + commitMutation, + createFragmentContainer, + createPaginationContainer, + createRefetchContainer, + requestSubscription, + QueryRenderer, + RelayPaginationProp, + RelayRefetchProp +} from "react-relay"; + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern Environment +// ~~~~~~~~~~~~~~~~~~~~~ +function fetchQuery(operation: any, variables: any, cacheConfig: {}) { + return fetch('/graphql'); +} +const network = Network.create(fetchQuery); +const source = new RecordSource(); +const store = new Store(source); +const modernEnvironment = new Environment({ network, store }); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern QueryRenderer +// ~~~~~~~~~~~~~~~~~~~~~ +const MyQueryRenderer = (props: { name: string}) => ( + { + if (error) { + return
{error.message}
; + } else if (props) { + return
{props.name} is great!
; + } + return
Loading
; + }} + /> +); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern FragmentContainer +// ~~~~~~~~~~~~~~~~~~~~~ +const MyFragmentContainer = createFragmentContainer( + class TodoListView extends React.Component { + render() { + return
; + } + }, + { + item: graphql` + fragment TodoItem_item on Todo { + text + isComplete + } + `, + } +); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern RefetchContainer +// ~~~~~~~~~~~~~~~~~~~~~ +interface StoryInterface { id: string; } +interface FeedStoriesProps { + relay: RelayRefetchProp; + feed: { + stories: { edges: Array<{ node: StoryInterface }> } + }; +} +class Story extends React.Component<{ story: StoryInterface }> {} +class FeedStories extends React.Component { + render() { + return ( +
+ {this.props.feed.stories.edges.map( + edge => + )} +
+ ); + } + + _loadMore() { + // Increments the number of stories being rendered by 10. + const refetchVariables = (fragmentVariables: {count: number }) => ({ + count: fragmentVariables.count + 10, + }); + this.props.relay.refetch(refetchVariables); + } + } + +const FeedRefetchContainer = createRefetchContainer( + FeedStories, + { + feed: graphql.experimental` + fragment FeedStories_feed on Feed + @argumentDefinitions( + count: {type: "Int", defaultValue: 10} + ) { + stories(first: $count) { + edges { + node { + id + ...Story_story + } + } + } + } + ` + }, + graphql.experimental` + query FeedStoriesRefetchQuery($count: Int) { + feed { + ...FeedStories_feed @arguments(count: $count) + } + } + `, + ); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern PaginationContainer +// ~~~~~~~~~~~~~~~~~~~~~ +interface FeedProps { + user: { feed: { edges: Array<{ node: StoryInterface}>}}; + relay: RelayPaginationProp; +} +class Feed extends React.Component { + render() { + return (
+ {this.props.user.feed.edges.map( + edge => + )} +
); + } + + _loadMore() { + if (!this.props.relay.hasMore() || this.props.relay.isLoading()) { + return; + } + + this.props.relay.loadMore( + 10, // Fetch the next 10 feed items + e => { + console.log(e); + }, + ); + } +} + +const FeedPaginationContainer = createPaginationContainer( + Feed, + { + user: graphql` + fragment Feed_user on User { + feed( + first: $count + after: $cursor + orderby: $orderBy # other variables + ) @connection(key: "Feed_feed") { + edges { + node { + id + ...Story_story + } + } + } + } + `, + }, + { + direction: 'forward', + getConnectionFromProps(props: { user: {feed: any}}) { + return props.user && props.user.feed; + }, + getFragmentVariables(prevVars, totalCount) { + return { + ...prevVars, + count: totalCount, + }; + }, + getVariables(props, {count, cursor}, fragmentVariables) { + return { + count, + cursor, + // in most cases, for variables other than connection filters like + // `first`, `after`, etc. you may want to use the previous values. + orderBy: fragmentVariables.orderBy, + }; + }, + query: graphql` + query FeedPaginationQuery( + $count: Int! + $cursor: String + $orderby: String! + ) { + user { + # You could reference the fragment defined previously. + ...Feed_user + } + } + ` + } +); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern Mutations +// ~~~~~~~~~~~~~~~~~~~~~ +const mutation = graphql` +mutation MarkReadNotificationMutation( + $input: MarkReadNotificationData! +) { + markReadNotification(data: $input) { + notification { + seenState + } + } +} +`; + +const optimisticResponse = { + markReadNotification: { + notification: { + seenState: 'SEEN', + }, + }, +}; + +const configs = [{ + type: 'NODE_DELETE' as 'NODE_DELETE', + deletedIDFieldName: 'destroyedShipId', +}, { + type: 'RANGE_ADD' as 'RANGE_ADD', + parentID: 'shipId', + connectionInfo: [{ + key: 'AddShip_ships', + rangeBehavior: 'append', + }], + edgeName: 'newShipEdge', +}, { + type: 'RANGE_DELETE' as 'RANGE_DELETE', + parentID: 'todoId', + connectionKeys: [{ + key: 'RemoveTags_tags', + rangeBehavior: 'append', + }], + pathToConnection: ['todo', 'tags'], + deletedIDFieldName: 'removedTagId' +}]; + +function markNotificationAsRead(source: string, storyID: string) { + const variables = { + input: { + source, + storyID, + }, + }; + + commitMutation( + modernEnvironment, + { + configs, + mutation, + optimisticResponse, + variables, + onCompleted: (response, errors) => { + console.log('Response received from server.'); + }, + onError: err => console.error(err), + }, + ); +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern Subscriptions +// ~~~~~~~~~~~~~~~~~~~~~ +const subscription = graphql` + subscription MarkReadNotificationSubscription( + $storyID: ID! + ) { + markReadNotification(storyID: $storyID) { + notification { + seenState + } + } + } +`; +const variables = { + storyID: '123', +}; +requestSubscription( + modernEnvironment, // see Environment docs + { + subscription, + variables, + // optional but recommended: + onCompleted: () => {}, + onError: error => console.error(error), + // example of a custom updater + updater: store => { + // Get the notification + const rootField = store.getRootField('markReadNotification'); + const notification = !!rootField && rootField.getLinkedRecord('notification'); + // Add it to a connection + const viewer = store.getRoot().getLinkedRecord('viewer'); + const notifications = + ConnectionHandler.getConnection(viewer, 'notifications'); + const edge = ConnectionHandler.createEdge( + store, + notifications, + notification, + '', + ); + ConnectionHandler.insertEdgeAfter(notifications, edge); + }, + } +); + +//////////////////////////// +// RELAY-CLASSIC TESTS +/////////////////////////// + +import * as Relay from "react-relay/classic"; + +interface Props { + text: string; + userId: string; +} + +export default class AddTweetMutation extends Relay.Mutation { + getMutation() { + return Relay.QL`mutation{addTweet}`; + } + + getFatQuery() { + return Relay.QL` + fragment on AddTweetPayload { + tweetEdge + user + } + `; + } + + getConfigs() { + return [{ + type: "RANGE_ADD", + parentName: "user", + parentID: this.props.userId, + connectionName: "tweets", + edgeName: "tweetEdge", + rangeBehaviors: { + "": "append", + }, + }]; + } + + getVariables() { + return this.props; + } +} + +interface ArtworkProps { + artwork: { + title: string + }; + relay: Relay.RelayProp; +} + +class Artwork extends React.Component { + render() { + return ( + + {this.props.artwork.title} + + ); + } +} + +const ArtworkContainer = Relay.createContainer(Artwork, { + fragments: { + artwork: () => Relay.QL` + fragment on Artwork { + title + } + ` + } +}); + +class StubbedArtwork extends React.Component { + render() { + const props = { + artwork: { title: "CHAMPAGNE FORMICA FLAG" }, + relay: { + route: { + name: "champagne" + }, + variables: { + artworkID: "champagne-formica-flag", + }, + setVariables: () => {}, + forceFetch: () => {}, + hasOptimisticUpdate: () => false, + getPendingTransactions: (): any => undefined, + commitUpdate: () => {}, + } + }; + return ; + } +} diff --git a/types/react-relay/v1/tsconfig.json b/types/react-relay/v1/tsconfig.json new file mode 100644 index 0000000000..e6b06bf446 --- /dev/null +++ b/types/react-relay/v1/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "paths": { + "react-relay": ["react-relay/v1"], + "react-relay/*": ["react-relay/v2/*"] + } + }, + "files": [ + "index.d.ts", + "react-relay-tests.tsx", + "lib/react-relay-classic.d.ts", + "lib/react-relay-modern.d.ts", + "lib/react-relay-compat.d.ts" + ] +} diff --git a/types/react-relay/tslint.json b/types/react-relay/v1/tslint.json similarity index 100% rename from types/react-relay/tslint.json rename to types/react-relay/v1/tslint.json diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 2bd9938b0c..152df90640 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -4,1129 +4,1127 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -// note: __Relay namespace is used so react-relay can access and inter-op -declare namespace __Relay { - namespace Common { - /** - * SOURCE: - * Relay 1.3.0 - * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js - */ - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type RelayConcreteNode = any; - type RelayMutationTransaction = any; - type RelayMutationRequest = any; - type RelayQueryRequest = any; - type ConcreteFragment = any; - type ConcreteBatch = any; - type ConcreteFragmentDefinition = object; - type ConcreteOperationDefinition = object; +// note: namespace is used so react-relay can access and inter-op +export namespace RelayCommonTypes { + /** + * SOURCE: + * Relay 1.3.0 + * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js + */ + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayConcreteNode = any; + type RelayMutationTransaction = any; + type RelayMutationRequest = any; + type RelayQueryRequest = any; + type ConcreteFragment = any; + type ConcreteBatch = any; + type ConcreteFragmentDefinition = object; + type ConcreteOperationDefinition = object; - /** - * FIXME: RelayContainer used to be typed with ReactClass, but - * ReactClass is broken and allows for access to any property. For example - * ReactClass.getFragment('foo') is valid even though ReactClass has no - * such getFragment() type definition. When ReactClass is fixed this causes a - * lot of errors in Relay code since methods like getFragment() are used often - * but have no definition in Relay's types. Suppressing for now. - */ - type RelayContainer = any; + /** + * FIXME: RelayContainer used to be typed with ReactClass, but + * ReactClass is broken and allows for access to any property. For example + * ReactClass.getFragment('foo') is valid even though ReactClass has no + * such getFragment() type definition. When ReactClass is fixed this causes a + * lot of errors in Relay code since methods like getFragment() are used often + * but have no definition in Relay's types. Suppressing for now. + */ + type RelayContainer = any; - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayQL - // ~~~~~~~~~~~~~~~~~~~~~ - type RelayQL = ( - strings: string[], - ...substitutions: any[] - ) => RelayConcreteNode; + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayQL + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayQL = ( + strings: string[], + ...substitutions: any[] + ) => RelayConcreteNode; - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayModernGraphQLTag - // ~~~~~~~~~~~~~~~~~~~~~ - interface GeneratedNodeMap { - [key: string]: GraphQLTaggedNode; - } - type GraphQLTaggedNode = - (() => ConcreteFragment | ConcreteBatch) | - { - modern(): ConcreteFragment | ConcreteBatch, - classic(relayQL: RelayQL): - | ConcreteFragmentDefinition - | ConcreteOperationDefinition, - }; - // ~~~~~~~~~~~~~~~~~~~~~ - // General Usage - // ~~~~~~~~~~~~~~~~~~~~~ - type DataID = string; - interface Variables { - [name: string]: any; - } - type Uploadable = File | Blob; - interface UploadableMap { - [key: string]: Uploadable; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayNetworkTypes - // Version: Relay 1.3.0 - // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js - // ~~~~~~~~~~~~~~~~~~~~~ - - interface LegacyObserver { - onCompleted?(): void; - onError?(error: Error): void; - onNext?(data: T): void; - } - interface PayloadError { - message: string; - locations?: Array<{ - line: number, - column: number, - }>; - } - /** - * A function that executes a GraphQL operation with request/response semantics. - * - * May return an Observable or Promise of a raw server response. - */ - function FetchFunction( - operation: ConcreteBatch, - variables: Variables, - cacheConfig: CacheConfig, - uploadables?: UploadableMap, - ): Runtime.ObservableFromValue; - - /** - * A function that executes a GraphQL subscription operation, returning one or - * more raw server responses over time. - * - * May return an Observable, otherwise must call the callbacks found in the - * fourth parameter. - */ - type SubscribeFunction = ( - operation: ConcreteBatch, - variables: Variables, - cacheConfig: CacheConfig, - observer: LegacyObserver, - ) => Runtime.RelayObservable | Disposable; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayStoreTypes - // Version: Relay 1.3.0 - // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/store/RelayStoreTypes.js - // ~~~~~~~~~~~~~~~~~~~~~ - /** - * A function that receives a proxy over the store and may trigger side-effects - * (indirectly) by calling `set*` methods on the store or its record proxies. - */ - type StoreUpdater = (store: RecordSourceProxy) => void; - - /** - * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in - * order to easily access the root fields of a query/mutation as well as a - * second argument of the response object of the mutation. - */ - type SelectorStoreUpdater = ( - store: RecordSourceSelectorProxy, - // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is - // inconvenient to access deeply in product code. - data: any, // FLOW FIXME - ) => void; - - /** - * Extends the RecordSourceProxy interface with methods for accessing the root - * fields of a Selector. - */ - interface RecordSourceSelectorProxy { - create(dataID: DataID, typeName: string): RecordProxy; - delete(dataID: DataID): void; - get(dataID: DataID): RecordProxy | void; - getRoot(): RecordProxy; - getRootField(fieldName: string): RecordProxy | void; - getPluralRootField(fieldName: string): RecordProxy[] | void; - } - - interface RecordProxy { - copyFieldsFrom(source: RecordProxy): void; - getDataID(): DataID; - getLinkedRecord(name: string, args?: Variables): RecordProxy | void; - getLinkedRecords(name: string, args?: Variables): Array | void; - getOrCreateLinkedRecord( - name: string, - typeName: string, - args?: Variables, - ): RecordProxy; - getType(): string; - getValue(name: string, args?: Variables): any; - setLinkedRecord( - record: RecordProxy, - name: string, - args?: Variables, - ): RecordProxy; - setLinkedRecords( - records: Array | undefined | null, - name: string, - args?: Variables, - ): RecordProxy; - setValue(value: any, name: string, args?: Variables): RecordProxy; - } - - interface RecordSourceProxy { - create(dataID: DataID, typeName: string): RecordProxy; - delete(dataID: DataID): void; - get(dataID: DataID): Array | void; - getRoot(): RecordProxy; - } - - interface HandleFieldPayload { - // The arguments that were fetched. - args: Variables; - // The __id of the record containing the source/handle field. - dataID: DataID; - // The (storage) key at which the original server data was written. - fieldKey: string; - // The name of the handle - handle: string; - // The (storage) key at which the handle's data should be written by the - // handler - handleKey: string; - } - interface HandlerInterface { - update(store: RecordSourceProxy, fieldPayload: HandleFieldPayload): void; - [functionName: string]: (...args: any[]) => any; - } - const Handler: HandlerInterface; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCombinedEnvironmentTypes - // Version: Relay 1.3.0 - // File: https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js - // ~~~~~~~~~~~~~~~~~~~~~ - /** - * Settings for how a query response may be cached. - * - * - `force`: causes a query to be issued unconditionally, irrespective of the - * state of any configured response cache. - * - `poll`: causes a query to live update by polling at the specified interval - * in milliseconds. (This value will be passed to setTimeout.) - */ - interface CacheConfig { - force?: boolean; - poll?: number; - } - - /** - * Represents any resource that must be explicitly disposed of. The most common - * use-case is as a return value for subscriptions, where calling `dispose()` - * would cancel the subscription. - */ - interface Disposable { - dispose(): void; - } - - /** - * Arbitrary data e.g. received by a container as props. - */ - interface Props { [key: string]: any; } - - /* - * An individual cached graph object. - */ - interface Record { [key: string]: any; } - - /** - * A collection of records keyed by id. - */ - interface RecordMap { [dataID: string]: Record | null | undefined; } - - /** - * A selector defines the starting point for a traversal into the graph for the - * purposes of targeting a subgraph. - */ - interface CSelector { - dataID: DataID; - node: TNode; - variables: Variables; - } - - /** - * A representation of a selector and its results at a particular point in time. - */ - type CSnapshot = CSelector & { - data: SelectorData | null | undefined, - seenRecords: RecordMap, + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayModernGraphQLTag + // ~~~~~~~~~~~~~~~~~~~~~ + interface GeneratedNodeMap { + [key: string]: GraphQLTaggedNode; + } + type GraphQLTaggedNode = + (() => ConcreteFragment | ConcreteBatch) | + { + modern(): ConcreteFragment | ConcreteBatch, + classic(relayQL: RelayQL): + | ConcreteFragmentDefinition + | ConcreteOperationDefinition, }; + // ~~~~~~~~~~~~~~~~~~~~~ + // General Usage + // ~~~~~~~~~~~~~~~~~~~~~ + type DataID = string; + interface Variables { + [name: string]: any; + } + type Uploadable = File | Blob; + interface UploadableMap { + [key: string]: Uploadable; + } + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayNetworkTypes + // Version: Relay 1.3.0 + // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js + // ~~~~~~~~~~~~~~~~~~~~~ + + interface LegacyObserver { + onCompleted?(): void; + onError?(error: Error): void; + onNext?(data: T): void; + } + interface PayloadError { + message: string; + locations?: Array<{ + line: number, + column: number, + }>; + } + /** + * A function that executes a GraphQL operation with request/response semantics. + * + * May return an Observable or Promise of a raw server response. + */ + function FetchFunction( + operation: ConcreteBatch, + variables: Variables, + cacheConfig: CacheConfig, + uploadables?: UploadableMap, + ): Runtime.ObservableFromValue; + + /** + * A function that executes a GraphQL subscription operation, returning one or + * more raw server responses over time. + * + * May return an Observable, otherwise must call the callbacks found in the + * fourth parameter. + */ + type SubscribeFunction = ( + operation: ConcreteBatch, + variables: Variables, + cacheConfig: CacheConfig, + observer: LegacyObserver, + ) => Runtime.RelayObservable | Disposable; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayStoreTypes + // Version: Relay 1.3.0 + // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/store/RelayStoreTypes.js + // ~~~~~~~~~~~~~~~~~~~~~ + /** + * A function that receives a proxy over the store and may trigger side-effects + * (indirectly) by calling `set*` methods on the store or its record proxies. + */ + type StoreUpdater = (store: RecordSourceProxy) => void; + + /** + * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in + * order to easily access the root fields of a query/mutation as well as a + * second argument of the response object of the mutation. + */ + type SelectorStoreUpdater = ( + store: RecordSourceSelectorProxy, + // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is + // inconvenient to access deeply in product code. + data: any, // FLOW FIXME + ) => void; + + /** + * Extends the RecordSourceProxy interface with methods for accessing the root + * fields of a Selector. + */ + interface RecordSourceSelectorProxy { + create(dataID: DataID, typeName: string): RecordProxy; + delete(dataID: DataID): void; + get(dataID: DataID): RecordProxy | void; + getRoot(): RecordProxy; + getRootField(fieldName: string): RecordProxy | void; + getPluralRootField(fieldName: string): RecordProxy[] | void; + } + + interface RecordProxy { + copyFieldsFrom(source: RecordProxy): void; + getDataID(): DataID; + getLinkedRecord(name: string, args?: Variables): RecordProxy | void; + getLinkedRecords(name: string, args?: Variables): Array | void; + getOrCreateLinkedRecord( + name: string, + typeName: string, + args?: Variables, + ): RecordProxy; + getType(): string; + getValue(name: string, args?: Variables): any; + setLinkedRecord( + record: RecordProxy, + name: string, + args?: Variables, + ): RecordProxy; + setLinkedRecords( + records: Array | undefined | null, + name: string, + args?: Variables, + ): RecordProxy; + setValue(value: any, name: string, args?: Variables): RecordProxy; + } + + interface RecordSourceProxy { + create(dataID: DataID, typeName: string): RecordProxy; + delete(dataID: DataID): void; + get(dataID: DataID): Array | void; + getRoot(): RecordProxy; + } + + interface HandleFieldPayload { + // The arguments that were fetched. + args: Variables; + // The __id of the record containing the source/handle field. + dataID: DataID; + // The (storage) key at which the original server data was written. + fieldKey: string; + // The name of the handle + handle: string; + // The (storage) key at which the handle's data should be written by the + // handler + handleKey: string; + } + interface HandlerInterface { + update(store: RecordSourceProxy, fieldPayload: HandleFieldPayload): void; + [functionName: string]: (...args: any[]) => any; + } + const Handler: HandlerInterface; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayCombinedEnvironmentTypes + // Version: Relay 1.3.0 + // File: https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js + // ~~~~~~~~~~~~~~~~~~~~~ + /** + * Settings for how a query response may be cached. + * + * - `force`: causes a query to be issued unconditionally, irrespective of the + * state of any configured response cache. + * - `poll`: causes a query to live update by polling at the specified interval + * in milliseconds. (This value will be passed to setTimeout.) + */ + interface CacheConfig { + force?: boolean; + poll?: number; + } + + /** + * Represents any resource that must be explicitly disposed of. The most common + * use-case is as a return value for subscriptions, where calling `dispose()` + * would cancel the subscription. + */ + interface Disposable { + dispose(): void; + } + + /** + * Arbitrary data e.g. received by a container as props. + */ + interface Props { [key: string]: any; } + + /* + * An individual cached graph object. + */ + interface Record { [key: string]: any; } + + /** + * A collection of records keyed by id. + */ + interface RecordMap { [dataID: string]: Record | null | undefined; } + + /** + * A selector defines the starting point for a traversal into the graph for the + * purposes of targeting a subgraph. + */ + interface CSelector { + dataID: DataID; + node: TNode; + variables: Variables; + } + + /** + * A representation of a selector and its results at a particular point in time. + */ + type CSnapshot = CSelector & { + data: SelectorData | null | undefined, + seenRecords: RecordMap, + }; + + /** + * The results of a selector given a store/RecordSource. + */ + interface SelectorData { [key: string]: any; } + + /** + * The results of reading the results of a FragmentMap given some input + * `Props`. + */ + interface FragmentSpecResults { [key: string]: any; } + + /** + * A utility for resolving and subscribing to the results of a fragment spec + * (key -> fragment mapping) given some "props" that determine the root ID + * and variables to use when reading each fragment. When props are changed via + * `setProps()`, the resolver will update its results and subscriptions + * accordingly. Internally, the resolver: + * - Converts the fragment map & props map into a map of `Selector`s. + * - Removes any resolvers for any props that became null. + * - Creates resolvers for any props that became non-null. + * - Updates resolvers with the latest props. + */ + interface FragmentSpecResolver { /** - * The results of a selector given a store/RecordSource. + * Stop watching for changes to the results of the fragments. */ - interface SelectorData { [key: string]: any; } + dispose(): void; /** - * The results of reading the results of a FragmentMap given some input - * `Props`. + * Get the current results. */ - interface FragmentSpecResults { [key: string]: any; } + resolve(): FragmentSpecResults; /** - * A utility for resolving and subscribing to the results of a fragment spec - * (key -> fragment mapping) given some "props" that determine the root ID - * and variables to use when reading each fragment. When props are changed via - * `setProps()`, the resolver will update its results and subscriptions - * accordingly. Internally, the resolver: - * - Converts the fragment map & props map into a map of `Selector`s. - * - Removes any resolvers for any props that became null. - * - Creates resolvers for any props that became non-null. - * - Updates resolvers with the latest props. + * Update the resolver with new inputs. Call `resolve()` to get the updated + * results. */ - interface FragmentSpecResolver { - /** - * Stop watching for changes to the results of the fragments. - */ - dispose(): void; - - /** - * Get the current results. - */ - resolve(): FragmentSpecResults; - - /** - * Update the resolver with new inputs. Call `resolve()` to get the updated - * results. - */ - setProps(props: Props): void; - - /** - * Override the variables used to read the results of the fragments. Call - * `resolve()` to get the updated results. - */ - setVariables(variables: Variables): void; - } - - interface CFragmentMap { [key: string]: TFragment; } + setProps(props: Props): void; /** - * An operation selector describes a specific instance of a GraphQL operation - * with variables applied. + * Override the variables used to read the results of the fragments. Call + * `resolve()` to get the updated results. + */ + setVariables(variables: Variables): void; + } + + interface CFragmentMap { [key: string]: TFragment; } + + /** + * An operation selector describes a specific instance of a GraphQL operation + * with variables applied. + * + * - `root`: a selector intended for processing server results or retaining + * response data in the store. + * - `fragment`: a selector intended for use in reading or subscribing to + * the results of the the operation. + */ + interface COperationSelector { + fragment: CSelector; + node: TOperation; + root: CSelector; + variables: Variables; + } + + /** + * The public API of Relay core. Represents an encapsulated environment with its + * own in-memory cache. + */ + interface CEnvironment< + TEnvironment, + TFragment, + TGraphQLTaggedNode, + TNode, + TOperation, + TPayload, + > { + /** + * Read the results of a selector from in-memory records in the store. + */ + lookup(selector: CSelector): CSnapshot; + + /** + * Subscribe to changes to the results of a selector. The callback is called + * when data has been committed to the store that would cause the results of + * the snapshot's selector to change. + */ + subscribe( + snapshot: CSnapshot, + callback: (snapshot: CSnapshot) => void, + ): Disposable; + + /** + * Ensure that all the records necessary to fulfill the given selector are + * retained in-memory. The records will not be eligible for garbage collection + * until the returned reference is disposed. * - * - `root`: a selector intended for processing server results or retaining - * response data in the store. - * - `fragment`: a selector intended for use in reading or subscribing to - * the results of the the operation. + * Note: This is a no-op in the classic core. */ - interface COperationSelector { - fragment: CSelector; - node: TOperation; - root: CSelector; - variables: Variables; - } + retain(selector: CSelector): Disposable; /** - * The public API of Relay core. Represents an encapsulated environment with its - * own in-memory cache. + * Send a query to the server with request/response semantics: the query will + * either complete successfully (calling `onNext` and `onCompleted`) or fail + * (calling `onError`). + * + * Note: Most applications should use `streamQuery` in order to + * optionally receive updated information over time, should that feature be + * supported by the network/server. A good rule of thumb is to use this method + * if you would otherwise immediately dispose the `streamQuery()` + * after receving the first `onNext` result. */ - interface CEnvironment< + sendQuery(config: { + cacheConfig?: CacheConfig, + onCompleted?(): void, + onError?(error: Error): void, + onNext?(payload: TPayload): void, + operation: COperationSelector, + }): Disposable; + + /** + * Send a query to the server with request/subscription semantics: one or more + * responses may be returned (via `onNext`) over time followed by either + * the request completing (`onCompleted`) or an error (`onError`). + * + * Networks/servers that support subscriptions may choose to hold the + * subscription open indefinitely such that `onCompleted` is not called. + */ + streamQuery(config: { + cacheConfig?: CacheConfig, + onCompleted?(): void, + onError?(error: Error): void, + onNext?(payload: TPayload): void, + operation: COperationSelector, + }): Disposable; + + unstable_internal: CUnstableEnvironmentCore< TEnvironment, TFragment, TGraphQLTaggedNode, TNode, - TOperation, - TPayload, - > { - /** - * Read the results of a selector from in-memory records in the store. - */ - lookup(selector: CSelector): CSnapshot; - - /** - * Subscribe to changes to the results of a selector. The callback is called - * when data has been committed to the store that would cause the results of - * the snapshot's selector to change. - */ - subscribe( - snapshot: CSnapshot, - callback: (snapshot: CSnapshot) => void, - ): Disposable; - - /** - * Ensure that all the records necessary to fulfill the given selector are - * retained in-memory. The records will not be eligible for garbage collection - * until the returned reference is disposed. - * - * Note: This is a no-op in the classic core. - */ - retain(selector: CSelector): Disposable; - - /** - * Send a query to the server with request/response semantics: the query will - * either complete successfully (calling `onNext` and `onCompleted`) or fail - * (calling `onError`). - * - * Note: Most applications should use `streamQuery` in order to - * optionally receive updated information over time, should that feature be - * supported by the network/server. A good rule of thumb is to use this method - * if you would otherwise immediately dispose the `streamQuery()` - * after receving the first `onNext` result. - */ - sendQuery(config: { - cacheConfig?: CacheConfig, - onCompleted?(): void, - onError?(error: Error): void, - onNext?(payload: TPayload): void, - operation: COperationSelector, - }): Disposable; - - /** - * Send a query to the server with request/subscription semantics: one or more - * responses may be returned (via `onNext`) over time followed by either - * the request completing (`onCompleted`) or an error (`onError`). - * - * Networks/servers that support subscriptions may choose to hold the - * subscription open indefinitely such that `onCompleted` is not called. - */ - streamQuery(config: { - cacheConfig?: CacheConfig, - onCompleted?(): void, - onError?(error: Error): void, - onNext?(payload: TPayload): void, - operation: COperationSelector, - }): Disposable; - - unstable_internal: CUnstableEnvironmentCore< - TEnvironment, - TFragment, - TGraphQLTaggedNode, - TNode, - TOperation - >; - } - - interface CUnstableEnvironmentCore< - TEnvironment, - TFragment, - TGraphQLTaggedNode, - TNode, - TOperation, - > { - /** - * Create an instance of a FragmentSpecResolver. - * - * TODO: The FragmentSpecResolver *can* be implemented via the other methods - * defined here, so this could be moved out of core. It's convenient to have - * separate implementations until the experimental core is in OSS. - */ - createFragmentSpecResolver( - context: CRelayContext, - containerName: string, - fragments: CFragmentMap, - props: Props, - callback: () => void, - ): FragmentSpecResolver; - - /** - * Creates an instance of an OperationSelector given an operation definition - * (see `getOperation`) and the variables to apply. The input variables are - * filtered to exclude variables that do not matche defined arguments on the - * operation, and default values are populated for null values. - */ - createOperationSelector( - operation: TOperation, - variables: Variables, - ): COperationSelector; - - /** - * Given a graphql`...` tagged template, extract a fragment definition usable - * by this version of Relay core. Throws if the value is not a fragment. - */ - getFragment(node: TGraphQLTaggedNode): TFragment; - - /** - * Given a graphql`...` tagged template, extract an operation definition - * usable by this version of Relay core. Throws if the value is not an - * operation. - */ - getOperation(node: TGraphQLTaggedNode): TOperation; - - /** - * Determine if two selectors are equal (represent the same selection). Note - * that this function returns `false` when the two queries/fragments are - * different objects, even if they select the same fields. - */ - areEqualSelectors(a: CSelector, b: CSelector): boolean; - - /** - * Given the result `item` from a parent that fetched `fragment`, creates a - * selector that can be used to read the results of that fragment for that item. - * - * Example: - * - * Given two fragments as follows: - * - * ``` - * fragment Parent on User { - * id - * ...Child - * } - * fragment Child on User { - * name - * } - * ``` - * - * And given some object `parent` that is the results of `Parent` for id "4", - * the results of `Child` can be accessed by first getting a selector and then - * using that selector to `lookup()` the results against the environment: - * - * ``` - * const childSelector = getSelector(queryVariables, Child, parent); - * const childData = environment.lookup(childSelector).data; - * ``` - */ - getSelector( - operationVariables: Variables, - fragment: TFragment, - prop: any, - ): CSelector | void; - - /** - * Given the result `items` from a parent that fetched `fragment`, creates a - * selector that can be used to read the results of that fragment on those - * items. This is similar to `getSelector` but for "plural" fragments that - * expect an array of results and therefore return an array of selectors. - */ - getSelectorList( - operationVariables: Variables, - fragment: TFragment, - props: any[], - ): Array> | void; - - /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts the selectors for those fragments from the results. - * - * The canonical use-case for this function are Relay Containers, which - * use this function to convert (props, fragments) into selectors so that they - * can read the results to pass to the inner component. - */ - getSelectorsFromObject( - operationVariables: Variables, - fragments: CFragmentMap, - props: Props, - ): { [key: string]: CSelector | Array> | null | undefined }; - - /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts a mapping of keys -> id(s) of the results. - * - * Similar to `getSelectorsFromObject()`, this function can be useful in - * determining the "identity" of the props passed to a component. - */ - getDataIDsFromObject( - fragments: CFragmentMap, - props: Props, - ): { [key: string]: DataID | DataID[] | null | undefined }; - - /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts the merged variables that would be in scope for those - * fragments/results. - * - * This can be useful in determing what varaibles were used to fetch the data - * for a Relay container, for example. - */ - getVariablesFromObject( - operationVariables: Variables, - fragments: CFragmentMap, - props: Props, - ): Variables; - } - - /** - * The type of the `relay` property set on React context by the React/Relay - * integration layer (e.g. QueryRenderer, FragmentContainer, etc). - */ - interface CRelayContext { - environment: TEnvironment; - variables: Variables; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayTypes - /** - * Version: Relay 1.3.0 - * File: - * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js - */ - // ~~~~~~~~~~~~~~~~~~~~~ - interface RerunParam { - param: string; - import: string; - max_runs: number; - } - interface FIELDS_CHANGE { - type: 'FIELDS_CHANGE'; - fieldIDs: { [fieldName: string]: DataID | DataID[]; }; - } - interface RANGE_ADD { - type: 'RANGE_ADD'; - parentName?: string; - parentID?: string; - connectionInfo?: Array<{ - key: string, - filters?: Variables, - rangeBehavior: string, - }>; - connectionName?: string; - edgeName: string; - rangeBehaviors?: RangeBehaviors; - } - interface NODE_DELETE { - type: 'NODE_DELETE'; - parentName?: string; - parentID?: string; - connectionName?: string; - deletedIDFieldName: string; - } - interface RANGE_DELETE { - type: 'RANGE_DELETE'; - parentName?: string; - parentID?: string; - connectionKeys?: Array<{ - key: string, - filters?: Variables, - }>; - connectionName?: string; - deletedIDFieldName: string | string[]; - pathToConnection: string[]; - } - interface REQUIRED_CHILDREN { - type: 'REQUIRED_CHILDREN'; - children: RelayConcreteNode[]; - } - type RelayMutationConfig = - FIELDS_CHANGE | - RANGE_ADD | - NODE_DELETE | - RANGE_DELETE | - REQUIRED_CHILDREN; - - interface RelayMutationTransactionCommitCallbacks { - onFailure?: RelayMutationTransactionCommitFailureCallback; - onSuccess?: RelayMutationTransactionCommitSuccessCallback; - } - type RelayMutationTransactionCommitFailureCallback = ( - transaction: RelayMutationTransaction, - preventAutoRollback: () => void, - ) => void; - type RelayMutationTransactionCommitSuccessCallback = (response: { - [key: string]: any, - }) => void; - interface NetworkLayer { - sendMutation(request: RelayMutationRequest): Promise | void; - sendQueries(requests: RelayQueryRequest[]): Promise | void; - supports(...options: string[]): boolean; - } - interface QueryResult { - error?: Error; - ref_params?: { [name: string]: any }; - response: QueryPayload; - } - interface ReadyState { - aborted: boolean; - done: boolean; - error: Error | null; - events: ReadyStateEvent[]; - ready: boolean; - stale: boolean; - } - type RelayContainerErrorEventType = - | 'CACHE_RESTORE_FAILED' - | 'NETWORK_QUERY_ERROR'; - type RelayContainerLoadingEventType = - | 'ABORT' - | 'CACHE_RESTORED_REQUIRED' - | 'CACHE_RESTORE_START' - | 'NETWORK_QUERY_RECEIVED_ALL' - | 'NETWORK_QUERY_RECEIVED_REQUIRED' - | 'NETWORK_QUERY_START' - | 'STORE_FOUND_ALL' - | 'STORE_FOUND_REQUIRED'; - type ReadyStateChangeCallback = (readyState: ReadyState) => void; - interface ReadyStateEvent { - type: RelayContainerLoadingEventType | RelayContainerErrorEventType; - error?: Error; - } - interface Abortable { - abort(): void; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayInternalTypes - /** - * Version: Relay 1.3.0 - * File: - * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js - */ - // ~~~~~~~~~~~~~~~~~~~~~ - interface QueryPayload { [key: string]: any; } - interface RelayQuerySet { [queryName: string]: any; } - type RangeBehaviorsFunction = (connectionArgs: { - [argName: string]: any, - }) => 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; - interface RangeBehaviorsObject { - [key: string]: 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; - } - type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; + TOperation + >; } - namespace Runtime { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type RelayDebugger = any; - type OptimisticUpdate = any; - type OperationSelector = Common.COperationSelector; - type Selector = Common.CSelector; - type PayloadData = any; - type Snapshot = Common.CSnapshot; - type RelayResponsePayload = any; - type MutableRecordSource = RecordSource; - + interface CUnstableEnvironmentCore< + TEnvironment, + TFragment, + TGraphQLTaggedNode, + TNode, + TOperation, + > { /** - * A function that returns an Observable representing the response of executing - * a GraphQL operation. - */ - type ExecuteFunction = ( - operation: object, - variables: Common.Variables, - cacheConfig: Common.CacheConfig, - uploadables?: Common.UploadableMap, - ) => Promise; - interface RelayNetwork { - execute: ExecuteFunction; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayDefaultHandlerProvider - // ~~~~~~~~~~~~~~~~~~~~~ - function HandlerProvider(name: string): typeof Common.Handler | void; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayModernEnvironment - // ~~~~~~~~~~~~~~~~~~~~~ - interface EnvironmentConfig { - configName?: string; - handlerProvider?: typeof HandlerProvider; - network: Network; - store: Store; - } - class Environment { - constructor(config: EnvironmentConfig); - getStore(): Store; - getDebugger(): RelayDebugger; - applyUpdate(optimisticUpdate: OptimisticUpdate): Common.Disposable; - revertUpdate(update: OptimisticUpdate): void; - replaceUpdate(update: OptimisticUpdate, newUpdate: OptimisticUpdate): void; - applyMutation(config: { - operation: OperationSelector, - optimisticUpdater?: Common.SelectorStoreUpdater, - optimisticResponse?: object, - }): Common.Disposable; - check(readSelector: Selector): boolean; - commitPayload( - operationSelector: OperationSelector, - payload: PayloadData, - ): void; - commitUpdate(updater: Common.StoreUpdater): void; - lookup(readSelector: Selector): Snapshot; - subscribe( - snapshot: Snapshot, - callback: (snapshot: Snapshot) => void, - ): Common.Disposable; - retain(selector: Selector): Common.Disposable; - execute(config: { - operation: OperationSelector, - cacheConfig?: Common.CacheConfig, - updater?: Common.SelectorStoreUpdater, - }): RelayObservable; - executeMutation(config: { - operation: OperationSelector, - optimisticUpdater?: Common.SelectorStoreUpdater, - optimisticResponse?: object, - updater?: Common.SelectorStoreUpdater, - uploadables?: Common.UploadableMap, - }): RelayObservable; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayInMemoryRecordSource - // ~~~~~~~~~~~~~~~~~~~~~ - interface Record { [key: string]: any; } - interface RecordMap { [dataID: string]: Record | null | undefined; } - - // ~~~~~~~~~~~~~~~~~~~~~ - // Network - // ~~~~~~~~~~~~~~~~~~~~~ - class Network { - /** - * Creates an implementation of the `Network` interface defined in - * `RelayNetworkTypes` given `fetch` and `subscribe` functions. - */ - static create(fetchFn: typeof Common.FetchFunction, subscribeFn?: Common.SubscribeFunction): RelayNetwork; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // Network - // ~~~~~~~~~~~~~~~~~~~~~ - class RecordSource { - constructor(records?: RecordMap); - clear(): void; - delete(dataID: Common.DataID): void; - get(dataID: Common.DataID): Record | void; - getRecordIDs(): Common.DataID[]; - getStatus(dataID: Common.DataID): 'EXISTENT' | 'NONEXISTENT' | 'UNKNOWN'; - has(dataID: Common.DataID): boolean; - load( - dataID: Common.DataID, - callback: (error: Error | null, record: Record | null) => void, - ): void; - remove(dataID: Common.DataID): void; - set(dataID: Common.DataID, record: Record): void; - size(): number; - toJSON(): RecordMap; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // ModernStore - // ~~~~~~~~~~~~~~~~~~~~~ - class Store { - constructor(source: RecordSource); - getSource(): MutableRecordSource; - check(selector: Selector): boolean; - retain(selector: Selector): Common.Disposable; - lookup(selector: Selector): Snapshot; - notify(): void; - publish(source: RecordSource): void; - subscribe( - snapshot: Snapshot, - callback: (snapshot: Snapshot) => void, - ): Common.Disposable; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayRecordSourceInspector - // ~~~~~~~~~~~~~~~~~~~~~ - /** - * An internal class to provide a console-friendly string representation of a - * Record. - */ - class RecordSummary { - id: Common.DataID; - type: string | null | undefined; - static createFromRecord(id: Common.DataID, record: any): RecordSummary; - constructor(id: Common.DataID, type: string | null | undefined); - toString(): string; - } - /** - * Internal class for inspecting a single Record. - */ - class RecordInspector { - constructor(sourceInspector: RelayRecordSourceInspector, record: Record); - /** - * Get the cache id of the given record. For types that implement the `Node` - * interface (or that have an `id`) this will be `id`, for other types it will be - * a synthesized identifier based on the field path from the nearest ancestor - * record that does have an `id`. - */ - getDataID(): Common.DataID; - - /** - * Returns a list of the fields that have been fetched on the current record. - */ - getFields(): string[]; - - /** - * Returns the type of the record. - */ - getType(): string; - - /** - * Returns a copy of the internal representation of the record. - */ - inspect(): any; - - /** - * Returns the value of a scalar field. May throw if the given field is - * present but not actually scalar. - */ - getValue(name: string, args?: Common.Variables): any; - - /** - * Returns an inspector for the given scalar "linked" field (a field whose - * value is another Record instead of a scalar). May throw if the field is - * present but not a scalar linked record. - */ - getLinkedRecord(name: string, args?: Common.Variables): RecordInspector | void; - - /** - * Returns an array of inspectors for the given plural "linked" field (a field - * whose value is an array of Records instead of a scalar). May throw if the - * field is present but not a plural linked record. - */ - getLinkedRecords(name: string, args?: Common.Variables): RecordInspector[] | void; - } - - class RelayRecordSourceInspector { - constructor(source: RecordSource); - static getForEnvironment(environment: Environment): RelayRecordSourceInspector; - /** - * Returns an inspector for the record with the given id, or null/undefined if - * that record is deleted/unfetched. - */ - get(dataID: Common.DataID): RecordInspector | void; - /** - * Returns a list of ": " for each record in the store that has an - * `id`. - */ - getNodes(): RecordSummary[]; - /** - * Returns a list of ": " for all records in the store including - * those that do not have an `id`. - */ - getRecords(): RecordSummary[]; - - /** - * Returns an inspector for the synthesized "root" object, allowing access to - * e.g. the `viewer` object or the results of other fields on the "Query" - * type. - */ - getRoot(): RecordInspector; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayObservable - // ~~~~~~~~~~~~~~~~~~~~~ - interface Subscription { - unsubscribe(): void; - readonly closed: boolean; - } - interface Observer { - start?(subscription: Subscription): any; - next?(nextThing: T): any; - error?(error: Error): any; - complete?(): any; - unsubscribe?(subscription: Subscription): any; - } - type Source = () => any; - interface Subscribable { - subscribe(observer: Observer): Subscription; - } - type ObservableFromValue = RelayObservable | Promise | T; - class RelayObservable implements Subscribable { - _source: Source; - - constructor(source: Source); - - /** - * When an unhandled error is detected, it is reported to the host environment - * (the ESObservable spec refers to this method as "HostReportErrors()"). - * - * The default implementation in development builds re-throws errors in a - * separate frame, and from production builds does nothing (swallowing - * uncaught errors). - * - * Called during application initialization, this method allows - * application-specific handling of uncaught errors. Allowing, for example, - * integration with error logging or developer tools. - */ - static onUnhandledError(callback: (error: Error) => any): void; - - /** - * Accepts various kinds of data sources, and always returns a RelayObservable - * useful for accepting the result of a user-provided FetchFunction. - */ - static from(obj: ObservableFromValue): RelayObservable; - - /** - * Creates a RelayObservable, given a function which expects a legacy - * Relay Observer as the last argument and which returns a Disposable. - * - * To support migration to Observable, the function may ignore the - * legacy Relay observer and directly return an Observable instead. - */ - static fromLegacy( - callback: (legacyObserver: Common.LegacyObserver) => Common.Disposable | RelayObservable, - ): RelayObservable; - - /** - * Returns a new Observable which returns the same values as this one, but - * modified so that the provided Observer is called to perform a side-effects - * for all events emitted by the source. - * - * Any errors that are thrown in the side-effect Observer are unhandled, and - * do not affect the source Observable or its Observer. - * - * This is useful for when debugging your Observables or performing other - * side-effects such as logging or performance monitoring. - */ - do(observer: Observer): RelayObservable; - - /** - * Returns a new Observable which returns the same values as this one, but - * modified so that the finally callback is performed after completion, - * whether normal or due to error or unsubscription. - * - * This is useful for cleanup such as resource finalization. - */ - finally(fn: () => any): RelayObservable; - - /** - * Returns a new Observable which is identical to this one, unless this - * Observable completes before yielding any values, in which case the new - * Observable will yield the values from the alternate Observable. - * - * If this Observable does yield values, the alternate is never subscribed to. - * - * This is useful for scenarios where values may come from multiple sources - * which should be tried in order, i.e. from a cache before a network. - */ - ifEmpty(alternate: RelayObservable): RelayObservable; - - /** - * Observable's primary API: returns an unsubscribable Subscription to the - * source of this Observable. - */ - subscribe(observer: Observer): Subscription; - - /** - * Supports subscription of a legacy Relay Observer, returning a Disposable. - */ - subscribeLegacy(legacyObserver: Common.LegacyObserver): Common.Disposable; - - /** - * Returns a new Observerable where each value has been transformed by - * the mapping function. - */ - map(fn: (thing: T) => U): RelayObservable; - - /** - * Returns a new Observable where each value is replaced with a new Observable - * by the mapping function, the results of which returned as a single - * concattenated Observable. - */ - concatMap(fn: (thing: T) => ObservableFromValue): RelayObservable; - - /** - * Returns a new Observable which first mirrors this Observable, then when it - * completes, waits for `pollInterval` milliseconds before re-subscribing to - * this Observable again, looping in this manner until unsubscribed. - * - * The returned Observable never completes. - */ - poll(pollInterval: number): RelayObservable; - - /** - * Returns a Promise which resolves when this Observable yields a first value - * or when it completes with no value. - */ - toPromise(): Promise; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // commitLocalUpdate - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - type commitLocalUpdate = ( - environment: Environment, - updater: Common.StoreUpdater, - ) => void; - - // ~~~~~~~~~~~~~~~~~~~~~ - // commitRelayModernMutation - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - interface MutationConfig { - configs?: Common.RelayMutationConfig[]; - mutation: Common.GraphQLTaggedNode; - variables: Common.Variables; - uploadables?: Common.UploadableMap; - onCompleted?(response: T, errors: Common.PayloadError[] | null | undefined): void; - onError?(error?: Error): void; - optimisticUpdater?: Common.SelectorStoreUpdater; - optimisticResponse?: object; - updater?: Common.SelectorStoreUpdater; - } - function commitRelayModernMutation( - environment: Environment, - config: MutationConfig, - ): Common.Disposable; - - // ~~~~~~~~~~~~~~~~~~~~~ - // applyRelayModernOptimisticMutation - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - interface OptimisticMutationConfig { - configs?: Common.RelayMutationConfig[]; - mutation: Common.GraphQLTaggedNode; - variables: Common.Variables; - optimisticUpdater?: Common.SelectorStoreUpdater; - optimisticResponse?: object; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // fetchRelayModernQuery - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - /** - * A helper function to fetch the results of a query. Note that results for - * fragment spreads are masked: fields must be explicitly listed in the query in - * order to be accessible in the result object. + * Create an instance of a FragmentSpecResolver. * - * NOTE: This module is primarily intended for integrating with classic APIs. - * Most product code should use a Renderer or Container. - * - * TODO(t16875667): The return type should be `Promise`, but - * that's not really helpful as `SelectorData` is essentially just `mixed`. We - * can probably leverage generated flow types here to return the real expected - * shape. + * TODO: The FragmentSpecResolver *can* be implemented via the other methods + * defined here, so this could be moved out of core. It's convenient to have + * separate implementations until the experimental core is in OSS. */ - function fetchRelayModernQuery( - environment: any, // FIXME - $FlowFixMe in facebook source code - taggedNode: Common.GraphQLTaggedNode, - variables: Common.Variables, - cacheConfig?: Common.CacheConfig, - ): Promise; // FIXME - $FlowFixMe in facebook source code + createFragmentSpecResolver( + context: CRelayContext, + containerName: string, + fragments: CFragmentMap, + props: Props, + callback: () => void, + ): FragmentSpecResolver; - // ~~~~~~~~~~~~~~~~~~~~~ - // requestRelaySubscription - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - interface GraphQLSubscriptionConfig { - configs?: Common.RelayMutationConfig[]; - subscription: Common.GraphQLTaggedNode; - variables: Common.Variables; - onCompleted?(): void; - onError?(error: Error): void; - onNext?(response: object | null | undefined): void; - updater?(store: Common.RecordSourceSelectorProxy): void; - } - function requestRelaySubscription( - environment: Environment, - config: GraphQLSubscriptionConfig, - ): Common.Disposable; + /** + * Creates an instance of an OperationSelector given an operation definition + * (see `getOperation`) and the variables to apply. The input variables are + * filtered to exclude variables that do not matche defined arguments on the + * operation, and default values are populated for null values. + */ + createOperationSelector( + operation: TOperation, + variables: Variables, + ): COperationSelector; + + /** + * Given a graphql`...` tagged template, extract a fragment definition usable + * by this version of Relay core. Throws if the value is not a fragment. + */ + getFragment(node: TGraphQLTaggedNode): TFragment; + + /** + * Given a graphql`...` tagged template, extract an operation definition + * usable by this version of Relay core. Throws if the value is not an + * operation. + */ + getOperation(node: TGraphQLTaggedNode): TOperation; + + /** + * Determine if two selectors are equal (represent the same selection). Note + * that this function returns `false` when the two queries/fragments are + * different objects, even if they select the same fields. + */ + areEqualSelectors(a: CSelector, b: CSelector): boolean; + + /** + * Given the result `item` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment for that item. + * + * Example: + * + * Given two fragments as follows: + * + * ``` + * fragment Parent on User { + * id + * ...Child + * } + * fragment Child on User { + * name + * } + * ``` + * + * And given some object `parent` that is the results of `Parent` for id "4", + * the results of `Child` can be accessed by first getting a selector and then + * using that selector to `lookup()` the results against the environment: + * + * ``` + * const childSelector = getSelector(queryVariables, Child, parent); + * const childData = environment.lookup(childSelector).data; + * ``` + */ + getSelector( + operationVariables: Variables, + fragment: TFragment, + prop: any, + ): CSelector | void; + + /** + * Given the result `items` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment on those + * items. This is similar to `getSelector` but for "plural" fragments that + * expect an array of results and therefore return an array of selectors. + */ + getSelectorList( + operationVariables: Variables, + fragment: TFragment, + props: any[], + ): Array> | void; + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the selectors for those fragments from the results. + * + * The canonical use-case for this function are Relay Containers, which + * use this function to convert (props, fragments) into selectors so that they + * can read the results to pass to the inner component. + */ + getSelectorsFromObject( + operationVariables: Variables, + fragments: CFragmentMap, + props: Props, + ): { [key: string]: CSelector | Array> | null | undefined }; + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts a mapping of keys -> id(s) of the results. + * + * Similar to `getSelectorsFromObject()`, this function can be useful in + * determining the "identity" of the props passed to a component. + */ + getDataIDsFromObject( + fragments: CFragmentMap, + props: Props, + ): { [key: string]: DataID | DataID[] | null | undefined }; + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the merged variables that would be in scope for those + * fragments/results. + * + * This can be useful in determing what varaibles were used to fetch the data + * for a Relay container, for example. + */ + getVariablesFromObject( + operationVariables: Variables, + fragments: CFragmentMap, + props: Props, + ): Variables; } + + /** + * The type of the `relay` property set on React context by the React/Relay + * integration layer (e.g. QueryRenderer, FragmentContainer, etc). + */ + interface CRelayContext { + environment: TEnvironment; + variables: Variables; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayTypes + /** + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js + */ + // ~~~~~~~~~~~~~~~~~~~~~ + interface RerunParam { + param: string; + import: string; + max_runs: number; + } + interface FIELDS_CHANGE { + type: 'FIELDS_CHANGE'; + fieldIDs: { [fieldName: string]: DataID | DataID[]; }; + } + interface RANGE_ADD { + type: 'RANGE_ADD'; + parentName?: string; + parentID?: string; + connectionInfo?: Array<{ + key: string, + filters?: Variables, + rangeBehavior: string, + }>; + connectionName?: string; + edgeName: string; + rangeBehaviors?: RangeBehaviors; + } + interface NODE_DELETE { + type: 'NODE_DELETE'; + parentName?: string; + parentID?: string; + connectionName?: string; + deletedIDFieldName: string; + } + interface RANGE_DELETE { + type: 'RANGE_DELETE'; + parentName?: string; + parentID?: string; + connectionKeys?: Array<{ + key: string, + filters?: Variables, + }>; + connectionName?: string; + deletedIDFieldName: string | string[]; + pathToConnection: string[]; + } + interface REQUIRED_CHILDREN { + type: 'REQUIRED_CHILDREN'; + children: RelayConcreteNode[]; + } + type RelayMutationConfig = + FIELDS_CHANGE | + RANGE_ADD | + NODE_DELETE | + RANGE_DELETE | + REQUIRED_CHILDREN; + + interface RelayMutationTransactionCommitCallbacks { + onFailure?: RelayMutationTransactionCommitFailureCallback; + onSuccess?: RelayMutationTransactionCommitSuccessCallback; + } + type RelayMutationTransactionCommitFailureCallback = ( + transaction: RelayMutationTransaction, + preventAutoRollback: () => void, + ) => void; + type RelayMutationTransactionCommitSuccessCallback = (response: { + [key: string]: any, + }) => void; + interface NetworkLayer { + sendMutation(request: RelayMutationRequest): Promise | void; + sendQueries(requests: RelayQueryRequest[]): Promise | void; + supports(...options: string[]): boolean; + } + interface QueryResult { + error?: Error; + ref_params?: { [name: string]: any }; + response: QueryPayload; + } + interface ReadyState { + aborted: boolean; + done: boolean; + error: Error | null; + events: ReadyStateEvent[]; + ready: boolean; + stale: boolean; + } + type RelayContainerErrorEventType = + | 'CACHE_RESTORE_FAILED' + | 'NETWORK_QUERY_ERROR'; + type RelayContainerLoadingEventType = + | 'ABORT' + | 'CACHE_RESTORED_REQUIRED' + | 'CACHE_RESTORE_START' + | 'NETWORK_QUERY_RECEIVED_ALL' + | 'NETWORK_QUERY_RECEIVED_REQUIRED' + | 'NETWORK_QUERY_START' + | 'STORE_FOUND_ALL' + | 'STORE_FOUND_REQUIRED'; + type ReadyStateChangeCallback = (readyState: ReadyState) => void; + interface ReadyStateEvent { + type: RelayContainerLoadingEventType | RelayContainerErrorEventType; + error?: Error; + } + interface Abortable { + abort(): void; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayInternalTypes + /** + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js + */ + // ~~~~~~~~~~~~~~~~~~~~~ + interface QueryPayload { [key: string]: any; } + interface RelayQuerySet { [queryName: string]: any; } + type RangeBehaviorsFunction = (connectionArgs: { + [argName: string]: any, + }) => 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; + interface RangeBehaviorsObject { + [key: string]: 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; + } + type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; } -// tslint:disable no-single-declare-module strict-export-declare-modifiers -declare module 'relay-runtime' { - export import Environment = __Relay.Runtime.Environment; - export import Network = __Relay.Runtime.Network; - export import RecordSource = __Relay.Runtime.RecordSource; - export import Store = __Relay.Runtime.Store; - export import Observable = __Relay.Runtime.RelayObservable; - // note RecordSourceInspector is only available in dev environment - export import RecordSourceInspector = __Relay.Runtime.RelayRecordSourceInspector; - export import ConnectionHandler = __Relay.Common.Handler; - export import ViewerHandler = __Relay.Common.Handler; +export namespace RelayRuntimeTypes { + // ~~~~~~~~~~~~~~~~~~~~~ + // Maybe Fix + // ~~~~~~~~~~~~~~~~~~~~~ + type RelayDebugger = any; + type OptimisticUpdate = any; + type OperationSelector = RelayCommonTypes.COperationSelector; + type Selector = RelayCommonTypes.CSelector; + type PayloadData = any; + type Snapshot = RelayCommonTypes.CSnapshot; + type RelayResponsePayload = any; + type MutableRecordSource = RecordSource; + + /** + * A function that returns an Observable representing the response of executing + * a GraphQL operation. + */ + type ExecuteFunction = ( + operation: object, + variables: RelayCommonTypes.Variables, + cacheConfig: RelayCommonTypes.CacheConfig, + uploadables?: RelayCommonTypes.UploadableMap, + ) => Promise; + interface RelayNetwork { + execute: ExecuteFunction; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayDefaultHandlerProvider + // ~~~~~~~~~~~~~~~~~~~~~ + function HandlerProvider(name: string): typeof RelayCommonTypes.Handler | void; + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayModernEnvironment + // ~~~~~~~~~~~~~~~~~~~~~ + interface EnvironmentConfig { + configName?: string; + handlerProvider?: typeof HandlerProvider; + network: Network; + store: Store; + } + class Environment { + constructor(config: EnvironmentConfig); + getStore(): Store; + getDebugger(): RelayDebugger; + applyUpdate(optimisticUpdate: OptimisticUpdate): RelayCommonTypes.Disposable; + revertUpdate(update: OptimisticUpdate): void; + replaceUpdate(update: OptimisticUpdate, newUpdate: OptimisticUpdate): void; + applyMutation(config: { + operation: OperationSelector, + optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater, + optimisticResponse?: object, + }): RelayCommonTypes.Disposable; + check(readSelector: Selector): boolean; + commitPayload( + operationSelector: OperationSelector, + payload: PayloadData, + ): void; + commitUpdate(updater: RelayCommonTypes.StoreUpdater): void; + lookup(readSelector: Selector): Snapshot; + subscribe( + snapshot: Snapshot, + callback: (snapshot: Snapshot) => void, + ): RelayCommonTypes.Disposable; + retain(selector: Selector): RelayCommonTypes.Disposable; + execute(config: { + operation: OperationSelector, + cacheConfig?: RelayCommonTypes.CacheConfig, + updater?: RelayCommonTypes.SelectorStoreUpdater, + }): RelayObservable; + executeMutation(config: { + operation: OperationSelector, + optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater, + optimisticResponse?: object, + updater?: RelayCommonTypes.SelectorStoreUpdater, + uploadables?: RelayCommonTypes.UploadableMap, + }): RelayObservable; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayInMemoryRecordSource + // ~~~~~~~~~~~~~~~~~~~~~ + interface Record { [key: string]: any; } + interface RecordMap { [dataID: string]: Record | null | undefined; } + + // ~~~~~~~~~~~~~~~~~~~~~ + // Network + // ~~~~~~~~~~~~~~~~~~~~~ + class Network { + /** + * Creates an implementation of the `Network` interface defined in + * `RelayNetworkTypes` given `fetch` and `subscribe` functions. + */ + static create(fetchFn: typeof RelayCommonTypes.FetchFunction, subscribeFn?: RelayCommonTypes.SubscribeFunction): RelayNetwork; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // Network + // ~~~~~~~~~~~~~~~~~~~~~ + class RecordSource { + constructor(records?: RecordMap); + clear(): void; + delete(dataID: RelayCommonTypes.DataID): void; + get(dataID: RelayCommonTypes.DataID): Record | void; + getRecordIDs(): RelayCommonTypes.DataID[]; + getStatus(dataID: RelayCommonTypes.DataID): 'EXISTENT' | 'NONEXISTENT' | 'UNKNOWN'; + has(dataID: RelayCommonTypes.DataID): boolean; + load( + dataID: RelayCommonTypes.DataID, + callback: (error: Error | null, record: Record | null) => void, + ): void; + remove(dataID: RelayCommonTypes.DataID): void; + set(dataID: RelayCommonTypes.DataID, record: Record): void; + size(): number; + toJSON(): RecordMap; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // ModernStore + // ~~~~~~~~~~~~~~~~~~~~~ + class Store { + constructor(source: RecordSource); + getSource(): MutableRecordSource; + check(selector: Selector): boolean; + retain(selector: Selector): RelayCommonTypes.Disposable; + lookup(selector: Selector): Snapshot; + notify(): void; + publish(source: RecordSource): void; + subscribe( + snapshot: Snapshot, + callback: (snapshot: Snapshot) => void, + ): RelayCommonTypes.Disposable; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayRecordSourceInspector + // ~~~~~~~~~~~~~~~~~~~~~ + /** + * An internal class to provide a console-friendly string representation of a + * Record. + */ + class RecordSummary { + id: RelayCommonTypes.DataID; + type: string | null | undefined; + static createFromRecord(id: RelayCommonTypes.DataID, record: any): RecordSummary; + constructor(id: RelayCommonTypes.DataID, type: string | null | undefined); + toString(): string; + } + /** + * Internal class for inspecting a single Record. + */ + class RecordInspector { + constructor(sourceInspector: RelayRecordSourceInspector, record: Record); + /** + * Get the cache id of the given record. For types that implement the `Node` + * interface (or that have an `id`) this will be `id`, for other types it will be + * a synthesized identifier based on the field path from the nearest ancestor + * record that does have an `id`. + */ + getDataID(): RelayCommonTypes.DataID; + + /** + * Returns a list of the fields that have been fetched on the current record. + */ + getFields(): string[]; + + /** + * Returns the type of the record. + */ + getType(): string; + + /** + * Returns a copy of the internal representation of the record. + */ + inspect(): any; + + /** + * Returns the value of a scalar field. May throw if the given field is + * present but not actually scalar. + */ + getValue(name: string, args?: RelayCommonTypes.Variables): any; + + /** + * Returns an inspector for the given scalar "linked" field (a field whose + * value is another Record instead of a scalar). May throw if the field is + * present but not a scalar linked record. + */ + getLinkedRecord(name: string, args?: RelayCommonTypes.Variables): RecordInspector | void; + + /** + * Returns an array of inspectors for the given plural "linked" field (a field + * whose value is an array of Records instead of a scalar). May throw if the + * field is present but not a plural linked record. + */ + getLinkedRecords(name: string, args?: RelayCommonTypes.Variables): RecordInspector[] | void; + } + + class RelayRecordSourceInspector { + constructor(source: RecordSource); + static getForEnvironment(environment: Environment): RelayRecordSourceInspector; + /** + * Returns an inspector for the record with the given id, or null/undefined if + * that record is deleted/unfetched. + */ + get(dataID: RelayCommonTypes.DataID): RecordInspector | void; + /** + * Returns a list of ": " for each record in the store that has an + * `id`. + */ + getNodes(): RecordSummary[]; + /** + * Returns a list of ": " for all records in the store including + * those that do not have an `id`. + */ + getRecords(): RecordSummary[]; + + /** + * Returns an inspector for the synthesized "root" object, allowing access to + * e.g. the `viewer` object or the results of other fields on the "Query" + * type. + */ + getRoot(): RecordInspector; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // RelayObservable + // ~~~~~~~~~~~~~~~~~~~~~ + interface Subscription { + unsubscribe(): void; + readonly closed: boolean; + } + interface Observer { + start?(subscription: Subscription): any; + next?(nextThing: T): any; + error?(error: Error): any; + complete?(): any; + unsubscribe?(subscription: Subscription): any; + } + type Source = () => any; + interface Subscribable { + subscribe(observer: Observer): Subscription; + } + type ObservableFromValue = RelayObservable | Promise | T; + class RelayObservable implements Subscribable { + _source: Source; + + constructor(source: Source); + + /** + * When an unhandled error is detected, it is reported to the host environment + * (the ESObservable spec refers to this method as "HostReportErrors()"). + * + * The default implementation in development builds re-throws errors in a + * separate frame, and from production builds does nothing (swallowing + * uncaught errors). + * + * Called during application initialization, this method allows + * application-specific handling of uncaught errors. Allowing, for example, + * integration with error logging or developer tools. + */ + static onUnhandledError(callback: (error: Error) => any): void; + + /** + * Accepts various kinds of data sources, and always returns a RelayObservable + * useful for accepting the result of a user-provided FetchFunction. + */ + static from(obj: ObservableFromValue): RelayObservable; + + /** + * Creates a RelayObservable, given a function which expects a legacy + * Relay Observer as the last argument and which returns a Disposable. + * + * To support migration to Observable, the function may ignore the + * legacy Relay observer and directly return an Observable instead. + */ + static fromLegacy( + callback: (legacyObserver: RelayCommonTypes.LegacyObserver) => RelayCommonTypes.Disposable | RelayObservable, + ): RelayObservable; + + /** + * Returns a new Observable which returns the same values as this one, but + * modified so that the provided Observer is called to perform a side-effects + * for all events emitted by the source. + * + * Any errors that are thrown in the side-effect Observer are unhandled, and + * do not affect the source Observable or its Observer. + * + * This is useful for when debugging your Observables or performing other + * side-effects such as logging or performance monitoring. + */ + do(observer: Observer): RelayObservable; + + /** + * Returns a new Observable which returns the same values as this one, but + * modified so that the finally callback is performed after completion, + * whether normal or due to error or unsubscription. + * + * This is useful for cleanup such as resource finalization. + */ + finally(fn: () => any): RelayObservable; + + /** + * Returns a new Observable which is identical to this one, unless this + * Observable completes before yielding any values, in which case the new + * Observable will yield the values from the alternate Observable. + * + * If this Observable does yield values, the alternate is never subscribed to. + * + * This is useful for scenarios where values may come from multiple sources + * which should be tried in order, i.e. from a cache before a network. + */ + ifEmpty(alternate: RelayObservable): RelayObservable; + + /** + * Observable's primary API: returns an unsubscribable Subscription to the + * source of this Observable. + */ + subscribe(observer: Observer): Subscription; + + /** + * Supports subscription of a legacy Relay Observer, returning a Disposable. + */ + subscribeLegacy(legacyObserver: RelayCommonTypes.LegacyObserver): RelayCommonTypes.Disposable; + + /** + * Returns a new Observerable where each value has been transformed by + * the mapping function. + */ + map(fn: (thing: T) => U): RelayObservable; + + /** + * Returns a new Observable where each value is replaced with a new Observable + * by the mapping function, the results of which returned as a single + * concattenated Observable. + */ + concatMap(fn: (thing: T) => ObservableFromValue): RelayObservable; + + /** + * Returns a new Observable which first mirrors this Observable, then when it + * completes, waits for `pollInterval` milliseconds before re-subscribing to + * this Observable again, looping in this manner until unsubscribed. + * + * The returned Observable never completes. + */ + poll(pollInterval: number): RelayObservable; + + /** + * Returns a Promise which resolves when this Observable yields a first value + * or when it completes with no value. + */ + toPromise(): Promise; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // commitLocalUpdate + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + type commitLocalUpdate = ( + environment: Environment, + updater: RelayCommonTypes.StoreUpdater, + ) => void; + + // ~~~~~~~~~~~~~~~~~~~~~ + // commitRelayModernMutation + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + interface MutationConfig { + configs?: RelayCommonTypes.RelayMutationConfig[]; + mutation: RelayCommonTypes.GraphQLTaggedNode; + variables: RelayCommonTypes.Variables; + uploadables?: RelayCommonTypes.UploadableMap; + onCompleted?(response: T, errors: RelayCommonTypes.PayloadError[] | null | undefined): void; + onError?(error?: Error): void; + optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater; + optimisticResponse?: object; + updater?: RelayCommonTypes.SelectorStoreUpdater; + } + function commitRelayModernMutation( + environment: Environment, + config: MutationConfig, + ): RelayCommonTypes.Disposable; + + // ~~~~~~~~~~~~~~~~~~~~~ + // applyRelayModernOptimisticMutation + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + interface OptimisticMutationConfig { + configs?: RelayCommonTypes.RelayMutationConfig[]; + mutation: RelayCommonTypes.GraphQLTaggedNode; + variables: RelayCommonTypes.Variables; + optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater; + optimisticResponse?: object; + } + + // ~~~~~~~~~~~~~~~~~~~~~ + // fetchRelayModernQuery + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + /** + * A helper function to fetch the results of a query. Note that results for + * fragment spreads are masked: fields must be explicitly listed in the query in + * order to be accessible in the result object. + * + * NOTE: This module is primarily intended for integrating with classic APIs. + * Most product code should use a Renderer or Container. + * + * TODO(t16875667): The return type should be `Promise`, but + * that's not really helpful as `SelectorData` is essentially just `mixed`. We + * can probably leverage generated flow types here to return the real expected + * shape. + */ + function fetchRelayModernQuery( + environment: any, // FIXME - $FlowFixMe in facebook source code + taggedNode: RelayCommonTypes.GraphQLTaggedNode, + variables: RelayCommonTypes.Variables, + cacheConfig?: RelayCommonTypes.CacheConfig, + ): Promise; // FIXME - $FlowFixMe in facebook source code + + // ~~~~~~~~~~~~~~~~~~~~~ + // requestRelaySubscription + // ~~~~~~~~~~~~~~~~~~~~~ + // exposed through RelayModern, not Runtime directly + interface GraphQLSubscriptionConfig { + configs?: RelayCommonTypes.RelayMutationConfig[]; + subscription: RelayCommonTypes.GraphQLTaggedNode; + variables: RelayCommonTypes.Variables; + onCompleted?(): void; + onError?(error: Error): void; + onNext?(response: object | null | undefined): void; + updater?(store: RelayCommonTypes.RecordSourceSelectorProxy): void; + } + function requestRelaySubscription( + environment: Environment, + config: GraphQLSubscriptionConfig, + ): RelayCommonTypes.Disposable; } + +// ~~~~~~~~~~~~~~~~~~~~~ +// Package Exports +// ~~~~~~~~~~~~~~~~~~~~~ +export import Environment = RelayRuntimeTypes.Environment; +export import Network = RelayRuntimeTypes.Network; +export import RecordSource = RelayRuntimeTypes.RecordSource; +export import Store = RelayRuntimeTypes.Store; +export import Observable = RelayRuntimeTypes.RelayObservable; +// note RecordSourceInspector is only available in dev environment +export import RecordSourceInspector = RelayRuntimeTypes.RelayRecordSourceInspector; +export import ConnectionHandler = RelayCommonTypes.Handler; +export import ViewerHandler = RelayCommonTypes.Handler; From 9d1970bce092c5859a39b9a698938255c732eec9 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Sun, 1 Oct 2017 19:47:49 -0700 Subject: [PATCH 027/314] trying to clean things up and fix some errors --- types/react-relay/v1/index.d.ts | 475 +----------------- .../v1/lib/react-relay-classic.d.ts | 218 ++++++++ .../v1/lib/react-relay-compat.d.ts | 57 +++ .../v1/lib/react-relay-modern.d.ts | 147 ++++++ types/react-relay/v1/react-relay-tests.tsx | 18 +- types/react-relay/v1/tsconfig.json | 4 +- 6 files changed, 450 insertions(+), 469 deletions(-) diff --git a/types/react-relay/v1/index.d.ts b/types/react-relay/v1/index.d.ts index 14c7bb756a..e214a9a441 100644 --- a/types/react-relay/v1/index.d.ts +++ b/types/react-relay/v1/index.d.ts @@ -4,471 +4,20 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import * as React from 'react'; -import { RelayCommonTypes, RelayRuntimeTypes } from 'relay-runtime'; - -//////////////////////////// -// RELAY MODERN TYPES -/////////////////////////// -export namespace RelayModernTypes { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type ConcreteFragment = any; - type ConcreteBatch = any; - type ConcreteFragmentDefinition = object; - type ConcreteOperationDefinition = object; - type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayProp - // ~~~~~~~~~~~~~~~~~~~~~ - // note: refetch and pagination containers augment this - interface RelayProp { - environment: RelayRuntimeTypes.Environment; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayQL - // ~~~~~~~~~~~~~~~~~~~~~ - function RelayQL( - strings: string[], - ...substitutions: any[] - ): RelayCommonTypes.RelayConcreteNode; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayModernGraphQLTag - // ~~~~~~~~~~~~~~~~~~~~~ - interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode; } - type GraphQLTaggedNode = - (() => ConcreteFragment | ConcreteBatch) - | { - modern(): ConcreteFragment | ConcreteBatch, - classic(relayQL: typeof RelayQL): - | ConcreteFragmentDefinition - | ConcreteOperationDefinition, - }; - /** - * Runtime function to correspond to the `graphql` tagged template function. - * All calls to this function should be transformed by the plugin. - */ - interface GraphqlInterface { - (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; - experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; - } - const graphql: GraphqlInterface; - - // ~~~~~~~~~~~~~~~~~~~~~ - // ReactRelayQueryRenderer - // ~~~~~~~~~~~~~~~~~~~~~ - interface QueryRendererProps { - cacheConfig?: RelayCommonTypes.CacheConfig; - environment: RelayRuntimeTypes.Environment; - query: GraphQLTaggedNode; - render(readyState: ReadyState): React.ReactElement | undefined | null; - variables: RelayCommonTypes.Variables; - rerunParamExperimental?: RelayCommonTypes.RerunParam; - } - interface ReadyState { - error: Error | undefined | null; - props: { [propName: string]: any } | undefined | null; - retry?(): void; - } - interface QueryRendererState { - readyState: ReadyState; - } - class ReactRelayQueryRenderer extends React.Component { } - - // ~~~~~~~~~~~~~~~~~~~~~ - // createFragmentContainer - // ~~~~~~~~~~~~~~~~~~~~~ - function createFragmentContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - ): ReactBaseComponent; - - // ~~~~~~~~~~~~~~~~~~~~~ - // createPaginationContainer - // ~~~~~~~~~~~~~~~~~~~~~ - interface PageInfo { - endCursor: string | undefined | null; - hasNextPage: boolean; - hasPreviousPage: boolean; - startCursor: string | undefined | null; - } - interface ConnectionData { - edges?: any[]; - pageInfo?: PageInfo; - } - type RelayPaginationProp = RelayProp & { - hasMore(): boolean, - isLoading(): boolean, - loadMore( - pageSize: number, - callback: (error?: Error) => void, - options?: RefetchOptions, - ): RelayCommonTypes.Disposable | undefined | null, - refetchConnection( - totalCount: number, - callback: (error?: Error) => void, - refetchVariables?: RelayCommonTypes.Variables, - ): RelayCommonTypes.Disposable | undefined | null, - }; - function FragmentVariablesGetter( - prevVars: RelayCommonTypes.Variables, - totalCount: number, - ): RelayCommonTypes.Variables; - interface ConnectionConfig { - direction?: 'backward' | 'forward'; - getConnectionFromProps?(props: object): ConnectionData | undefined | null; - getFragmentVariables?: typeof FragmentVariablesGetter; - getVariables( - props: { [propName: string]: any }, - paginationInfo: { count: number, cursor?: string }, - fragmentVariables: RelayCommonTypes.Variables, - ): RelayCommonTypes.Variables; - query: GraphQLTaggedNode; - } - function createPaginationContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - connectionConfig: ConnectionConfig, - ): ReactBaseComponent; - - // ~~~~~~~~~~~~~~~~~~~~~ - // createFragmentContainer - // ~~~~~~~~~~~~~~~~~~~~~ - interface RefetchOptions { - force?: boolean; - rerunParamExperimental?: RelayCommonTypes.RerunParam; - } - type RelayRefetchProp = RelayProp & { - refetch( - refetchVariables: RelayCommonTypes.Variables | ((fragmentVariables: RelayCommonTypes.Variables) => RelayCommonTypes.Variables), - renderVariables?: RelayCommonTypes.Variables, - callback?: (error?: Error) => void, - options?: RefetchOptions, - ): RelayCommonTypes.Disposable, - }; - function createRefetchContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - taggedNode: GraphQLTaggedNode, - ): ReactBaseComponent; -} - -//////////////////////////// -// RELAY CLASSIC TYPES -/////////////////////////// -// note: the namespace here is really for use inside of -// relay-compat; the module declaration below -// uses the old, pre-existing types -export namespace RelayClassicTypes { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type StoreReaderData = any; - type StoreReaderOptions = any; - type RelayStoreData = any; - interface RelayQuery { Fragment: any; Node: any; Root: any; } - - // ~~~~~~~~~~~~~~~~~~~~~ - // Environment - // ~~~~~~~~~~~~~~~~~~~~~ - interface FragmentResolver { - dispose(): void; - resolve( - fragment: RelayQuery["Fragment"], - dataIDs: RelayCommonTypes.DataID | RelayCommonTypes.DataID[], - ): StoreReaderData | StoreReaderData[] | undefined | null; - } - interface RelayEnvironmentInterface { - forceFetch( - querySet: RelayCommonTypes.RelayQuerySet, - onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback, - ): RelayCommonTypes.Abortable; - getFragmentResolver( - fragment: RelayQuery["Fragment"], - onNext: () => void, - ): FragmentResolver; - getStoreData(): RelayStoreData; - primeCache( - querySet: RelayCommonTypes.RelayQuerySet, - onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback, - ): RelayCommonTypes.Abortable; - read( - node: RelayQuery["Node"], - dataID: RelayCommonTypes.DataID, - options?: StoreReaderOptions, - ): StoreReaderData | void; - readQuery( - root: RelayQuery["Root"], - options?: StoreReaderOptions, - ): StoreReaderData[] | void; - } -} - -//////////////////////////// -// RELAY COMPAT TYPES -/////////////////////////// -export namespace RelayCompatTypes { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type ConcreteFragment = any; - type ConcreteBatch = any; - type ConcreteFragmentDefinition = object; - type ConcreteOperationDefinition = object; - - // ~~~~~~~~~~~~~~~~~~~~~ - // Util - // ~~~~~~~~~~~~~~~~~~~~~ - function getFragment(q: string, v?: RelayCommonTypes.Variables): string; - interface ComponentWithFragment extends React.ComponentClass { - getFragment: typeof getFragment; - } - interface StatelessWithFragment extends React.StatelessComponent { - getFragment: typeof getFragment; - } - type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; - type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; - type RelayClassicEnvironment = RelayClassicTypes.RelayEnvironmentInterface; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCompatTypes - // ~~~~~~~~~~~~~~~~~~~~~ - type CompatEnvironment = RelayRuntimeTypes.Environment | RelayClassicEnvironment; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCompatMutations - // ~~~~~~~~~~~~~~~~~~~~~ - function commitUpdate( - environment: CompatEnvironment, - config: RelayRuntimeTypes.MutationConfig, - ): RelayCommonTypes.Disposable; - function applyUpdate( - environment: CompatEnvironment, - config: RelayRuntimeTypes.OptimisticMutationConfig, - ): RelayCommonTypes.Disposable; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCompatContainer - // ~~~~~~~~~~~~~~~~~~~~~ - interface GeneratedNodeMap { [key: string]: RelayModernTypes.GraphQLTaggedNode; } - function createContainer( - Component: ReactBaseComponent, - fragmentSpec: RelayModernTypes.GraphQLTaggedNode | GeneratedNodeMap, - ): ReactFragmentComponent; - - // ~~~~~~~~~~~~~~~~~~~~~ - // injectDefaultVariablesProvider - // ~~~~~~~~~~~~~~~~~~~~~ - type VariablesProvider = () => RelayCommonTypes.Variables; - function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; -} - - -//////////////////////////// -// MODULES -/////////////////////////// -export import QueryRenderer = RelayModernTypes.ReactRelayQueryRenderer; -export import createFragmentContainer = RelayModernTypes.createFragmentContainer; -export import createPaginationContainer = RelayModernTypes.createPaginationContainer; -export import createRefetchContainer = RelayModernTypes.createRefetchContainer; -export import graphql = RelayModernTypes.graphql; +import { RelayRuntimeTypes } from 'relay-runtime'; +import * as ReactRelayModernTypes from './lib/react-relay-modern'; +// ~~~~~~~~~~~~~~~~~~~~~ +// React-Relay Modern +// ~~~~~~~~~~~~~~~~~~~~~ +export import QueryRenderer = ReactRelayModernTypes.ReactRelayQueryRenderer; +export import createFragmentContainer = ReactRelayModernTypes.createFragmentContainer; +export import createPaginationContainer = ReactRelayModernTypes.createPaginationContainer; +export import createRefetchContainer = ReactRelayModernTypes.createRefetchContainer; +export import graphql = ReactRelayModernTypes.graphql; export import commitLocalUpdate = RelayRuntimeTypes.commitLocalUpdate; export import commitMutation = RelayRuntimeTypes.commitRelayModernMutation; export import fetchQuery = RelayRuntimeTypes.fetchRelayModernQuery; export import requestSubscription = RelayRuntimeTypes.requestRelaySubscription; - -// exported for convenience — not exports in the original module -export import RelayProp = RelayModernTypes.RelayProp; -export import RelayPaginationProp = RelayModernTypes.RelayPaginationProp; -export import RelayRefetchProp = RelayModernTypes.RelayRefetchProp; - -declare module 'react-relay/compat' { - export import applyOptimisticMutation = RelayCompatTypes.applyUpdate; - export import commitMutation = RelayCompatTypes.commitUpdate; - export import createFragmentContainer = RelayCompatTypes.createContainer; - export import createPaginationContainer = RelayCompatTypes.createContainer; - export import createRefetchContainer = RelayCompatTypes.createContainer; - export import injectDefaultVariablesProvider = RelayCompatTypes.injectDefaultVariablesProvider; - export import QueryRenderer = RelayModernTypes.ReactRelayQueryRenderer; - export import graphql = RelayModernTypes.graphql; - export import fetchQuery = RelayRuntimeTypes.fetchRelayModernQuery; -} -// tslint:enable strict-export-declare-modifiers - -declare module "react-relay/classic" { - import * as React from "react"; - - type ClientMutationID = string; - - /** Fragments are a hash of functions */ - interface Fragments { - [query: string]: ((variables?: RelayVariables) => string); - } - - interface CreateContainerOpts { - initialVariables?: any; - fragments: Fragments; - prepareVariables?(prevVariables: RelayVariables): RelayVariables; - } - - interface RelayVariables { - [name: string]: any; - } - - /** add static getFragment method to the component constructor */ - interface RelayContainerClass extends React.ComponentClass { - getFragment: ((q: string, v?: RelayVariables) => string); - } - - interface RelayQueryRequestResolve { - response: any; - } - - type RelayMutationStatus = - 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. - 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. - 'COLLISION_COMMIT_FAILED' | // Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, - // including this one, have been failed. Transaction can be recommitted or rolled back. - 'COMMITTING' | // Transaction is waiting for the server to respond. - 'COMMIT_FAILED'; - - class RelayMutationTransaction { - applyOptimistic(): RelayMutationTransaction; - commit(): RelayMutationTransaction | null; - recommit(): void; - rollback(): void; - getError(): Error; - getStatus(): RelayMutationStatus; - getHash(): string; - getID(): ClientMutationID; - } - - interface RelayMutationRequest { - getQueryString(): string; - getVariables(): RelayVariables; - resolve(result: RelayQueryRequestResolve): any; - reject(errors: any): any; - } - - interface RelayQueryRequest { - resolve(result: RelayQueryRequestResolve): any; - reject(errors: any): any; - getQueryString(): string; - getVariables(): RelayVariables; - getID(): string; - getDebugName(): string; - } - - interface RelayNetworkLayer { - supports(...options: string[]): boolean; - } - - class DefaultNetworkLayer implements RelayNetworkLayer { - constructor(host: string, options?: any); - supports(...options: string[]): boolean; - } - - function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass; - function injectNetworkLayer(networkLayer: RelayNetworkLayer): any; - function isContainer(component: React.ComponentClass): boolean; - function QL(...args: any[]): string; - - class Route { - constructor(params?: RelayVariables) - } - - /** - * Relay Mutation class, where T are the props it takes and S is the returned payload from Relay.Store.update. - * S is typically dynamic as it depends on the data the app is currently using, but it's possible to always - * return some data in the payload using REQUIRED_CHILDREN which is where specifying S is the most useful. - */ - class Mutation { - props: T; - - constructor(props: T); - static getFragment(q: string): string; - } - - interface Transaction { - getError(): Error; - Status(): number; - } - - interface StoreUpdateCallbacks { - onFailure?(transaction: Transaction): any; - onSuccess?(response: T): any; - } - - interface Store { - commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; - } - - const Store: Store; - - class RootContainer extends React.Component { } - - interface RootContainerProps extends React.Props { - Component: RelayContainerClass; - route: Route; - renderLoading?(): JSX.Element; - renderFetched?(data: any): JSX.Element; - renderFailure?(error: Error, retry: (...args: any[]) => any): JSX.Element; - } - - class Renderer extends React.Component { } - - interface RendererProps { - Container: RelayContainerClass; // Relay container that defines fragments and the view to render. - forceFetch?: boolean; // Whether to send a server request regardless of data available on the client. - queryConfig: Route; // `QueryConfig` or `Relay.Route` that defines the query roots. - environment: Store; // An instance of `Relay.Environment` or any object that implements the `RelayEnvironment` interface. - render?: RenderCallback; // Called to render when data requirements are being fulfilled. - onReadyStateChange?: OnReadyStateChange; - } - - interface RenderStateConfig { - props?: { [propName: string]: any }; - done: boolean; - error?: Error; - retry?(): void; - stale: boolean; - } - type RenderCallback = (renderState: RenderStateConfig) => any; - - type ReadyStateEvent = - 'ABORT' | - 'CACHE_RESTORED_REQUIRED' | - 'CACHE_RESTORE_FAILED' | - 'CACHE_RESTORE_START' | - 'NETWORK_QUERY_ERROR' | - 'NETWORK_QUERY_RECEIVED_ALL' | - 'NETWORK_QUERY_RECEIVED_REQUIRED' | - 'NETWORK_QUERY_START' | - 'STORE_FOUND_ALL' | - 'STORE_FOUND_REQUIRED'; - - type OnReadyStateChange = (readyState: { - ready: boolean, - done: boolean, - stale: boolean, - error?: Error, - events: ReadyStateEvent[], - aborted: boolean - }) => void; - - interface RelayProp { - readonly route: { name: string; }; // incomplete, also has params and queries - readonly variables: any; - readonly pendingVariables?: any; - setVariables(variables: any, onReadyStateChange?: OnReadyStateChange): void; - forceFetch(variables: any, onReadyStateChange?: OnReadyStateChange): void; - hasOptimisticUpdate(record: any): boolean; - getPendingTransactions(record: any): RelayMutationTransaction[]; - commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; - } -} +// exported for convenience +export import ModernTypes = ReactRelayModernTypes; diff --git a/types/react-relay/v1/lib/react-relay-classic.d.ts b/types/react-relay/v1/lib/react-relay-classic.d.ts index e69de29bb2..02517b7e80 100644 --- a/types/react-relay/v1/lib/react-relay-classic.d.ts +++ b/types/react-relay/v1/lib/react-relay-classic.d.ts @@ -0,0 +1,218 @@ +import * as React from 'react'; +import { RelayCommonTypes } from 'relay-runtime'; + +// ~~~~~~~~~~~~~~~~~~~~~ +// Maybe Fix +// ~~~~~~~~~~~~~~~~~~~~~ +export type StoreReaderData = any; +export type StoreReaderOptions = any; +export type RelayStoreData = any; +export interface RelayQuery { Fragment: any; Node: any; Root: any; } + +// ~~~~~~~~~~~~~~~~~~~~~ +// Environment +// ~~~~~~~~~~~~~~~~~~~~~ +export interface FragmentResolver { + dispose(): void; + resolve( + fragment: RelayQuery["Fragment"], + dataIDs: RelayCommonTypes.DataID | RelayCommonTypes.DataID[], + ): StoreReaderData | StoreReaderData[] | undefined | null; +} + +export interface RelayEnvironmentInterface { + forceFetch( + querySet: RelayCommonTypes.RelayQuerySet, + onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback, + ): RelayCommonTypes.Abortable; + getFragmentResolver( + fragment: RelayQuery["Fragment"], + onNext: () => void, + ): FragmentResolver; + getStoreData(): RelayStoreData; + primeCache( + querySet: RelayCommonTypes.RelayQuerySet, + onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback, + ): RelayCommonTypes.Abortable; + read( + node: RelayQuery["Node"], + dataID: RelayCommonTypes.DataID, + options?: StoreReaderOptions, + ): StoreReaderData | void; + readQuery( + root: RelayQuery["Root"], + options?: StoreReaderOptions, + ): StoreReaderData[] | void; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// the rest is to match pre-existing types from before v1 +// ~~~~~~~~~~~~~~~~~~~~~ +export type ClientMutationID = string; + +/** Fragments are a hash of functions */ +export interface Fragments { + [query: string]: ((variables?: RelayVariables) => string); +} + +export interface CreateContainerOpts { + initialVariables?: any; + fragments: Fragments; + prepareVariables?(prevVariables: RelayVariables): RelayVariables; +} + +export interface RelayVariables { + [name: string]: any; +} + +/** add static getFragment method to the component constructor */ +export interface RelayContainerClass extends React.ComponentClass { + getFragment: ((q: string, v?: RelayVariables) => string); +} + +export interface RelayQueryRequestResolve { + response: any; +} + +export type RelayMutationStatus = + 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. + 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. + 'COLLISION_COMMIT_FAILED' | // Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, + // including this one, have been failed. Transaction can be recommitted or rolled back. + 'COMMITTING' | // Transaction is waiting for the server to respond. + 'COMMIT_FAILED'; + +export class RelayMutationTransaction { + applyOptimistic(): RelayMutationTransaction; + commit(): RelayMutationTransaction | null; + recommit(): void; + rollback(): void; + getError(): Error; + getStatus(): RelayMutationStatus; + getHash(): string; + getID(): ClientMutationID; +} + +export interface RelayMutationRequest { + getQueryString(): string; + getVariables(): RelayVariables; + resolve(result: RelayQueryRequestResolve): any; + reject(errors: any): any; +} + +export interface RelayQueryRequest { + resolve(result: RelayQueryRequestResolve): any; + reject(errors: any): any; + getQueryString(): string; + getVariables(): RelayVariables; + getID(): string; + getDebugName(): string; +} + +export interface RelayNetworkLayer { + supports(...options: string[]): boolean; +} + +export class DefaultNetworkLayer implements RelayNetworkLayer { + constructor(host: string, options?: any); + supports(...options: string[]): boolean; +} + +export function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass; +export function injectNetworkLayer(networkLayer: RelayNetworkLayer): any; +export function isContainer(component: React.ComponentClass): boolean; +export function QL(...args: any[]): string; + +export class Route { + constructor(params?: RelayVariables) +} + +/** + * Relay Mutation class, where T are the props it takes and S is the returned payload from Relay.Store.update. + * S is typically dynamic as it depends on the data the app is currently using, but it's possible to always + * return some data in the payload using REQUIRED_CHILDREN which is where specifying S is the most useful. + */ +export class Mutation { + props: T; + + constructor(props: T); + static getFragment(q: string): string; +} + +export interface Transaction { + getError(): Error; + Status(): number; +} + +export interface StoreUpdateCallbacks { + onFailure?(transaction: Transaction): any; + onSuccess?(response: T): any; +} + +export interface Store { + commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; +} + +export const Store: Store; + +export class RootContainer extends React.Component { } + +export interface RootContainerProps extends React.Props { + Component: RelayContainerClass; + route: Route; + renderLoading?(): JSX.Element; + renderFetched?(data: any): JSX.Element; + renderFailure?(error: Error, retry: (...args: any[]) => any): JSX.Element; +} + +export class Renderer extends React.Component { } + +export interface RendererProps { + Container: RelayContainerClass; // Relay container that defines fragments and the view to render. + forceFetch?: boolean; // Whether to send a server request regardless of data available on the client. + queryConfig: Route; // `QueryConfig` or `Relay.Route` that defines the query roots. + environment: Store; // An instance of `Relay.Environment` or any object that implements the `RelayEnvironment` interface. + render?: RenderCallback; // Called to render when data requirements are being fulfilled. + onReadyStateChange?: OnReadyStateChange; +} + +export interface RenderStateConfig { + props?: { [propName: string]: any }; + done: boolean; + error?: Error; + retry?(): void; + stale: boolean; +} +export type RenderCallback = (renderState: RenderStateConfig) => any; + +export type ReadyStateEvent = + 'ABORT' | + 'CACHE_RESTORED_REQUIRED' | + 'CACHE_RESTORE_FAILED' | + 'CACHE_RESTORE_START' | + 'NETWORK_QUERY_ERROR' | + 'NETWORK_QUERY_RECEIVED_ALL' | + 'NETWORK_QUERY_RECEIVED_REQUIRED' | + 'NETWORK_QUERY_START' | + 'STORE_FOUND_ALL' | + 'STORE_FOUND_REQUIRED'; + +export type OnReadyStateChange = (readyState: { + ready: boolean, + done: boolean, + stale: boolean, + error?: Error, + events: ReadyStateEvent[], + aborted: boolean +}) => void; + +export interface RelayProp { + readonly route: { name: string; }; // incomplete, also has params and queries + readonly variables: any; + readonly pendingVariables?: any; + setVariables(variables: any, onReadyStateChange?: OnReadyStateChange): void; + forceFetch(variables: any, onReadyStateChange?: OnReadyStateChange): void; + hasOptimisticUpdate(record: any): boolean; + getPendingTransactions(record: any): RelayMutationTransaction[]; + commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any; +} diff --git a/types/react-relay/v1/lib/react-relay-compat.d.ts b/types/react-relay/v1/lib/react-relay-compat.d.ts index e69de29bb2..0d6197d2eb 100644 --- a/types/react-relay/v1/lib/react-relay-compat.d.ts +++ b/types/react-relay/v1/lib/react-relay-compat.d.ts @@ -0,0 +1,57 @@ +import { RelayRuntimeTypes, RelayCommonTypes } from 'relay-runtime'; +import { RelayEnvironmentInterface } from './react-relay-classic'; +import {} from './react-relay-modern'; + +// ~~~~~~~~~~~~~~~~~~~~~ +// Maybe Fix +// ~~~~~~~~~~~~~~~~~~~~~ +type ConcreteFragment = any; +type ConcreteBatch = any; +type ConcreteFragmentDefinition = object; +type ConcreteOperationDefinition = object; + +// ~~~~~~~~~~~~~~~~~~~~~ +// Util +// ~~~~~~~~~~~~~~~~~~~~~ +export function getFragment(q: string, v?: RelayCommonTypes.Variables): string; +export interface ComponentWithFragment extends React.ComponentClass { + getFragment: typeof getFragment; +} +export interface StatelessWithFragment extends React.StatelessComponent { + getFragment: typeof getFragment; +} +export type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; +export type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; +export type RelayClassicEnvironment = RelayEnvironmentInterface; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayCompatTypes +// ~~~~~~~~~~~~~~~~~~~~~ +export type CompatEnvironment = RelayRuntimeTypes.Environment | RelayClassicEnvironment; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayCompatMutations +// ~~~~~~~~~~~~~~~~~~~~~ +export function commitUpdate( + environment: CompatEnvironment, + config: RelayRuntimeTypes.MutationConfig, +): RelayCommonTypes.Disposable; +export function applyUpdate( + environment: CompatEnvironment, + config: RelayRuntimeTypes.OptimisticMutationConfig, +): RelayCommonTypes.Disposable; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayCompatContainer +// ~~~~~~~~~~~~~~~~~~~~~ +export interface GeneratedNodeMap { [key: string]: RelayCommonTypes.GraphQLTaggedNode; } +export function createContainer( + Component: ReactBaseComponent, + fragmentSpec: RelayCommonTypes.GraphQLTaggedNode | GeneratedNodeMap, +): ReactFragmentComponent; + +// ~~~~~~~~~~~~~~~~~~~~~ +// injectDefaultVariablesProvider +// ~~~~~~~~~~~~~~~~~~~~~ +export type VariablesProvider = () => RelayCommonTypes.Variables; +export function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; diff --git a/types/react-relay/v1/lib/react-relay-modern.d.ts b/types/react-relay/v1/lib/react-relay-modern.d.ts index e69de29bb2..f6d1eb0381 100644 --- a/types/react-relay/v1/lib/react-relay-modern.d.ts +++ b/types/react-relay/v1/lib/react-relay-modern.d.ts @@ -0,0 +1,147 @@ +import * as React from 'react'; +import { RelayCommonTypes, RelayRuntimeTypes } from 'relay-runtime'; + +// ~~~~~~~~~~~~~~~~~~~~~ +// Maybe Fix +// ~~~~~~~~~~~~~~~~~~~~~ +type ConcreteFragment = any; +type ConcreteBatch = any; +type ConcreteFragmentDefinition = object; +type ConcreteOperationDefinition = object; +type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayProp +// ~~~~~~~~~~~~~~~~~~~~~ +// note: refetch and pagination containers augment this +export interface RelayProp { + environment: RelayRuntimeTypes.Environment; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayQL +// ~~~~~~~~~~~~~~~~~~~~~ +export function RelayQL( + strings: string[], + ...substitutions: any[] +): RelayCommonTypes.RelayConcreteNode; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayModernGraphQLTag +// ~~~~~~~~~~~~~~~~~~~~~ +export interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode; } +export type GraphQLTaggedNode = + (() => ConcreteFragment | ConcreteBatch) + | { + modern(): ConcreteFragment | ConcreteBatch, + classic(relayQL: typeof RelayQL): + | ConcreteFragmentDefinition + | ConcreteOperationDefinition, + }; +/** + * Runtime function to correspond to the `graphql` tagged template function. + * All calls to this function should be transformed by the plugin. + */ +export interface GraphqlInterface { + (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; + experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; +} +export const graphql: GraphqlInterface; + +// ~~~~~~~~~~~~~~~~~~~~~ +// ReactRelayQueryRenderer +// ~~~~~~~~~~~~~~~~~~~~~ +export interface QueryRendererProps { + cacheConfig?: RelayCommonTypes.CacheConfig; + environment: RelayRuntimeTypes.Environment; + query: GraphQLTaggedNode; + render(readyState: ReadyState): React.ReactElement | undefined | null; + variables: RelayCommonTypes.Variables; + rerunParamExperimental?: RelayCommonTypes.RerunParam; +} +export interface ReadyState { + error: Error | undefined | null; + props: { [propName: string]: any } | undefined | null; + retry?(): void; +} +export interface QueryRendererState { + readyState: ReadyState; +} +export class ReactRelayQueryRenderer extends React.Component { } + +// ~~~~~~~~~~~~~~~~~~~~~ +// createFragmentContainer +// ~~~~~~~~~~~~~~~~~~~~~ +export function createFragmentContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, +): ReactBaseComponent; + +// ~~~~~~~~~~~~~~~~~~~~~ +// createPaginationContainer +// ~~~~~~~~~~~~~~~~~~~~~ +export interface PageInfo { + endCursor: string | undefined | null; + hasNextPage: boolean; + hasPreviousPage: boolean; + startCursor: string | undefined | null; +} +export interface ConnectionData { + edges?: any[]; + pageInfo?: PageInfo; +} +export type RelayPaginationProp = RelayProp & { + hasMore(): boolean, + isLoading(): boolean, + loadMore( + pageSize: number, + callback: (error?: Error) => void, + options?: RefetchOptions, + ): RelayCommonTypes.Disposable | undefined | null, + refetchConnection( + totalCount: number, + callback: (error?: Error) => void, + refetchVariables?: RelayCommonTypes.Variables, + ): RelayCommonTypes.Disposable | undefined | null, +}; +export function FragmentVariablesGetter( + prevVars: RelayCommonTypes.Variables, + totalCount: number, +): RelayCommonTypes.Variables; +export interface ConnectionConfig { + direction?: 'backward' | 'forward'; + getConnectionFromProps?(props: object): ConnectionData | undefined | null; + getFragmentVariables?: typeof FragmentVariablesGetter; + getVariables( + props: { [propName: string]: any }, + paginationInfo: { count: number, cursor?: string }, + fragmentVariables: RelayCommonTypes.Variables, + ): RelayCommonTypes.Variables; + query: GraphQLTaggedNode; +} +export function createPaginationContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + connectionConfig: ConnectionConfig, +): ReactBaseComponent; + +// ~~~~~~~~~~~~~~~~~~~~~ +// createFragmentContainer +// ~~~~~~~~~~~~~~~~~~~~~ +export interface RefetchOptions { + force?: boolean; + rerunParamExperimental?: RelayCommonTypes.RerunParam; +} +export type RelayRefetchProp = RelayProp & { + refetch( + refetchVariables: RelayCommonTypes.Variables | ((fragmentVariables: RelayCommonTypes.Variables) => RelayCommonTypes.Variables), + renderVariables?: RelayCommonTypes.Variables, + callback?: (error?: Error) => void, + options?: RefetchOptions, + ): RelayCommonTypes.Disposable, +}; +export function createRefetchContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + taggedNode: GraphQLTaggedNode, +): ReactBaseComponent; diff --git a/types/react-relay/v1/react-relay-tests.tsx b/types/react-relay/v1/react-relay-tests.tsx index 2b8e371ee2..50506ac111 100644 --- a/types/react-relay/v1/react-relay-tests.tsx +++ b/types/react-relay/v1/react-relay-tests.tsx @@ -18,8 +18,7 @@ import { createRefetchContainer, requestSubscription, QueryRenderer, - RelayPaginationProp, - RelayRefetchProp + ModernTypes, } from "react-relay"; // ~~~~~~~~~~~~~~~~~~~~~ @@ -84,7 +83,7 @@ const MyFragmentContainer = createFragmentContainer( // ~~~~~~~~~~~~~~~~~~~~~ interface StoryInterface { id: string; } interface FeedStoriesProps { - relay: RelayRefetchProp; + relay: ModernTypes.RelayRefetchProp; feed: { stories: { edges: Array<{ node: StoryInterface }> } }; @@ -147,7 +146,7 @@ const FeedRefetchContainer = createRefetchContainer( // ~~~~~~~~~~~~~~~~~~~~~ interface FeedProps { user: { feed: { edges: Array<{ node: StoryInterface}>}}; - relay: RelayPaginationProp; + relay: ModernTypes.RelayPaginationProp; } class Feed extends React.Component { render() { @@ -344,10 +343,19 @@ requestSubscription( } ); +//////////////////////////// +// RELAY COMPAT TESTS +/////////////////////////// +import { + QueryRenderer as CompatQueryRenderer, + createFragmentContainer as createFragmentContainerCompat +} from "react-relay/compat"; + +// TODO? This is all more or less identical to modern... + //////////////////////////// // RELAY-CLASSIC TESTS /////////////////////////// - import * as Relay from "react-relay/classic"; interface Props { diff --git a/types/react-relay/v1/tsconfig.json b/types/react-relay/v1/tsconfig.json index e6b06bf446..37049aa13e 100644 --- a/types/react-relay/v1/tsconfig.json +++ b/types/react-relay/v1/tsconfig.json @@ -18,7 +18,9 @@ "jsx": "react", "paths": { "react-relay": ["react-relay/v1"], - "react-relay/*": ["react-relay/v2/*"] + "react-relay/*": ["react-relay/v1/*"], + "react-relay/classic": ["react-relay/v1/classic.d"], + "react-relay/compat": ["react-relay/v1/compat.d"] } }, "files": [ From 694fb9b2286ba5d37d3c8a4d85e05dd9a6c855b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 11 Oct 2017 15:08:00 +0200 Subject: [PATCH 028/314] [Relay] Change imports to work as per normal usage. --- .../react-relay-classic.d.ts => classic.d.ts} | 0 .../react-relay-compat.d.ts => compat.d.ts} | 4 +- types/react-relay/index.d.ts | 175 +------ .../react-relay-modern.d.ts => modern.d.ts} | 0 .../react-relay/react-relay-classic-tests.tsx | 92 ++++ types/react-relay/react-relay-tests.tsx | 401 +++++++++++++++- types/react-relay/tsconfig.json | 10 +- types/react-relay/{v1 => }/tslint.json | 0 types/react-relay/v1/index.d.ts | 23 - types/react-relay/v1/react-relay-tests.tsx | 445 ------------------ types/react-relay/v1/tsconfig.json | 33 -- 11 files changed, 497 insertions(+), 686 deletions(-) rename types/react-relay/{v1/lib/react-relay-classic.d.ts => classic.d.ts} (100%) rename types/react-relay/{v1/lib/react-relay-compat.d.ts => compat.d.ts} (95%) rename types/react-relay/{v1/lib/react-relay-modern.d.ts => modern.d.ts} (100%) create mode 100644 types/react-relay/react-relay-classic-tests.tsx rename types/react-relay/{v1 => }/tslint.json (100%) delete mode 100644 types/react-relay/v1/index.d.ts delete mode 100644 types/react-relay/v1/react-relay-tests.tsx delete mode 100644 types/react-relay/v1/tsconfig.json diff --git a/types/react-relay/v1/lib/react-relay-classic.d.ts b/types/react-relay/classic.d.ts similarity index 100% rename from types/react-relay/v1/lib/react-relay-classic.d.ts rename to types/react-relay/classic.d.ts diff --git a/types/react-relay/v1/lib/react-relay-compat.d.ts b/types/react-relay/compat.d.ts similarity index 95% rename from types/react-relay/v1/lib/react-relay-compat.d.ts rename to types/react-relay/compat.d.ts index 0d6197d2eb..e16bbb01f9 100644 --- a/types/react-relay/v1/lib/react-relay-compat.d.ts +++ b/types/react-relay/compat.d.ts @@ -1,6 +1,6 @@ import { RelayRuntimeTypes, RelayCommonTypes } from 'relay-runtime'; -import { RelayEnvironmentInterface } from './react-relay-classic'; -import {} from './react-relay-modern'; +import { RelayEnvironmentInterface } from 'react-relay/classic'; +import {} from 'react-relay/modern'; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 4f9f49e5e7..72a661e6b7 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -1,160 +1,23 @@ -// Type definitions for react-relay 0.9.2 +// Type definitions for react-relay 1.3 // Project: https://github.com/facebook/relay -// Definitions by: Johannes Schickling +// Definitions by: Johannes Schickling , Matt Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 -declare module "react-relay" { - import * as React from "react"; +import { RelayRuntimeTypes } from 'relay-runtime'; +import * as ReactRelayModernTypes from 'react-relay/modern'; - type ClientMutationID = string; - - /** Fragments are a hash of functions */ - interface Fragments { - [query: string]: ((variables?: RelayVariables) => string) - } - - interface CreateContainerOpts { - initialVariables?: any - fragments: Fragments - prepareVariables?(prevVariables: RelayVariables): RelayVariables - } - - interface RelayVariables { - [name: string]: any - } - - /** add static getFragment method to the component constructor */ - interface RelayContainerClass extends React.ComponentClass { - getFragment: ((q: string, v?: RelayVariables) => string) - } - - interface RelayQueryRequestResolve { - response: any - } - - type RelayMutationStatus = - 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. - 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. - 'COLLISION_COMMIT_FAILED' | //Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, including this one, have been failed. Transaction can be recommitted or rolled back. - 'COMMITTING' | // Transaction is waiting for the server to respond. - 'COMMIT_FAILED'; - - class RelayMutationTransaction { - applyOptimistic(): RelayMutationTransaction; - commit(): RelayMutationTransaction | null; - recommit(): void; - rollback(): void; - getError(): Error; - getStatus(): RelayMutationStatus; - getHash(): string; - getID(): ClientMutationID; - } - - interface RelayMutationRequest { - getQueryString(): string - getVariables(): RelayVariables - resolve(result: RelayQueryRequestResolve): any - reject(errors: any): any - } - - interface RelayQueryRequest { - resolve(result: RelayQueryRequestResolve): any - reject(errors: any): any - - getQueryString(): string - getVariables(): RelayVariables - getID(): string - getDebugName(): string - } - - interface RelayNetworkLayer { - supports(...options: string[]): boolean - } - - class DefaultNetworkLayer implements RelayNetworkLayer { - constructor(host: string, options?: any) - supports(...options: string[]): boolean - } - - function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass - function injectNetworkLayer(networkLayer: RelayNetworkLayer): any - function isContainer(component: React.ComponentClass): boolean - function QL(...args: any[]): string - - class Route { - constructor(params?: RelayVariables) - } - - /** - * Relay Mutation class, where T are the props it takes and S is the returned payload from Relay.Store.update. - * S is typically dynamic as it depends on the data the app is currently using, but it's possible to always - * return some data in the payload using REQUIRED_CHILDREN which is where specifying S is the most useful. - */ - class Mutation { - props: T - - constructor(props: T) - static getFragment(q: string): string - } - - interface Transaction { - getError(): Error - Status(): number - } - - interface StoreUpdateCallbacks { - onFailure?(transaction: Transaction): any - onSuccess?(response: T): any - } - - interface Store { - commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any - } - - var Store: Store - - class RootContainer extends React.Component {} - - interface RootContainerProps extends React.Props{ - Component: RelayContainerClass - route: Route - renderLoading?(): JSX.Element - renderFetched?(data: any): JSX.Element - renderFailure?(error: Error, retry: Function): JSX.Element - } - - type ReadyStateEvent = - 'ABORT' | - 'CACHE_RESTORED_REQUIRED' | - 'CACHE_RESTORE_FAILED' | - 'CACHE_RESTORE_START' | - 'NETWORK_QUERY_ERROR' | - 'NETWORK_QUERY_RECEIVED_ALL' | - 'NETWORK_QUERY_RECEIVED_REQUIRED' | - 'NETWORK_QUERY_START' | - 'STORE_FOUND_ALL' | - 'STORE_FOUND_REQUIRED'; - - interface OnReadyStateChange { - (readyState: { - ready: boolean, - done: boolean, - stale: boolean, - error?: Error, - events: Array, - aborted: boolean - }): void - } - - interface RelayProp { - readonly route: { name: string; }; // incomplete, also has params and queries - readonly variables: any; - readonly pendingVariables?: any | null; - setVariables(variables: any, onReadyStateChange?: OnReadyStateChange): void; - forceFetch(variables: any, onReadyStateChange?: OnReadyStateChange): void; - hasOptimisticUpdate(record: any): boolean; - getPendingTransactions(record: any): RelayMutationTransaction[]; - commitUpdate: (mutation: Mutation, callbacks?: StoreUpdateCallbacks) => any; - } -} +// ~~~~~~~~~~~~~~~~~~~~~ +// React-Relay Modern +// ~~~~~~~~~~~~~~~~~~~~~ +export import QueryRenderer = ReactRelayModernTypes.ReactRelayQueryRenderer; +export import createFragmentContainer = ReactRelayModernTypes.createFragmentContainer; +export import createPaginationContainer = ReactRelayModernTypes.createPaginationContainer; +export import createRefetchContainer = ReactRelayModernTypes.createRefetchContainer; +export import graphql = ReactRelayModernTypes.graphql; +export import commitLocalUpdate = RelayRuntimeTypes.commitLocalUpdate; +export import commitMutation = RelayRuntimeTypes.commitRelayModernMutation; +export import fetchQuery = RelayRuntimeTypes.fetchRelayModernQuery; +export import requestSubscription = RelayRuntimeTypes.requestRelaySubscription; +// exported for convenience +export import ModernTypes = ReactRelayModernTypes; diff --git a/types/react-relay/v1/lib/react-relay-modern.d.ts b/types/react-relay/modern.d.ts similarity index 100% rename from types/react-relay/v1/lib/react-relay-modern.d.ts rename to types/react-relay/modern.d.ts diff --git a/types/react-relay/react-relay-classic-tests.tsx b/types/react-relay/react-relay-classic-tests.tsx new file mode 100644 index 0000000000..b7531598eb --- /dev/null +++ b/types/react-relay/react-relay-classic-tests.tsx @@ -0,0 +1,92 @@ +import * as React from "react" +import * as Relay from "react-relay/classic" + +interface Props { + text: string + userId: string +} + +interface Response { +} + +export default class AddTweetMutation extends Relay.Mutation { + + getMutation () { + return Relay.QL`mutation{addTweet}` + } + + getFatQuery () { + return Relay.QL` + fragment on AddTweetPayload { + tweetEdge + user + } + ` + } + + getConfigs () { + return [{ + type: "RANGE_ADD", + parentName: "user", + parentID: this.props.userId, + connectionName: "tweets", + edgeName: "tweetEdge", + rangeBehaviors: { + "": "append", + }, + }] + } + + getVariables () { + return this.props + } +} + +interface ArtworkProps { + artwork: { + title: string + }, + relay: Relay.RelayProp, +} + +class Artwork extends React.Component { + render() { + return ( + + {this.props.artwork.title} + + ) + } +} + +const ArtworkContainer = Relay.createContainer(Artwork, { + fragments: { + artwork: () => Relay.QL` + fragment on Artwork { + title + } + ` + } +}) + +class StubbedArtwork extends React.Component { + render() { + const props = { + artwork: { title: "CHAMPAGNE FORMICA FLAG" }, + relay: { + route: { + name: "champagne" + }, + variables: { + artworkID: "champagne-formica-flag", + }, + setVariables: () => {}, + forceFetch: () => {}, + hasOptimisticUpdate: () => false, + getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, + commitUpdate: () => {}, + } + } + return + } +} diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/react-relay-tests.tsx index 90425156cc..50506ac111 100644 --- a/types/react-relay/react-relay-tests.tsx +++ b/types/react-relay/react-relay-tests.tsx @@ -1,30 +1,383 @@ -import * as React from "react" -import * as Relay from "react-relay" +import * as React from "react"; +import { + Environment, + Network, + RecordSource, + Store, + ConnectionHandler, +} from 'relay-runtime'; -interface Props { - text: string - userId: string +//////////////////////////// +// RELAY MODERN TESTS +/////////////////////////// +import { + graphql, + commitMutation, + createFragmentContainer, + createPaginationContainer, + createRefetchContainer, + requestSubscription, + QueryRenderer, + ModernTypes, +} from "react-relay"; + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern Environment +// ~~~~~~~~~~~~~~~~~~~~~ +function fetchQuery(operation: any, variables: any, cacheConfig: {}) { + return fetch('/graphql'); } +const network = Network.create(fetchQuery); +const source = new RecordSource(); +const store = new Store(source); +const modernEnvironment = new Environment({ network, store }); -interface Response { +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern QueryRenderer +// ~~~~~~~~~~~~~~~~~~~~~ +const MyQueryRenderer = (props: { name: string}) => ( + { + if (error) { + return
{error.message}
; + } else if (props) { + return
{props.name} is great!
; + } + return
Loading
; + }} + /> +); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern FragmentContainer +// ~~~~~~~~~~~~~~~~~~~~~ +const MyFragmentContainer = createFragmentContainer( + class TodoListView extends React.Component { + render() { + return
; + } + }, + { + item: graphql` + fragment TodoItem_item on Todo { + text + isComplete + } + `, + } +); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern RefetchContainer +// ~~~~~~~~~~~~~~~~~~~~~ +interface StoryInterface { id: string; } +interface FeedStoriesProps { + relay: ModernTypes.RelayRefetchProp; + feed: { + stories: { edges: Array<{ node: StoryInterface }> } + }; } - -export default class AddTweetMutation extends Relay.Mutation { - - getMutation () { - return Relay.QL`mutation{addTweet}` +class Story extends React.Component<{ story: StoryInterface }> {} +class FeedStories extends React.Component { + render() { + return ( +
+ {this.props.feed.stories.edges.map( + edge => + )} +
+ ); } - getFatQuery () { + _loadMore() { + // Increments the number of stories being rendered by 10. + const refetchVariables = (fragmentVariables: {count: number }) => ({ + count: fragmentVariables.count + 10, + }); + this.props.relay.refetch(refetchVariables); + } + } + +const FeedRefetchContainer = createRefetchContainer( + FeedStories, + { + feed: graphql.experimental` + fragment FeedStories_feed on Feed + @argumentDefinitions( + count: {type: "Int", defaultValue: 10} + ) { + stories(first: $count) { + edges { + node { + id + ...Story_story + } + } + } + } + ` + }, + graphql.experimental` + query FeedStoriesRefetchQuery($count: Int) { + feed { + ...FeedStories_feed @arguments(count: $count) + } + } + `, + ); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern PaginationContainer +// ~~~~~~~~~~~~~~~~~~~~~ +interface FeedProps { + user: { feed: { edges: Array<{ node: StoryInterface}>}}; + relay: ModernTypes.RelayPaginationProp; +} +class Feed extends React.Component { + render() { + return (
+ {this.props.user.feed.edges.map( + edge => + )} +
); + } + + _loadMore() { + if (!this.props.relay.hasMore() || this.props.relay.isLoading()) { + return; + } + + this.props.relay.loadMore( + 10, // Fetch the next 10 feed items + e => { + console.log(e); + }, + ); + } +} + +const FeedPaginationContainer = createPaginationContainer( + Feed, + { + user: graphql` + fragment Feed_user on User { + feed( + first: $count + after: $cursor + orderby: $orderBy # other variables + ) @connection(key: "Feed_feed") { + edges { + node { + id + ...Story_story + } + } + } + } + `, + }, + { + direction: 'forward', + getConnectionFromProps(props: { user: {feed: any}}) { + return props.user && props.user.feed; + }, + getFragmentVariables(prevVars, totalCount) { + return { + ...prevVars, + count: totalCount, + }; + }, + getVariables(props, {count, cursor}, fragmentVariables) { + return { + count, + cursor, + // in most cases, for variables other than connection filters like + // `first`, `after`, etc. you may want to use the previous values. + orderBy: fragmentVariables.orderBy, + }; + }, + query: graphql` + query FeedPaginationQuery( + $count: Int! + $cursor: String + $orderby: String! + ) { + user { + # You could reference the fragment defined previously. + ...Feed_user + } + } + ` + } +); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern Mutations +// ~~~~~~~~~~~~~~~~~~~~~ +const mutation = graphql` +mutation MarkReadNotificationMutation( + $input: MarkReadNotificationData! +) { + markReadNotification(data: $input) { + notification { + seenState + } + } +} +`; + +const optimisticResponse = { + markReadNotification: { + notification: { + seenState: 'SEEN', + }, + }, +}; + +const configs = [{ + type: 'NODE_DELETE' as 'NODE_DELETE', + deletedIDFieldName: 'destroyedShipId', +}, { + type: 'RANGE_ADD' as 'RANGE_ADD', + parentID: 'shipId', + connectionInfo: [{ + key: 'AddShip_ships', + rangeBehavior: 'append', + }], + edgeName: 'newShipEdge', +}, { + type: 'RANGE_DELETE' as 'RANGE_DELETE', + parentID: 'todoId', + connectionKeys: [{ + key: 'RemoveTags_tags', + rangeBehavior: 'append', + }], + pathToConnection: ['todo', 'tags'], + deletedIDFieldName: 'removedTagId' +}]; + +function markNotificationAsRead(source: string, storyID: string) { + const variables = { + input: { + source, + storyID, + }, + }; + + commitMutation( + modernEnvironment, + { + configs, + mutation, + optimisticResponse, + variables, + onCompleted: (response, errors) => { + console.log('Response received from server.'); + }, + onError: err => console.error(err), + }, + ); +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern Subscriptions +// ~~~~~~~~~~~~~~~~~~~~~ +const subscription = graphql` + subscription MarkReadNotificationSubscription( + $storyID: ID! + ) { + markReadNotification(storyID: $storyID) { + notification { + seenState + } + } + } +`; +const variables = { + storyID: '123', +}; +requestSubscription( + modernEnvironment, // see Environment docs + { + subscription, + variables, + // optional but recommended: + onCompleted: () => {}, + onError: error => console.error(error), + // example of a custom updater + updater: store => { + // Get the notification + const rootField = store.getRootField('markReadNotification'); + const notification = !!rootField && rootField.getLinkedRecord('notification'); + // Add it to a connection + const viewer = store.getRoot().getLinkedRecord('viewer'); + const notifications = + ConnectionHandler.getConnection(viewer, 'notifications'); + const edge = ConnectionHandler.createEdge( + store, + notifications, + notification, + '', + ); + ConnectionHandler.insertEdgeAfter(notifications, edge); + }, + } +); + +//////////////////////////// +// RELAY COMPAT TESTS +/////////////////////////// +import { + QueryRenderer as CompatQueryRenderer, + createFragmentContainer as createFragmentContainerCompat +} from "react-relay/compat"; + +// TODO? This is all more or less identical to modern... + +//////////////////////////// +// RELAY-CLASSIC TESTS +/////////////////////////// +import * as Relay from "react-relay/classic"; + +interface Props { + text: string; + userId: string; +} + +export default class AddTweetMutation extends Relay.Mutation { + getMutation() { + return Relay.QL`mutation{addTweet}`; + } + + getFatQuery() { return Relay.QL` fragment on AddTweetPayload { tweetEdge user } - ` + `; } - getConfigs () { + getConfigs() { return [{ type: "RANGE_ADD", parentName: "user", @@ -34,19 +387,19 @@ export default class AddTweetMutation extends Relay.Mutation { rangeBehaviors: { "": "append", }, - }] + }]; } - getVariables () { - return this.props + getVariables() { + return this.props; } } interface ArtworkProps { artwork: { title: string - }, - relay: Relay.RelayProp, + }; + relay: Relay.RelayProp; } class Artwork extends React.Component { @@ -55,7 +408,7 @@ class Artwork extends React.Component { {this.props.artwork.title} - ) + ); } } @@ -67,7 +420,7 @@ const ArtworkContainer = Relay.createContainer(Artwork, { } ` } -}) +}); class StubbedArtwork extends React.Component { render() { @@ -83,10 +436,10 @@ class StubbedArtwork extends React.Component { setVariables: () => {}, forceFetch: () => {}, hasOptimisticUpdate: () => false, - getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, + getPendingTransactions: (): any => undefined, commitUpdate: () => {}, } - } - return + }; + return ; } } diff --git a/types/react-relay/tsconfig.json b/types/react-relay/tsconfig.json index 90680fbafc..5447ff74ca 100644 --- a/types/react-relay/tsconfig.json +++ b/types/react-relay/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,6 +19,10 @@ }, "files": [ "index.d.ts", - "react-relay-tests.tsx" + "react-relay-tests.tsx", + "react-relay-classic-tests.tsx", + "classic.d.ts", + "modern.d.ts", + "compat.d.ts" ] -} \ No newline at end of file +} diff --git a/types/react-relay/v1/tslint.json b/types/react-relay/tslint.json similarity index 100% rename from types/react-relay/v1/tslint.json rename to types/react-relay/tslint.json diff --git a/types/react-relay/v1/index.d.ts b/types/react-relay/v1/index.d.ts deleted file mode 100644 index e214a9a441..0000000000 --- a/types/react-relay/v1/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Type definitions for react-relay 1.3 -// Project: https://github.com/facebook/relay -// Definitions by: Johannes Schickling , Matt Martin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -import { RelayRuntimeTypes } from 'relay-runtime'; -import * as ReactRelayModernTypes from './lib/react-relay-modern'; - -// ~~~~~~~~~~~~~~~~~~~~~ -// React-Relay Modern -// ~~~~~~~~~~~~~~~~~~~~~ -export import QueryRenderer = ReactRelayModernTypes.ReactRelayQueryRenderer; -export import createFragmentContainer = ReactRelayModernTypes.createFragmentContainer; -export import createPaginationContainer = ReactRelayModernTypes.createPaginationContainer; -export import createRefetchContainer = ReactRelayModernTypes.createRefetchContainer; -export import graphql = ReactRelayModernTypes.graphql; -export import commitLocalUpdate = RelayRuntimeTypes.commitLocalUpdate; -export import commitMutation = RelayRuntimeTypes.commitRelayModernMutation; -export import fetchQuery = RelayRuntimeTypes.fetchRelayModernQuery; -export import requestSubscription = RelayRuntimeTypes.requestRelaySubscription; -// exported for convenience -export import ModernTypes = ReactRelayModernTypes; diff --git a/types/react-relay/v1/react-relay-tests.tsx b/types/react-relay/v1/react-relay-tests.tsx deleted file mode 100644 index 50506ac111..0000000000 --- a/types/react-relay/v1/react-relay-tests.tsx +++ /dev/null @@ -1,445 +0,0 @@ -import * as React from "react"; -import { - Environment, - Network, - RecordSource, - Store, - ConnectionHandler, -} from 'relay-runtime'; - -//////////////////////////// -// RELAY MODERN TESTS -/////////////////////////// -import { - graphql, - commitMutation, - createFragmentContainer, - createPaginationContainer, - createRefetchContainer, - requestSubscription, - QueryRenderer, - ModernTypes, -} from "react-relay"; - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern Environment -// ~~~~~~~~~~~~~~~~~~~~~ -function fetchQuery(operation: any, variables: any, cacheConfig: {}) { - return fetch('/graphql'); -} -const network = Network.create(fetchQuery); -const source = new RecordSource(); -const store = new Store(source); -const modernEnvironment = new Environment({ network, store }); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern QueryRenderer -// ~~~~~~~~~~~~~~~~~~~~~ -const MyQueryRenderer = (props: { name: string}) => ( - { - if (error) { - return
{error.message}
; - } else if (props) { - return
{props.name} is great!
; - } - return
Loading
; - }} - /> -); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern FragmentContainer -// ~~~~~~~~~~~~~~~~~~~~~ -const MyFragmentContainer = createFragmentContainer( - class TodoListView extends React.Component { - render() { - return
; - } - }, - { - item: graphql` - fragment TodoItem_item on Todo { - text - isComplete - } - `, - } -); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern RefetchContainer -// ~~~~~~~~~~~~~~~~~~~~~ -interface StoryInterface { id: string; } -interface FeedStoriesProps { - relay: ModernTypes.RelayRefetchProp; - feed: { - stories: { edges: Array<{ node: StoryInterface }> } - }; -} -class Story extends React.Component<{ story: StoryInterface }> {} -class FeedStories extends React.Component { - render() { - return ( -
- {this.props.feed.stories.edges.map( - edge => - )} -
- ); - } - - _loadMore() { - // Increments the number of stories being rendered by 10. - const refetchVariables = (fragmentVariables: {count: number }) => ({ - count: fragmentVariables.count + 10, - }); - this.props.relay.refetch(refetchVariables); - } - } - -const FeedRefetchContainer = createRefetchContainer( - FeedStories, - { - feed: graphql.experimental` - fragment FeedStories_feed on Feed - @argumentDefinitions( - count: {type: "Int", defaultValue: 10} - ) { - stories(first: $count) { - edges { - node { - id - ...Story_story - } - } - } - } - ` - }, - graphql.experimental` - query FeedStoriesRefetchQuery($count: Int) { - feed { - ...FeedStories_feed @arguments(count: $count) - } - } - `, - ); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern PaginationContainer -// ~~~~~~~~~~~~~~~~~~~~~ -interface FeedProps { - user: { feed: { edges: Array<{ node: StoryInterface}>}}; - relay: ModernTypes.RelayPaginationProp; -} -class Feed extends React.Component { - render() { - return (
- {this.props.user.feed.edges.map( - edge => - )} -
); - } - - _loadMore() { - if (!this.props.relay.hasMore() || this.props.relay.isLoading()) { - return; - } - - this.props.relay.loadMore( - 10, // Fetch the next 10 feed items - e => { - console.log(e); - }, - ); - } -} - -const FeedPaginationContainer = createPaginationContainer( - Feed, - { - user: graphql` - fragment Feed_user on User { - feed( - first: $count - after: $cursor - orderby: $orderBy # other variables - ) @connection(key: "Feed_feed") { - edges { - node { - id - ...Story_story - } - } - } - } - `, - }, - { - direction: 'forward', - getConnectionFromProps(props: { user: {feed: any}}) { - return props.user && props.user.feed; - }, - getFragmentVariables(prevVars, totalCount) { - return { - ...prevVars, - count: totalCount, - }; - }, - getVariables(props, {count, cursor}, fragmentVariables) { - return { - count, - cursor, - // in most cases, for variables other than connection filters like - // `first`, `after`, etc. you may want to use the previous values. - orderBy: fragmentVariables.orderBy, - }; - }, - query: graphql` - query FeedPaginationQuery( - $count: Int! - $cursor: String - $orderby: String! - ) { - user { - # You could reference the fragment defined previously. - ...Feed_user - } - } - ` - } -); - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern Mutations -// ~~~~~~~~~~~~~~~~~~~~~ -const mutation = graphql` -mutation MarkReadNotificationMutation( - $input: MarkReadNotificationData! -) { - markReadNotification(data: $input) { - notification { - seenState - } - } -} -`; - -const optimisticResponse = { - markReadNotification: { - notification: { - seenState: 'SEEN', - }, - }, -}; - -const configs = [{ - type: 'NODE_DELETE' as 'NODE_DELETE', - deletedIDFieldName: 'destroyedShipId', -}, { - type: 'RANGE_ADD' as 'RANGE_ADD', - parentID: 'shipId', - connectionInfo: [{ - key: 'AddShip_ships', - rangeBehavior: 'append', - }], - edgeName: 'newShipEdge', -}, { - type: 'RANGE_DELETE' as 'RANGE_DELETE', - parentID: 'todoId', - connectionKeys: [{ - key: 'RemoveTags_tags', - rangeBehavior: 'append', - }], - pathToConnection: ['todo', 'tags'], - deletedIDFieldName: 'removedTagId' -}]; - -function markNotificationAsRead(source: string, storyID: string) { - const variables = { - input: { - source, - storyID, - }, - }; - - commitMutation( - modernEnvironment, - { - configs, - mutation, - optimisticResponse, - variables, - onCompleted: (response, errors) => { - console.log('Response received from server.'); - }, - onError: err => console.error(err), - }, - ); -} - -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern Subscriptions -// ~~~~~~~~~~~~~~~~~~~~~ -const subscription = graphql` - subscription MarkReadNotificationSubscription( - $storyID: ID! - ) { - markReadNotification(storyID: $storyID) { - notification { - seenState - } - } - } -`; -const variables = { - storyID: '123', -}; -requestSubscription( - modernEnvironment, // see Environment docs - { - subscription, - variables, - // optional but recommended: - onCompleted: () => {}, - onError: error => console.error(error), - // example of a custom updater - updater: store => { - // Get the notification - const rootField = store.getRootField('markReadNotification'); - const notification = !!rootField && rootField.getLinkedRecord('notification'); - // Add it to a connection - const viewer = store.getRoot().getLinkedRecord('viewer'); - const notifications = - ConnectionHandler.getConnection(viewer, 'notifications'); - const edge = ConnectionHandler.createEdge( - store, - notifications, - notification, - '', - ); - ConnectionHandler.insertEdgeAfter(notifications, edge); - }, - } -); - -//////////////////////////// -// RELAY COMPAT TESTS -/////////////////////////// -import { - QueryRenderer as CompatQueryRenderer, - createFragmentContainer as createFragmentContainerCompat -} from "react-relay/compat"; - -// TODO? This is all more or less identical to modern... - -//////////////////////////// -// RELAY-CLASSIC TESTS -/////////////////////////// -import * as Relay from "react-relay/classic"; - -interface Props { - text: string; - userId: string; -} - -export default class AddTweetMutation extends Relay.Mutation { - getMutation() { - return Relay.QL`mutation{addTweet}`; - } - - getFatQuery() { - return Relay.QL` - fragment on AddTweetPayload { - tweetEdge - user - } - `; - } - - getConfigs() { - return [{ - type: "RANGE_ADD", - parentName: "user", - parentID: this.props.userId, - connectionName: "tweets", - edgeName: "tweetEdge", - rangeBehaviors: { - "": "append", - }, - }]; - } - - getVariables() { - return this.props; - } -} - -interface ArtworkProps { - artwork: { - title: string - }; - relay: Relay.RelayProp; -} - -class Artwork extends React.Component { - render() { - return ( - - {this.props.artwork.title} - - ); - } -} - -const ArtworkContainer = Relay.createContainer(Artwork, { - fragments: { - artwork: () => Relay.QL` - fragment on Artwork { - title - } - ` - } -}); - -class StubbedArtwork extends React.Component { - render() { - const props = { - artwork: { title: "CHAMPAGNE FORMICA FLAG" }, - relay: { - route: { - name: "champagne" - }, - variables: { - artworkID: "champagne-formica-flag", - }, - setVariables: () => {}, - forceFetch: () => {}, - hasOptimisticUpdate: () => false, - getPendingTransactions: (): any => undefined, - commitUpdate: () => {}, - } - }; - return ; - } -} diff --git a/types/react-relay/v1/tsconfig.json b/types/react-relay/v1/tsconfig.json deleted file mode 100644 index 37049aa13e..0000000000 --- a/types/react-relay/v1/tsconfig.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react", - "paths": { - "react-relay": ["react-relay/v1"], - "react-relay/*": ["react-relay/v1/*"], - "react-relay/classic": ["react-relay/v1/classic.d"], - "react-relay/compat": ["react-relay/v1/compat.d"] - } - }, - "files": [ - "index.d.ts", - "react-relay-tests.tsx", - "lib/react-relay-classic.d.ts", - "lib/react-relay-modern.d.ts", - "lib/react-relay-compat.d.ts" - ] -} From b438270ef30cba0eba981947fdbfdd0d579076a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 11 Oct 2017 15:15:43 +0200 Subject: [PATCH 029/314] [Relay] Reformat all files using prettier. prettier --parser typescript --tab-width 4 --semi --trailing-comma es5 \ --write --print-width 120 \ types/{react-relay,relay-runtime}/*.ts* --- types/react-relay/classic.d.ts | 91 ++--- types/react-relay/compat.d.ts | 16 +- types/react-relay/index.d.ts | 4 +- types/react-relay/modern.d.ts | 59 ++- .../react-relay/react-relay-classic-tests.tsx | 75 ++-- types/react-relay/react-relay-tests.tsx | 350 ++++++++---------- types/relay-runtime/index.d.ts | 291 +++++++-------- types/relay-runtime/relay-runtime-tests.tsx | 29 +- 8 files changed, 422 insertions(+), 493 deletions(-) diff --git a/types/react-relay/classic.d.ts b/types/react-relay/classic.d.ts index 02517b7e80..9345199d27 100644 --- a/types/react-relay/classic.d.ts +++ b/types/react-relay/classic.d.ts @@ -1,5 +1,5 @@ -import * as React from 'react'; -import { RelayCommonTypes } from 'relay-runtime'; +import * as React from "react"; +import { RelayCommonTypes } from "relay-runtime"; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix @@ -7,7 +7,11 @@ import { RelayCommonTypes } from 'relay-runtime'; export type StoreReaderData = any; export type StoreReaderOptions = any; export type RelayStoreData = any; -export interface RelayQuery { Fragment: any; Node: any; Root: any; } +export interface RelayQuery { + Fragment: any; + Node: any; + Root: any; +} // ~~~~~~~~~~~~~~~~~~~~~ // Environment @@ -16,33 +20,27 @@ export interface FragmentResolver { dispose(): void; resolve( fragment: RelayQuery["Fragment"], - dataIDs: RelayCommonTypes.DataID | RelayCommonTypes.DataID[], + dataIDs: RelayCommonTypes.DataID | RelayCommonTypes.DataID[] ): StoreReaderData | StoreReaderData[] | undefined | null; } export interface RelayEnvironmentInterface { forceFetch( querySet: RelayCommonTypes.RelayQuerySet, - onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback, + onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback ): RelayCommonTypes.Abortable; - getFragmentResolver( - fragment: RelayQuery["Fragment"], - onNext: () => void, - ): FragmentResolver; + getFragmentResolver(fragment: RelayQuery["Fragment"], onNext: () => void): FragmentResolver; getStoreData(): RelayStoreData; primeCache( querySet: RelayCommonTypes.RelayQuerySet, - onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback, + onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback ): RelayCommonTypes.Abortable; read( node: RelayQuery["Node"], dataID: RelayCommonTypes.DataID, - options?: StoreReaderOptions, + options?: StoreReaderOptions ): StoreReaderData | void; - readQuery( - root: RelayQuery["Root"], - options?: StoreReaderOptions, - ): StoreReaderData[] | void; + readQuery(root: RelayQuery["Root"], options?: StoreReaderOptions): StoreReaderData[] | void; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -75,12 +73,12 @@ export interface RelayQueryRequestResolve { } export type RelayMutationStatus = - 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. - 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. - 'COLLISION_COMMIT_FAILED' | // Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, + | "UNCOMMITTED" // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. + | "COMMIT_QUEUED" // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. + | "COLLISION_COMMIT_FAILED" // Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, // including this one, have been failed. Transaction can be recommitted or rolled back. - 'COMMITTING' | // Transaction is waiting for the server to respond. - 'COMMIT_FAILED'; + | "COMMITTING" // Transaction is waiting for the server to respond. + | "COMMIT_FAILED"; export class RelayMutationTransaction { applyOptimistic(): RelayMutationTransaction; @@ -118,13 +116,16 @@ export class DefaultNetworkLayer implements RelayNetworkLayer { supports(...options: string[]): boolean; } -export function createContainer(component: React.ComponentClass | React.StatelessComponent, params?: CreateContainerOpts): RelayContainerClass; +export function createContainer( + component: React.ComponentClass | React.StatelessComponent, + params?: CreateContainerOpts +): RelayContainerClass; export function injectNetworkLayer(networkLayer: RelayNetworkLayer): any; export function isContainer(component: React.ComponentClass): boolean; export function QL(...args: any[]): string; export class Route { - constructor(params?: RelayVariables) + constructor(params?: RelayVariables); } /** @@ -155,7 +156,7 @@ export interface Store { export const Store: Store; -export class RootContainer extends React.Component { } +export class RootContainer extends React.Component {} export interface RootContainerProps extends React.Props { Component: RelayContainerClass; @@ -165,13 +166,13 @@ export interface RootContainerProps extends React.Props { renderFailure?(error: Error, retry: (...args: any[]) => any): JSX.Element; } -export class Renderer extends React.Component { } +export class Renderer extends React.Component {} export interface RendererProps { Container: RelayContainerClass; // Relay container that defines fragments and the view to render. forceFetch?: boolean; // Whether to send a server request regardless of data available on the client. queryConfig: Route; // `QueryConfig` or `Relay.Route` that defines the query roots. - environment: Store; // An instance of `Relay.Environment` or any object that implements the `RelayEnvironment` interface. + environment: Store; // An instance of `Relay.Environment` or any object that implements the `RelayEnvironment` interface. render?: RenderCallback; // Called to render when data requirements are being fulfilled. onReadyStateChange?: OnReadyStateChange; } @@ -186,28 +187,30 @@ export interface RenderStateConfig { export type RenderCallback = (renderState: RenderStateConfig) => any; export type ReadyStateEvent = - 'ABORT' | - 'CACHE_RESTORED_REQUIRED' | - 'CACHE_RESTORE_FAILED' | - 'CACHE_RESTORE_START' | - 'NETWORK_QUERY_ERROR' | - 'NETWORK_QUERY_RECEIVED_ALL' | - 'NETWORK_QUERY_RECEIVED_REQUIRED' | - 'NETWORK_QUERY_START' | - 'STORE_FOUND_ALL' | - 'STORE_FOUND_REQUIRED'; + | "ABORT" + | "CACHE_RESTORED_REQUIRED" + | "CACHE_RESTORE_FAILED" + | "CACHE_RESTORE_START" + | "NETWORK_QUERY_ERROR" + | "NETWORK_QUERY_RECEIVED_ALL" + | "NETWORK_QUERY_RECEIVED_REQUIRED" + | "NETWORK_QUERY_START" + | "STORE_FOUND_ALL" + | "STORE_FOUND_REQUIRED"; -export type OnReadyStateChange = (readyState: { - ready: boolean, - done: boolean, - stale: boolean, - error?: Error, - events: ReadyStateEvent[], - aborted: boolean -}) => void; +export type OnReadyStateChange = ( + readyState: { + ready: boolean; + done: boolean; + stale: boolean; + error?: Error; + events: ReadyStateEvent[]; + aborted: boolean; + } +) => void; export interface RelayProp { - readonly route: { name: string; }; // incomplete, also has params and queries + readonly route: { name: string }; // incomplete, also has params and queries readonly variables: any; readonly pendingVariables?: any; setVariables(variables: any, onReadyStateChange?: OnReadyStateChange): void; diff --git a/types/react-relay/compat.d.ts b/types/react-relay/compat.d.ts index e16bbb01f9..74f7f55a03 100644 --- a/types/react-relay/compat.d.ts +++ b/types/react-relay/compat.d.ts @@ -1,6 +1,6 @@ -import { RelayRuntimeTypes, RelayCommonTypes } from 'relay-runtime'; -import { RelayEnvironmentInterface } from 'react-relay/classic'; -import {} from 'react-relay/modern'; +import { RelayRuntimeTypes, RelayCommonTypes } from "relay-runtime"; +import { RelayEnvironmentInterface } from "react-relay/classic"; +import {} from "react-relay/modern"; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix @@ -34,20 +34,22 @@ export type CompatEnvironment = RelayRuntimeTypes.Environment | RelayClassicEnvi // ~~~~~~~~~~~~~~~~~~~~~ export function commitUpdate( environment: CompatEnvironment, - config: RelayRuntimeTypes.MutationConfig, + config: RelayRuntimeTypes.MutationConfig ): RelayCommonTypes.Disposable; export function applyUpdate( environment: CompatEnvironment, - config: RelayRuntimeTypes.OptimisticMutationConfig, + config: RelayRuntimeTypes.OptimisticMutationConfig ): RelayCommonTypes.Disposable; // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatContainer // ~~~~~~~~~~~~~~~~~~~~~ -export interface GeneratedNodeMap { [key: string]: RelayCommonTypes.GraphQLTaggedNode; } +export interface GeneratedNodeMap { + [key: string]: RelayCommonTypes.GraphQLTaggedNode; +} export function createContainer( Component: ReactBaseComponent, - fragmentSpec: RelayCommonTypes.GraphQLTaggedNode | GeneratedNodeMap, + fragmentSpec: RelayCommonTypes.GraphQLTaggedNode | GeneratedNodeMap ): ReactFragmentComponent; // ~~~~~~~~~~~~~~~~~~~~~ diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 72a661e6b7..30cb29b3e3 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -4,8 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import { RelayRuntimeTypes } from 'relay-runtime'; -import * as ReactRelayModernTypes from 'react-relay/modern'; +import { RelayRuntimeTypes } from "relay-runtime"; +import * as ReactRelayModernTypes from "react-relay/modern"; // ~~~~~~~~~~~~~~~~~~~~~ // React-Relay Modern diff --git a/types/react-relay/modern.d.ts b/types/react-relay/modern.d.ts index f6d1eb0381..13b43bf449 100644 --- a/types/react-relay/modern.d.ts +++ b/types/react-relay/modern.d.ts @@ -1,5 +1,5 @@ -import * as React from 'react'; -import { RelayCommonTypes, RelayRuntimeTypes } from 'relay-runtime'; +import * as React from "react"; +import { RelayCommonTypes, RelayRuntimeTypes } from "relay-runtime"; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix @@ -21,23 +21,20 @@ export interface RelayProp { // ~~~~~~~~~~~~~~~~~~~~~ // RelayQL // ~~~~~~~~~~~~~~~~~~~~~ -export function RelayQL( - strings: string[], - ...substitutions: any[] -): RelayCommonTypes.RelayConcreteNode; +export function RelayQL(strings: string[], ...substitutions: any[]): RelayCommonTypes.RelayConcreteNode; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernGraphQLTag // ~~~~~~~~~~~~~~~~~~~~~ -export interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode; } +export interface GeneratedNodeMap { + [key: string]: GraphQLTaggedNode; +} export type GraphQLTaggedNode = - (() => ConcreteFragment | ConcreteBatch) + | (() => ConcreteFragment | ConcreteBatch) | { - modern(): ConcreteFragment | ConcreteBatch, - classic(relayQL: typeof RelayQL): - | ConcreteFragmentDefinition - | ConcreteOperationDefinition, - }; + modern(): ConcreteFragment | ConcreteBatch; + classic(relayQL: typeof RelayQL): ConcreteFragmentDefinition | ConcreteOperationDefinition; + }; /** * Runtime function to correspond to the `graphql` tagged template function. * All calls to this function should be transformed by the plugin. @@ -67,14 +64,14 @@ export interface ReadyState { export interface QueryRendererState { readyState: ReadyState; } -export class ReactRelayQueryRenderer extends React.Component { } +export class ReactRelayQueryRenderer extends React.Component {} // ~~~~~~~~~~~~~~~~~~~~~ // createFragmentContainer // ~~~~~~~~~~~~~~~~~~~~~ export function createFragmentContainer( Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap ): ReactBaseComponent; // ~~~~~~~~~~~~~~~~~~~~~ @@ -91,38 +88,38 @@ export interface ConnectionData { pageInfo?: PageInfo; } export type RelayPaginationProp = RelayProp & { - hasMore(): boolean, - isLoading(): boolean, + hasMore(): boolean; + isLoading(): boolean; loadMore( pageSize: number, callback: (error?: Error) => void, - options?: RefetchOptions, - ): RelayCommonTypes.Disposable | undefined | null, + options?: RefetchOptions + ): RelayCommonTypes.Disposable | undefined | null; refetchConnection( totalCount: number, callback: (error?: Error) => void, - refetchVariables?: RelayCommonTypes.Variables, - ): RelayCommonTypes.Disposable | undefined | null, + refetchVariables?: RelayCommonTypes.Variables + ): RelayCommonTypes.Disposable | undefined | null; }; export function FragmentVariablesGetter( prevVars: RelayCommonTypes.Variables, - totalCount: number, + totalCount: number ): RelayCommonTypes.Variables; export interface ConnectionConfig { - direction?: 'backward' | 'forward'; + direction?: "backward" | "forward"; getConnectionFromProps?(props: object): ConnectionData | undefined | null; getFragmentVariables?: typeof FragmentVariablesGetter; getVariables( props: { [propName: string]: any }, - paginationInfo: { count: number, cursor?: string }, - fragmentVariables: RelayCommonTypes.Variables, + paginationInfo: { count: number; cursor?: string }, + fragmentVariables: RelayCommonTypes.Variables ): RelayCommonTypes.Variables; query: GraphQLTaggedNode; } export function createPaginationContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - connectionConfig: ConnectionConfig, + connectionConfig: ConnectionConfig ): ReactBaseComponent; // ~~~~~~~~~~~~~~~~~~~~~ @@ -134,14 +131,16 @@ export interface RefetchOptions { } export type RelayRefetchProp = RelayProp & { refetch( - refetchVariables: RelayCommonTypes.Variables | ((fragmentVariables: RelayCommonTypes.Variables) => RelayCommonTypes.Variables), + refetchVariables: + | RelayCommonTypes.Variables + | ((fragmentVariables: RelayCommonTypes.Variables) => RelayCommonTypes.Variables), renderVariables?: RelayCommonTypes.Variables, callback?: (error?: Error) => void, - options?: RefetchOptions, - ): RelayCommonTypes.Disposable, + options?: RefetchOptions + ): RelayCommonTypes.Disposable; }; export function createRefetchContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - taggedNode: GraphQLTaggedNode, + taggedNode: GraphQLTaggedNode ): ReactBaseComponent; diff --git a/types/react-relay/react-relay-classic-tests.tsx b/types/react-relay/react-relay-classic-tests.tsx index b7531598eb..7aae267dfc 100644 --- a/types/react-relay/react-relay-classic-tests.tsx +++ b/types/react-relay/react-relay-classic-tests.tsx @@ -1,61 +1,58 @@ -import * as React from "react" -import * as Relay from "react-relay/classic" +import * as React from "react"; +import * as Relay from "react-relay/classic"; interface Props { - text: string - userId: string + text: string; + userId: string; } -interface Response { -} +// tslint:disable-next-line no-empty-interface +interface Response {} export default class AddTweetMutation extends Relay.Mutation { - - getMutation () { - return Relay.QL`mutation{addTweet}` + getMutation() { + return Relay.QL`mutation{addTweet}`; } - getFatQuery () { + getFatQuery() { return Relay.QL` fragment on AddTweetPayload { tweetEdge user } - ` + `; } - getConfigs () { - return [{ - type: "RANGE_ADD", - parentName: "user", - parentID: this.props.userId, - connectionName: "tweets", - edgeName: "tweetEdge", - rangeBehaviors: { - "": "append", + getConfigs() { + return [ + { + type: "RANGE_ADD", + parentName: "user", + parentID: this.props.userId, + connectionName: "tweets", + edgeName: "tweetEdge", + rangeBehaviors: { + "": "append", + }, }, - }] + ]; } - getVariables () { - return this.props + getVariables() { + return this.props; } } interface ArtworkProps { artwork: { - title: string - }, - relay: Relay.RelayProp, + title: string; + }; + relay: Relay.RelayProp; } class Artwork extends React.Component { render() { - return ( - - {this.props.artwork.title} - - ) + return {this.props.artwork.title}; } } @@ -65,9 +62,9 @@ const ArtworkContainer = Relay.createContainer(Artwork, { fragment on Artwork { title } - ` - } -}) + `, + }, +}); class StubbedArtwork extends React.Component { render() { @@ -75,7 +72,7 @@ class StubbedArtwork extends React.Component { artwork: { title: "CHAMPAGNE FORMICA FLAG" }, relay: { route: { - name: "champagne" + name: "champagne", }, variables: { artworkID: "champagne-formica-flag", @@ -83,10 +80,10 @@ class StubbedArtwork extends React.Component { setVariables: () => {}, forceFetch: () => {}, hasOptimisticUpdate: () => false, - getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, + getPendingTransactions: (): Relay.RelayMutationTransaction[] => [], commitUpdate: () => {}, - } - } - return + }, + }; + return ; } } diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/react-relay-tests.tsx index 50506ac111..97cc5d47d9 100644 --- a/types/react-relay/react-relay-tests.tsx +++ b/types/react-relay/react-relay-tests.tsx @@ -1,11 +1,5 @@ import * as React from "react"; -import { - Environment, - Network, - RecordSource, - Store, - ConnectionHandler, -} from 'relay-runtime'; +import { Environment, Network, RecordSource, Store, ConnectionHandler } from "relay-runtime"; //////////////////////////// // RELAY MODERN TESTS @@ -25,7 +19,7 @@ import { // Modern Environment // ~~~~~~~~~~~~~~~~~~~~~ function fetchQuery(operation: any, variables: any, cacheConfig: {}) { - return fetch('/graphql'); + return fetch("/graphql"); } const network = Network.create(fetchQuery); const source = new RecordSource(); @@ -35,28 +29,28 @@ const modernEnvironment = new Environment({ network, store }); // ~~~~~~~~~~~~~~~~~~~~~ // Modern QueryRenderer // ~~~~~~~~~~~~~~~~~~~~~ -const MyQueryRenderer = (props: { name: string}) => ( - { - if (error) { - return
{error.message}
; - } else if (props) { - return
{props.name} is great!
; - } - return
Loading
; - }} - /> +const MyQueryRenderer = (props: { name: string }) => ( + { + if (error) { + return
{error.message}
; + } else if (props) { + return
{props.name} is great!
; + } + return
Loading
; + }} + /> ); // ~~~~~~~~~~~~~~~~~~~~~ @@ -65,14 +59,14 @@ const MyQueryRenderer = (props: { name: string}) => ( const MyFragmentContainer = createFragmentContainer( class TodoListView extends React.Component { render() { - return
; + return
; } }, { item: graphql` fragment TodoItem_item on Todo { - text - isComplete + text + isComplete } `, } @@ -81,84 +75,75 @@ const MyFragmentContainer = createFragmentContainer( // ~~~~~~~~~~~~~~~~~~~~~ // Modern RefetchContainer // ~~~~~~~~~~~~~~~~~~~~~ -interface StoryInterface { id: string; } +interface StoryInterface { + id: string; +} interface FeedStoriesProps { relay: ModernTypes.RelayRefetchProp; feed: { - stories: { edges: Array<{ node: StoryInterface }> } + stories: { edges: Array<{ node: StoryInterface }> }; }; } class Story extends React.Component<{ story: StoryInterface }> {} class FeedStories extends React.Component { render() { - return ( -
- {this.props.feed.stories.edges.map( - edge => - )} -
- ); + return ( +
+ {this.props.feed.stories.edges.map(edge => )} +
+ ); } _loadMore() { - // Increments the number of stories being rendered by 10. - const refetchVariables = (fragmentVariables: {count: number }) => ({ - count: fragmentVariables.count + 10, - }); - this.props.relay.refetch(refetchVariables); + // Increments the number of stories being rendered by 10. + const refetchVariables = (fragmentVariables: { count: number }) => ({ + count: fragmentVariables.count + 10, + }); + this.props.relay.refetch(refetchVariables); } - } +} const FeedRefetchContainer = createRefetchContainer( FeedStories, { - feed: graphql.experimental` - fragment FeedStories_feed on Feed - @argumentDefinitions( - count: {type: "Int", defaultValue: 10} - ) { - stories(first: $count) { - edges { - node { - id - ...Story_story - } + feed: graphql.experimental` + fragment FeedStories_feed on Feed @argumentDefinitions(count: { type: "Int", defaultValue: 10 }) { + stories(first: $count) { + edges { + node { + id + ...Story_story + } + } + } } - } - } - ` + `, }, graphql.experimental` - query FeedStoriesRefetchQuery($count: Int) { - feed { - ...FeedStories_feed @arguments(count: $count) + query FeedStoriesRefetchQuery($count: Int) { + feed { + ...FeedStories_feed @arguments(count: $count) + } } - } - `, - ); + ` +); // ~~~~~~~~~~~~~~~~~~~~~ // Modern PaginationContainer // ~~~~~~~~~~~~~~~~~~~~~ interface FeedProps { - user: { feed: { edges: Array<{ node: StoryInterface}>}}; + user: { feed: { edges: Array<{ node: StoryInterface }> } }; relay: ModernTypes.RelayPaginationProp; } class Feed extends React.Component { render() { - return (
- {this.props.user.feed.edges.map( - edge => - )} -
); + return ( +
+ {this.props.user.feed.edges.map(edge => )} +
+ ); } _loadMore() { @@ -170,7 +155,7 @@ class Feed extends React.Component { 10, // Fetch the next 10 feed items e => { console.log(e); - }, + } ); } } @@ -179,25 +164,25 @@ const FeedPaginationContainer = createPaginationContainer( Feed, { user: graphql` - fragment Feed_user on User { - feed( - first: $count - after: $cursor - orderby: $orderBy # other variables - ) @connection(key: "Feed_feed") { - edges { - node { - id - ...Story_story + fragment Feed_user on User { + feed( + first: $count + after: $cursor + orderby: $orderBy # other variables + ) @connection(key: "Feed_feed") { + edges { + node { + id + ...Story_story + } + } } } - } - } `, }, { - direction: 'forward', - getConnectionFromProps(props: { user: {feed: any}}) { + direction: "forward", + getConnectionFromProps(props: { user: { feed: any } }) { return props.user && props.user.feed; }, getFragmentVariables(prevVars, totalCount) { @@ -206,7 +191,7 @@ const FeedPaginationContainer = createPaginationContainer( count: totalCount, }; }, - getVariables(props, {count, cursor}, fragmentVariables) { + getVariables(props, { count, cursor }, fragmentVariables) { return { count, cursor, @@ -216,17 +201,13 @@ const FeedPaginationContainer = createPaginationContainer( }; }, query: graphql` - query FeedPaginationQuery( - $count: Int! - $cursor: String - $orderby: String! - ) { - user { - # You could reference the fragment defined previously. - ...Feed_user + query FeedPaginationQuery($count: Int!, $cursor: String, $orderby: String!) { + user { + # You could reference the fragment defined previously. + ...Feed_user + } } - } - ` + `, } ); @@ -234,46 +215,52 @@ const FeedPaginationContainer = createPaginationContainer( // Modern Mutations // ~~~~~~~~~~~~~~~~~~~~~ const mutation = graphql` -mutation MarkReadNotificationMutation( - $input: MarkReadNotificationData! -) { - markReadNotification(data: $input) { - notification { - seenState + mutation MarkReadNotificationMutation($input: MarkReadNotificationData!) { + markReadNotification(data: $input) { + notification { + seenState + } } } -} `; const optimisticResponse = { markReadNotification: { notification: { - seenState: 'SEEN', + seenState: "SEEN", }, }, }; -const configs = [{ - type: 'NODE_DELETE' as 'NODE_DELETE', - deletedIDFieldName: 'destroyedShipId', -}, { - type: 'RANGE_ADD' as 'RANGE_ADD', - parentID: 'shipId', - connectionInfo: [{ - key: 'AddShip_ships', - rangeBehavior: 'append', - }], - edgeName: 'newShipEdge', -}, { - type: 'RANGE_DELETE' as 'RANGE_DELETE', - parentID: 'todoId', - connectionKeys: [{ - key: 'RemoveTags_tags', - rangeBehavior: 'append', - }], - pathToConnection: ['todo', 'tags'], - deletedIDFieldName: 'removedTagId' -}]; +const configs = [ + { + type: "NODE_DELETE" as "NODE_DELETE", + deletedIDFieldName: "destroyedShipId", + }, + { + type: "RANGE_ADD" as "RANGE_ADD", + parentID: "shipId", + connectionInfo: [ + { + key: "AddShip_ships", + rangeBehavior: "append", + }, + ], + edgeName: "newShipEdge", + }, + { + type: "RANGE_DELETE" as "RANGE_DELETE", + parentID: "todoId", + connectionKeys: [ + { + key: "RemoveTags_tags", + rangeBehavior: "append", + }, + ], + pathToConnection: ["todo", "tags"], + deletedIDFieldName: "removedTagId", + }, +]; function markNotificationAsRead(source: string, storyID: string) { const variables = { @@ -283,37 +270,32 @@ function markNotificationAsRead(source: string, storyID: string) { }, }; - commitMutation( - modernEnvironment, - { - configs, - mutation, - optimisticResponse, - variables, - onCompleted: (response, errors) => { - console.log('Response received from server.'); - }, - onError: err => console.error(err), + commitMutation(modernEnvironment, { + configs, + mutation, + optimisticResponse, + variables, + onCompleted: (response, errors) => { + console.log("Response received from server."); }, - ); + onError: err => console.error(err), + }); } // ~~~~~~~~~~~~~~~~~~~~~ // Modern Subscriptions // ~~~~~~~~~~~~~~~~~~~~~ const subscription = graphql` - subscription MarkReadNotificationSubscription( - $storyID: ID! - ) { - markReadNotification(storyID: $storyID) { - notification { - seenState + subscription MarkReadNotificationSubscription($storyID: ID!) { + markReadNotification(storyID: $storyID) { + notification { + seenState + } } } - } `; const variables = { - storyID: '123', + storyID: "123", }; requestSubscription( modernEnvironment, // see Environment docs @@ -326,18 +308,12 @@ requestSubscription( // example of a custom updater updater: store => { // Get the notification - const rootField = store.getRootField('markReadNotification'); - const notification = !!rootField && rootField.getLinkedRecord('notification'); + const rootField = store.getRootField("markReadNotification"); + const notification = !!rootField && rootField.getLinkedRecord("notification"); // Add it to a connection - const viewer = store.getRoot().getLinkedRecord('viewer'); - const notifications = - ConnectionHandler.getConnection(viewer, 'notifications'); - const edge = ConnectionHandler.createEdge( - store, - notifications, - notification, - '', - ); + const viewer = store.getRoot().getLinkedRecord("viewer"); + const notifications = ConnectionHandler.getConnection(viewer, "notifications"); + const edge = ConnectionHandler.createEdge(store, notifications, notification, ""); ConnectionHandler.insertEdgeAfter(notifications, edge); }, } @@ -348,7 +324,7 @@ requestSubscription( /////////////////////////// import { QueryRenderer as CompatQueryRenderer, - createFragmentContainer as createFragmentContainerCompat + createFragmentContainer as createFragmentContainerCompat, } from "react-relay/compat"; // TODO? This is all more or less identical to modern... @@ -378,16 +354,18 @@ export default class AddTweetMutation extends Relay.Mutation { } getConfigs() { - return [{ - type: "RANGE_ADD", - parentName: "user", - parentID: this.props.userId, - connectionName: "tweets", - edgeName: "tweetEdge", - rangeBehaviors: { - "": "append", + return [ + { + type: "RANGE_ADD", + parentName: "user", + parentID: this.props.userId, + connectionName: "tweets", + edgeName: "tweetEdge", + rangeBehaviors: { + "": "append", + }, }, - }]; + ]; } getVariables() { @@ -397,18 +375,14 @@ export default class AddTweetMutation extends Relay.Mutation { interface ArtworkProps { artwork: { - title: string + title: string; }; relay: Relay.RelayProp; } class Artwork extends React.Component { render() { - return ( - - {this.props.artwork.title} - - ); + return {this.props.artwork.title}; } } @@ -418,8 +392,8 @@ const ArtworkContainer = Relay.createContainer(Artwork, { fragment on Artwork { title } - ` - } + `, + }, }); class StubbedArtwork extends React.Component { @@ -428,7 +402,7 @@ class StubbedArtwork extends React.Component { artwork: { title: "CHAMPAGNE FORMICA FLAG" }, relay: { route: { - name: "champagne" + name: "champagne", }, variables: { artworkID: "champagne-formica-flag", @@ -438,7 +412,7 @@ class StubbedArtwork extends React.Component { hasOptimisticUpdate: () => false, getPendingTransactions: (): any => undefined, commitUpdate: () => {}, - } + }, }; return ; } diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 152df90640..88abec0a9b 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -36,10 +36,7 @@ export namespace RelayCommonTypes { // ~~~~~~~~~~~~~~~~~~~~~ // RelayQL // ~~~~~~~~~~~~~~~~~~~~~ - type RelayQL = ( - strings: string[], - ...substitutions: any[] - ) => RelayConcreteNode; + type RelayQL = (strings: string[], ...substitutions: any[]) => RelayConcreteNode; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernGraphQLTag @@ -48,13 +45,11 @@ export namespace RelayCommonTypes { [key: string]: GraphQLTaggedNode; } type GraphQLTaggedNode = - (() => ConcreteFragment | ConcreteBatch) | - { - modern(): ConcreteFragment | ConcreteBatch, - classic(relayQL: RelayQL): - | ConcreteFragmentDefinition - | ConcreteOperationDefinition, - }; + | (() => ConcreteFragment | ConcreteBatch) + | { + modern(): ConcreteFragment | ConcreteBatch; + classic(relayQL: RelayQL): ConcreteFragmentDefinition | ConcreteOperationDefinition; + }; // ~~~~~~~~~~~~~~~~~~~~~ // General Usage // ~~~~~~~~~~~~~~~~~~~~~ @@ -81,8 +76,8 @@ export namespace RelayCommonTypes { interface PayloadError { message: string; locations?: Array<{ - line: number, - column: number, + line: number; + column: number; }>; } /** @@ -94,7 +89,7 @@ export namespace RelayCommonTypes { operation: ConcreteBatch, variables: Variables, cacheConfig: CacheConfig, - uploadables?: UploadableMap, + uploadables?: UploadableMap ): Runtime.ObservableFromValue; /** @@ -108,7 +103,7 @@ export namespace RelayCommonTypes { operation: ConcreteBatch, variables: Variables, cacheConfig: CacheConfig, - observer: LegacyObserver, + observer: LegacyObserver ) => Runtime.RelayObservable | Disposable; // ~~~~~~~~~~~~~~~~~~~~~ @@ -131,7 +126,7 @@ export namespace RelayCommonTypes { store: RecordSourceSelectorProxy, // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is // inconvenient to access deeply in product code. - data: any, // FLOW FIXME + data: any // FLOW FIXME ) => void; /** @@ -152,22 +147,14 @@ export namespace RelayCommonTypes { getDataID(): DataID; getLinkedRecord(name: string, args?: Variables): RecordProxy | void; getLinkedRecords(name: string, args?: Variables): Array | void; - getOrCreateLinkedRecord( - name: string, - typeName: string, - args?: Variables, - ): RecordProxy; + getOrCreateLinkedRecord(name: string, typeName: string, args?: Variables): RecordProxy; getType(): string; getValue(name: string, args?: Variables): any; - setLinkedRecord( - record: RecordProxy, - name: string, - args?: Variables, - ): RecordProxy; + setLinkedRecord(record: RecordProxy, name: string, args?: Variables): RecordProxy; setLinkedRecords( records: Array | undefined | null, name: string, - args?: Variables, + args?: Variables ): RecordProxy; setValue(value: any, name: string, args?: Variables): RecordProxy; } @@ -228,17 +215,23 @@ export namespace RelayCommonTypes { /** * Arbitrary data e.g. received by a container as props. */ - interface Props { [key: string]: any; } + interface Props { + [key: string]: any; + } /* * An individual cached graph object. */ - interface Record { [key: string]: any; } + interface Record { + [key: string]: any; + } /** * A collection of records keyed by id. */ - interface RecordMap { [dataID: string]: Record | null | undefined; } + interface RecordMap { + [dataID: string]: Record | null | undefined; + } /** * A selector defines the starting point for a traversal into the graph for the @@ -254,20 +247,24 @@ export namespace RelayCommonTypes { * A representation of a selector and its results at a particular point in time. */ type CSnapshot = CSelector & { - data: SelectorData | null | undefined, - seenRecords: RecordMap, + data: SelectorData | null | undefined; + seenRecords: RecordMap; }; /** * The results of a selector given a store/RecordSource. */ - interface SelectorData { [key: string]: any; } + interface SelectorData { + [key: string]: any; + } /** * The results of reading the results of a FragmentMap given some input * `Props`. */ - interface FragmentSpecResults { [key: string]: any; } + interface FragmentSpecResults { + [key: string]: any; + } /** * A utility for resolving and subscribing to the results of a fragment spec @@ -304,7 +301,9 @@ export namespace RelayCommonTypes { setVariables(variables: Variables): void; } - interface CFragmentMap { [key: string]: TFragment; } + interface CFragmentMap { + [key: string]: TFragment; + } /** * An operation selector describes a specific instance of a GraphQL operation @@ -326,14 +325,7 @@ export namespace RelayCommonTypes { * The public API of Relay core. Represents an encapsulated environment with its * own in-memory cache. */ - interface CEnvironment< - TEnvironment, - TFragment, - TGraphQLTaggedNode, - TNode, - TOperation, - TPayload, - > { + interface CEnvironment { /** * Read the results of a selector from in-memory records in the store. */ @@ -344,10 +336,7 @@ export namespace RelayCommonTypes { * when data has been committed to the store that would cause the results of * the snapshot's selector to change. */ - subscribe( - snapshot: CSnapshot, - callback: (snapshot: CSnapshot) => void, - ): Disposable; + subscribe(snapshot: CSnapshot, callback: (snapshot: CSnapshot) => void): Disposable; /** * Ensure that all the records necessary to fulfill the given selector are @@ -370,11 +359,11 @@ export namespace RelayCommonTypes { * after receving the first `onNext` result. */ sendQuery(config: { - cacheConfig?: CacheConfig, - onCompleted?(): void, - onError?(error: Error): void, - onNext?(payload: TPayload): void, - operation: COperationSelector, + cacheConfig?: CacheConfig; + onCompleted?(): void; + onError?(error: Error): void; + onNext?(payload: TPayload): void; + operation: COperationSelector; }): Disposable; /** @@ -386,29 +375,17 @@ export namespace RelayCommonTypes { * subscription open indefinitely such that `onCompleted` is not called. */ streamQuery(config: { - cacheConfig?: CacheConfig, - onCompleted?(): void, - onError?(error: Error): void, - onNext?(payload: TPayload): void, - operation: COperationSelector, + cacheConfig?: CacheConfig; + onCompleted?(): void; + onError?(error: Error): void; + onNext?(payload: TPayload): void; + operation: COperationSelector; }): Disposable; - unstable_internal: CUnstableEnvironmentCore< - TEnvironment, - TFragment, - TGraphQLTaggedNode, - TNode, - TOperation - >; + unstable_internal: CUnstableEnvironmentCore; } - interface CUnstableEnvironmentCore< - TEnvironment, - TFragment, - TGraphQLTaggedNode, - TNode, - TOperation, - > { + interface CUnstableEnvironmentCore { /** * Create an instance of a FragmentSpecResolver. * @@ -421,7 +398,7 @@ export namespace RelayCommonTypes { containerName: string, fragments: CFragmentMap, props: Props, - callback: () => void, + callback: () => void ): FragmentSpecResolver; /** @@ -430,10 +407,7 @@ export namespace RelayCommonTypes { * filtered to exclude variables that do not matche defined arguments on the * operation, and default values are populated for null values. */ - createOperationSelector( - operation: TOperation, - variables: Variables, - ): COperationSelector; + createOperationSelector(operation: TOperation, variables: Variables): COperationSelector; /** * Given a graphql`...` tagged template, extract a fragment definition usable @@ -482,11 +456,7 @@ export namespace RelayCommonTypes { * const childData = environment.lookup(childSelector).data; * ``` */ - getSelector( - operationVariables: Variables, - fragment: TFragment, - prop: any, - ): CSelector | void; + getSelector(operationVariables: Variables, fragment: TFragment, prop: any): CSelector | void; /** * Given the result `items` from a parent that fetched `fragment`, creates a @@ -497,7 +467,7 @@ export namespace RelayCommonTypes { getSelectorList( operationVariables: Variables, fragment: TFragment, - props: any[], + props: any[] ): Array> | void; /** @@ -511,7 +481,7 @@ export namespace RelayCommonTypes { getSelectorsFromObject( operationVariables: Variables, fragments: CFragmentMap, - props: Props, + props: Props ): { [key: string]: CSelector | Array> | null | undefined }; /** @@ -523,7 +493,7 @@ export namespace RelayCommonTypes { */ getDataIDsFromObject( fragments: CFragmentMap, - props: Props, + props: Props ): { [key: string]: DataID | DataID[] | null | undefined }; /** @@ -537,7 +507,7 @@ export namespace RelayCommonTypes { getVariablesFromObject( operationVariables: Variables, fragments: CFragmentMap, - props: Props, + props: Props ): Variables; } @@ -564,51 +534,46 @@ export namespace RelayCommonTypes { max_runs: number; } interface FIELDS_CHANGE { - type: 'FIELDS_CHANGE'; - fieldIDs: { [fieldName: string]: DataID | DataID[]; }; + type: "FIELDS_CHANGE"; + fieldIDs: { [fieldName: string]: DataID | DataID[] }; } interface RANGE_ADD { - type: 'RANGE_ADD'; + type: "RANGE_ADD"; parentName?: string; parentID?: string; connectionInfo?: Array<{ - key: string, - filters?: Variables, - rangeBehavior: string, + key: string; + filters?: Variables; + rangeBehavior: string; }>; connectionName?: string; edgeName: string; rangeBehaviors?: RangeBehaviors; } interface NODE_DELETE { - type: 'NODE_DELETE'; + type: "NODE_DELETE"; parentName?: string; parentID?: string; connectionName?: string; deletedIDFieldName: string; } interface RANGE_DELETE { - type: 'RANGE_DELETE'; + type: "RANGE_DELETE"; parentName?: string; parentID?: string; connectionKeys?: Array<{ - key: string, - filters?: Variables, + key: string; + filters?: Variables; }>; connectionName?: string; deletedIDFieldName: string | string[]; pathToConnection: string[]; } interface REQUIRED_CHILDREN { - type: 'REQUIRED_CHILDREN'; + type: "REQUIRED_CHILDREN"; children: RelayConcreteNode[]; } - type RelayMutationConfig = - FIELDS_CHANGE | - RANGE_ADD | - NODE_DELETE | - RANGE_DELETE | - REQUIRED_CHILDREN; + type RelayMutationConfig = FIELDS_CHANGE | RANGE_ADD | NODE_DELETE | RANGE_DELETE | REQUIRED_CHILDREN; interface RelayMutationTransactionCommitCallbacks { onFailure?: RelayMutationTransactionCommitFailureCallback; @@ -616,11 +581,13 @@ export namespace RelayCommonTypes { } type RelayMutationTransactionCommitFailureCallback = ( transaction: RelayMutationTransaction, - preventAutoRollback: () => void, + preventAutoRollback: () => void + ) => void; + type RelayMutationTransactionCommitSuccessCallback = ( + response: { + [key: string]: any; + } ) => void; - type RelayMutationTransactionCommitSuccessCallback = (response: { - [key: string]: any, - }) => void; interface NetworkLayer { sendMutation(request: RelayMutationRequest): Promise | void; sendQueries(requests: RelayQueryRequest[]): Promise | void; @@ -639,18 +606,16 @@ export namespace RelayCommonTypes { ready: boolean; stale: boolean; } - type RelayContainerErrorEventType = - | 'CACHE_RESTORE_FAILED' - | 'NETWORK_QUERY_ERROR'; + type RelayContainerErrorEventType = "CACHE_RESTORE_FAILED" | "NETWORK_QUERY_ERROR"; type RelayContainerLoadingEventType = - | 'ABORT' - | 'CACHE_RESTORED_REQUIRED' - | 'CACHE_RESTORE_START' - | 'NETWORK_QUERY_RECEIVED_ALL' - | 'NETWORK_QUERY_RECEIVED_REQUIRED' - | 'NETWORK_QUERY_START' - | 'STORE_FOUND_ALL' - | 'STORE_FOUND_REQUIRED'; + | "ABORT" + | "CACHE_RESTORED_REQUIRED" + | "CACHE_RESTORE_START" + | "NETWORK_QUERY_RECEIVED_ALL" + | "NETWORK_QUERY_RECEIVED_REQUIRED" + | "NETWORK_QUERY_START" + | "STORE_FOUND_ALL" + | "STORE_FOUND_REQUIRED"; type ReadyStateChangeCallback = (readyState: ReadyState) => void; interface ReadyStateEvent { type: RelayContainerLoadingEventType | RelayContainerErrorEventType; @@ -668,13 +633,19 @@ export namespace RelayCommonTypes { * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js */ // ~~~~~~~~~~~~~~~~~~~~~ - interface QueryPayload { [key: string]: any; } - interface RelayQuerySet { [queryName: string]: any; } - type RangeBehaviorsFunction = (connectionArgs: { - [argName: string]: any, - }) => 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; + interface QueryPayload { + [key: string]: any; + } + interface RelayQuerySet { + [queryName: string]: any; + } + type RangeBehaviorsFunction = ( + connectionArgs: { + [argName: string]: any; + } + ) => "APPEND" | "IGNORE" | "PREPEND" | "REFETCH" | "REMOVE"; interface RangeBehaviorsObject { - [key: string]: 'APPEND' | 'IGNORE' | 'PREPEND' | 'REFETCH' | 'REMOVE'; + [key: string]: "APPEND" | "IGNORE" | "PREPEND" | "REFETCH" | "REMOVE"; } type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; } @@ -700,7 +671,7 @@ export namespace RelayRuntimeTypes { operation: object, variables: RelayCommonTypes.Variables, cacheConfig: RelayCommonTypes.CacheConfig, - uploadables?: RelayCommonTypes.UploadableMap, + uploadables?: RelayCommonTypes.UploadableMap ) => Promise; interface RelayNetwork { execute: ExecuteFunction; @@ -728,41 +699,39 @@ export namespace RelayRuntimeTypes { revertUpdate(update: OptimisticUpdate): void; replaceUpdate(update: OptimisticUpdate, newUpdate: OptimisticUpdate): void; applyMutation(config: { - operation: OperationSelector, - optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater, - optimisticResponse?: object, + operation: OperationSelector; + optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater; + optimisticResponse?: object; }): RelayCommonTypes.Disposable; check(readSelector: Selector): boolean; - commitPayload( - operationSelector: OperationSelector, - payload: PayloadData, - ): void; + commitPayload(operationSelector: OperationSelector, payload: PayloadData): void; commitUpdate(updater: RelayCommonTypes.StoreUpdater): void; lookup(readSelector: Selector): Snapshot; - subscribe( - snapshot: Snapshot, - callback: (snapshot: Snapshot) => void, - ): RelayCommonTypes.Disposable; + subscribe(snapshot: Snapshot, callback: (snapshot: Snapshot) => void): RelayCommonTypes.Disposable; retain(selector: Selector): RelayCommonTypes.Disposable; execute(config: { - operation: OperationSelector, - cacheConfig?: RelayCommonTypes.CacheConfig, - updater?: RelayCommonTypes.SelectorStoreUpdater, + operation: OperationSelector; + cacheConfig?: RelayCommonTypes.CacheConfig; + updater?: RelayCommonTypes.SelectorStoreUpdater; }): RelayObservable; executeMutation(config: { - operation: OperationSelector, - optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater, - optimisticResponse?: object, - updater?: RelayCommonTypes.SelectorStoreUpdater, - uploadables?: RelayCommonTypes.UploadableMap, + operation: OperationSelector; + optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater; + optimisticResponse?: object; + updater?: RelayCommonTypes.SelectorStoreUpdater; + uploadables?: RelayCommonTypes.UploadableMap; }): RelayObservable; } // ~~~~~~~~~~~~~~~~~~~~~ // RelayInMemoryRecordSource // ~~~~~~~~~~~~~~~~~~~~~ - interface Record { [key: string]: any; } - interface RecordMap { [dataID: string]: Record | null | undefined; } + interface Record { + [key: string]: any; + } + interface RecordMap { + [dataID: string]: Record | null | undefined; + } // ~~~~~~~~~~~~~~~~~~~~~ // Network @@ -772,7 +741,10 @@ export namespace RelayRuntimeTypes { * Creates an implementation of the `Network` interface defined in * `RelayNetworkTypes` given `fetch` and `subscribe` functions. */ - static create(fetchFn: typeof RelayCommonTypes.FetchFunction, subscribeFn?: RelayCommonTypes.SubscribeFunction): RelayNetwork; + static create( + fetchFn: typeof RelayCommonTypes.FetchFunction, + subscribeFn?: RelayCommonTypes.SubscribeFunction + ): RelayNetwork; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -784,12 +756,9 @@ export namespace RelayRuntimeTypes { delete(dataID: RelayCommonTypes.DataID): void; get(dataID: RelayCommonTypes.DataID): Record | void; getRecordIDs(): RelayCommonTypes.DataID[]; - getStatus(dataID: RelayCommonTypes.DataID): 'EXISTENT' | 'NONEXISTENT' | 'UNKNOWN'; + getStatus(dataID: RelayCommonTypes.DataID): "EXISTENT" | "NONEXISTENT" | "UNKNOWN"; has(dataID: RelayCommonTypes.DataID): boolean; - load( - dataID: RelayCommonTypes.DataID, - callback: (error: Error | null, record: Record | null) => void, - ): void; + load(dataID: RelayCommonTypes.DataID, callback: (error: Error | null, record: Record | null) => void): void; remove(dataID: RelayCommonTypes.DataID): void; set(dataID: RelayCommonTypes.DataID, record: Record): void; size(): number; @@ -807,10 +776,7 @@ export namespace RelayRuntimeTypes { lookup(selector: Selector): Snapshot; notify(): void; publish(source: RecordSource): void; - subscribe( - snapshot: Snapshot, - callback: (snapshot: Snapshot) => void, - ): RelayCommonTypes.Disposable; + subscribe(snapshot: Snapshot, callback: (snapshot: Snapshot) => void): RelayCommonTypes.Disposable; } // ~~~~~~~~~~~~~~~~~~~~~ @@ -955,7 +921,9 @@ export namespace RelayRuntimeTypes { * legacy Relay observer and directly return an Observable instead. */ static fromLegacy( - callback: (legacyObserver: RelayCommonTypes.LegacyObserver) => RelayCommonTypes.Disposable | RelayObservable, + callback: ( + legacyObserver: RelayCommonTypes.LegacyObserver + ) => RelayCommonTypes.Disposable | RelayObservable ): RelayObservable; /** @@ -1036,10 +1004,7 @@ export namespace RelayRuntimeTypes { // commitLocalUpdate // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly - type commitLocalUpdate = ( - environment: Environment, - updater: RelayCommonTypes.StoreUpdater, - ) => void; + type commitLocalUpdate = (environment: Environment, updater: RelayCommonTypes.StoreUpdater) => void; // ~~~~~~~~~~~~~~~~~~~~~ // commitRelayModernMutation @@ -1058,7 +1023,7 @@ export namespace RelayRuntimeTypes { } function commitRelayModernMutation( environment: Environment, - config: MutationConfig, + config: MutationConfig ): RelayCommonTypes.Disposable; // ~~~~~~~~~~~~~~~~~~~~~ @@ -1094,7 +1059,7 @@ export namespace RelayRuntimeTypes { environment: any, // FIXME - $FlowFixMe in facebook source code taggedNode: RelayCommonTypes.GraphQLTaggedNode, variables: RelayCommonTypes.Variables, - cacheConfig?: RelayCommonTypes.CacheConfig, + cacheConfig?: RelayCommonTypes.CacheConfig ): Promise; // FIXME - $FlowFixMe in facebook source code // ~~~~~~~~~~~~~~~~~~~~~ @@ -1112,7 +1077,7 @@ export namespace RelayRuntimeTypes { } function requestRelaySubscription( environment: Environment, - config: GraphQLSubscriptionConfig, + config: GraphQLSubscriptionConfig ): RelayCommonTypes.Disposable; } diff --git a/types/relay-runtime/relay-runtime-tests.tsx b/types/relay-runtime/relay-runtime-tests.tsx index c6dd9c15a2..f786e4d5fa 100644 --- a/types/relay-runtime/relay-runtime-tests.tsx +++ b/types/relay-runtime/relay-runtime-tests.tsx @@ -1,11 +1,4 @@ -import { - Environment, - Network, - RecordSource, - Store, - ConnectionHandler, - ViewerHandler, -} from 'relay-runtime'; +import { Environment, Network, RecordSource, Store, ConnectionHandler, ViewerHandler } from "relay-runtime"; const source = new RecordSource(); const store = new Store(source); @@ -15,13 +8,9 @@ const store = new Store(source); // ~~~~~~~~~~~~~~~~~~~~~ // Define a function that fetches the results of an operation (query/mutation/etc) // and returns its results as a Promise: -function fetchQuery( - operation: any, - variables: { [key: string]: string }, - cacheConfig: {}, -) { - return fetch('/graphql', { - method: 'POST', +function fetchQuery(operation: any, variables: { [key: string]: string }, cacheConfig: {}) { + return fetch("/graphql", { + method: "POST", body: JSON.stringify({ query: operation.text, // GraphQL text from input variables, @@ -50,10 +39,10 @@ const environment = new Environment({ function handlerProvider(handle: any) { switch (handle) { // Augment (or remove from) this list: - case 'connection': return ConnectionHandler; - case 'viewer': return ViewerHandler; + case "connection": + return ConnectionHandler; + case "viewer": + return ViewerHandler; } - throw new Error( - `handlerProvider: No handler provided for ${handle}` - ); + throw new Error(`handlerProvider: No handler provided for ${handle}`); } From bafb5407cb8d37c6c8d34af91a0e546545726dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 11 Oct 2017 15:56:18 +0200 Subject: [PATCH 030/314] [Relay] Fix dtslint issues with test files. --- types/react-relay/{ => test}/react-relay-classic-tests.tsx | 0 types/react-relay/{ => test}/react-relay-tests.tsx | 0 types/react-relay/tsconfig.json | 6 +++--- 3 files changed, 3 insertions(+), 3 deletions(-) rename types/react-relay/{ => test}/react-relay-classic-tests.tsx (100%) rename types/react-relay/{ => test}/react-relay-tests.tsx (100%) diff --git a/types/react-relay/react-relay-classic-tests.tsx b/types/react-relay/test/react-relay-classic-tests.tsx similarity index 100% rename from types/react-relay/react-relay-classic-tests.tsx rename to types/react-relay/test/react-relay-classic-tests.tsx diff --git a/types/react-relay/react-relay-tests.tsx b/types/react-relay/test/react-relay-tests.tsx similarity index 100% rename from types/react-relay/react-relay-tests.tsx rename to types/react-relay/test/react-relay-tests.tsx diff --git a/types/react-relay/tsconfig.json b/types/react-relay/tsconfig.json index 5447ff74ca..2b992f91c8 100644 --- a/types/react-relay/tsconfig.json +++ b/types/react-relay/tsconfig.json @@ -19,10 +19,10 @@ }, "files": [ "index.d.ts", - "react-relay-tests.tsx", - "react-relay-classic-tests.tsx", "classic.d.ts", "modern.d.ts", - "compat.d.ts" + "compat.d.ts", + "test/react-relay-tests.tsx", + "test/react-relay-classic-tests.tsx" ] } From 339eadd3e10e9f6b40461c573cc2e32572ed863e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 11 Oct 2017 15:56:44 +0200 Subject: [PATCH 031/314] [Relay] Fix namespace reference. --- types/relay-runtime/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 88abec0a9b..5b1554e929 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -90,7 +90,7 @@ export namespace RelayCommonTypes { variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap - ): Runtime.ObservableFromValue; + ): RelayRuntimeTypes.ObservableFromValue; /** * A function that executes a GraphQL subscription operation, returning one or @@ -104,7 +104,7 @@ export namespace RelayCommonTypes { variables: Variables, cacheConfig: CacheConfig, observer: LegacyObserver - ) => Runtime.RelayObservable | Disposable; + ) => RelayRuntimeTypes.RelayObservable | Disposable; // ~~~~~~~~~~~~~~~~~~~~~ // RelayStoreTypes From 3439a2d7a179616f834cc5bcf6d377a7f998358d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 11 Oct 2017 15:59:12 +0200 Subject: [PATCH 032/314] [Relay] Add myself to list of maintainers. --- types/react-relay/index.d.ts | 4 +++- types/relay-runtime/index.d.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 30cb29b3e3..cdb38afae6 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for react-relay 1.3 // Project: https://github.com/facebook/relay -// Definitions by: Johannes Schickling , Matt Martin +// Definitions by: Johannes Schickling +// Matt Martin +// Eloy Durán // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 5b1554e929..a4867b4091 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for relay-runtime 1.3 // Project: https://github.com/facebook/relay // Definitions by: Matt Martin +// Eloy Durán // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 From 091c46291e8635c31ed0e26ac24accd1d9697e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 11 Oct 2017 16:23:14 +0200 Subject: [PATCH 033/314] [Relay] Add generics for `getConnectionFromProps`. --- types/react-relay/modern.d.ts | 6 +++--- types/react-relay/test/react-relay-tests.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-relay/modern.d.ts b/types/react-relay/modern.d.ts index 13b43bf449..d4c422b823 100644 --- a/types/react-relay/modern.d.ts +++ b/types/react-relay/modern.d.ts @@ -105,9 +105,9 @@ export function FragmentVariablesGetter( prevVars: RelayCommonTypes.Variables, totalCount: number ): RelayCommonTypes.Variables; -export interface ConnectionConfig { +export interface ConnectionConfig { direction?: "backward" | "forward"; - getConnectionFromProps?(props: object): ConnectionData | undefined | null; + getConnectionFromProps?(props: T): ConnectionData | undefined | null; getFragmentVariables?: typeof FragmentVariablesGetter; getVariables( props: { [propName: string]: any }, @@ -119,7 +119,7 @@ export interface ConnectionConfig { export function createPaginationContainer( Component: ReactBaseComponent, fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - connectionConfig: ConnectionConfig + connectionConfig: ConnectionConfig ): ReactBaseComponent; // ~~~~~~~~~~~~~~~~~~~~~ diff --git a/types/react-relay/test/react-relay-tests.tsx b/types/react-relay/test/react-relay-tests.tsx index 97cc5d47d9..c7d144122b 100644 --- a/types/react-relay/test/react-relay-tests.tsx +++ b/types/react-relay/test/react-relay-tests.tsx @@ -182,7 +182,7 @@ const FeedPaginationContainer = createPaginationContainer( }, { direction: "forward", - getConnectionFromProps(props: { user: { feed: any } }) { + getConnectionFromProps(props) { return props.user && props.user.feed; }, getFragmentVariables(prevVars, totalCount) { From 08f193a6941ad3b3fbf701a63f0425930e6f9e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 12 Oct 2017 00:46:10 +0200 Subject: [PATCH 034/314] [Relay] Return `null` instead of `void` for Flow Maybe types. --- types/react-relay/test/react-relay-tests.tsx | 6 ++++ types/relay-runtime/index.d.ts | 30 ++++++++++---------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/types/react-relay/test/react-relay-tests.tsx b/types/react-relay/test/react-relay-tests.tsx index c7d144122b..80380122f7 100644 --- a/types/react-relay/test/react-relay-tests.tsx +++ b/types/react-relay/test/react-relay-tests.tsx @@ -279,6 +279,12 @@ function markNotificationAsRead(source: string, storyID: string) { console.log("Response received from server."); }, onError: err => console.error(err), + updater: (store, data) => { + const field = store.get(storyID); + if (field) { + field.setValue(data.story, "story"); + } + } }); } diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index a4867b4091..69f5088ab4 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -137,17 +137,17 @@ export namespace RelayCommonTypes { interface RecordSourceSelectorProxy { create(dataID: DataID, typeName: string): RecordProxy; delete(dataID: DataID): void; - get(dataID: DataID): RecordProxy | void; + get(dataID: DataID): RecordProxy | null; getRoot(): RecordProxy; - getRootField(fieldName: string): RecordProxy | void; - getPluralRootField(fieldName: string): RecordProxy[] | void; + getRootField(fieldName: string): RecordProxy | null; + getPluralRootField(fieldName: string): RecordProxy[] | null; } interface RecordProxy { copyFieldsFrom(source: RecordProxy): void; getDataID(): DataID; - getLinkedRecord(name: string, args?: Variables): RecordProxy | void; - getLinkedRecords(name: string, args?: Variables): Array | void; + getLinkedRecord(name: string, args?: Variables): RecordProxy | null; + getLinkedRecords(name: string, args?: Variables): Array | null; getOrCreateLinkedRecord(name: string, typeName: string, args?: Variables): RecordProxy; getType(): string; getValue(name: string, args?: Variables): any; @@ -163,7 +163,7 @@ export namespace RelayCommonTypes { interface RecordSourceProxy { create(dataID: DataID, typeName: string): RecordProxy; delete(dataID: DataID): void; - get(dataID: DataID): Array | void; + get(dataID: DataID): Array | null; getRoot(): RecordProxy; } @@ -457,7 +457,7 @@ export namespace RelayCommonTypes { * const childData = environment.lookup(childSelector).data; * ``` */ - getSelector(operationVariables: Variables, fragment: TFragment, prop: any): CSelector | void; + getSelector(operationVariables: Variables, fragment: TFragment, prop: any): CSelector | null; /** * Given the result `items` from a parent that fetched `fragment`, creates a @@ -469,7 +469,7 @@ export namespace RelayCommonTypes { operationVariables: Variables, fragment: TFragment, props: any[] - ): Array> | void; + ): Array> | null; /** * Given a mapping of keys -> results and a mapping of keys -> fragments, @@ -590,8 +590,8 @@ export namespace RelayCommonTypes { } ) => void; interface NetworkLayer { - sendMutation(request: RelayMutationRequest): Promise | void; - sendQueries(requests: RelayQueryRequest[]): Promise | void; + sendMutation(request: RelayMutationRequest): Promise | null; + sendQueries(requests: RelayQueryRequest[]): Promise | null; supports(...options: string[]): boolean; } interface QueryResult { @@ -681,7 +681,7 @@ export namespace RelayRuntimeTypes { // ~~~~~~~~~~~~~~~~~~~~~ // RelayDefaultHandlerProvider // ~~~~~~~~~~~~~~~~~~~~~ - function HandlerProvider(name: string): typeof RelayCommonTypes.Handler | void; + function HandlerProvider(name: string): typeof RelayCommonTypes.Handler | null; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernEnvironment @@ -755,7 +755,7 @@ export namespace RelayRuntimeTypes { constructor(records?: RecordMap); clear(): void; delete(dataID: RelayCommonTypes.DataID): void; - get(dataID: RelayCommonTypes.DataID): Record | void; + get(dataID: RelayCommonTypes.DataID): Record | null; getRecordIDs(): RelayCommonTypes.DataID[]; getStatus(dataID: RelayCommonTypes.DataID): "EXISTENT" | "NONEXISTENT" | "UNKNOWN"; has(dataID: RelayCommonTypes.DataID): boolean; @@ -833,14 +833,14 @@ export namespace RelayRuntimeTypes { * value is another Record instead of a scalar). May throw if the field is * present but not a scalar linked record. */ - getLinkedRecord(name: string, args?: RelayCommonTypes.Variables): RecordInspector | void; + getLinkedRecord(name: string, args?: RelayCommonTypes.Variables): RecordInspector | null; /** * Returns an array of inspectors for the given plural "linked" field (a field * whose value is an array of Records instead of a scalar). May throw if the * field is present but not a plural linked record. */ - getLinkedRecords(name: string, args?: RelayCommonTypes.Variables): RecordInspector[] | void; + getLinkedRecords(name: string, args?: RelayCommonTypes.Variables): RecordInspector[] | null; } class RelayRecordSourceInspector { @@ -850,7 +850,7 @@ export namespace RelayRuntimeTypes { * Returns an inspector for the record with the given id, or null/undefined if * that record is deleted/unfetched. */ - get(dataID: RelayCommonTypes.DataID): RecordInspector | void; + get(dataID: RelayCommonTypes.DataID): RecordInspector | null; /** * Returns a list of ": " for each record in the store that has an * `id`. From 95479db2fd29ddc5504b490151b51bf6bac26f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 18 Oct 2017 00:15:58 +0200 Subject: [PATCH 035/314] [Relay] Simplify modules by removing namespaces. --- types/react-relay/classic.d.ts | 18 +- types/react-relay/compat.d.ts | 25 +- types/react-relay/index.d.ts | 165 +- types/react-relay/modern.d.ts | 146 -- types/react-relay/test/react-relay-tests.tsx | 7 +- types/react-relay/tsconfig.json | 1 - types/relay-runtime/index.d.ts | 2115 +++++++++--------- 7 files changed, 1216 insertions(+), 1261 deletions(-) delete mode 100644 types/react-relay/modern.d.ts diff --git a/types/react-relay/classic.d.ts b/types/react-relay/classic.d.ts index 9345199d27..0db5308975 100644 --- a/types/react-relay/classic.d.ts +++ b/types/react-relay/classic.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -import { RelayCommonTypes } from "relay-runtime"; +import * as RelayRuntimeTypes from "relay-runtime"; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix @@ -20,24 +20,24 @@ export interface FragmentResolver { dispose(): void; resolve( fragment: RelayQuery["Fragment"], - dataIDs: RelayCommonTypes.DataID | RelayCommonTypes.DataID[] + dataIDs: RelayRuntimeTypes.DataID | RelayRuntimeTypes.DataID[] ): StoreReaderData | StoreReaderData[] | undefined | null; } export interface RelayEnvironmentInterface { forceFetch( - querySet: RelayCommonTypes.RelayQuerySet, - onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback - ): RelayCommonTypes.Abortable; + querySet: RelayRuntimeTypes.RelayQuerySet, + onReadyStateChange: RelayRuntimeTypes.ReadyStateChangeCallback + ): RelayRuntimeTypes.Abortable; getFragmentResolver(fragment: RelayQuery["Fragment"], onNext: () => void): FragmentResolver; getStoreData(): RelayStoreData; primeCache( - querySet: RelayCommonTypes.RelayQuerySet, - onReadyStateChange: RelayCommonTypes.ReadyStateChangeCallback - ): RelayCommonTypes.Abortable; + querySet: RelayRuntimeTypes.RelayQuerySet, + onReadyStateChange: RelayRuntimeTypes.ReadyStateChangeCallback + ): RelayRuntimeTypes.Abortable; read( node: RelayQuery["Node"], - dataID: RelayCommonTypes.DataID, + dataID: RelayRuntimeTypes.DataID, options?: StoreReaderOptions ): StoreReaderData | void; readQuery(root: RelayQuery["Root"], options?: StoreReaderOptions): StoreReaderData[] | void; diff --git a/types/react-relay/compat.d.ts b/types/react-relay/compat.d.ts index 74f7f55a03..bbc69a3cc4 100644 --- a/types/react-relay/compat.d.ts +++ b/types/react-relay/compat.d.ts @@ -1,6 +1,15 @@ -import { RelayRuntimeTypes, RelayCommonTypes } from "relay-runtime"; +export { + QueryRenderer, + commitMutation, + createFragmentContainer, + createPaginationContainer, + createRefetchContainer, + fetchQuery, + graphql, +} from "react-relay"; + +import * as RelayRuntimeTypes from "relay-runtime"; import { RelayEnvironmentInterface } from "react-relay/classic"; -import {} from "react-relay/modern"; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix @@ -13,7 +22,7 @@ type ConcreteOperationDefinition = object; // ~~~~~~~~~~~~~~~~~~~~~ // Util // ~~~~~~~~~~~~~~~~~~~~~ -export function getFragment(q: string, v?: RelayCommonTypes.Variables): string; +export function getFragment(q: string, v?: RelayRuntimeTypes.Variables): string; export interface ComponentWithFragment extends React.ComponentClass { getFragment: typeof getFragment; } @@ -35,25 +44,25 @@ export type CompatEnvironment = RelayRuntimeTypes.Environment | RelayClassicEnvi export function commitUpdate( environment: CompatEnvironment, config: RelayRuntimeTypes.MutationConfig -): RelayCommonTypes.Disposable; +): RelayRuntimeTypes.Disposable; export function applyUpdate( environment: CompatEnvironment, config: RelayRuntimeTypes.OptimisticMutationConfig -): RelayCommonTypes.Disposable; +): RelayRuntimeTypes.Disposable; // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatContainer // ~~~~~~~~~~~~~~~~~~~~~ export interface GeneratedNodeMap { - [key: string]: RelayCommonTypes.GraphQLTaggedNode; + [key: string]: RelayRuntimeTypes.GraphQLTaggedNode; } export function createContainer( Component: ReactBaseComponent, - fragmentSpec: RelayCommonTypes.GraphQLTaggedNode | GeneratedNodeMap + fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap ): ReactFragmentComponent; // ~~~~~~~~~~~~~~~~~~~~~ // injectDefaultVariablesProvider // ~~~~~~~~~~~~~~~~~~~~~ -export type VariablesProvider = () => RelayCommonTypes.Variables; +export type VariablesProvider = () => RelayRuntimeTypes.Variables; export function injectDefaultVariablesProvider(variablesProvider: VariablesProvider): void; diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index cdb38afae6..fa23ac4dd7 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -6,20 +6,157 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import { RelayRuntimeTypes } from "relay-runtime"; -import * as ReactRelayModernTypes from "react-relay/modern"; +export { + commitLocalUpdate, + commitRelayModernMutation as commitMutation, + fetchRelayModernQuery as fetchQuery, + requestRelaySubscription as requestSubscription, +} from "relay-runtime"; + +import * as React from "react"; +import * as RelayRuntimeTypes from "relay-runtime"; // ~~~~~~~~~~~~~~~~~~~~~ -// React-Relay Modern +// Maybe Fix // ~~~~~~~~~~~~~~~~~~~~~ -export import QueryRenderer = ReactRelayModernTypes.ReactRelayQueryRenderer; -export import createFragmentContainer = ReactRelayModernTypes.createFragmentContainer; -export import createPaginationContainer = ReactRelayModernTypes.createPaginationContainer; -export import createRefetchContainer = ReactRelayModernTypes.createRefetchContainer; -export import graphql = ReactRelayModernTypes.graphql; -export import commitLocalUpdate = RelayRuntimeTypes.commitLocalUpdate; -export import commitMutation = RelayRuntimeTypes.commitRelayModernMutation; -export import fetchQuery = RelayRuntimeTypes.fetchRelayModernQuery; -export import requestSubscription = RelayRuntimeTypes.requestRelaySubscription; -// exported for convenience -export import ModernTypes = ReactRelayModernTypes; +type ConcreteFragment = any; +type ConcreteBatch = any; +type ConcreteFragmentDefinition = object; +type ConcreteOperationDefinition = object; +type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayProp +// ~~~~~~~~~~~~~~~~~~~~~ +// note: refetch and pagination containers augment this +export interface RelayProp { + environment: RelayRuntimeTypes.Environment; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayQL +// ~~~~~~~~~~~~~~~~~~~~~ +export function RelayQL(strings: string[], ...substitutions: any[]): RelayRuntimeTypes.RelayConcreteNode; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayModernGraphQLTag +// ~~~~~~~~~~~~~~~~~~~~~ +export interface GeneratedNodeMap { + [key: string]: GraphQLTaggedNode; +} +export type GraphQLTaggedNode = + | (() => ConcreteFragment | ConcreteBatch) + | { + modern(): ConcreteFragment | ConcreteBatch; + classic(relayQL: typeof RelayQL): ConcreteFragmentDefinition | ConcreteOperationDefinition; + }; +/** + * Runtime function to correspond to the `graphql` tagged template function. + * All calls to this function should be transformed by the plugin. + */ +export interface GraphqlInterface { + (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; + experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; +} +export const graphql: GraphqlInterface; + +// ~~~~~~~~~~~~~~~~~~~~~ +// ReactRelayQueryRenderer +// ~~~~~~~~~~~~~~~~~~~~~ +export interface QueryRendererProps { + cacheConfig?: RelayRuntimeTypes.CacheConfig; + environment: RelayRuntimeTypes.Environment; + query: GraphQLTaggedNode; + render(readyState: ReadyState): React.ReactElement | undefined | null; + variables: RelayRuntimeTypes.Variables; + rerunParamExperimental?: RelayRuntimeTypes.RerunParam; +} +export interface ReadyState { + error: Error | undefined | null; + props: { [propName: string]: any } | undefined | null; + retry?(): void; +} +export interface QueryRendererState { + readyState: ReadyState; +} +export class ReactRelayQueryRenderer extends React.Component {} +export class QueryRenderer extends ReactRelayQueryRenderer {} + +// ~~~~~~~~~~~~~~~~~~~~~ +// createFragmentContainer +// ~~~~~~~~~~~~~~~~~~~~~ +export function createFragmentContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap +): ReactBaseComponent; + +// ~~~~~~~~~~~~~~~~~~~~~ +// createPaginationContainer +// ~~~~~~~~~~~~~~~~~~~~~ +export interface PageInfo { + endCursor: string | undefined | null; + hasNextPage: boolean; + hasPreviousPage: boolean; + startCursor: string | undefined | null; +} +export interface ConnectionData { + edges?: any[]; + pageInfo?: PageInfo; +} +export type RelayPaginationProp = RelayProp & { + hasMore(): boolean; + isLoading(): boolean; + loadMore( + pageSize: number, + callback: (error?: Error) => void, + options?: RefetchOptions + ): RelayRuntimeTypes.Disposable | undefined | null; + refetchConnection( + totalCount: number, + callback: (error?: Error) => void, + refetchVariables?: RelayRuntimeTypes.Variables + ): RelayRuntimeTypes.Disposable | undefined | null; +}; +export function FragmentVariablesGetter( + prevVars: RelayRuntimeTypes.Variables, + totalCount: number +): RelayRuntimeTypes.Variables; +export interface ConnectionConfig { + direction?: "backward" | "forward"; + getConnectionFromProps?(props: T): ConnectionData | undefined | null; + getFragmentVariables?: typeof FragmentVariablesGetter; + getVariables( + props: { [propName: string]: any }, + paginationInfo: { count: number; cursor?: string }, + fragmentVariables: RelayRuntimeTypes.Variables + ): RelayRuntimeTypes.Variables; + query: GraphQLTaggedNode; +} +export function createPaginationContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + connectionConfig: ConnectionConfig +): ReactBaseComponent; + +// ~~~~~~~~~~~~~~~~~~~~~ +// createFragmentContainer +// ~~~~~~~~~~~~~~~~~~~~~ +export interface RefetchOptions { + force?: boolean; + rerunParamExperimental?: RelayRuntimeTypes.RerunParam; +} +export type RelayRefetchProp = RelayProp & { + refetch( + refetchVariables: + | RelayRuntimeTypes.Variables + | ((fragmentVariables: RelayRuntimeTypes.Variables) => RelayRuntimeTypes.Variables), + renderVariables?: RelayRuntimeTypes.Variables, + callback?: (error?: Error) => void, + options?: RefetchOptions + ): RelayRuntimeTypes.Disposable; +}; +export function createRefetchContainer( + Component: ReactBaseComponent, + fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + taggedNode: GraphQLTaggedNode +): ReactBaseComponent; diff --git a/types/react-relay/modern.d.ts b/types/react-relay/modern.d.ts deleted file mode 100644 index d4c422b823..0000000000 --- a/types/react-relay/modern.d.ts +++ /dev/null @@ -1,146 +0,0 @@ -import * as React from "react"; -import { RelayCommonTypes, RelayRuntimeTypes } from "relay-runtime"; - -// ~~~~~~~~~~~~~~~~~~~~~ -// Maybe Fix -// ~~~~~~~~~~~~~~~~~~~~~ -type ConcreteFragment = any; -type ConcreteBatch = any; -type ConcreteFragmentDefinition = object; -type ConcreteOperationDefinition = object; -type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; - -// ~~~~~~~~~~~~~~~~~~~~~ -// RelayProp -// ~~~~~~~~~~~~~~~~~~~~~ -// note: refetch and pagination containers augment this -export interface RelayProp { - environment: RelayRuntimeTypes.Environment; -} - -// ~~~~~~~~~~~~~~~~~~~~~ -// RelayQL -// ~~~~~~~~~~~~~~~~~~~~~ -export function RelayQL(strings: string[], ...substitutions: any[]): RelayCommonTypes.RelayConcreteNode; - -// ~~~~~~~~~~~~~~~~~~~~~ -// RelayModernGraphQLTag -// ~~~~~~~~~~~~~~~~~~~~~ -export interface GeneratedNodeMap { - [key: string]: GraphQLTaggedNode; -} -export type GraphQLTaggedNode = - | (() => ConcreteFragment | ConcreteBatch) - | { - modern(): ConcreteFragment | ConcreteBatch; - classic(relayQL: typeof RelayQL): ConcreteFragmentDefinition | ConcreteOperationDefinition; - }; -/** - * Runtime function to correspond to the `graphql` tagged template function. - * All calls to this function should be transformed by the plugin. - */ -export interface GraphqlInterface { - (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; - experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; -} -export const graphql: GraphqlInterface; - -// ~~~~~~~~~~~~~~~~~~~~~ -// ReactRelayQueryRenderer -// ~~~~~~~~~~~~~~~~~~~~~ -export interface QueryRendererProps { - cacheConfig?: RelayCommonTypes.CacheConfig; - environment: RelayRuntimeTypes.Environment; - query: GraphQLTaggedNode; - render(readyState: ReadyState): React.ReactElement | undefined | null; - variables: RelayCommonTypes.Variables; - rerunParamExperimental?: RelayCommonTypes.RerunParam; -} -export interface ReadyState { - error: Error | undefined | null; - props: { [propName: string]: any } | undefined | null; - retry?(): void; -} -export interface QueryRendererState { - readyState: ReadyState; -} -export class ReactRelayQueryRenderer extends React.Component {} - -// ~~~~~~~~~~~~~~~~~~~~~ -// createFragmentContainer -// ~~~~~~~~~~~~~~~~~~~~~ -export function createFragmentContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap -): ReactBaseComponent; - -// ~~~~~~~~~~~~~~~~~~~~~ -// createPaginationContainer -// ~~~~~~~~~~~~~~~~~~~~~ -export interface PageInfo { - endCursor: string | undefined | null; - hasNextPage: boolean; - hasPreviousPage: boolean; - startCursor: string | undefined | null; -} -export interface ConnectionData { - edges?: any[]; - pageInfo?: PageInfo; -} -export type RelayPaginationProp = RelayProp & { - hasMore(): boolean; - isLoading(): boolean; - loadMore( - pageSize: number, - callback: (error?: Error) => void, - options?: RefetchOptions - ): RelayCommonTypes.Disposable | undefined | null; - refetchConnection( - totalCount: number, - callback: (error?: Error) => void, - refetchVariables?: RelayCommonTypes.Variables - ): RelayCommonTypes.Disposable | undefined | null; -}; -export function FragmentVariablesGetter( - prevVars: RelayCommonTypes.Variables, - totalCount: number -): RelayCommonTypes.Variables; -export interface ConnectionConfig { - direction?: "backward" | "forward"; - getConnectionFromProps?(props: T): ConnectionData | undefined | null; - getFragmentVariables?: typeof FragmentVariablesGetter; - getVariables( - props: { [propName: string]: any }, - paginationInfo: { count: number; cursor?: string }, - fragmentVariables: RelayCommonTypes.Variables - ): RelayCommonTypes.Variables; - query: GraphQLTaggedNode; -} -export function createPaginationContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - connectionConfig: ConnectionConfig -): ReactBaseComponent; - -// ~~~~~~~~~~~~~~~~~~~~~ -// createFragmentContainer -// ~~~~~~~~~~~~~~~~~~~~~ -export interface RefetchOptions { - force?: boolean; - rerunParamExperimental?: RelayCommonTypes.RerunParam; -} -export type RelayRefetchProp = RelayProp & { - refetch( - refetchVariables: - | RelayCommonTypes.Variables - | ((fragmentVariables: RelayCommonTypes.Variables) => RelayCommonTypes.Variables), - renderVariables?: RelayCommonTypes.Variables, - callback?: (error?: Error) => void, - options?: RefetchOptions - ): RelayCommonTypes.Disposable; -}; -export function createRefetchContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - taggedNode: GraphQLTaggedNode -): ReactBaseComponent; diff --git a/types/react-relay/test/react-relay-tests.tsx b/types/react-relay/test/react-relay-tests.tsx index 80380122f7..6caf997dba 100644 --- a/types/react-relay/test/react-relay-tests.tsx +++ b/types/react-relay/test/react-relay-tests.tsx @@ -12,7 +12,8 @@ import { createRefetchContainer, requestSubscription, QueryRenderer, - ModernTypes, + RelayRefetchProp, + RelayPaginationProp } from "react-relay"; // ~~~~~~~~~~~~~~~~~~~~~ @@ -79,7 +80,7 @@ interface StoryInterface { id: string; } interface FeedStoriesProps { - relay: ModernTypes.RelayRefetchProp; + relay: RelayRefetchProp; feed: { stories: { edges: Array<{ node: StoryInterface }> }; }; @@ -134,7 +135,7 @@ const FeedRefetchContainer = createRefetchContainer( // ~~~~~~~~~~~~~~~~~~~~~ interface FeedProps { user: { feed: { edges: Array<{ node: StoryInterface }> } }; - relay: ModernTypes.RelayPaginationProp; + relay: RelayPaginationProp; } class Feed extends React.Component { render() { diff --git a/types/react-relay/tsconfig.json b/types/react-relay/tsconfig.json index 2b992f91c8..ef2af0375f 100644 --- a/types/react-relay/tsconfig.json +++ b/types/react-relay/tsconfig.json @@ -20,7 +20,6 @@ "files": [ "index.d.ts", "classic.d.ts", - "modern.d.ts", "compat.d.ts", "test/react-relay-tests.tsx", "test/react-relay-classic-tests.tsx" diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 69f5088ab4..bbc3e07a7a 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -5,1092 +5,1047 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -// note: namespace is used so react-relay can access and inter-op -export namespace RelayCommonTypes { - /** - * SOURCE: - * Relay 1.3.0 - * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js - */ - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type RelayConcreteNode = any; - type RelayMutationTransaction = any; - type RelayMutationRequest = any; - type RelayQueryRequest = any; - type ConcreteFragment = any; - type ConcreteBatch = any; - type ConcreteFragmentDefinition = object; - type ConcreteOperationDefinition = object; +/** + * SOURCE: + * Relay 1.3.0 + * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js + */ +// ~~~~~~~~~~~~~~~~~~~~~ +// Maybe Fix +// ~~~~~~~~~~~~~~~~~~~~~ +type RelayConcreteNode = any; +type RelayMutationTransaction = any; +type RelayMutationRequest = any; +type RelayQueryRequest = any; +type ConcreteFragment = any; +type ConcreteBatch = any; +type ConcreteFragmentDefinition = object; +type ConcreteOperationDefinition = object; - /** - * FIXME: RelayContainer used to be typed with ReactClass, but - * ReactClass is broken and allows for access to any property. For example - * ReactClass.getFragment('foo') is valid even though ReactClass has no - * such getFragment() type definition. When ReactClass is fixed this causes a - * lot of errors in Relay code since methods like getFragment() are used often - * but have no definition in Relay's types. Suppressing for now. - */ - type RelayContainer = any; +/** + * FIXME: RelayContainer used to be typed with ReactClass, but + * ReactClass is broken and allows for access to any property. For example + * ReactClass.getFragment('foo') is valid even though ReactClass has no + * such getFragment() type definition. When ReactClass is fixed this causes a + * lot of errors in Relay code since methods like getFragment() are used often + * but have no definition in Relay's types. Suppressing for now. + */ +type RelayContainer = any; - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayQL - // ~~~~~~~~~~~~~~~~~~~~~ - type RelayQL = (strings: string[], ...substitutions: any[]) => RelayConcreteNode; +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayQL +// ~~~~~~~~~~~~~~~~~~~~~ +type RelayQL = (strings: string[], ...substitutions: any[]) => RelayConcreteNode; - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayModernGraphQLTag - // ~~~~~~~~~~~~~~~~~~~~~ - interface GeneratedNodeMap { - [key: string]: GraphQLTaggedNode; - } - type GraphQLTaggedNode = - | (() => ConcreteFragment | ConcreteBatch) - | { - modern(): ConcreteFragment | ConcreteBatch; - classic(relayQL: RelayQL): ConcreteFragmentDefinition | ConcreteOperationDefinition; - }; - // ~~~~~~~~~~~~~~~~~~~~~ - // General Usage - // ~~~~~~~~~~~~~~~~~~~~~ - type DataID = string; - interface Variables { - [name: string]: any; - } - type Uploadable = File | Blob; - interface UploadableMap { - [key: string]: Uploadable; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayNetworkTypes - // Version: Relay 1.3.0 - // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js - // ~~~~~~~~~~~~~~~~~~~~~ - - interface LegacyObserver { - onCompleted?(): void; - onError?(error: Error): void; - onNext?(data: T): void; - } - interface PayloadError { - message: string; - locations?: Array<{ - line: number; - column: number; - }>; - } - /** - * A function that executes a GraphQL operation with request/response semantics. - * - * May return an Observable or Promise of a raw server response. - */ - function FetchFunction( - operation: ConcreteBatch, - variables: Variables, - cacheConfig: CacheConfig, - uploadables?: UploadableMap - ): RelayRuntimeTypes.ObservableFromValue; - - /** - * A function that executes a GraphQL subscription operation, returning one or - * more raw server responses over time. - * - * May return an Observable, otherwise must call the callbacks found in the - * fourth parameter. - */ - type SubscribeFunction = ( - operation: ConcreteBatch, - variables: Variables, - cacheConfig: CacheConfig, - observer: LegacyObserver - ) => RelayRuntimeTypes.RelayObservable | Disposable; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayStoreTypes - // Version: Relay 1.3.0 - // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/store/RelayStoreTypes.js - // ~~~~~~~~~~~~~~~~~~~~~ - /** - * A function that receives a proxy over the store and may trigger side-effects - * (indirectly) by calling `set*` methods on the store or its record proxies. - */ - type StoreUpdater = (store: RecordSourceProxy) => void; - - /** - * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in - * order to easily access the root fields of a query/mutation as well as a - * second argument of the response object of the mutation. - */ - type SelectorStoreUpdater = ( - store: RecordSourceSelectorProxy, - // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is - // inconvenient to access deeply in product code. - data: any // FLOW FIXME - ) => void; - - /** - * Extends the RecordSourceProxy interface with methods for accessing the root - * fields of a Selector. - */ - interface RecordSourceSelectorProxy { - create(dataID: DataID, typeName: string): RecordProxy; - delete(dataID: DataID): void; - get(dataID: DataID): RecordProxy | null; - getRoot(): RecordProxy; - getRootField(fieldName: string): RecordProxy | null; - getPluralRootField(fieldName: string): RecordProxy[] | null; - } - - interface RecordProxy { - copyFieldsFrom(source: RecordProxy): void; - getDataID(): DataID; - getLinkedRecord(name: string, args?: Variables): RecordProxy | null; - getLinkedRecords(name: string, args?: Variables): Array | null; - getOrCreateLinkedRecord(name: string, typeName: string, args?: Variables): RecordProxy; - getType(): string; - getValue(name: string, args?: Variables): any; - setLinkedRecord(record: RecordProxy, name: string, args?: Variables): RecordProxy; - setLinkedRecords( - records: Array | undefined | null, - name: string, - args?: Variables - ): RecordProxy; - setValue(value: any, name: string, args?: Variables): RecordProxy; - } - - interface RecordSourceProxy { - create(dataID: DataID, typeName: string): RecordProxy; - delete(dataID: DataID): void; - get(dataID: DataID): Array | null; - getRoot(): RecordProxy; - } - - interface HandleFieldPayload { - // The arguments that were fetched. - args: Variables; - // The __id of the record containing the source/handle field. - dataID: DataID; - // The (storage) key at which the original server data was written. - fieldKey: string; - // The name of the handle - handle: string; - // The (storage) key at which the handle's data should be written by the - // handler - handleKey: string; - } - interface HandlerInterface { - update(store: RecordSourceProxy, fieldPayload: HandleFieldPayload): void; - [functionName: string]: (...args: any[]) => any; - } - const Handler: HandlerInterface; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayCombinedEnvironmentTypes - // Version: Relay 1.3.0 - // File: https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js - // ~~~~~~~~~~~~~~~~~~~~~ - /** - * Settings for how a query response may be cached. - * - * - `force`: causes a query to be issued unconditionally, irrespective of the - * state of any configured response cache. - * - `poll`: causes a query to live update by polling at the specified interval - * in milliseconds. (This value will be passed to setTimeout.) - */ - interface CacheConfig { - force?: boolean; - poll?: number; - } - - /** - * Represents any resource that must be explicitly disposed of. The most common - * use-case is as a return value for subscriptions, where calling `dispose()` - * would cancel the subscription. - */ - interface Disposable { - dispose(): void; - } - - /** - * Arbitrary data e.g. received by a container as props. - */ - interface Props { - [key: string]: any; - } - - /* - * An individual cached graph object. - */ - interface Record { - [key: string]: any; - } - - /** - * A collection of records keyed by id. - */ - interface RecordMap { - [dataID: string]: Record | null | undefined; - } - - /** - * A selector defines the starting point for a traversal into the graph for the - * purposes of targeting a subgraph. - */ - interface CSelector { - dataID: DataID; - node: TNode; - variables: Variables; - } - - /** - * A representation of a selector and its results at a particular point in time. - */ - type CSnapshot = CSelector & { - data: SelectorData | null | undefined; - seenRecords: RecordMap; - }; - - /** - * The results of a selector given a store/RecordSource. - */ - interface SelectorData { - [key: string]: any; - } - - /** - * The results of reading the results of a FragmentMap given some input - * `Props`. - */ - interface FragmentSpecResults { - [key: string]: any; - } - - /** - * A utility for resolving and subscribing to the results of a fragment spec - * (key -> fragment mapping) given some "props" that determine the root ID - * and variables to use when reading each fragment. When props are changed via - * `setProps()`, the resolver will update its results and subscriptions - * accordingly. Internally, the resolver: - * - Converts the fragment map & props map into a map of `Selector`s. - * - Removes any resolvers for any props that became null. - * - Creates resolvers for any props that became non-null. - * - Updates resolvers with the latest props. - */ - interface FragmentSpecResolver { - /** - * Stop watching for changes to the results of the fragments. - */ - dispose(): void; - - /** - * Get the current results. - */ - resolve(): FragmentSpecResults; - - /** - * Update the resolver with new inputs. Call `resolve()` to get the updated - * results. - */ - setProps(props: Props): void; - - /** - * Override the variables used to read the results of the fragments. Call - * `resolve()` to get the updated results. - */ - setVariables(variables: Variables): void; - } - - interface CFragmentMap { - [key: string]: TFragment; - } - - /** - * An operation selector describes a specific instance of a GraphQL operation - * with variables applied. - * - * - `root`: a selector intended for processing server results or retaining - * response data in the store. - * - `fragment`: a selector intended for use in reading or subscribing to - * the results of the the operation. - */ - interface COperationSelector { - fragment: CSelector; - node: TOperation; - root: CSelector; - variables: Variables; - } - - /** - * The public API of Relay core. Represents an encapsulated environment with its - * own in-memory cache. - */ - interface CEnvironment { - /** - * Read the results of a selector from in-memory records in the store. - */ - lookup(selector: CSelector): CSnapshot; - - /** - * Subscribe to changes to the results of a selector. The callback is called - * when data has been committed to the store that would cause the results of - * the snapshot's selector to change. - */ - subscribe(snapshot: CSnapshot, callback: (snapshot: CSnapshot) => void): Disposable; - - /** - * Ensure that all the records necessary to fulfill the given selector are - * retained in-memory. The records will not be eligible for garbage collection - * until the returned reference is disposed. - * - * Note: This is a no-op in the classic core. - */ - retain(selector: CSelector): Disposable; - - /** - * Send a query to the server with request/response semantics: the query will - * either complete successfully (calling `onNext` and `onCompleted`) or fail - * (calling `onError`). - * - * Note: Most applications should use `streamQuery` in order to - * optionally receive updated information over time, should that feature be - * supported by the network/server. A good rule of thumb is to use this method - * if you would otherwise immediately dispose the `streamQuery()` - * after receving the first `onNext` result. - */ - sendQuery(config: { - cacheConfig?: CacheConfig; - onCompleted?(): void; - onError?(error: Error): void; - onNext?(payload: TPayload): void; - operation: COperationSelector; - }): Disposable; - - /** - * Send a query to the server with request/subscription semantics: one or more - * responses may be returned (via `onNext`) over time followed by either - * the request completing (`onCompleted`) or an error (`onError`). - * - * Networks/servers that support subscriptions may choose to hold the - * subscription open indefinitely such that `onCompleted` is not called. - */ - streamQuery(config: { - cacheConfig?: CacheConfig; - onCompleted?(): void; - onError?(error: Error): void; - onNext?(payload: TPayload): void; - operation: COperationSelector; - }): Disposable; - - unstable_internal: CUnstableEnvironmentCore; - } - - interface CUnstableEnvironmentCore { - /** - * Create an instance of a FragmentSpecResolver. - * - * TODO: The FragmentSpecResolver *can* be implemented via the other methods - * defined here, so this could be moved out of core. It's convenient to have - * separate implementations until the experimental core is in OSS. - */ - createFragmentSpecResolver( - context: CRelayContext, - containerName: string, - fragments: CFragmentMap, - props: Props, - callback: () => void - ): FragmentSpecResolver; - - /** - * Creates an instance of an OperationSelector given an operation definition - * (see `getOperation`) and the variables to apply. The input variables are - * filtered to exclude variables that do not matche defined arguments on the - * operation, and default values are populated for null values. - */ - createOperationSelector(operation: TOperation, variables: Variables): COperationSelector; - - /** - * Given a graphql`...` tagged template, extract a fragment definition usable - * by this version of Relay core. Throws if the value is not a fragment. - */ - getFragment(node: TGraphQLTaggedNode): TFragment; - - /** - * Given a graphql`...` tagged template, extract an operation definition - * usable by this version of Relay core. Throws if the value is not an - * operation. - */ - getOperation(node: TGraphQLTaggedNode): TOperation; - - /** - * Determine if two selectors are equal (represent the same selection). Note - * that this function returns `false` when the two queries/fragments are - * different objects, even if they select the same fields. - */ - areEqualSelectors(a: CSelector, b: CSelector): boolean; - - /** - * Given the result `item` from a parent that fetched `fragment`, creates a - * selector that can be used to read the results of that fragment for that item. - * - * Example: - * - * Given two fragments as follows: - * - * ``` - * fragment Parent on User { - * id - * ...Child - * } - * fragment Child on User { - * name - * } - * ``` - * - * And given some object `parent` that is the results of `Parent` for id "4", - * the results of `Child` can be accessed by first getting a selector and then - * using that selector to `lookup()` the results against the environment: - * - * ``` - * const childSelector = getSelector(queryVariables, Child, parent); - * const childData = environment.lookup(childSelector).data; - * ``` - */ - getSelector(operationVariables: Variables, fragment: TFragment, prop: any): CSelector | null; - - /** - * Given the result `items` from a parent that fetched `fragment`, creates a - * selector that can be used to read the results of that fragment on those - * items. This is similar to `getSelector` but for "plural" fragments that - * expect an array of results and therefore return an array of selectors. - */ - getSelectorList( - operationVariables: Variables, - fragment: TFragment, - props: any[] - ): Array> | null; - - /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts the selectors for those fragments from the results. - * - * The canonical use-case for this function are Relay Containers, which - * use this function to convert (props, fragments) into selectors so that they - * can read the results to pass to the inner component. - */ - getSelectorsFromObject( - operationVariables: Variables, - fragments: CFragmentMap, - props: Props - ): { [key: string]: CSelector | Array> | null | undefined }; - - /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts a mapping of keys -> id(s) of the results. - * - * Similar to `getSelectorsFromObject()`, this function can be useful in - * determining the "identity" of the props passed to a component. - */ - getDataIDsFromObject( - fragments: CFragmentMap, - props: Props - ): { [key: string]: DataID | DataID[] | null | undefined }; - - /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts the merged variables that would be in scope for those - * fragments/results. - * - * This can be useful in determing what varaibles were used to fetch the data - * for a Relay container, for example. - */ - getVariablesFromObject( - operationVariables: Variables, - fragments: CFragmentMap, - props: Props - ): Variables; - } - - /** - * The type of the `relay` property set on React context by the React/Relay - * integration layer (e.g. QueryRenderer, FragmentContainer, etc). - */ - interface CRelayContext { - environment: TEnvironment; - variables: Variables; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayTypes - /** - * Version: Relay 1.3.0 - * File: - * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js - */ - // ~~~~~~~~~~~~~~~~~~~~~ - interface RerunParam { - param: string; - import: string; - max_runs: number; - } - interface FIELDS_CHANGE { - type: "FIELDS_CHANGE"; - fieldIDs: { [fieldName: string]: DataID | DataID[] }; - } - interface RANGE_ADD { - type: "RANGE_ADD"; - parentName?: string; - parentID?: string; - connectionInfo?: Array<{ - key: string; - filters?: Variables; - rangeBehavior: string; - }>; - connectionName?: string; - edgeName: string; - rangeBehaviors?: RangeBehaviors; - } - interface NODE_DELETE { - type: "NODE_DELETE"; - parentName?: string; - parentID?: string; - connectionName?: string; - deletedIDFieldName: string; - } - interface RANGE_DELETE { - type: "RANGE_DELETE"; - parentName?: string; - parentID?: string; - connectionKeys?: Array<{ - key: string; - filters?: Variables; - }>; - connectionName?: string; - deletedIDFieldName: string | string[]; - pathToConnection: string[]; - } - interface REQUIRED_CHILDREN { - type: "REQUIRED_CHILDREN"; - children: RelayConcreteNode[]; - } - type RelayMutationConfig = FIELDS_CHANGE | RANGE_ADD | NODE_DELETE | RANGE_DELETE | REQUIRED_CHILDREN; - - interface RelayMutationTransactionCommitCallbacks { - onFailure?: RelayMutationTransactionCommitFailureCallback; - onSuccess?: RelayMutationTransactionCommitSuccessCallback; - } - type RelayMutationTransactionCommitFailureCallback = ( - transaction: RelayMutationTransaction, - preventAutoRollback: () => void - ) => void; - type RelayMutationTransactionCommitSuccessCallback = ( - response: { - [key: string]: any; - } - ) => void; - interface NetworkLayer { - sendMutation(request: RelayMutationRequest): Promise | null; - sendQueries(requests: RelayQueryRequest[]): Promise | null; - supports(...options: string[]): boolean; - } - interface QueryResult { - error?: Error; - ref_params?: { [name: string]: any }; - response: QueryPayload; - } - interface ReadyState { - aborted: boolean; - done: boolean; - error: Error | null; - events: ReadyStateEvent[]; - ready: boolean; - stale: boolean; - } - type RelayContainerErrorEventType = "CACHE_RESTORE_FAILED" | "NETWORK_QUERY_ERROR"; - type RelayContainerLoadingEventType = - | "ABORT" - | "CACHE_RESTORED_REQUIRED" - | "CACHE_RESTORE_START" - | "NETWORK_QUERY_RECEIVED_ALL" - | "NETWORK_QUERY_RECEIVED_REQUIRED" - | "NETWORK_QUERY_START" - | "STORE_FOUND_ALL" - | "STORE_FOUND_REQUIRED"; - type ReadyStateChangeCallback = (readyState: ReadyState) => void; - interface ReadyStateEvent { - type: RelayContainerLoadingEventType | RelayContainerErrorEventType; - error?: Error; - } - interface Abortable { - abort(): void; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayInternalTypes - /** - * Version: Relay 1.3.0 - * File: - * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js - */ - // ~~~~~~~~~~~~~~~~~~~~~ - interface QueryPayload { - [key: string]: any; - } - interface RelayQuerySet { - [queryName: string]: any; - } - type RangeBehaviorsFunction = ( - connectionArgs: { - [argName: string]: any; - } - ) => "APPEND" | "IGNORE" | "PREPEND" | "REFETCH" | "REMOVE"; - interface RangeBehaviorsObject { - [key: string]: "APPEND" | "IGNORE" | "PREPEND" | "REFETCH" | "REMOVE"; - } - type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayModernGraphQLTag +// ~~~~~~~~~~~~~~~~~~~~~ +interface GeneratedNodeMap { + [key: string]: GraphQLTaggedNode; } - -export namespace RelayRuntimeTypes { - // ~~~~~~~~~~~~~~~~~~~~~ - // Maybe Fix - // ~~~~~~~~~~~~~~~~~~~~~ - type RelayDebugger = any; - type OptimisticUpdate = any; - type OperationSelector = RelayCommonTypes.COperationSelector; - type Selector = RelayCommonTypes.CSelector; - type PayloadData = any; - type Snapshot = RelayCommonTypes.CSnapshot; - type RelayResponsePayload = any; - type MutableRecordSource = RecordSource; - - /** - * A function that returns an Observable representing the response of executing - * a GraphQL operation. - */ - type ExecuteFunction = ( - operation: object, - variables: RelayCommonTypes.Variables, - cacheConfig: RelayCommonTypes.CacheConfig, - uploadables?: RelayCommonTypes.UploadableMap - ) => Promise; - interface RelayNetwork { - execute: ExecuteFunction; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayDefaultHandlerProvider - // ~~~~~~~~~~~~~~~~~~~~~ - function HandlerProvider(name: string): typeof RelayCommonTypes.Handler | null; - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayModernEnvironment - // ~~~~~~~~~~~~~~~~~~~~~ - interface EnvironmentConfig { - configName?: string; - handlerProvider?: typeof HandlerProvider; - network: Network; - store: Store; - } - class Environment { - constructor(config: EnvironmentConfig); - getStore(): Store; - getDebugger(): RelayDebugger; - applyUpdate(optimisticUpdate: OptimisticUpdate): RelayCommonTypes.Disposable; - revertUpdate(update: OptimisticUpdate): void; - replaceUpdate(update: OptimisticUpdate, newUpdate: OptimisticUpdate): void; - applyMutation(config: { - operation: OperationSelector; - optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater; - optimisticResponse?: object; - }): RelayCommonTypes.Disposable; - check(readSelector: Selector): boolean; - commitPayload(operationSelector: OperationSelector, payload: PayloadData): void; - commitUpdate(updater: RelayCommonTypes.StoreUpdater): void; - lookup(readSelector: Selector): Snapshot; - subscribe(snapshot: Snapshot, callback: (snapshot: Snapshot) => void): RelayCommonTypes.Disposable; - retain(selector: Selector): RelayCommonTypes.Disposable; - execute(config: { - operation: OperationSelector; - cacheConfig?: RelayCommonTypes.CacheConfig; - updater?: RelayCommonTypes.SelectorStoreUpdater; - }): RelayObservable; - executeMutation(config: { - operation: OperationSelector; - optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater; - optimisticResponse?: object; - updater?: RelayCommonTypes.SelectorStoreUpdater; - uploadables?: RelayCommonTypes.UploadableMap; - }): RelayObservable; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayInMemoryRecordSource - // ~~~~~~~~~~~~~~~~~~~~~ - interface Record { - [key: string]: any; - } - interface RecordMap { - [dataID: string]: Record | null | undefined; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // Network - // ~~~~~~~~~~~~~~~~~~~~~ - class Network { - /** - * Creates an implementation of the `Network` interface defined in - * `RelayNetworkTypes` given `fetch` and `subscribe` functions. - */ - static create( - fetchFn: typeof RelayCommonTypes.FetchFunction, - subscribeFn?: RelayCommonTypes.SubscribeFunction - ): RelayNetwork; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // Network - // ~~~~~~~~~~~~~~~~~~~~~ - class RecordSource { - constructor(records?: RecordMap); - clear(): void; - delete(dataID: RelayCommonTypes.DataID): void; - get(dataID: RelayCommonTypes.DataID): Record | null; - getRecordIDs(): RelayCommonTypes.DataID[]; - getStatus(dataID: RelayCommonTypes.DataID): "EXISTENT" | "NONEXISTENT" | "UNKNOWN"; - has(dataID: RelayCommonTypes.DataID): boolean; - load(dataID: RelayCommonTypes.DataID, callback: (error: Error | null, record: Record | null) => void): void; - remove(dataID: RelayCommonTypes.DataID): void; - set(dataID: RelayCommonTypes.DataID, record: Record): void; - size(): number; - toJSON(): RecordMap; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // ModernStore - // ~~~~~~~~~~~~~~~~~~~~~ - class Store { - constructor(source: RecordSource); - getSource(): MutableRecordSource; - check(selector: Selector): boolean; - retain(selector: Selector): RelayCommonTypes.Disposable; - lookup(selector: Selector): Snapshot; - notify(): void; - publish(source: RecordSource): void; - subscribe(snapshot: Snapshot, callback: (snapshot: Snapshot) => void): RelayCommonTypes.Disposable; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayRecordSourceInspector - // ~~~~~~~~~~~~~~~~~~~~~ - /** - * An internal class to provide a console-friendly string representation of a - * Record. - */ - class RecordSummary { - id: RelayCommonTypes.DataID; - type: string | null | undefined; - static createFromRecord(id: RelayCommonTypes.DataID, record: any): RecordSummary; - constructor(id: RelayCommonTypes.DataID, type: string | null | undefined); - toString(): string; - } - /** - * Internal class for inspecting a single Record. - */ - class RecordInspector { - constructor(sourceInspector: RelayRecordSourceInspector, record: Record); - /** - * Get the cache id of the given record. For types that implement the `Node` - * interface (or that have an `id`) this will be `id`, for other types it will be - * a synthesized identifier based on the field path from the nearest ancestor - * record that does have an `id`. - */ - getDataID(): RelayCommonTypes.DataID; - - /** - * Returns a list of the fields that have been fetched on the current record. - */ - getFields(): string[]; - - /** - * Returns the type of the record. - */ - getType(): string; - - /** - * Returns a copy of the internal representation of the record. - */ - inspect(): any; - - /** - * Returns the value of a scalar field. May throw if the given field is - * present but not actually scalar. - */ - getValue(name: string, args?: RelayCommonTypes.Variables): any; - - /** - * Returns an inspector for the given scalar "linked" field (a field whose - * value is another Record instead of a scalar). May throw if the field is - * present but not a scalar linked record. - */ - getLinkedRecord(name: string, args?: RelayCommonTypes.Variables): RecordInspector | null; - - /** - * Returns an array of inspectors for the given plural "linked" field (a field - * whose value is an array of Records instead of a scalar). May throw if the - * field is present but not a plural linked record. - */ - getLinkedRecords(name: string, args?: RelayCommonTypes.Variables): RecordInspector[] | null; - } - - class RelayRecordSourceInspector { - constructor(source: RecordSource); - static getForEnvironment(environment: Environment): RelayRecordSourceInspector; - /** - * Returns an inspector for the record with the given id, or null/undefined if - * that record is deleted/unfetched. - */ - get(dataID: RelayCommonTypes.DataID): RecordInspector | null; - /** - * Returns a list of ": " for each record in the store that has an - * `id`. - */ - getNodes(): RecordSummary[]; - /** - * Returns a list of ": " for all records in the store including - * those that do not have an `id`. - */ - getRecords(): RecordSummary[]; - - /** - * Returns an inspector for the synthesized "root" object, allowing access to - * e.g. the `viewer` object or the results of other fields on the "Query" - * type. - */ - getRoot(): RecordInspector; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // RelayObservable - // ~~~~~~~~~~~~~~~~~~~~~ - interface Subscription { - unsubscribe(): void; - readonly closed: boolean; - } - interface Observer { - start?(subscription: Subscription): any; - next?(nextThing: T): any; - error?(error: Error): any; - complete?(): any; - unsubscribe?(subscription: Subscription): any; - } - type Source = () => any; - interface Subscribable { - subscribe(observer: Observer): Subscription; - } - type ObservableFromValue = RelayObservable | Promise | T; - class RelayObservable implements Subscribable { - _source: Source; - - constructor(source: Source); - - /** - * When an unhandled error is detected, it is reported to the host environment - * (the ESObservable spec refers to this method as "HostReportErrors()"). - * - * The default implementation in development builds re-throws errors in a - * separate frame, and from production builds does nothing (swallowing - * uncaught errors). - * - * Called during application initialization, this method allows - * application-specific handling of uncaught errors. Allowing, for example, - * integration with error logging or developer tools. - */ - static onUnhandledError(callback: (error: Error) => any): void; - - /** - * Accepts various kinds of data sources, and always returns a RelayObservable - * useful for accepting the result of a user-provided FetchFunction. - */ - static from(obj: ObservableFromValue): RelayObservable; - - /** - * Creates a RelayObservable, given a function which expects a legacy - * Relay Observer as the last argument and which returns a Disposable. - * - * To support migration to Observable, the function may ignore the - * legacy Relay observer and directly return an Observable instead. - */ - static fromLegacy( - callback: ( - legacyObserver: RelayCommonTypes.LegacyObserver - ) => RelayCommonTypes.Disposable | RelayObservable - ): RelayObservable; - - /** - * Returns a new Observable which returns the same values as this one, but - * modified so that the provided Observer is called to perform a side-effects - * for all events emitted by the source. - * - * Any errors that are thrown in the side-effect Observer are unhandled, and - * do not affect the source Observable or its Observer. - * - * This is useful for when debugging your Observables or performing other - * side-effects such as logging or performance monitoring. - */ - do(observer: Observer): RelayObservable; - - /** - * Returns a new Observable which returns the same values as this one, but - * modified so that the finally callback is performed after completion, - * whether normal or due to error or unsubscription. - * - * This is useful for cleanup such as resource finalization. - */ - finally(fn: () => any): RelayObservable; - - /** - * Returns a new Observable which is identical to this one, unless this - * Observable completes before yielding any values, in which case the new - * Observable will yield the values from the alternate Observable. - * - * If this Observable does yield values, the alternate is never subscribed to. - * - * This is useful for scenarios where values may come from multiple sources - * which should be tried in order, i.e. from a cache before a network. - */ - ifEmpty(alternate: RelayObservable): RelayObservable; - - /** - * Observable's primary API: returns an unsubscribable Subscription to the - * source of this Observable. - */ - subscribe(observer: Observer): Subscription; - - /** - * Supports subscription of a legacy Relay Observer, returning a Disposable. - */ - subscribeLegacy(legacyObserver: RelayCommonTypes.LegacyObserver): RelayCommonTypes.Disposable; - - /** - * Returns a new Observerable where each value has been transformed by - * the mapping function. - */ - map(fn: (thing: T) => U): RelayObservable; - - /** - * Returns a new Observable where each value is replaced with a new Observable - * by the mapping function, the results of which returned as a single - * concattenated Observable. - */ - concatMap(fn: (thing: T) => ObservableFromValue): RelayObservable; - - /** - * Returns a new Observable which first mirrors this Observable, then when it - * completes, waits for `pollInterval` milliseconds before re-subscribing to - * this Observable again, looping in this manner until unsubscribed. - * - * The returned Observable never completes. - */ - poll(pollInterval: number): RelayObservable; - - /** - * Returns a Promise which resolves when this Observable yields a first value - * or when it completes with no value. - */ - toPromise(): Promise; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // commitLocalUpdate - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - type commitLocalUpdate = (environment: Environment, updater: RelayCommonTypes.StoreUpdater) => void; - - // ~~~~~~~~~~~~~~~~~~~~~ - // commitRelayModernMutation - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - interface MutationConfig { - configs?: RelayCommonTypes.RelayMutationConfig[]; - mutation: RelayCommonTypes.GraphQLTaggedNode; - variables: RelayCommonTypes.Variables; - uploadables?: RelayCommonTypes.UploadableMap; - onCompleted?(response: T, errors: RelayCommonTypes.PayloadError[] | null | undefined): void; - onError?(error?: Error): void; - optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater; - optimisticResponse?: object; - updater?: RelayCommonTypes.SelectorStoreUpdater; - } - function commitRelayModernMutation( - environment: Environment, - config: MutationConfig - ): RelayCommonTypes.Disposable; - - // ~~~~~~~~~~~~~~~~~~~~~ - // applyRelayModernOptimisticMutation - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - interface OptimisticMutationConfig { - configs?: RelayCommonTypes.RelayMutationConfig[]; - mutation: RelayCommonTypes.GraphQLTaggedNode; - variables: RelayCommonTypes.Variables; - optimisticUpdater?: RelayCommonTypes.SelectorStoreUpdater; - optimisticResponse?: object; - } - - // ~~~~~~~~~~~~~~~~~~~~~ - // fetchRelayModernQuery - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - /** - * A helper function to fetch the results of a query. Note that results for - * fragment spreads are masked: fields must be explicitly listed in the query in - * order to be accessible in the result object. - * - * NOTE: This module is primarily intended for integrating with classic APIs. - * Most product code should use a Renderer or Container. - * - * TODO(t16875667): The return type should be `Promise`, but - * that's not really helpful as `SelectorData` is essentially just `mixed`. We - * can probably leverage generated flow types here to return the real expected - * shape. - */ - function fetchRelayModernQuery( - environment: any, // FIXME - $FlowFixMe in facebook source code - taggedNode: RelayCommonTypes.GraphQLTaggedNode, - variables: RelayCommonTypes.Variables, - cacheConfig?: RelayCommonTypes.CacheConfig - ): Promise; // FIXME - $FlowFixMe in facebook source code - - // ~~~~~~~~~~~~~~~~~~~~~ - // requestRelaySubscription - // ~~~~~~~~~~~~~~~~~~~~~ - // exposed through RelayModern, not Runtime directly - interface GraphQLSubscriptionConfig { - configs?: RelayCommonTypes.RelayMutationConfig[]; - subscription: RelayCommonTypes.GraphQLTaggedNode; - variables: RelayCommonTypes.Variables; - onCompleted?(): void; - onError?(error: Error): void; - onNext?(response: object | null | undefined): void; - updater?(store: RelayCommonTypes.RecordSourceSelectorProxy): void; - } - function requestRelaySubscription( - environment: Environment, - config: GraphQLSubscriptionConfig - ): RelayCommonTypes.Disposable; +type GraphQLTaggedNode = + | (() => ConcreteFragment | ConcreteBatch) + | { + modern(): ConcreteFragment | ConcreteBatch; + classic(relayQL: RelayQL): ConcreteFragmentDefinition | ConcreteOperationDefinition; + }; +// ~~~~~~~~~~~~~~~~~~~~~ +// General Usage +// ~~~~~~~~~~~~~~~~~~~~~ +type DataID = string; +interface Variables { + [name: string]: any; +} +type Uploadable = File | Blob; +interface UploadableMap { + [key: string]: Uploadable; } // ~~~~~~~~~~~~~~~~~~~~~ -// Package Exports +// RelayNetworkTypes +// Version: Relay 1.3.0 +// File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js // ~~~~~~~~~~~~~~~~~~~~~ -export import Environment = RelayRuntimeTypes.Environment; -export import Network = RelayRuntimeTypes.Network; -export import RecordSource = RelayRuntimeTypes.RecordSource; -export import Store = RelayRuntimeTypes.Store; -export import Observable = RelayRuntimeTypes.RelayObservable; + +interface LegacyObserver { + onCompleted?(): void; + onError?(error: Error): void; + onNext?(data: T): void; +} +interface PayloadError { + message: string; + locations?: Array<{ + line: number; + column: number; + }>; +} +/** + * A function that executes a GraphQL operation with request/response semantics. + * + * May return an Observable or Promise of a raw server response. + */ +declare function FetchFunction( + operation: ConcreteBatch, + variables: Variables, + cacheConfig: CacheConfig, + uploadables?: UploadableMap +): ObservableFromValue; + +/** + * A function that executes a GraphQL subscription operation, returning one or + * more raw server responses over time. + * + * May return an Observable, otherwise must call the callbacks found in the + * fourth parameter. + */ +type SubscribeFunction = ( + operation: ConcreteBatch, + variables: Variables, + cacheConfig: CacheConfig, + observer: LegacyObserver +) => RelayObservable | Disposable; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayStoreTypes +// Version: Relay 1.3.0 +// File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/store/RelayStoreTypes.js +// ~~~~~~~~~~~~~~~~~~~~~ +/** + * A function that receives a proxy over the store and may trigger side-effects + * (indirectly) by calling `set*` methods on the store or its record proxies. + */ +type StoreUpdater = (store: RecordSourceProxy) => void; + +/** + * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in + * order to easily access the root fields of a query/mutation as well as a + * second argument of the response object of the mutation. + */ +type SelectorStoreUpdater = ( + store: RecordSourceSelectorProxy, + // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is + // inconvenient to access deeply in product code. + data: any // FLOW FIXME +) => void; + +/** + * Extends the RecordSourceProxy interface with methods for accessing the root + * fields of a Selector. + */ +interface RecordSourceSelectorProxy { + create(dataID: DataID, typeName: string): RecordProxy; + delete(dataID: DataID): void; + get(dataID: DataID): RecordProxy | null; + getRoot(): RecordProxy; + getRootField(fieldName: string): RecordProxy | null; + getPluralRootField(fieldName: string): RecordProxy[] | null; +} + +interface RecordProxy { + copyFieldsFrom(source: RecordProxy): void; + getDataID(): DataID; + getLinkedRecord(name: string, args?: Variables): RecordProxy | null; + getLinkedRecords(name: string, args?: Variables): Array | null; + getOrCreateLinkedRecord(name: string, typeName: string, args?: Variables): RecordProxy; + getType(): string; + getValue(name: string, args?: Variables): any; + setLinkedRecord(record: RecordProxy, name: string, args?: Variables): RecordProxy; + setLinkedRecords( + records: Array | undefined | null, + name: string, + args?: Variables + ): RecordProxy; + setValue(value: any, name: string, args?: Variables): RecordProxy; +} + +interface RecordSourceProxy { + create(dataID: DataID, typeName: string): RecordProxy; + delete(dataID: DataID): void; + get(dataID: DataID): Array | null; + getRoot(): RecordProxy; +} + +interface HandleFieldPayload { + // The arguments that were fetched. + args: Variables; + // The __id of the record containing the source/handle field. + dataID: DataID; + // The (storage) key at which the original server data was written. + fieldKey: string; + // The name of the handle + handle: string; + // The (storage) key at which the handle's data should be written by the + // handler + handleKey: string; +} +interface HandlerInterface { + update(store: RecordSourceProxy, fieldPayload: HandleFieldPayload): void; + [functionName: string]: (...args: any[]) => any; +} +export const ConnectionHandler: HandlerInterface; +export const ViewerHandler: HandlerInterface; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayCombinedEnvironmentTypes +// Version: Relay 1.3.0 +// File: https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js +// ~~~~~~~~~~~~~~~~~~~~~ +/** + * Settings for how a query response may be cached. + * + * - `force`: causes a query to be issued unconditionally, irrespective of the + * state of any configured response cache. + * - `poll`: causes a query to live update by polling at the specified interval + * in milliseconds. (This value will be passed to setTimeout.) + */ +interface CacheConfig { + force?: boolean; + poll?: number; +} + +/** + * Represents any resource that must be explicitly disposed of. The most common + * use-case is as a return value for subscriptions, where calling `dispose()` + * would cancel the subscription. + */ +interface Disposable { + dispose(): void; +} + +/** + * Arbitrary data e.g. received by a container as props. + */ +interface Props { + [key: string]: any; +} + +/** + * A selector defines the starting point for a traversal into the graph for the + * purposes of targeting a subgraph. + */ +interface CSelector { + dataID: DataID; + node: TNode; + variables: Variables; +} + +/** + * A representation of a selector and its results at a particular point in time. + */ +type CSnapshot = CSelector & { + data: SelectorData | null | undefined; + seenRecords: RecordMap; +}; + +/** + * The results of a selector given a store/RecordSource. + */ +interface SelectorData { + [key: string]: any; +} + +/** + * The results of reading the results of a FragmentMap given some input + * `Props`. + */ +interface FragmentSpecResults { + [key: string]: any; +} + +/** + * A utility for resolving and subscribing to the results of a fragment spec + * (key -> fragment mapping) given some "props" that determine the root ID + * and variables to use when reading each fragment. When props are changed via + * `setProps()`, the resolver will update its results and subscriptions + * accordingly. Internally, the resolver: + * - Converts the fragment map & props map into a map of `Selector`s. + * - Removes any resolvers for any props that became null. + * - Creates resolvers for any props that became non-null. + * - Updates resolvers with the latest props. + */ +interface FragmentSpecResolver { + /** + * Stop watching for changes to the results of the fragments. + */ + dispose(): void; + + /** + * Get the current results. + */ + resolve(): FragmentSpecResults; + + /** + * Update the resolver with new inputs. Call `resolve()` to get the updated + * results. + */ + setProps(props: Props): void; + + /** + * Override the variables used to read the results of the fragments. Call + * `resolve()` to get the updated results. + */ + setVariables(variables: Variables): void; +} + +interface CFragmentMap { + [key: string]: TFragment; +} + +/** + * An operation selector describes a specific instance of a GraphQL operation + * with variables applied. + * + * - `root`: a selector intended for processing server results or retaining + * response data in the store. + * - `fragment`: a selector intended for use in reading or subscribing to + * the results of the the operation. + */ +interface COperationSelector { + fragment: CSelector; + node: TOperation; + root: CSelector; + variables: Variables; +} + +/** + * The public API of Relay core. Represents an encapsulated environment with its + * own in-memory cache. + */ +interface CEnvironment { + /** + * Read the results of a selector from in-memory records in the store. + */ + lookup(selector: CSelector): CSnapshot; + + /** + * Subscribe to changes to the results of a selector. The callback is called + * when data has been committed to the store that would cause the results of + * the snapshot's selector to change. + */ + subscribe(snapshot: CSnapshot, callback: (snapshot: CSnapshot) => void): Disposable; + + /** + * Ensure that all the records necessary to fulfill the given selector are + * retained in-memory. The records will not be eligible for garbage collection + * until the returned reference is disposed. + * + * Note: This is a no-op in the classic core. + */ + retain(selector: CSelector): Disposable; + + /** + * Send a query to the server with request/response semantics: the query will + * either complete successfully (calling `onNext` and `onCompleted`) or fail + * (calling `onError`). + * + * Note: Most applications should use `streamQuery` in order to + * optionally receive updated information over time, should that feature be + * supported by the network/server. A good rule of thumb is to use this method + * if you would otherwise immediately dispose the `streamQuery()` + * after receving the first `onNext` result. + */ + sendQuery(config: { + cacheConfig?: CacheConfig; + onCompleted?(): void; + onError?(error: Error): void; + onNext?(payload: TPayload): void; + operation: COperationSelector; + }): Disposable; + + /** + * Send a query to the server with request/subscription semantics: one or more + * responses may be returned (via `onNext`) over time followed by either + * the request completing (`onCompleted`) or an error (`onError`). + * + * Networks/servers that support subscriptions may choose to hold the + * subscription open indefinitely such that `onCompleted` is not called. + */ + streamQuery(config: { + cacheConfig?: CacheConfig; + onCompleted?(): void; + onError?(error: Error): void; + onNext?(payload: TPayload): void; + operation: COperationSelector; + }): Disposable; + + unstable_internal: CUnstableEnvironmentCore; +} + +interface CUnstableEnvironmentCore { + /** + * Create an instance of a FragmentSpecResolver. + * + * TODO: The FragmentSpecResolver *can* be implemented via the other methods + * defined here, so this could be moved out of core. It's convenient to have + * separate implementations until the experimental core is in OSS. + */ + createFragmentSpecResolver( + context: CRelayContext, + containerName: string, + fragments: CFragmentMap, + props: Props, + callback: () => void + ): FragmentSpecResolver; + + /** + * Creates an instance of an OperationSelector given an operation definition + * (see `getOperation`) and the variables to apply. The input variables are + * filtered to exclude variables that do not matche defined arguments on the + * operation, and default values are populated for null values. + */ + createOperationSelector(operation: TOperation, variables: Variables): COperationSelector; + + /** + * Given a graphql`...` tagged template, extract a fragment definition usable + * by this version of Relay core. Throws if the value is not a fragment. + */ + getFragment(node: TGraphQLTaggedNode): TFragment; + + /** + * Given a graphql`...` tagged template, extract an operation definition + * usable by this version of Relay core. Throws if the value is not an + * operation. + */ + getOperation(node: TGraphQLTaggedNode): TOperation; + + /** + * Determine if two selectors are equal (represent the same selection). Note + * that this function returns `false` when the two queries/fragments are + * different objects, even if they select the same fields. + */ + areEqualSelectors(a: CSelector, b: CSelector): boolean; + + /** + * Given the result `item` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment for that item. + * + * Example: + * + * Given two fragments as follows: + * + * ``` + * fragment Parent on User { + * id + * ...Child + * } + * fragment Child on User { + * name + * } + * ``` + * + * And given some object `parent` that is the results of `Parent` for id "4", + * the results of `Child` can be accessed by first getting a selector and then + * using that selector to `lookup()` the results against the environment: + * + * ``` + * const childSelector = getSelector(queryVariables, Child, parent); + * const childData = environment.lookup(childSelector).data; + * ``` + */ + getSelector(operationVariables: Variables, fragment: TFragment, prop: any): CSelector | null; + + /** + * Given the result `items` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment on those + * items. This is similar to `getSelector` but for "plural" fragments that + * expect an array of results and therefore return an array of selectors. + */ + getSelectorList(operationVariables: Variables, fragment: TFragment, props: any[]): Array> | null; + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the selectors for those fragments from the results. + * + * The canonical use-case for this function are Relay Containers, which + * use this function to convert (props, fragments) into selectors so that they + * can read the results to pass to the inner component. + */ + getSelectorsFromObject( + operationVariables: Variables, + fragments: CFragmentMap, + props: Props + ): { [key: string]: CSelector | Array> | null | undefined }; + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts a mapping of keys -> id(s) of the results. + * + * Similar to `getSelectorsFromObject()`, this function can be useful in + * determining the "identity" of the props passed to a component. + */ + getDataIDsFromObject( + fragments: CFragmentMap, + props: Props + ): { [key: string]: DataID | DataID[] | null | undefined }; + + /** + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the merged variables that would be in scope for those + * fragments/results. + * + * This can be useful in determing what varaibles were used to fetch the data + * for a Relay container, for example. + */ + getVariablesFromObject(operationVariables: Variables, fragments: CFragmentMap, props: Props): Variables; +} + +/** + * The type of the `relay` property set on React context by the React/Relay + * integration layer (e.g. QueryRenderer, FragmentContainer, etc). + */ +interface CRelayContext { + environment: TEnvironment; + variables: Variables; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayTypes +/** + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js + */ +// ~~~~~~~~~~~~~~~~~~~~~ +interface RerunParam { + param: string; + import: string; + max_runs: number; +} +interface FIELDS_CHANGE { + type: "FIELDS_CHANGE"; + fieldIDs: { [fieldName: string]: DataID | DataID[] }; +} +interface RANGE_ADD { + type: "RANGE_ADD"; + parentName?: string; + parentID?: string; + connectionInfo?: Array<{ + key: string; + filters?: Variables; + rangeBehavior: string; + }>; + connectionName?: string; + edgeName: string; + rangeBehaviors?: RangeBehaviors; +} +interface NODE_DELETE { + type: "NODE_DELETE"; + parentName?: string; + parentID?: string; + connectionName?: string; + deletedIDFieldName: string; +} +interface RANGE_DELETE { + type: "RANGE_DELETE"; + parentName?: string; + parentID?: string; + connectionKeys?: Array<{ + key: string; + filters?: Variables; + }>; + connectionName?: string; + deletedIDFieldName: string | string[]; + pathToConnection: string[]; +} +interface REQUIRED_CHILDREN { + type: "REQUIRED_CHILDREN"; + children: RelayConcreteNode[]; +} +type RelayMutationConfig = FIELDS_CHANGE | RANGE_ADD | NODE_DELETE | RANGE_DELETE | REQUIRED_CHILDREN; + +interface RelayMutationTransactionCommitCallbacks { + onFailure?: RelayMutationTransactionCommitFailureCallback; + onSuccess?: RelayMutationTransactionCommitSuccessCallback; +} +type RelayMutationTransactionCommitFailureCallback = ( + transaction: RelayMutationTransaction, + preventAutoRollback: () => void +) => void; +type RelayMutationTransactionCommitSuccessCallback = ( + response: { + [key: string]: any; + } +) => void; +interface NetworkLayer { + sendMutation(request: RelayMutationRequest): Promise | null; + sendQueries(requests: RelayQueryRequest[]): Promise | null; + supports(...options: string[]): boolean; +} +interface QueryResult { + error?: Error; + ref_params?: { [name: string]: any }; + response: QueryPayload; +} +interface ReadyState { + aborted: boolean; + done: boolean; + error: Error | null; + events: ReadyStateEvent[]; + ready: boolean; + stale: boolean; +} +type RelayContainerErrorEventType = "CACHE_RESTORE_FAILED" | "NETWORK_QUERY_ERROR"; +type RelayContainerLoadingEventType = + | "ABORT" + | "CACHE_RESTORED_REQUIRED" + | "CACHE_RESTORE_START" + | "NETWORK_QUERY_RECEIVED_ALL" + | "NETWORK_QUERY_RECEIVED_REQUIRED" + | "NETWORK_QUERY_START" + | "STORE_FOUND_ALL" + | "STORE_FOUND_REQUIRED"; +type ReadyStateChangeCallback = (readyState: ReadyState) => void; +interface ReadyStateEvent { + type: RelayContainerLoadingEventType | RelayContainerErrorEventType; + error?: Error; +} +interface Abortable { + abort(): void; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayInternalTypes +/** + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js + */ +// ~~~~~~~~~~~~~~~~~~~~~ +interface QueryPayload { + [key: string]: any; +} +interface RelayQuerySet { + [queryName: string]: any; +} +type RangeBehaviorsFunction = ( + connectionArgs: { + [argName: string]: any; + } +) => "APPEND" | "IGNORE" | "PREPEND" | "REFETCH" | "REMOVE"; +interface RangeBehaviorsObject { + [key: string]: "APPEND" | "IGNORE" | "PREPEND" | "REFETCH" | "REMOVE"; +} +type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; + +// ~~~~~~~~~~~~~~~~~~~~~ +// Maybe Fix +// ~~~~~~~~~~~~~~~~~~~~~ +type RelayDebugger = any; +type OptimisticUpdate = any; +type OperationSelector = COperationSelector; +type Selector = CSelector; +type PayloadData = any; +type Snapshot = CSnapshot; +type RelayResponsePayload = any; +type MutableRecordSource = RecordSource; + +/** + * A function that returns an Observable representing the response of executing + * a GraphQL operation. + */ +type ExecuteFunction = ( + operation: object, + variables: Variables, + cacheConfig: CacheConfig, + uploadables?: UploadableMap +) => Promise; +interface RelayNetwork { + execute: ExecuteFunction; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayDefaultHandlerProvider +// ~~~~~~~~~~~~~~~~~~~~~ +declare function HandlerProvider(name: string): HandlerInterface | null; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayModernEnvironment +// ~~~~~~~~~~~~~~~~~~~~~ +interface EnvironmentConfig { + configName?: string; + handlerProvider?: typeof HandlerProvider; + network: Network; + store: Store; +} +export class Environment { + constructor(config: EnvironmentConfig); + getStore(): Store; + getDebugger(): RelayDebugger; + applyUpdate(optimisticUpdate: OptimisticUpdate): Disposable; + revertUpdate(update: OptimisticUpdate): void; + replaceUpdate(update: OptimisticUpdate, newUpdate: OptimisticUpdate): void; + applyMutation(config: { + operation: OperationSelector; + optimisticUpdater?: SelectorStoreUpdater; + optimisticResponse?: object; + }): Disposable; + check(readSelector: Selector): boolean; + commitPayload(operationSelector: OperationSelector, payload: PayloadData): void; + commitUpdate(updater: StoreUpdater): void; + lookup(readSelector: Selector): Snapshot; + subscribe(snapshot: Snapshot, callback: (snapshot: Snapshot) => void): Disposable; + retain(selector: Selector): Disposable; + execute(config: { + operation: OperationSelector; + cacheConfig?: CacheConfig; + updater?: SelectorStoreUpdater; + }): RelayObservable; + executeMutation(config: { + operation: OperationSelector; + optimisticUpdater?: SelectorStoreUpdater; + optimisticResponse?: object; + updater?: SelectorStoreUpdater; + uploadables?: UploadableMap; + }): RelayObservable; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayInMemoryRecordSource +// ~~~~~~~~~~~~~~~~~~~~~ +interface RelayInMemoryRecordSource { + [key: string]: any; +} +interface RecordMap { + [dataID: string]: RelayInMemoryRecordSource | null | undefined; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// Network +// ~~~~~~~~~~~~~~~~~~~~~ +export class Network { + /** + * Creates an implementation of the `Network` interface defined in + * `RelayNetworkTypes` given `fetch` and `subscribe` functions. + */ + static create(fetchFn: typeof FetchFunction, subscribeFn?: SubscribeFunction): RelayNetwork; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// Network +// ~~~~~~~~~~~~~~~~~~~~~ +declare class RecordSource { + constructor(records?: RecordMap); + clear(): void; + delete(dataID: DataID): void; + get(dataID: DataID): RelayInMemoryRecordSource | null; + getRecordIDs(): DataID[]; + getStatus(dataID: DataID): "EXISTENT" | "NONEXISTENT" | "UNKNOWN"; + has(dataID: DataID): boolean; + load(dataID: DataID, callback: (error: Error | null, record: RelayInMemoryRecordSource | null) => void): void; + remove(dataID: DataID): void; + set(dataID: DataID, record: RelayInMemoryRecordSource): void; + size(): number; + toJSON(): RecordMap; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// ModernStore +// ~~~~~~~~~~~~~~~~~~~~~ +export class Store { + constructor(source: RecordSource); + getSource(): MutableRecordSource; + check(selector: Selector): boolean; + retain(selector: Selector): Disposable; + lookup(selector: Selector): Snapshot; + notify(): void; + publish(source: RecordSource): void; + subscribe(snapshot: Snapshot, callback: (snapshot: Snapshot) => void): Disposable; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayRecordSourceInspector +// ~~~~~~~~~~~~~~~~~~~~~ +/** + * An internal class to provide a console-friendly string representation of a + * RelayInMemoryRecordSource. + */ +declare class RecordSummary { + id: DataID; + type: string | null | undefined; + static createFromRecord(id: DataID, record: any): RecordSummary; + constructor(id: DataID, type: string | null | undefined); + toString(): string; +} +/** + * Internal class for inspecting a single RelayInMemoryRecordSource. + */ +declare class RecordInspector { + constructor(sourceInspector: RelayRecordSourceInspector, record: RelayInMemoryRecordSource); + /** + * Get the cache id of the given record. For types that implement the `Node` + * interface (or that have an `id`) this will be `id`, for other types it will be + * a synthesized identifier based on the field path from the nearest ancestor + * record that does have an `id`. + */ + getDataID(): DataID; + + /** + * Returns a list of the fields that have been fetched on the current record. + */ + getFields(): string[]; + + /** + * Returns the type of the record. + */ + getType(): string; + + /** + * Returns a copy of the internal representation of the record. + */ + inspect(): any; + + /** + * Returns the value of a scalar field. May throw if the given field is + * present but not actually scalar. + */ + getValue(name: string, args?: Variables): any; + + /** + * Returns an inspector for the given scalar "linked" field (a field whose + * value is another RelayInMemoryRecordSource instead of a scalar). May throw if the field is + * present but not a scalar linked record. + */ + getLinkedRecord(name: string, args?: Variables): RecordInspector | null; + + /** + * Returns an array of inspectors for the given plural "linked" field (a field + * whose value is an array of Records instead of a scalar). May throw if the + * field is present but not a plural linked record. + */ + getLinkedRecords(name: string, args?: Variables): RecordInspector[] | null; +} + +declare class RelayRecordSourceInspector { + constructor(source: RecordSource); + static getForEnvironment(environment: Environment): RelayRecordSourceInspector; + /** + * Returns an inspector for the record with the given id, or null/undefined if + * that record is deleted/unfetched. + */ + get(dataID: DataID): RecordInspector | null; + /** + * Returns a list of ": " for each record in the store that has an + * `id`. + */ + getNodes(): RecordSummary[]; + /** + * Returns a list of ": " for all records in the store including + * those that do not have an `id`. + */ + getRecords(): RecordSummary[]; + + /** + * Returns an inspector for the synthesized "root" object, allowing access to + * e.g. the `viewer` object or the results of other fields on the "Query" + * type. + */ + getRoot(): RecordInspector; +} + // note RecordSourceInspector is only available in dev environment -export import RecordSourceInspector = RelayRuntimeTypes.RelayRecordSourceInspector; -export import ConnectionHandler = RelayCommonTypes.Handler; -export import ViewerHandler = RelayCommonTypes.Handler; +export type RecordSourceInspector = RelayRecordSourceInspector; + +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayObservable +// ~~~~~~~~~~~~~~~~~~~~~ +interface Subscription { + unsubscribe(): void; + readonly closed: boolean; +} +interface Observer { + start?(subscription: Subscription): any; + next?(nextThing: T): any; + error?(error: Error): any; + complete?(): any; + unsubscribe?(subscription: Subscription): any; +} +type Source = () => any; +interface Subscribable { + subscribe(observer: Observer): Subscription; +} +type ObservableFromValue = RelayObservable | Promise | T; +declare class RelayObservable implements Subscribable { + _source: Source; + + constructor(source: Source); + + /** + * When an unhandled error is detected, it is reported to the host environment + * (the ESObservable spec refers to this method as "HostReportErrors()"). + * + * The default implementation in development builds re-throws errors in a + * separate frame, and from production builds does nothing (swallowing + * uncaught errors). + * + * Called during application initialization, this method allows + * application-specific handling of uncaught errors. Allowing, for example, + * integration with error logging or developer tools. + */ + static onUnhandledError(callback: (error: Error) => any): void; + + /** + * Accepts various kinds of data sources, and always returns a RelayObservable + * useful for accepting the result of a user-provided FetchFunction. + */ + static from(obj: ObservableFromValue): RelayObservable; + + /** + * Creates a RelayObservable, given a function which expects a legacy + * Relay Observer as the last argument and which returns a Disposable. + * + * To support migration to Observable, the function may ignore the + * legacy Relay observer and directly return an Observable instead. + */ + static fromLegacy( + callback: (legacyObserver: LegacyObserver) => Disposable | RelayObservable + ): RelayObservable; + + /** + * Returns a new Observable which returns the same values as this one, but + * modified so that the provided Observer is called to perform a side-effects + * for all events emitted by the source. + * + * Any errors that are thrown in the side-effect Observer are unhandled, and + * do not affect the source Observable or its Observer. + * + * This is useful for when debugging your Observables or performing other + * side-effects such as logging or performance monitoring. + */ + do(observer: Observer): RelayObservable; + + /** + * Returns a new Observable which returns the same values as this one, but + * modified so that the finally callback is performed after completion, + * whether normal or due to error or unsubscription. + * + * This is useful for cleanup such as resource finalization. + */ + finally(fn: () => any): RelayObservable; + + /** + * Returns a new Observable which is identical to this one, unless this + * Observable completes before yielding any values, in which case the new + * Observable will yield the values from the alternate Observable. + * + * If this Observable does yield values, the alternate is never subscribed to. + * + * This is useful for scenarios where values may come from multiple sources + * which should be tried in order, i.e. from a cache before a network. + */ + ifEmpty(alternate: RelayObservable): RelayObservable; + + /** + * Observable's primary API: returns an unsubscribable Subscription to the + * source of this Observable. + */ + subscribe(observer: Observer): Subscription; + + /** + * Supports subscription of a legacy Relay Observer, returning a Disposable. + */ + subscribeLegacy(legacyObserver: LegacyObserver): Disposable; + + /** + * Returns a new Observerable where each value has been transformed by + * the mapping function. + */ + map(fn: (thing: T) => U): RelayObservable; + + /** + * Returns a new Observable where each value is replaced with a new Observable + * by the mapping function, the results of which returned as a single + * concattenated Observable. + */ + concatMap(fn: (thing: T) => ObservableFromValue): RelayObservable; + + /** + * Returns a new Observable which first mirrors this Observable, then when it + * completes, waits for `pollInterval` milliseconds before re-subscribing to + * this Observable again, looping in this manner until unsubscribed. + * + * The returned Observable never completes. + */ + poll(pollInterval: number): RelayObservable; + + /** + * Returns a Promise which resolves when this Observable yields a first value + * or when it completes with no value. + */ + toPromise(): Promise; +} + +export type Observable = RelayObservable; + +// ~~~~~~~~~~~~~~~~~~~~~ +// commitLocalUpdate +// ~~~~~~~~~~~~~~~~~~~~~ +// exposed through RelayModern, not Runtime directly +type commitLocalUpdate = (environment: Environment, updater: StoreUpdater) => void; + +// ~~~~~~~~~~~~~~~~~~~~~ +// commitRelayModernMutation +// ~~~~~~~~~~~~~~~~~~~~~ +// exposed through RelayModern, not Runtime directly +interface MutationConfig { + configs?: RelayMutationConfig[]; + mutation: GraphQLTaggedNode; + variables: Variables; + uploadables?: UploadableMap; + onCompleted?(response: T, errors: PayloadError[] | null | undefined): void; + onError?(error?: Error): void; + optimisticUpdater?: SelectorStoreUpdater; + optimisticResponse?: object; + updater?: SelectorStoreUpdater; +} +declare function commitRelayModernMutation(environment: Environment, config: MutationConfig): Disposable; + +// ~~~~~~~~~~~~~~~~~~~~~ +// applyRelayModernOptimisticMutation +// ~~~~~~~~~~~~~~~~~~~~~ +// exposed through RelayModern, not Runtime directly +interface OptimisticMutationConfig { + configs?: RelayMutationConfig[]; + mutation: GraphQLTaggedNode; + variables: Variables; + optimisticUpdater?: SelectorStoreUpdater; + optimisticResponse?: object; +} + +// ~~~~~~~~~~~~~~~~~~~~~ +// fetchRelayModernQuery +// ~~~~~~~~~~~~~~~~~~~~~ +// exposed through RelayModern, not Runtime directly +/** + * A helper function to fetch the results of a query. Note that results for + * fragment spreads are masked: fields must be explicitly listed in the query in + * order to be accessible in the result object. + * + * NOTE: This module is primarily intended for integrating with classic APIs. + * Most product code should use a Renderer or Container. + * + * TODO(t16875667): The return type should be `Promise`, but + * that's not really helpful as `SelectorData` is essentially just `mixed`. We + * can probably leverage generated flow types here to return the real expected + * shape. + */ +declare function fetchRelayModernQuery( + environment: any, // FIXME - $FlowFixMe in facebook source code + taggedNode: GraphQLTaggedNode, + variables: Variables, + cacheConfig?: CacheConfig +): Promise; // FIXME - $FlowFixMe in facebook source code + +// ~~~~~~~~~~~~~~~~~~~~~ +// requestRelaySubscription +// ~~~~~~~~~~~~~~~~~~~~~ +// exposed through RelayModern, not Runtime directly +interface GraphQLSubscriptionConfig { + configs?: RelayMutationConfig[]; + subscription: GraphQLTaggedNode; + variables: Variables; + onCompleted?(): void; + onError?(error: Error): void; + onNext?(response: object | null | undefined): void; + updater?(store: RecordSourceSelectorProxy): void; +} +declare function requestRelaySubscription(environment: Environment, config: GraphQLSubscriptionConfig): Disposable; From 7b8aacb5d6852526ed1d859950918340126c2f4c Mon Sep 17 00:00:00 2001 From: voxmatt Date: Tue, 17 Oct 2017 18:11:40 -0700 Subject: [PATCH 036/314] removing deprecated types --- types/react-relay/v1/classic.d.ts | 42 ------------------------------- types/react-relay/v1/compat.d.ts | 24 ------------------ 2 files changed, 66 deletions(-) delete mode 100644 types/react-relay/v1/classic.d.ts delete mode 100644 types/react-relay/v1/compat.d.ts diff --git a/types/react-relay/v1/classic.d.ts b/types/react-relay/v1/classic.d.ts deleted file mode 100644 index d6c3352457..0000000000 --- a/types/react-relay/v1/classic.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Type definitions for react-relay/classic 1.3 -// Project: https://github.com/facebook/relay -// Definitions by: Johannes Schickling , Matt Martin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -// ~~~~~~~~~~~~~~~~~~~~~ -// React-Relay Classic -// ~~~~~~~~~~~~~~~~~~~~~ -// kind of gross, but maintains compatability with previous version of types -export { - ClientMutationID, - Fragments, - CreateContainerOpts, - RelayVariables, - RelayContainerClass, - RelayQueryRequestResolve, - RelayMutationStatus, - RelayMutationTransaction, - RelayMutationRequest, - RelayQueryRequest, - RelayNetworkLayer, - DefaultNetworkLayer, - createContainer, - injectNetworkLayer, - isContainer, - QL, - Route, - Mutation, - Transaction, - StoreUpdateCallbacks, - Store, - RootContainer, - RootContainerProps, - Renderer, - RendererProps, - RenderStateConfig, - RenderCallback, - ReadyStateEvent, - OnReadyStateChange, - RelayProp, -} from './lib/react-relay-classic'; diff --git a/types/react-relay/v1/compat.d.ts b/types/react-relay/v1/compat.d.ts deleted file mode 100644 index ef11bfc509..0000000000 --- a/types/react-relay/v1/compat.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Type definitions for react-relay/compat 1.3 -// Project: https://github.com/facebook/relay -// Definitions by: Johannes Schickling , Matt Martin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -import { RelayRuntimeTypes } from 'relay-runtime'; -import * as ReactRelayModernTypes from './lib/react-relay-modern'; -import * as ReactRelayCompatTypes from './lib/react-relay-compat'; - -// ~~~~~~~~~~~~~~~~~~~~~ -// React-Relay Compat -// ~~~~~~~~~~~~~~~~~~~~~ -export import applyOptimisticMutation = ReactRelayCompatTypes.applyUpdate; -export import commitMutation = ReactRelayCompatTypes.commitUpdate; -export import createFragmentContainer = ReactRelayCompatTypes.createContainer; -export import createPaginationContainer = ReactRelayCompatTypes.createContainer; -export import createRefetchContainer = ReactRelayCompatTypes.createContainer; -export import injectDefaultVariablesProvider = ReactRelayCompatTypes.injectDefaultVariablesProvider; -export import QueryRenderer = ReactRelayModernTypes.ReactRelayQueryRenderer; -export import graphql = ReactRelayModernTypes.graphql; -export import fetchQuery = RelayRuntimeTypes.fetchRelayModernQuery; -// exported for convenience -export import CompatTypes = ReactRelayCompatTypes; From d12367fe0a66c7a443d52a9a9b26509c64e6485d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 18 Oct 2017 12:30:27 +0200 Subject: [PATCH 037/314] [Relay] Fix linter issues. --- types/react-relay/compat.d.ts | 12 +- types/react-relay/index.d.ts | 16 +- types/relay-runtime/index.d.ts | 832 +++++++++++++++--------------- types/relay-runtime/tsconfig.json | 1 + 4 files changed, 431 insertions(+), 430 deletions(-) diff --git a/types/react-relay/compat.d.ts b/types/react-relay/compat.d.ts index bbc69a3cc4..d214e451ae 100644 --- a/types/react-relay/compat.d.ts +++ b/types/react-relay/compat.d.ts @@ -6,18 +6,18 @@ export { createRefetchContainer, fetchQuery, graphql, -} from "react-relay"; +} from "./index"; import * as RelayRuntimeTypes from "relay-runtime"; -import { RelayEnvironmentInterface } from "react-relay/classic"; +import { RelayEnvironmentInterface } from "./classic"; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix // ~~~~~~~~~~~~~~~~~~~~~ -type ConcreteFragment = any; -type ConcreteBatch = any; -type ConcreteFragmentDefinition = object; -type ConcreteOperationDefinition = object; +export type ConcreteFragment = any; +export type ConcreteBatch = any; +export type ConcreteFragmentDefinition = object; +export type ConcreteOperationDefinition = object; // ~~~~~~~~~~~~~~~~~~~~~ // Util diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index fa23ac4dd7..04c173e9e2 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -19,11 +19,11 @@ import * as RelayRuntimeTypes from "relay-runtime"; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix // ~~~~~~~~~~~~~~~~~~~~~ -type ConcreteFragment = any; -type ConcreteBatch = any; -type ConcreteFragmentDefinition = object; -type ConcreteOperationDefinition = object; -type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; +export type ConcreteFragment = any; +export type ConcreteBatch = any; +export type ConcreteFragmentDefinition = object; +export type ConcreteOperationDefinition = object; +export type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; // ~~~~~~~~~~~~~~~~~~~~~ // RelayProp @@ -51,9 +51,9 @@ export type GraphQLTaggedNode = classic(relayQL: typeof RelayQL): ConcreteFragmentDefinition | ConcreteOperationDefinition; }; /** - * Runtime function to correspond to the `graphql` tagged template function. - * All calls to this function should be transformed by the plugin. - */ + * Runtime function to correspond to the `graphql` tagged template function. + * All calls to this function should be transformed by the plugin. + */ export interface GraphqlInterface { (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index bbc3e07a7a..c4c35a017e 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -6,44 +6,44 @@ // TypeScript Version: 2.4 /** - * SOURCE: - * Relay 1.3.0 - * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js - */ + * SOURCE: + * Relay 1.3.0 + * https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js + */ // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix // ~~~~~~~~~~~~~~~~~~~~~ -type RelayConcreteNode = any; -type RelayMutationTransaction = any; -type RelayMutationRequest = any; -type RelayQueryRequest = any; -type ConcreteFragment = any; -type ConcreteBatch = any; -type ConcreteFragmentDefinition = object; -type ConcreteOperationDefinition = object; +export type RelayConcreteNode = any; +export type RelayMutationTransaction = any; +export type RelayMutationRequest = any; +export type RelayQueryRequest = any; +export type ConcreteFragment = any; +export type ConcreteBatch = any; +export type ConcreteFragmentDefinition = object; +export type ConcreteOperationDefinition = object; /** - * FIXME: RelayContainer used to be typed with ReactClass, but - * ReactClass is broken and allows for access to any property. For example - * ReactClass.getFragment('foo') is valid even though ReactClass has no - * such getFragment() type definition. When ReactClass is fixed this causes a - * lot of errors in Relay code since methods like getFragment() are used often - * but have no definition in Relay's types. Suppressing for now. - */ -type RelayContainer = any; + * FIXME: RelayContainer used to be typed with ReactClass, but + * ReactClass is broken and allows for access to any property. For example + * ReactClass.getFragment('foo') is valid even though ReactClass has no + * such getFragment() type definition. When ReactClass is fixed this causes a + * lot of errors in Relay code since methods like getFragment() are used often + * but have no definition in Relay's types. Suppressing for now. + */ +export type RelayContainer = any; // ~~~~~~~~~~~~~~~~~~~~~ // RelayQL // ~~~~~~~~~~~~~~~~~~~~~ -type RelayQL = (strings: string[], ...substitutions: any[]) => RelayConcreteNode; +export type RelayQL = (strings: string[], ...substitutions: any[]) => RelayConcreteNode; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernGraphQLTag // ~~~~~~~~~~~~~~~~~~~~~ -interface GeneratedNodeMap { +export interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode; } -type GraphQLTaggedNode = +export type GraphQLTaggedNode = | (() => ConcreteFragment | ConcreteBatch) | { modern(): ConcreteFragment | ConcreteBatch; @@ -52,12 +52,12 @@ type GraphQLTaggedNode = // ~~~~~~~~~~~~~~~~~~~~~ // General Usage // ~~~~~~~~~~~~~~~~~~~~~ -type DataID = string; -interface Variables { +export type DataID = string; +export interface Variables { [name: string]: any; } -type Uploadable = File | Blob; -interface UploadableMap { +export type Uploadable = File | Blob; +export interface UploadableMap { [key: string]: Uploadable; } @@ -67,12 +67,12 @@ interface UploadableMap { // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/network/RelayNetworkTypes.js // ~~~~~~~~~~~~~~~~~~~~~ -interface LegacyObserver { +export interface LegacyObserver { onCompleted?(): void; onError?(error: Error): void; onNext?(data: T): void; } -interface PayloadError { +export interface PayloadError { message: string; locations?: Array<{ line: number; @@ -80,11 +80,11 @@ interface PayloadError { }>; } /** - * A function that executes a GraphQL operation with request/response semantics. - * - * May return an Observable or Promise of a raw server response. - */ -declare function FetchFunction( + * A function that executes a GraphQL operation with request/response semantics. + * + * May return an Observable or Promise of a raw server response. + */ +export function FetchFunction( operation: ConcreteBatch, variables: Variables, cacheConfig: CacheConfig, @@ -92,13 +92,13 @@ declare function FetchFunction( ): ObservableFromValue; /** - * A function that executes a GraphQL subscription operation, returning one or - * more raw server responses over time. - * - * May return an Observable, otherwise must call the callbacks found in the - * fourth parameter. - */ -type SubscribeFunction = ( + * A function that executes a GraphQL subscription operation, returning one or + * more raw server responses over time. + * + * May return an Observable, otherwise must call the callbacks found in the + * fourth parameter. + */ +export type SubscribeFunction = ( operation: ConcreteBatch, variables: Variables, cacheConfig: CacheConfig, @@ -111,17 +111,17 @@ type SubscribeFunction = ( // File: https://github.com/facebook/relay/blob/master/packages/relay-runtime/store/RelayStoreTypes.js // ~~~~~~~~~~~~~~~~~~~~~ /** - * A function that receives a proxy over the store and may trigger side-effects - * (indirectly) by calling `set*` methods on the store or its record proxies. - */ -type StoreUpdater = (store: RecordSourceProxy) => void; + * A function that receives a proxy over the store and may trigger side-effects + * (indirectly) by calling `set*` methods on the store or its record proxies. + */ +export type StoreUpdater = (store: RecordSourceProxy) => void; /** - * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in - * order to easily access the root fields of a query/mutation as well as a - * second argument of the response object of the mutation. - */ -type SelectorStoreUpdater = ( + * Similar to StoreUpdater, but accepts a proxy tied to a specific selector in + * order to easily access the root fields of a query/mutation as well as a + * second argument of the response object of the mutation. + */ +export type SelectorStoreUpdater = ( store: RecordSourceSelectorProxy, // Actually RelayCombinedEnvironmentTypes#SelectorData, but mixed is // inconvenient to access deeply in product code. @@ -129,10 +129,10 @@ type SelectorStoreUpdater = ( ) => void; /** - * Extends the RecordSourceProxy interface with methods for accessing the root - * fields of a Selector. - */ -interface RecordSourceSelectorProxy { + * Extends the RecordSourceProxy interface with methods for accessing the root + * fields of a Selector. + */ +export interface RecordSourceSelectorProxy { create(dataID: DataID, typeName: string): RecordProxy; delete(dataID: DataID): void; get(dataID: DataID): RecordProxy | null; @@ -141,7 +141,7 @@ interface RecordSourceSelectorProxy { getPluralRootField(fieldName: string): RecordProxy[] | null; } -interface RecordProxy { +export interface RecordProxy { copyFieldsFrom(source: RecordProxy): void; getDataID(): DataID; getLinkedRecord(name: string, args?: Variables): RecordProxy | null; @@ -158,14 +158,14 @@ interface RecordProxy { setValue(value: any, name: string, args?: Variables): RecordProxy; } -interface RecordSourceProxy { +export interface RecordSourceProxy { create(dataID: DataID, typeName: string): RecordProxy; delete(dataID: DataID): void; get(dataID: DataID): Array | null; getRoot(): RecordProxy; } -interface HandleFieldPayload { +export interface HandleFieldPayload { // The arguments that were fetched. args: Variables; // The __id of the record containing the source/handle field. @@ -178,7 +178,7 @@ interface HandleFieldPayload { // handler handleKey: string; } -interface HandlerInterface { +export interface HandlerInterface { update(store: RecordSourceProxy, fieldPayload: HandleFieldPayload): void; [functionName: string]: (...args: any[]) => any; } @@ -191,116 +191,116 @@ export const ViewerHandler: HandlerInterface; // File: https://github.com/facebook/relay/blob/b85a1d69bb72be4ace67179f55c2a54a8d761c8b/packages/react-relay/classic/environment/RelayCombinedEnvironmentTypes.js // ~~~~~~~~~~~~~~~~~~~~~ /** - * Settings for how a query response may be cached. - * - * - `force`: causes a query to be issued unconditionally, irrespective of the - * state of any configured response cache. - * - `poll`: causes a query to live update by polling at the specified interval - * in milliseconds. (This value will be passed to setTimeout.) - */ -interface CacheConfig { + * Settings for how a query response may be cached. + * + * - `force`: causes a query to be issued unconditionally, irrespective of the + * state of any configured response cache. + * - `poll`: causes a query to live update by polling at the specified interval + * in milliseconds. (This value will be passed to setTimeout.) + */ +export interface CacheConfig { force?: boolean; poll?: number; } /** - * Represents any resource that must be explicitly disposed of. The most common - * use-case is as a return value for subscriptions, where calling `dispose()` - * would cancel the subscription. - */ -interface Disposable { + * Represents any resource that must be explicitly disposed of. The most common + * use-case is as a return value for subscriptions, where calling `dispose()` + * would cancel the subscription. + */ +export interface Disposable { dispose(): void; } /** - * Arbitrary data e.g. received by a container as props. - */ -interface Props { + * Arbitrary data e.g. received by a container as props. + */ +export interface Props { [key: string]: any; } /** - * A selector defines the starting point for a traversal into the graph for the - * purposes of targeting a subgraph. - */ -interface CSelector { + * A selector defines the starting point for a traversal into the graph for the + * purposes of targeting a subgraph. + */ +export interface CSelector { dataID: DataID; node: TNode; variables: Variables; } /** - * A representation of a selector and its results at a particular point in time. - */ -type CSnapshot = CSelector & { + * A representation of a selector and its results at a particular point in time. + */ +export type CSnapshot = CSelector & { data: SelectorData | null | undefined; seenRecords: RecordMap; }; /** - * The results of a selector given a store/RecordSource. - */ -interface SelectorData { + * The results of a selector given a store/RecordSource. + */ +export interface SelectorData { [key: string]: any; } /** - * The results of reading the results of a FragmentMap given some input - * `Props`. - */ -interface FragmentSpecResults { + * The results of reading the results of a FragmentMap given some input + * `Props`. + */ +export interface FragmentSpecResults { [key: string]: any; } /** - * A utility for resolving and subscribing to the results of a fragment spec - * (key -> fragment mapping) given some "props" that determine the root ID - * and variables to use when reading each fragment. When props are changed via - * `setProps()`, the resolver will update its results and subscriptions - * accordingly. Internally, the resolver: - * - Converts the fragment map & props map into a map of `Selector`s. - * - Removes any resolvers for any props that became null. - * - Creates resolvers for any props that became non-null. - * - Updates resolvers with the latest props. - */ -interface FragmentSpecResolver { + * A utility for resolving and subscribing to the results of a fragment spec + * (key -> fragment mapping) given some "props" that determine the root ID + * and variables to use when reading each fragment. When props are changed via + * `setProps()`, the resolver will update its results and subscriptions + * accordingly. Internally, the resolver: + * - Converts the fragment map & props map into a map of `Selector`s. + * - Removes any resolvers for any props that became null. + * - Creates resolvers for any props that became non-null. + * - Updates resolvers with the latest props. + */ +export interface FragmentSpecResolver { /** - * Stop watching for changes to the results of the fragments. - */ + * Stop watching for changes to the results of the fragments. + */ dispose(): void; /** - * Get the current results. - */ + * Get the current results. + */ resolve(): FragmentSpecResults; /** - * Update the resolver with new inputs. Call `resolve()` to get the updated - * results. - */ + * Update the resolver with new inputs. Call `resolve()` to get the updated + * results. + */ setProps(props: Props): void; /** - * Override the variables used to read the results of the fragments. Call - * `resolve()` to get the updated results. - */ + * Override the variables used to read the results of the fragments. Call + * `resolve()` to get the updated results. + */ setVariables(variables: Variables): void; } -interface CFragmentMap { +export interface CFragmentMap { [key: string]: TFragment; } /** - * An operation selector describes a specific instance of a GraphQL operation - * with variables applied. - * - * - `root`: a selector intended for processing server results or retaining - * response data in the store. - * - `fragment`: a selector intended for use in reading or subscribing to - * the results of the the operation. - */ -interface COperationSelector { + * An operation selector describes a specific instance of a GraphQL operation + * with variables applied. + * + * - `root`: a selector intended for processing server results or retaining + * response data in the store. + * - `fragment`: a selector intended for use in reading or subscribing to + * the results of the the operation. + */ +export interface COperationSelector { fragment: CSelector; node: TOperation; root: CSelector; @@ -308,42 +308,42 @@ interface COperationSelector { } /** - * The public API of Relay core. Represents an encapsulated environment with its - * own in-memory cache. - */ -interface CEnvironment { + * The public API of Relay core. Represents an encapsulated environment with its + * own in-memory cache. + */ +export interface CEnvironment { /** - * Read the results of a selector from in-memory records in the store. - */ + * Read the results of a selector from in-memory records in the store. + */ lookup(selector: CSelector): CSnapshot; /** - * Subscribe to changes to the results of a selector. The callback is called - * when data has been committed to the store that would cause the results of - * the snapshot's selector to change. - */ + * Subscribe to changes to the results of a selector. The callback is called + * when data has been committed to the store that would cause the results of + * the snapshot's selector to change. + */ subscribe(snapshot: CSnapshot, callback: (snapshot: CSnapshot) => void): Disposable; /** - * Ensure that all the records necessary to fulfill the given selector are - * retained in-memory. The records will not be eligible for garbage collection - * until the returned reference is disposed. - * - * Note: This is a no-op in the classic core. - */ + * Ensure that all the records necessary to fulfill the given selector are + * retained in-memory. The records will not be eligible for garbage collection + * until the returned reference is disposed. + * + * Note: This is a no-op in the classic core. + */ retain(selector: CSelector): Disposable; /** - * Send a query to the server with request/response semantics: the query will - * either complete successfully (calling `onNext` and `onCompleted`) or fail - * (calling `onError`). - * - * Note: Most applications should use `streamQuery` in order to - * optionally receive updated information over time, should that feature be - * supported by the network/server. A good rule of thumb is to use this method - * if you would otherwise immediately dispose the `streamQuery()` - * after receving the first `onNext` result. - */ + * Send a query to the server with request/response semantics: the query will + * either complete successfully (calling `onNext` and `onCompleted`) or fail + * (calling `onError`). + * + * Note: Most applications should use `streamQuery` in order to + * optionally receive updated information over time, should that feature be + * supported by the network/server. A good rule of thumb is to use this method + * if you would otherwise immediately dispose the `streamQuery()` + * after receving the first `onNext` result. + */ sendQuery(config: { cacheConfig?: CacheConfig; onCompleted?(): void; @@ -353,13 +353,13 @@ interface CEnvironment; } -interface CUnstableEnvironmentCore { +export interface CUnstableEnvironmentCore { /** - * Create an instance of a FragmentSpecResolver. - * - * TODO: The FragmentSpecResolver *can* be implemented via the other methods - * defined here, so this could be moved out of core. It's convenient to have - * separate implementations until the experimental core is in OSS. - */ + * Create an instance of a FragmentSpecResolver. + * + * TODO: The FragmentSpecResolver *can* be implemented via the other methods + * defined here, so this could be moved out of core. It's convenient to have + * separate implementations until the experimental core is in OSS. + */ createFragmentSpecResolver( context: CRelayContext, containerName: string, @@ -388,78 +388,78 @@ interface CUnstableEnvironmentCore; /** - * Given a graphql`...` tagged template, extract a fragment definition usable - * by this version of Relay core. Throws if the value is not a fragment. - */ + * Given a graphql`...` tagged template, extract a fragment definition usable + * by this version of Relay core. Throws if the value is not a fragment. + */ getFragment(node: TGraphQLTaggedNode): TFragment; /** - * Given a graphql`...` tagged template, extract an operation definition - * usable by this version of Relay core. Throws if the value is not an - * operation. - */ + * Given a graphql`...` tagged template, extract an operation definition + * usable by this version of Relay core. Throws if the value is not an + * operation. + */ getOperation(node: TGraphQLTaggedNode): TOperation; /** - * Determine if two selectors are equal (represent the same selection). Note - * that this function returns `false` when the two queries/fragments are - * different objects, even if they select the same fields. - */ + * Determine if two selectors are equal (represent the same selection). Note + * that this function returns `false` when the two queries/fragments are + * different objects, even if they select the same fields. + */ areEqualSelectors(a: CSelector, b: CSelector): boolean; /** - * Given the result `item` from a parent that fetched `fragment`, creates a - * selector that can be used to read the results of that fragment for that item. - * - * Example: - * - * Given two fragments as follows: - * - * ``` - * fragment Parent on User { - * id - * ...Child - * } - * fragment Child on User { - * name - * } - * ``` - * - * And given some object `parent` that is the results of `Parent` for id "4", - * the results of `Child` can be accessed by first getting a selector and then - * using that selector to `lookup()` the results against the environment: - * - * ``` - * const childSelector = getSelector(queryVariables, Child, parent); - * const childData = environment.lookup(childSelector).data; - * ``` - */ + * Given the result `item` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment for that item. + * + * Example: + * + * Given two fragments as follows: + * + * ``` + * fragment Parent on User { + * id + * ...Child + * } + * fragment Child on User { + * name + * } + * ``` + * + * And given some object `parent` that is the results of `Parent` for id "4", + * the results of `Child` can be accessed by first getting a selector and then + * using that selector to `lookup()` the results against the environment: + * + * ``` + * const childSelector = getSelector(queryVariables, Child, parent); + * const childData = environment.lookup(childSelector).data; + * ``` + */ getSelector(operationVariables: Variables, fragment: TFragment, prop: any): CSelector | null; /** - * Given the result `items` from a parent that fetched `fragment`, creates a - * selector that can be used to read the results of that fragment on those - * items. This is similar to `getSelector` but for "plural" fragments that - * expect an array of results and therefore return an array of selectors. - */ + * Given the result `items` from a parent that fetched `fragment`, creates a + * selector that can be used to read the results of that fragment on those + * items. This is similar to `getSelector` but for "plural" fragments that + * expect an array of results and therefore return an array of selectors. + */ getSelectorList(operationVariables: Variables, fragment: TFragment, props: any[]): Array> | null; /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts the selectors for those fragments from the results. - * - * The canonical use-case for this function are Relay Containers, which - * use this function to convert (props, fragments) into selectors so that they - * can read the results to pass to the inner component. - */ + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the selectors for those fragments from the results. + * + * The canonical use-case for this function are Relay Containers, which + * use this function to convert (props, fragments) into selectors so that they + * can read the results to pass to the inner component. + */ getSelectorsFromObject( operationVariables: Variables, fragments: CFragmentMap, @@ -467,33 +467,33 @@ interface CUnstableEnvironmentCore | Array> | null | undefined }; /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts a mapping of keys -> id(s) of the results. - * - * Similar to `getSelectorsFromObject()`, this function can be useful in - * determining the "identity" of the props passed to a component. - */ + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts a mapping of keys -> id(s) of the results. + * + * Similar to `getSelectorsFromObject()`, this function can be useful in + * determining the "identity" of the props passed to a component. + */ getDataIDsFromObject( fragments: CFragmentMap, props: Props ): { [key: string]: DataID | DataID[] | null | undefined }; /** - * Given a mapping of keys -> results and a mapping of keys -> fragments, - * extracts the merged variables that would be in scope for those - * fragments/results. - * - * This can be useful in determing what varaibles were used to fetch the data - * for a Relay container, for example. - */ + * Given a mapping of keys -> results and a mapping of keys -> fragments, + * extracts the merged variables that would be in scope for those + * fragments/results. + * + * This can be useful in determing what varaibles were used to fetch the data + * for a Relay container, for example. + */ getVariablesFromObject(operationVariables: Variables, fragments: CFragmentMap, props: Props): Variables; } /** - * The type of the `relay` property set on React context by the React/Relay - * integration layer (e.g. QueryRenderer, FragmentContainer, etc). - */ -interface CRelayContext { + * The type of the `relay` property set on React context by the React/Relay + * integration layer (e.g. QueryRenderer, FragmentContainer, etc). + */ +export interface CRelayContext { environment: TEnvironment; variables: Variables; } @@ -501,21 +501,21 @@ interface CRelayContext { // ~~~~~~~~~~~~~~~~~~~~~ // RelayTypes /** - * Version: Relay 1.3.0 - * File: - * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js - */ + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/fa9f48ea209ee2402d433b59a84d1cbc046574e2/packages/react-relay/classic/tools/RelayTypes.js + */ // ~~~~~~~~~~~~~~~~~~~~~ -interface RerunParam { +export interface RerunParam { param: string; import: string; max_runs: number; } -interface FIELDS_CHANGE { +export interface FIELDS_CHANGE { type: "FIELDS_CHANGE"; fieldIDs: { [fieldName: string]: DataID | DataID[] }; } -interface RANGE_ADD { +export interface RANGE_ADD { type: "RANGE_ADD"; parentName?: string; parentID?: string; @@ -528,14 +528,14 @@ interface RANGE_ADD { edgeName: string; rangeBehaviors?: RangeBehaviors; } -interface NODE_DELETE { +export interface NODE_DELETE { type: "NODE_DELETE"; parentName?: string; parentID?: string; connectionName?: string; deletedIDFieldName: string; } -interface RANGE_DELETE { +export interface RANGE_DELETE { type: "RANGE_DELETE"; parentName?: string; parentID?: string; @@ -547,36 +547,36 @@ interface RANGE_DELETE { deletedIDFieldName: string | string[]; pathToConnection: string[]; } -interface REQUIRED_CHILDREN { +export interface REQUIRED_CHILDREN { type: "REQUIRED_CHILDREN"; children: RelayConcreteNode[]; } -type RelayMutationConfig = FIELDS_CHANGE | RANGE_ADD | NODE_DELETE | RANGE_DELETE | REQUIRED_CHILDREN; +export type RelayMutationConfig = FIELDS_CHANGE | RANGE_ADD | NODE_DELETE | RANGE_DELETE | REQUIRED_CHILDREN; -interface RelayMutationTransactionCommitCallbacks { +export interface RelayMutationTransactionCommitCallbacks { onFailure?: RelayMutationTransactionCommitFailureCallback; onSuccess?: RelayMutationTransactionCommitSuccessCallback; } -type RelayMutationTransactionCommitFailureCallback = ( +export type RelayMutationTransactionCommitFailureCallback = ( transaction: RelayMutationTransaction, preventAutoRollback: () => void ) => void; -type RelayMutationTransactionCommitSuccessCallback = ( +export type RelayMutationTransactionCommitSuccessCallback = ( response: { [key: string]: any; } ) => void; -interface NetworkLayer { +export interface NetworkLayer { sendMutation(request: RelayMutationRequest): Promise | null; sendQueries(requests: RelayQueryRequest[]): Promise | null; supports(...options: string[]): boolean; } -interface QueryResult { +export interface QueryResult { error?: Error; ref_params?: { [name: string]: any }; response: QueryPayload; } -interface ReadyState { +export interface ReadyState { aborted: boolean; done: boolean; error: Error | null; @@ -584,8 +584,8 @@ interface ReadyState { ready: boolean; stale: boolean; } -type RelayContainerErrorEventType = "CACHE_RESTORE_FAILED" | "NETWORK_QUERY_ERROR"; -type RelayContainerLoadingEventType = +export type RelayContainerErrorEventType = "CACHE_RESTORE_FAILED" | "NETWORK_QUERY_ERROR"; +export type RelayContainerLoadingEventType = | "ABORT" | "CACHE_RESTORED_REQUIRED" | "CACHE_RESTORE_START" @@ -594,74 +594,74 @@ type RelayContainerLoadingEventType = | "NETWORK_QUERY_START" | "STORE_FOUND_ALL" | "STORE_FOUND_REQUIRED"; -type ReadyStateChangeCallback = (readyState: ReadyState) => void; -interface ReadyStateEvent { +export type ReadyStateChangeCallback = (readyState: ReadyState) => void; +export interface ReadyStateEvent { type: RelayContainerLoadingEventType | RelayContainerErrorEventType; error?: Error; } -interface Abortable { +export interface Abortable { abort(): void; } // ~~~~~~~~~~~~~~~~~~~~~ // RelayInternalTypes /** - * Version: Relay 1.3.0 - * File: - * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js - */ + * Version: Relay 1.3.0 + * File: + * https://github.com/facebook/relay/blob/master/packages/react-relay/classic/tools/RelayInternalTypes.js + */ // ~~~~~~~~~~~~~~~~~~~~~ -interface QueryPayload { +export interface QueryPayload { [key: string]: any; } -interface RelayQuerySet { +export interface RelayQuerySet { [queryName: string]: any; } -type RangeBehaviorsFunction = ( +export type RangeBehaviorsFunction = ( connectionArgs: { [argName: string]: any; } ) => "APPEND" | "IGNORE" | "PREPEND" | "REFETCH" | "REMOVE"; -interface RangeBehaviorsObject { +export interface RangeBehaviorsObject { [key: string]: "APPEND" | "IGNORE" | "PREPEND" | "REFETCH" | "REMOVE"; } -type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; +export type RangeBehaviors = RangeBehaviorsFunction | RangeBehaviorsObject; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix // ~~~~~~~~~~~~~~~~~~~~~ -type RelayDebugger = any; -type OptimisticUpdate = any; -type OperationSelector = COperationSelector; -type Selector = CSelector; -type PayloadData = any; -type Snapshot = CSnapshot; -type RelayResponsePayload = any; -type MutableRecordSource = RecordSource; +export type RelayDebugger = any; +export type OptimisticUpdate = any; +export type OperationSelector = COperationSelector; +export type Selector = CSelector; +export type PayloadData = any; +export type Snapshot = CSnapshot; +export type RelayResponsePayload = any; +export type MutableRecordSource = RecordSource; /** - * A function that returns an Observable representing the response of executing - * a GraphQL operation. - */ -type ExecuteFunction = ( + * A function that returns an Observable representing the response of executing + * a GraphQL operation. + */ +export type ExecuteFunction = ( operation: object, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap ) => Promise; -interface RelayNetwork { +export interface RelayNetwork { execute: ExecuteFunction; } // ~~~~~~~~~~~~~~~~~~~~~ // RelayDefaultHandlerProvider // ~~~~~~~~~~~~~~~~~~~~~ -declare function HandlerProvider(name: string): HandlerInterface | null; +export function HandlerProvider(name: string): HandlerInterface | null; // ~~~~~~~~~~~~~~~~~~~~~ // RelayModernEnvironment // ~~~~~~~~~~~~~~~~~~~~~ -interface EnvironmentConfig { +export interface EnvironmentConfig { configName?: string; handlerProvider?: typeof HandlerProvider; network: Network; @@ -702,10 +702,10 @@ export class Environment { // ~~~~~~~~~~~~~~~~~~~~~ // RelayInMemoryRecordSource // ~~~~~~~~~~~~~~~~~~~~~ -interface RelayInMemoryRecordSource { +export interface RelayInMemoryRecordSource { [key: string]: any; } -interface RecordMap { +export interface RecordMap { [dataID: string]: RelayInMemoryRecordSource | null | undefined; } @@ -714,16 +714,16 @@ interface RecordMap { // ~~~~~~~~~~~~~~~~~~~~~ export class Network { /** - * Creates an implementation of the `Network` interface defined in - * `RelayNetworkTypes` given `fetch` and `subscribe` functions. - */ + * Creates an implementation of the `Network` interface defined in + * `RelayNetworkTypes` given `fetch` and `subscribe` functions. + */ static create(fetchFn: typeof FetchFunction, subscribeFn?: SubscribeFunction): RelayNetwork; } // ~~~~~~~~~~~~~~~~~~~~~ // Network // ~~~~~~~~~~~~~~~~~~~~~ -declare class RecordSource { +export class RecordSource { constructor(records?: RecordMap); clear(): void; delete(dataID: DataID): void; @@ -756,10 +756,10 @@ export class Store { // RelayRecordSourceInspector // ~~~~~~~~~~~~~~~~~~~~~ /** - * An internal class to provide a console-friendly string representation of a - * RelayInMemoryRecordSource. - */ -declare class RecordSummary { + * An internal class to provide a console-friendly string representation of a + * RelayInMemoryRecordSource. + */ +export class RecordSummary { id: DataID; type: string | null | undefined; static createFromRecord(id: DataID, record: any): RecordSummary; @@ -767,78 +767,78 @@ declare class RecordSummary { toString(): string; } /** - * Internal class for inspecting a single RelayInMemoryRecordSource. - */ -declare class RecordInspector { + * Internal class for inspecting a single RelayInMemoryRecordSource. + */ +export class RecordInspector { constructor(sourceInspector: RelayRecordSourceInspector, record: RelayInMemoryRecordSource); /** - * Get the cache id of the given record. For types that implement the `Node` - * interface (or that have an `id`) this will be `id`, for other types it will be - * a synthesized identifier based on the field path from the nearest ancestor - * record that does have an `id`. - */ + * Get the cache id of the given record. For types that implement the `Node` + * interface (or that have an `id`) this will be `id`, for other types it will be + * a synthesized identifier based on the field path from the nearest ancestor + * record that does have an `id`. + */ getDataID(): DataID; /** - * Returns a list of the fields that have been fetched on the current record. - */ + * Returns a list of the fields that have been fetched on the current record. + */ getFields(): string[]; /** - * Returns the type of the record. - */ + * Returns the type of the record. + */ getType(): string; /** - * Returns a copy of the internal representation of the record. - */ + * Returns a copy of the internal representation of the record. + */ inspect(): any; /** - * Returns the value of a scalar field. May throw if the given field is - * present but not actually scalar. - */ + * Returns the value of a scalar field. May throw if the given field is + * present but not actually scalar. + */ getValue(name: string, args?: Variables): any; /** - * Returns an inspector for the given scalar "linked" field (a field whose - * value is another RelayInMemoryRecordSource instead of a scalar). May throw if the field is - * present but not a scalar linked record. - */ + * Returns an inspector for the given scalar "linked" field (a field whose + * value is another RelayInMemoryRecordSource instead of a scalar). May throw if the field is + * present but not a scalar linked record. + */ getLinkedRecord(name: string, args?: Variables): RecordInspector | null; /** - * Returns an array of inspectors for the given plural "linked" field (a field - * whose value is an array of Records instead of a scalar). May throw if the - * field is present but not a plural linked record. - */ + * Returns an array of inspectors for the given plural "linked" field (a field + * whose value is an array of Records instead of a scalar). May throw if the + * field is present but not a plural linked record. + */ getLinkedRecords(name: string, args?: Variables): RecordInspector[] | null; } -declare class RelayRecordSourceInspector { +export class RelayRecordSourceInspector { constructor(source: RecordSource); static getForEnvironment(environment: Environment): RelayRecordSourceInspector; /** - * Returns an inspector for the record with the given id, or null/undefined if - * that record is deleted/unfetched. - */ + * Returns an inspector for the record with the given id, or null/undefined if + * that record is deleted/unfetched. + */ get(dataID: DataID): RecordInspector | null; /** - * Returns a list of ": " for each record in the store that has an - * `id`. - */ + * Returns a list of ": " for each record in the store that has an + * `id`. + */ getNodes(): RecordSummary[]; /** - * Returns a list of ": " for all records in the store including - * those that do not have an `id`. - */ + * Returns a list of ": " for all records in the store including + * those that do not have an `id`. + */ getRecords(): RecordSummary[]; /** - * Returns an inspector for the synthesized "root" object, allowing access to - * e.g. the `viewer` object or the results of other fields on the "Query" - * type. - */ + * Returns an inspector for the synthesized "root" object, allowing access to + * e.g. the `viewer` object or the results of other fields on the "Query" + * type. + */ getRoot(): RecordInspector; } @@ -848,129 +848,129 @@ export type RecordSourceInspector = RelayRecordSourceInspector; // ~~~~~~~~~~~~~~~~~~~~~ // RelayObservable // ~~~~~~~~~~~~~~~~~~~~~ -interface Subscription { +export interface Subscription { unsubscribe(): void; readonly closed: boolean; } -interface Observer { +export interface Observer { start?(subscription: Subscription): any; next?(nextThing: T): any; error?(error: Error): any; complete?(): any; unsubscribe?(subscription: Subscription): any; } -type Source = () => any; -interface Subscribable { +export type Source = () => any; // tslint:disable-line:no-unnecessary-generics +export interface Subscribable { subscribe(observer: Observer): Subscription; } -type ObservableFromValue = RelayObservable | Promise | T; -declare class RelayObservable implements Subscribable { +export type ObservableFromValue = RelayObservable | Promise | T; +export class RelayObservable implements Subscribable { _source: Source; constructor(source: Source); /** - * When an unhandled error is detected, it is reported to the host environment - * (the ESObservable spec refers to this method as "HostReportErrors()"). - * - * The default implementation in development builds re-throws errors in a - * separate frame, and from production builds does nothing (swallowing - * uncaught errors). - * - * Called during application initialization, this method allows - * application-specific handling of uncaught errors. Allowing, for example, - * integration with error logging or developer tools. - */ + * When an unhandled error is detected, it is reported to the host environment + * (the ESObservable spec refers to this method as "HostReportErrors()"). + * + * The default implementation in development builds re-throws errors in a + * separate frame, and from production builds does nothing (swallowing + * uncaught errors). + * + * Called during application initialization, this method allows + * application-specific handling of uncaught errors. Allowing, for example, + * integration with error logging or developer tools. + */ static onUnhandledError(callback: (error: Error) => any): void; /** - * Accepts various kinds of data sources, and always returns a RelayObservable - * useful for accepting the result of a user-provided FetchFunction. - */ + * Accepts various kinds of data sources, and always returns a RelayObservable + * useful for accepting the result of a user-provided FetchFunction. + */ static from(obj: ObservableFromValue): RelayObservable; /** - * Creates a RelayObservable, given a function which expects a legacy - * Relay Observer as the last argument and which returns a Disposable. - * - * To support migration to Observable, the function may ignore the - * legacy Relay observer and directly return an Observable instead. - */ + * Creates a RelayObservable, given a function which expects a legacy + * Relay Observer as the last argument and which returns a Disposable. + * + * To support migration to Observable, the function may ignore the + * legacy Relay observer and directly return an Observable instead. + */ static fromLegacy( callback: (legacyObserver: LegacyObserver) => Disposable | RelayObservable ): RelayObservable; /** - * Returns a new Observable which returns the same values as this one, but - * modified so that the provided Observer is called to perform a side-effects - * for all events emitted by the source. - * - * Any errors that are thrown in the side-effect Observer are unhandled, and - * do not affect the source Observable or its Observer. - * - * This is useful for when debugging your Observables or performing other - * side-effects such as logging or performance monitoring. - */ + * Returns a new Observable which returns the same values as this one, but + * modified so that the provided Observer is called to perform a side-effects + * for all events emitted by the source. + * + * Any errors that are thrown in the side-effect Observer are unhandled, and + * do not affect the source Observable or its Observer. + * + * This is useful for when debugging your Observables or performing other + * side-effects such as logging or performance monitoring. + */ do(observer: Observer): RelayObservable; /** - * Returns a new Observable which returns the same values as this one, but - * modified so that the finally callback is performed after completion, - * whether normal or due to error or unsubscription. - * - * This is useful for cleanup such as resource finalization. - */ + * Returns a new Observable which returns the same values as this one, but + * modified so that the finally callback is performed after completion, + * whether normal or due to error or unsubscription. + * + * This is useful for cleanup such as resource finalization. + */ finally(fn: () => any): RelayObservable; /** - * Returns a new Observable which is identical to this one, unless this - * Observable completes before yielding any values, in which case the new - * Observable will yield the values from the alternate Observable. - * - * If this Observable does yield values, the alternate is never subscribed to. - * - * This is useful for scenarios where values may come from multiple sources - * which should be tried in order, i.e. from a cache before a network. - */ + * Returns a new Observable which is identical to this one, unless this + * Observable completes before yielding any values, in which case the new + * Observable will yield the values from the alternate Observable. + * + * If this Observable does yield values, the alternate is never subscribed to. + * + * This is useful for scenarios where values may come from multiple sources + * which should be tried in order, i.e. from a cache before a network. + */ ifEmpty(alternate: RelayObservable): RelayObservable; /** - * Observable's primary API: returns an unsubscribable Subscription to the - * source of this Observable. - */ + * Observable's primary API: returns an unsubscribable Subscription to the + * source of this Observable. + */ subscribe(observer: Observer): Subscription; /** - * Supports subscription of a legacy Relay Observer, returning a Disposable. - */ + * Supports subscription of a legacy Relay Observer, returning a Disposable. + */ subscribeLegacy(legacyObserver: LegacyObserver): Disposable; /** - * Returns a new Observerable where each value has been transformed by - * the mapping function. - */ + * Returns a new Observerable where each value has been transformed by + * the mapping function. + */ map(fn: (thing: T) => U): RelayObservable; /** - * Returns a new Observable where each value is replaced with a new Observable - * by the mapping function, the results of which returned as a single - * concattenated Observable. - */ + * Returns a new Observable where each value is replaced with a new Observable + * by the mapping function, the results of which returned as a single + * concattenated Observable. + */ concatMap(fn: (thing: T) => ObservableFromValue): RelayObservable; /** - * Returns a new Observable which first mirrors this Observable, then when it - * completes, waits for `pollInterval` milliseconds before re-subscribing to - * this Observable again, looping in this manner until unsubscribed. - * - * The returned Observable never completes. - */ + * Returns a new Observable which first mirrors this Observable, then when it + * completes, waits for `pollInterval` milliseconds before re-subscribing to + * this Observable again, looping in this manner until unsubscribed. + * + * The returned Observable never completes. + */ poll(pollInterval: number): RelayObservable; /** - * Returns a Promise which resolves when this Observable yields a first value - * or when it completes with no value. - */ + * Returns a Promise which resolves when this Observable yields a first value + * or when it completes with no value. + */ toPromise(): Promise; } @@ -980,13 +980,13 @@ export type Observable = RelayObservable; // commitLocalUpdate // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly -type commitLocalUpdate = (environment: Environment, updater: StoreUpdater) => void; +export type commitLocalUpdate = (environment: Environment, updater: StoreUpdater) => void; // ~~~~~~~~~~~~~~~~~~~~~ // commitRelayModernMutation // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly -interface MutationConfig { +export interface MutationConfig { configs?: RelayMutationConfig[]; mutation: GraphQLTaggedNode; variables: Variables; @@ -997,13 +997,13 @@ interface MutationConfig { optimisticResponse?: object; updater?: SelectorStoreUpdater; } -declare function commitRelayModernMutation(environment: Environment, config: MutationConfig): Disposable; +export function commitRelayModernMutation(environment: Environment, config: MutationConfig): Disposable; // ~~~~~~~~~~~~~~~~~~~~~ // applyRelayModernOptimisticMutation // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly -interface OptimisticMutationConfig { +export interface OptimisticMutationConfig { configs?: RelayMutationConfig[]; mutation: GraphQLTaggedNode; variables: Variables; @@ -1016,19 +1016,19 @@ interface OptimisticMutationConfig { // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly /** - * A helper function to fetch the results of a query. Note that results for - * fragment spreads are masked: fields must be explicitly listed in the query in - * order to be accessible in the result object. - * - * NOTE: This module is primarily intended for integrating with classic APIs. - * Most product code should use a Renderer or Container. - * - * TODO(t16875667): The return type should be `Promise`, but - * that's not really helpful as `SelectorData` is essentially just `mixed`. We - * can probably leverage generated flow types here to return the real expected - * shape. - */ -declare function fetchRelayModernQuery( + * A helper function to fetch the results of a query. Note that results for + * fragment spreads are masked: fields must be explicitly listed in the query in + * order to be accessible in the result object. + * + * NOTE: This module is primarily intended for integrating with classic APIs. + * Most product code should use a Renderer or Container. + * + * TODO(t16875667): The return type should be `Promise`, but + * that's not really helpful as `SelectorData` is essentially just `mixed`. We + * can probably leverage generated flow types here to return the real expected + * shape. + */ +export function fetchRelayModernQuery( environment: any, // FIXME - $FlowFixMe in facebook source code taggedNode: GraphQLTaggedNode, variables: Variables, @@ -1039,7 +1039,7 @@ declare function fetchRelayModernQuery( // requestRelaySubscription // ~~~~~~~~~~~~~~~~~~~~~ // exposed through RelayModern, not Runtime directly -interface GraphQLSubscriptionConfig { +export interface GraphQLSubscriptionConfig { configs?: RelayMutationConfig[]; subscription: GraphQLTaggedNode; variables: Variables; @@ -1048,4 +1048,4 @@ interface GraphQLSubscriptionConfig { onNext?(response: object | null | undefined): void; updater?(store: RecordSourceSelectorProxy): void; } -declare function requestRelaySubscription(environment: Environment, config: GraphQLSubscriptionConfig): Disposable; +export function requestRelaySubscription(environment: Environment, config: GraphQLSubscriptionConfig): Disposable; diff --git a/types/relay-runtime/tsconfig.json b/types/relay-runtime/tsconfig.json index dd77fca0e4..8aed884320 100644 --- a/types/relay-runtime/tsconfig.json +++ b/types/relay-runtime/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 28822d262c70e805b0aeab6c023ac88030e0fffd Mon Sep 17 00:00:00 2001 From: Chris Grigg Date: Wed, 18 Oct 2017 16:31:50 -0400 Subject: [PATCH 038/314] @types/rosie: allow factory.build with class constructor (#20564) * allow Rosie factory.build with class constructor to work, though type unsafe * improve types for build with constructor, improve tests --- types/rosie/index.d.ts | 2 +- types/rosie/rosie-tests.ts | 31 +++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/types/rosie/index.d.ts b/types/rosie/index.d.ts index d8cb96a231..51728127ea 100644 --- a/types/rosie/index.d.ts +++ b/types/rosie/index.d.ts @@ -14,7 +14,7 @@ declare namespace rosie { * @param {function(object): *=} constructor * @return {Factory} */ - define(name: string, constructor?: (opts?: any) => any): IFactory; + define(name: string, constructor?: ((...opts: any[]) => any) | (new(...opts: any[]) => any)): IFactory; /** * Locates a factory by name and calls #build on it. diff --git a/types/rosie/rosie-tests.ts b/types/rosie/rosie-tests.ts index e44b05b255..8d7c6d83b8 100644 --- a/types/rosie/rosie-tests.ts +++ b/types/rosie/rosie-tests.ts @@ -62,8 +62,35 @@ personFactory.attr('secretCode', ['firstName', 'lastName', 'age', 'age', 'firstN // You can go past five dependencies, but you need to specify types personFactory.attr('secretCode', ['firstName', 'lastName', 'age', 'age', 'firstName', 'firstName'], (firstName: string, lastName: string, age1: number, age2: number, firstNameAgain: string, firstNameThisIsTooMuch: string) => ({ name: firstNameAgain, value: age1 + age2 })); -const personObj = Factory.build('Person'); -if (personObj.firstName !== 'John') { throw new Error('incorrect Person build'); } +// Having defined 'Person', `build` will return an object of type Person, using the generic type. +const person = Factory.build('Person'); +let aString = ''; +aString = person.firstName; + +class CustomClass { + type: string; + + constructor(props: { type: string }) { + this.type = props.type; + } +} + +Factory.define('CustomClass', CustomClass); + +class CustomClass2 { + constructor(prop1: string, prop2: string, prop3: string) { + } +} + +Factory.define('CustomClass2', CustomClass2); + +class CustomClassWithoutConstructor { + constructor() { + // set some state + } +} + +Factory.define('CustomClassWithoutConstructor', CustomClassWithoutConstructor); import rosie = require('rosie'); From 862695fbb4618014960843f087abc3e337764808 Mon Sep 17 00:00:00 2001 From: Anatoly Demidovich Date: Wed, 18 Oct 2017 23:34:17 +0300 Subject: [PATCH 039/314] fix connect() overload (#20674) --- types/mongodb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index afd32099bd..d8e646670e 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -17,8 +17,8 @@ import { ObjectID } from 'bson'; import { EventEmitter } from 'events'; import { Readable, Writable } from "stream"; -export function connect(uri: string, callback: MongoCallback): void; export function connect(uri: string, options?: MongoClientOptions): Promise; +export function connect(uri: string, callback: MongoCallback): void; export function connect(uri: string, options: MongoClientOptions, callback: MongoCallback): void; export { Binary, Double, Long, Decimal128, MaxKey, MinKey, ObjectID, ObjectId, Timestamp } from 'bson'; From 2fd1709e595544ad01ac191ef4a6fae15328109c Mon Sep 17 00:00:00 2001 From: Roberto Desideri Date: Wed, 18 Oct 2017 22:44:29 +0200 Subject: [PATCH 040/314] Remove myself from the authors (#20697) --- types/node/v7/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 45df6015fe..fc6cd33091 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -3,7 +3,6 @@ // Definitions by: Microsoft TypeScript // DefinitelyTyped // Parambir Singh -// Roberto Desideri // Christian Vaagland Tellnes // Wilco Bakker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 0b214148d09d7c7a3d033d65007f8652cfa7ce2a Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 18 Oct 2017 14:26:11 -0700 Subject: [PATCH 041/314] Update CODEOWNERS --- .github/CODEOWNERS | 671 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 510 insertions(+), 161 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c9c83c77c4..8c22099cc8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,15 +3,30 @@ /types/abs/ @AyaMorisawa /types/absolute/ @AyaMorisawa /types/acc-wizard/ @cyrilschumacher +/types/accept-language-parser/ @kampfgnom /types/accepts/ @bomret /types/accounting/ @gerich-home @chrisleck /types/ace/ @Diullei /types/acl/ @tkQubo /types/acorn/ @RReverser @e-cloud /types/actioncable/ @zhu1230 +/types/activex-access/ @zspitz /types/activex-adodb/ @zspitz +/types/activex-dao/ @zspitz +/types/activex-excel/ @zspitz +/types/activex-infopath/ @zspitz +/types/activex-libreoffice/ @zspitz +/types/activex-msforms/ @zspitz +/types/activex-mshtml/ @zspitz +/types/activex-msxml2/ @zspitz +/types/activex-office/ @zspitz +/types/activex-outlook/ @zspitz +/types/activex-powerpoint/ @zspitz /types/activex-scripting/ @zspitz +/types/activex-stdole/ @zspitz +/types/activex-vbide/ @zspitz /types/activex-wia/ @zspitz +/types/activex-word/ @zspitz /types/adal/ @mmaitre314 /types/adm-zip/ @jvilk @abner /types/adone/ @s0m3on3 @maxveres @@ -22,14 +37,14 @@ /types/alexa-sdk/ @petebeegle @hoo29 @pascalwhoop @blforce /types/alexa-voice-service/ @dolanmiu /types/algebra.js/ @CaselIT -/types/algoliasearch/ @cbaptiste +/types/algoliasearch/ @cbaptiste @haroenv @aherve /types/alt/ @Shearerbeard -/types/amazon-product-api/ @MattiLehtinen +/types/amazon-product-api/ @MattiLehtinen @alien35 /types/amcharts/ @aleksey-bykov /types/amplify/ @joeriks /types/amplify-deferred/ @joeriks @laurentiustamate94 /types/amplitude-js/ @Asido -/types/amqp/ @seikho +/types/amqp/ @seikho @jonnysparkplugs /types/amqp-rpc/ @wokim /types/amqplib/ @mnahkies @abreits @nfantone /types/analytics-node/ @fongandrew @@ -50,6 +65,7 @@ /types/angular-es/ @mbutsykin /types/angular-feature-flags/ @borislavjivkov /types/angular-file-saver/ @deenairn +/types/angular-file-upload/ @cyrilgandon /types/angular-formly/ @scatcher /types/angular-fullscreen/ @julienpa /types/angular-gettext/ @AkosLukacs @@ -62,7 +78,7 @@ /types/angular-idle/ @mthamil /types/angular-jwt/ @rerezz /types/angular-load/ @david-gang -/types/angular-loading-bar/ @stephenlautier +/types/angular-loading-bar/ @stephenlautier @tyronedougherty /types/angular-local-storage/ @kenfdev @dona278 /types/angular-localforage/ @reppners /types/angular-locker/ @nkovacic @@ -84,14 +100,14 @@ /types/angular-signalr-hub/ @AdamSantaniello /types/angular-spinner/ @Biegal /types/angular-storage/ @mdekrey -/types/angular-strap/ @samherrmann +/types/angular-strap/ @samherrmann @mkannwischer /types/angular-toastr/ @nkovacic @trodi /types/angular-toasty/ @muenchdo /types/angular-tooltips/ @leonard-thieu /types/angular-touchspin/ @nkovacic /types/angular-translate/ @michelsalib /types/angular-ui-bootstrap/ @xt0rted @ry8806 -/types/angular-ui-router/ @michelsalib @matiishyn +/types/angular-ui-router/ @michelsalib @matiishyn @mikehaas763 /types/angular-ui-scroll/ @marknadig /types/angular-ui-sortable/ @thgreasi /types/angular-ui-tree/ @CalvinFernandez @@ -116,6 +132,7 @@ /types/aphrodite/ @asvetliakov /types/api-error-handler/ @tkrotoff /types/apigee-access/ @CasperSkydt +/types/apollo-codegen/ @bradleyayers /types/app-root-path/ @shantmarouti /types/appframework/ @kyo-ago /types/appletvjs/ @brainded @@ -129,7 +146,7 @@ /types/archiver/ @dolanmiu @crevil /types/archy/ @vvakame /types/are-we-there-yet/ @brianloveswords -/types/argparse/ @arcticwaters +/types/argparse/ @arcticwaters @tlaziuk /types/argv/ @hookclaw /types/array-find-index/ @samverschueren /types/array-foreach/ @skysteve @@ -148,13 +165,18 @@ /types/assertsharp/ @brunolm /types/assets-webpack-plugin/ @kryops /types/async/ @borisyankov @kern0 @Penryn @fenying @pascalmartin +/types/async-cache/ @BendingBender /types/async-lock/ @elisee /types/async-polling/ @Goldsmith42 /types/async.nexttick/ @pyrho /types/asyncblock/ @horiuchi -/types/atmosphere/ @toedter -/types/atom/ @vvakame -/types/atom-keymap/ @enlight +/types/atmosphere/ @toedter @Mory1879 +/types/atmosphere.js/ @toedter @Mory1879 +/types/atom/v0/ @vvakame @smhxx +/types/atom/ @GlenCFL +/types/atom-keymap/v5/ @enlight +/types/atom-keymap/ @GlenCFL +/types/atom-mocha-test-runner/ @GlenCFL /types/atpl/ @soywiz /types/audiosprite/ @Perlmint /types/aurelia-knockout/ @code-chris @@ -172,11 +194,12 @@ /types/autoprefixer/ @odnamrataizem /types/autosize/ @kingdango @keika299 @NeekSandhu /types/awesomplete/ @webbiesdk @bmdixon @tbekolay -/types/aws-iot-device-sdk/ @niik -/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 +/types/aws-iot-device-sdk/ @niik @mlamp +/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex /types/aws-serverless-express/ @threesquared @jcaffey @mattmeye /types/aws4/ @ajcrites /types/axel/ @ruslan-molodyko +/types/axios-mock-adapter/ @tkryskiewicz /types/azure/ @AndrewGaspar @antiveeranna @SomaticIT /types/azure-mobile-services-client/ @dmorosinotto /types/azure-sb/ @Azure @@ -184,12 +207,14 @@ /types/babel-code-frame/ @mohsen1 /types/babel-core/ @yortus @marvinhagemeister /types/babel-generator/ @yortus @johnnyestilles +/types/babel-plugin-react-pug/ @jpap /types/babel-plugin-syntax-jsx/ @marvinhagemeister /types/babel-template/ @yortus @marvinhagemeister /types/babel-traverse/ @yortus @marvinhagemeister /types/babel-types/ @yortus @baxtersa @marvinhagemeister /types/babelify/ @TeamworkGuy2 @marvinhagemeister /types/babylon/ @yortus @marvinhagemeister +/types/babylon-walk/ @czbuchi /types/babyparse/ @cdiddy77 /types/backbone/ @borisyankov @nvivo /types/backbone-associations/ @craigbrett17 @@ -202,6 +227,7 @@ /types/backbone.radio/ @alphaleonis /types/backgrid/ @jlujan /types/backlog-js/ @vvatanabe +/types/backoff/ @BendingBender /types/baconjs/ @alexander-matsievsky @gekkio /types/bagpipes/ @micmro /types/barcode/ @pvomhoff @@ -218,11 +244,11 @@ /types/bcryptjs/ @RafaelKr /types/bem-cn/ @selkinvitaly /types/better-curry/ @pocesar -/types/better-sqlite3/ @Morfent +/types/better-sqlite3/ @Morfent @matrumz /types/bezier-easing/ @ptlis /types/bezier-js/ @danmarshall /types/bgiframe/ @sumegizoltan -/types/big.js/ @nycdotnet +/types/big.js/ @nycdotnet @googol /types/bigi/ @mhegazy /types/bigint/ @Evgenus /types/bignum/ @Patman64 @@ -242,6 +268,7 @@ /types/blessed/ @brynbellomy /types/blissfuljs/ @fskorzec /types/blob-stream/ @erichillah +/types/blob-to-buffer/ @nrlquaker /types/blob-util/ @WorldMaker /types/blocks/ @ksmigiel /types/bloomfilter/ @slawiko @@ -272,15 +299,17 @@ /types/bootstrap-treeview/ @jbtronics /types/bootstrap-validator/ @BradyLiles /types/bootstrap.paginator/ @derikwhittaker -/types/bootstrap.timepicker/ @derikwhittaker +/types/bootstrap.timepicker/ @derikwhittaker @heatherbooker /types/bootstrap.v3.datetimepicker/v3/ @bayitajesi /types/bootstrap.v3.datetimepicker/ @katonap +/types/botvs/ @acrazing /types/bounce.js/ @cherrry /types/bowser/ @pocesar /types/box2d/ @jbaldwin /types/brace-expansion/ @BendingBender /types/braintree-web/ @chlela /types/breeze/ @borisyankov +/types/bricks.js/ @kondi /types/brorand/ @chrootsu /types/browser-bunyan/ @PaulLockwood @kryops /types/browser-fingerprint/ @LKay @@ -302,6 +331,7 @@ /types/bunnymq/ @cyrilschumacher /types/bunyan/ @amikhalev /types/bunyan-blackhole/ @olivr70 +/types/bunyan-bugsnag/ @pasieronen /types/bunyan-config/ @cyrilschumacher /types/bunyan-prettystream/ @jasonswearingen @enlight /types/bunyan-winston-adapter/ @stevehipwell @@ -325,6 +355,7 @@ /types/canvas-gauges/ @Mikhus /types/canvasjs/ @brutalimp /types/capitalize/ @frederickfogerty +/types/card-validator/ @ChanceM /types/cash/ @akvlko /types/casperjs/ @jedmao /types/cassandra-driver/ @Svjard @@ -334,12 +365,13 @@ /types/chai/v2/ @Bartvds @AGBrown /types/chai/ @jedmao @Bartvds @AGBrown @olivr70 @mwistrand @joshuakgoldberg @shaunluttin /types/chai-arrays/ @clementprevot -/types/chai-as-promised/ @jt000 @Kuniwak @leonard-thieu +/types/chai-as-promised/ @jt000 @Kuniwak @leonard-thieu @lazerwalker @mattbishop /types/chai-datetime/ @cliffburger /types/chai-dom/ @mattlewis92 /types/chai-enzyme/ @asvetliakov /types/chai-fuzzy/ @Bartvds /types/chai-http/ @Nemo157 @G1itcher @CaselIT +/types/chai-jest-snapshot/ @mattvperry /types/chai-jquery/ @kazimanzurrashid /types/chai-json-schema/ @ulrichheiniger /types/chai-oequal/ @mizunashi-mana @@ -351,16 +383,18 @@ /types/chance/ @cbowdon /types/change-emitter/ @iskandersierra /types/charm/ @Xananax -/types/chart.js/ @anuti @FabienLavocat @KentarouTakeda @larrybahr -/types/chartist/ @mtgibbs @psimonski +/types/chart.js/ @anuti @FabienLavocat @KentarouTakeda @larrybahr @mernen @josefpaij +/types/chartist/ @mtgibbs @psimonski @clottman /types/chartjs/ @Steve-Fenton @FanaHOVA /types/chayns/ @HenningKuehl /types/check-sum/ @BendingBender /types/checkstyle-formatter/ @mhegazy /types/checksum/ @rogierschouten /types/cheerio/ @blittle @wmaurer @umarniz -/types/chokidar/ @reppners @felixfbecker +/types/chmodr/ @BendingBender +/types/chokidar/ @reppners @felixfbecker @bayssmekanique /types/chosen-js/ @borisyankov @denisname +/types/chownr/ @BendingBender /types/chroma-js/v0/ @invliD /types/chroma-js/ @invliD @mpacholec /types/chrome/ @matthewkimber @otiai10 @couven92 @rreverser @sreimer15 @@ -373,6 +407,7 @@ /types/clean-css/ @tkrotoff /types/clean-stack/ @BendingBender /types/clear-require/ @dan-j +/types/cleave.js/ @clentfort /types/cli/ @kayahr /types/cli-color/ @ChaosinaCan /types/cli-table2/ @mgroenhoff @@ -382,9 +417,11 @@ /types/clipboard-js/ @markwongsk /types/clipboardy/ @BendingBender /types/clndr/ @jasperjn +/types/clockpicker/ @jfcere /types/closure-compiler/ @mprobst /types/cloud-env/ @Morfent /types/cloudflare-apps/ @MartynasZilinskas +/types/cls-hooked/ @aleung /types/co-body/ @geoffreak /types/co-views/ @devlee @geoffreak /types/code/ @prashaantt @@ -411,7 +448,7 @@ /types/commander/ @alan-agius4 @mdezem @vvakame /types/commangular/ @hiraash /types/comment-json/ @Jason3S -/types/common-tags/ @zuzusik +/types/common-tags/ @zuzusik @tzupengwang /types/commonmark/ @nicojs @leonard-thieu /types/compare-version/ @jpevarnek /types/complex/ @AyaMorisawa @@ -425,7 +462,7 @@ /types/conf/v0/ @SamVerschueren /types/conf/ @SamVerschueren @BendingBender /types/confidence/ @jppellerin -/types/config/ @RWander +/types/config/ @RWander @forrestbice @jndonald3 /types/configstore/ @ArcticLight /types/confit/ @ethanresnick /types/connect/ @SomaticIT @@ -435,6 +472,7 @@ /types/connect-livereload/ @SomaticIT /types/connect-modrewrite/ @tinganho /types/connect-mongo/ @Syati +/types/connect-pg-simple/ @pasieronen /types/connect-redis/ @xstoudi @morcerf /types/connect-slashes/ @samherrmann /types/connect-timeout/ @cyrilschumacher @@ -447,6 +485,7 @@ /types/contextjs/ @kernhanda /types/continuation-local-storage/ @rath @heycalmdown @aboveyou00 /types/convert-hrtime/ @BendingBender +/types/convert-layout/ @xeningem /types/convert-source-map/ @AndrewGaspar @mgroenhoff @TeamworkGuy2 /types/convict/ @Nemo157 @vesse @elyscape /types/cookie/ @pine613 @@ -463,7 +502,9 @@ /types/cordova-plugin-background-mode/ @Lordnoname /types/cordova-plugin-badge/ @timbru31 /types/cordova-plugin-ble-central/ @gjunge +/types/cordova-plugin-canvascamera/ @lordazzi /types/cordova-plugin-device-name/ @larrybahr +/types/cordova-plugin-file-opener2/ @cyrilgandon /types/cordova-plugin-ibeacon/ @Ritzlgrmft /types/cordova-plugin-insomnia/ @Ritzlgrmft /types/cordova-plugin-keyboard/ @danmana @@ -485,6 +526,8 @@ /types/cote/ @makepost /types/couchbase/ @maouida /types/countdown/ @gjuchault +/types/counterpart/ @santiagodoldan +/types/countries-and-timezones/ @zero51 /types/country-list/ @iRoachie /types/country-select-js/ @humrochagf /types/cp-file/ @BendingBender @@ -492,13 +535,14 @@ /types/cradle/ @panuhorsmalahti /types/crc/ @YuJianrong /types/create-error/ @tkrotoff +/types/create-react-class/ @jgoz /types/createjs/ @evilangelist @gyohk /types/createjs-lib/ @evilangelist @gyohk /types/credential/ @phuvo /types/credit-card-type/ @LKay /types/cron/ @horiuchi /types/cropperjs/ @stepancar -/types/croppie/ @connor4312 +/types/croppie/ @connor4312 @dklmuc /types/crossfilter/ @schmuli @iebaker /types/crossroads/ @diullei /types/cryptiles/ @awendland @@ -514,16 +558,18 @@ /types/csurf/ @horiuchi /types/csv-parse/ @davidm77 @obi-jan-kenobi /types/csv-stringify/ @rogierschouten @arjenvanderende +/types/csvrow/ @codeanimal /types/csvtojson/ @EricByers @wcarson /types/cucumber/v1/ @abraaoalves @jan-molak @isoung @BendingBender /types/cucumber/ @abraaoalves @jan-molak @isoung @BendingBender -/types/currency-formatter/ @mhegazy +/types/currency-formatter/ @mhegazy @davidmpaz /types/custom-error-generator/ @thmiceli /types/cwise/ @taoqf /types/cwise-compiler/ @taoqf /types/cwise-parser/ @taoqf /types/cybozulabs-md5/ @pine613 -/types/cypress/ @ghengeveld @mikewoudenberg +/types/cypress/ @ghengeveld @mikewoudenberg @rvanmarkus +/types/cytoscape/ @phreed @wy193777 /types/d3/v3/ @gustavderdrache @borisyankov /types/d3/ @tomwanzek @gustavderdrache @borisyankov /types/d3-array/ @gustavderdrache @borisyankov @tomwanzek @@ -553,7 +599,7 @@ /types/d3-request/ @Ledragon @gustavderdrache @borisyankov @tomwanzek /types/d3-sankey/ @tomwanzek @gustavderdrache /types/d3-scale/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-scale-chromatic/ @Ledragon @gustavderdrache @borisyankov +/types/d3-scale-chromatic/ @Ledragon @gustavderdrache @borisyankov @henriquefm /types/d3-selection/ @tomwanzek @gustavderdrache @borisyankov /types/d3-selection-multi/ @gustavderdrache @borisyankov /types/d3-shape/ @tomwanzek @gustavderdrache @borisyankov @@ -568,8 +614,9 @@ /types/d3.slider/ @lk-chen /types/d3kit/ @morphatic /types/d3pie/ @mc-petry -/types/dagre/ @qinfchen +/types/dagre/ @qinfchen @Frankrike @vilterp /types/dagre-d3/ @markwongsk +/types/dagre-layout/ @qinfchen @Frankrike @vilterp /types/dargs/ @BendingBender /types/dat-gui/ @gyohk @sonic3d @rroylance /types/data-driven/ @mrhen @@ -579,6 +626,7 @@ /types/datatables.net-fixedheader/ @szechyjs /types/datatables.net-rowreorder/ @baywet /types/datatables.net-select/ @szechyjs +/types/date-arithmetic/ @HeeL /types/date.format.js/ @balrob /types/dateformat/ @aicest /types/datejs/ @rupertavery @@ -594,6 +642,7 @@ /types/decamelize/ @samverschueren /types/decay/ @enaeseth /types/decimal.js/ @musicist288 +/types/decompress/ @plantain-00 /types/decorum/ @dflor003 /types/dedent/ @douglasduteil /types/deep-assign/ @souldreamer @@ -601,8 +650,9 @@ /types/deep-equal/ @remojansen @janslow /types/deep-extend/ @rhysd /types/deep-freeze/ @Bartvds @aluanhaddad +/types/deep-freeze-es6/ @mattbishop /types/deep-freeze-strict/ @mhegazy -/types/deepmerge/ @marvinscharle +/types/deepmerge/ @marvinscharle @syy1125 /types/defaults/ @IbtihelCHNAB /types/define-lazy-prop/ @BendingBender /types/defined/ @BendingBender @@ -613,7 +663,7 @@ /types/delay/ @BendingBender /types/denodeify/ @joaomoreno /types/deoxxa-content-type/ @pine613 -/types/depd/ @danny8002 +/types/depd/ @danny8002 @BendingBender /types/deployjava/ @cyrilschumacher /types/destroy/ @BendingBender /types/destroy-on-hwm/ @BendingBender @@ -638,11 +688,12 @@ /types/discontinuous-range/ @OiCMudkips /types/disposable-email-domains/ @geoffreak /types/doccookies/ @jonegerton -/types/dockerode/ @seikho @nlaplante @isac322 +/types/dockerode/ @seikho @nlaplante @isac322 @lazarusx @meisenzahl /types/docopt/ @giggio /types/doctrine/ @rictic /types/documentdb/ @NoelAbrahams @brettferdosi @ctstone @yifanwu /types/documentdb-server/ @lith-light-g +/types/documentdb-session/ @DanielRosenwasser /types/dojo/ @vansimke /types/dom-inputevent/ @diagramatics /types/dom4/ @adidahiya @giladgray @@ -656,14 +707,15 @@ /types/dot-prop/v2/ @samverschueren /types/dot-prop/ @samverschueren @BendingBender /types/dotdotdot/ @milanjaros -/types/dotenv/v2/ @borekb @enaeseth +/types/dotenv/v2/ @jussikinnula @borekb @enaeseth /types/dotenv/ @jussikinnula @borekb @enaeseth /types/dotenv-safe/ @krenor /types/dottie/ @domarmstrong /types/doublearray/ @mzsm /types/doubleclick-gpt/ @johngeorgewright /types/downloadjs/ @cwmoo740 -/types/draft-js/ @dmitryrogozhny @eelco @ghotiphud @schwers @michael-yx-wu @willisplummer +/types/draft-js/ @dmitryrogozhny @eelco @ghotiphud @schwers @michael-yx-wu @willisplummer @smvilar +/types/drag-timetable/ @chinkan /types/draggabilly/ @jaydubu /types/dragster/ @zskovacs /types/dragula/ @pwelter34 @abruzzihraig @@ -671,12 +723,17 @@ /types/dropkickjs/ @VorobeY1326 /types/dropzone/v4/ @nvivo @outring @renuo @Hikariii /types/dropzone/ @nvivo @outring @renuo @Hikariii @tedbcsgpro +/types/dts-generator/ @mtraynham /types/duplexer2/ @Goldsmith42 /types/duplexer3/ @BendingBender +/types/duplexify/ @strax +/types/duplicate-package-checker-webpack-plugin/ @mtraynham /types/durandal/ @BlueSpire /types/dustjs-linkedin/ @mdezem /types/dw-bxslider-4/ @namerci -/types/dwt/ @yushulx +/types/dwt/v12/ @yushulx +/types/dwt/ @yushulx @jbh +/types/dygraphs/ @danvk /types/dymo-label-framework/ @thijskuipers /types/dynatable/ @francoismassart /types/each/ @misak113 @@ -696,6 +753,8 @@ /types/egg/ @sheperdwind /types/egg-mock/ @sheperdwind /types/egg.js/ @ToastHawaii +/types/egjs__axes/ @naver +/types/egjs__component/ @naver /types/ej.web.all/ @syncfusion /types/ejs-locals/ @jt000 /types/ejson/ @shantanubhadoria @@ -703,7 +762,8 @@ /types/electron-config/ @mrfunkycold @unindented /types/electron-debug/ @unindented /types/electron-devtools-installer/ @gamesmaxed -/types/electron-json-storage/ @stpettersens +/types/electron-is-dev/ @trodi +/types/electron-json-storage/ @stpettersens @nrlquaker /types/electron-notifications/ @djpereira /types/electron-notify/ @djpereira /types/electron-packager/ @SomaticIT @cortopy @@ -711,6 +771,7 @@ /types/electron-settings/ @icopp /types/electron-store/ @unindented /types/electron-window-state/ @rhysd +/types/electron-winstaller/ @shiftkey /types/element-ready/ @BendingBender /types/element-resize-event/ @rogierschouten @plgregoire /types/elm/ @thSoft @@ -718,11 +779,13 @@ /types/email-templates/ @cyrilschumacher @gurisko /types/email-validator/ @paullessing /types/ember/v1/ @jedmao -/types/ember/ @jedmao @bttf +/types/ember/ @jedmao @bttf @dwickern @chriskrycho @theroncross +/types/ember-testing-helpers/ @chriskrycho /types/emissary/ @vvakame /types/emojione/ @dbrgn /types/empower/ @vvakame /types/emscripten/ @zakki @periklis +/types/end-of-stream/ @strax /types/engine.io/ @KentarouTakeda /types/engine.io-client/ @KentarouTakeda /types/enhanced-resolve/ @e-cloud @onigoetz @@ -731,6 +794,8 @@ /types/env-to-object/ @MugeSo /types/envify/ @tkQubo /types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden +/types/enzyme-adapter-react-15/ @tkrotoff +/types/enzyme-adapter-react-16/ @tkrotoff /types/enzyme-to-json/ @joscha /types/eonasdan-bootstrap-datetimepicker/ @ToastHawaii /types/epiceditor/ @borisyankov @@ -748,7 +813,8 @@ /types/escape-string-regexp/ @kruncher /types/escodegen/ @simondel /types/eslint-plugin-prettier/ @ikatyang -/types/esprima/ @teppeis @RReverser +/types/esprima/v2/ @teppeis @RReverser +/types/esprima/ @teppeis @RReverser @peter-scott /types/esprima-walk/ @tswaters /types/esri-leaflet/ @strajuser /types/esri-leaflet-geocoder/ @BendingBender @@ -759,7 +825,8 @@ /types/eureka-js-client/ @Schnillz /types/evaporate/ @kookster @chrisrhoden /types/event-emitter/ @LKay -/types/event-kit/ @enlight +/types/event-kit/v1/ @enlight +/types/event-kit/ @GlenCFL /types/event-loop-lag/ @rogierschouten /types/event-stream/ @flcdrg /types/event-to-promise/ @flying-sheep @@ -777,17 +844,19 @@ /types/express-brute/ @cyrilschumacher /types/express-brute-memcached/ @cyrilschumacher /types/express-brute-mongo/ @cyrilschumacher +/types/express-brute-redis/ @scottharwell /types/express-debug/ @federicobond /types/express-domain-middleware/ @hookclaw /types/express-enforces-ssl/ @kevinstubbs /types/express-fileupload/ @Naktibalda /types/express-flash-2/ @mathsalmi /types/express-formidable/ @tdolsen -/types/express-graphql/ @isman-usoh @nitintutlani +/types/express-graphql/ @isman-usoh @nitintutlani @hubel /types/express-handlebars/ @stpettersens @yhaskell /types/express-jwt/ @wokim @kacepe @Sl1MBoy /types/express-less/ @xieyubo /types/express-minify/ @borislavjivkov +/types/express-mongo-sanitize/ @ericbyers /types/express-mung/ @cyrilschumacher /types/express-myconnection/ @Cellule /types/express-mysql-session/ @Akim95 @@ -822,6 +891,7 @@ /types/farbtastic/ @EnableSoftware /types/fast-diff/ @djrenren /types/fast-levenshtein/ @mizunashi-mana +/types/fast-list/ @BendingBender /types/fast-stats/ @rogierschouten /types/fastclick/ @shinnn /types/favico.js/ @drowse314-dev-ymat @@ -829,6 +899,7 @@ /types/fbemitter/ @kmxz /types/featherlight/ @xStrom /types/fecha/ @9y5 +/types/feedme/ @codeanimal /types/fetch-jsonp/ @tkrotoff /types/fetch-mock/ @asvetliakov @tamird @merrywhether @chrissinclair /types/fetch.io/ @newraina @@ -840,6 +911,7 @@ /types/file-exists/ @BendingBender /types/file-saver/ @cyrilschumacher @DaIgeb /types/file-type/ @tcaesvk @BendingBender +/types/file-url/ @coderslagoon /types/filenamify/ @rokt33r /types/filesize/ @GiedriusGrabauskas /types/fill-pdf/ @westy92 @@ -855,12 +927,14 @@ /types/firebird/ @karak /types/firefox/ @vvakame /types/firmata/ @troywweber7 -/types/first-mate/ @enlight +/types/first-mate/v4/ @enlight +/types/first-mate/ @GlenCFL /types/fixed-data-table/ @pepaar @stephenjelfs /types/flat/ @chrootsu /types/flatpickr/v2/ @UnwrittenFun /types/flatpickr/ @UnwrittenFun @rowellx68 @wagich /types/flexslider/ @diullei +/types/flickity/ @clmcgrath @wagich /types/flight/ @jonathanhedren /types/flightplan/ @borislavjivkov /types/flipsnap/ @kubosho @gsino @mayuki @@ -868,7 +942,7 @@ /types/flowjs/ @ryan10132 /types/fluent-ffmpeg/ @tcaesvk @DingWeizhe /types/flux/ @stkb @GiedriusGrabauskas -/types/flux-standard-action/ @tkqubo +/types/flux-standard-action/ @tkqubo @zimme /types/fluxxor/ @mrk21 /types/fm-websync/ @markusmauch /types/fontfaceobserver/ @RandScullard @@ -888,24 +962,26 @@ /types/freedom/ @jpevarnek /types/freeport/ @atd-schubert /types/fresh/ @BendingBender +/types/friendly-errors-webpack-plugin/ @bahlo /types/frisby/ @johnny4753 /types/from/ @Bartvds /types/from2/ @BendingBender /types/fromjs/ @glenndierckx /types/fromnow/ @marinewater /types/fs-ext/ @OguzhanE -/types/fs-extra/ @alan-agius4 @midknight41 @shiftkey +/types/fs-extra/ @alan-agius4 @midknight41 @shiftkey @mees- /types/fs-extra-promise/ @midknight41 @jasonswearingen @HiromiShikata /types/fs-extra-promise-es6/ @midknight41 @jasonswearingen @geoffreak @HiromiShikata /types/fs-finder/ @misak113 /types/fs-mock/ @rogierschouten /types/fs-promise/ @tarruda +/types/fs-readdir-recursive/ @pscanf /types/fsevents/ @BendingBender /types/ftdomdelegate/ @dotnetnerd /types/ftp/ @rogierschouten /types/ftpd/ @rogierschouten /types/fullcalendar/v1/ @nestalk @hasellcamargo -/types/fullcalendar/ @nestalk @hasellcamargo @panic175 +/types/fullcalendar/ @nestalk @hasellcamargo @panic175 @hmil /types/fullname/ @kayahr /types/fuse/ @smrq /types/fusioncharts/ @rohitkr @shivarajkv @@ -920,6 +996,131 @@ /types/gapi.analytics/ @gatsbimantico /types/gapi.auth2/ @flawless2011 /types/gapi.calendar/ @tkrotoff +/types/gapi.client/ @Bolisov +/types/gapi.client.acceleratedmobilepageurl/ @Bolisov +/types/gapi.client.adexchangebuyer/ @Bolisov +/types/gapi.client.adexchangebuyer2/ @Bolisov +/types/gapi.client.adexchangeseller/ @Bolisov +/types/gapi.client.adexperiencereport/ @Bolisov +/types/gapi.client.admin/ @Bolisov +/types/gapi.client.adsense/ @Bolisov +/types/gapi.client.adsensehost/ @Bolisov +/types/gapi.client.analytics/ @Bolisov +/types/gapi.client.analyticsreporting/ @Bolisov +/types/gapi.client.androiddeviceprovisioning/ @Bolisov +/types/gapi.client.androidenterprise/ @Bolisov +/types/gapi.client.androidmanagement/ @Bolisov +/types/gapi.client.androidpublisher/ @Bolisov +/types/gapi.client.appengine/ @Bolisov +/types/gapi.client.appsactivity/ @Bolisov +/types/gapi.client.appstate/ @Bolisov +/types/gapi.client.bigquery/ @Bolisov +/types/gapi.client.bigquerydatatransfer/ @Bolisov +/types/gapi.client.blogger/ @Bolisov +/types/gapi.client.books/ @Bolisov +/types/gapi.client.calendar/ @Bolisov +/types/gapi.client.civicinfo/ @Bolisov +/types/gapi.client.classroom/ @Bolisov +/types/gapi.client.cloudbilling/ @Bolisov +/types/gapi.client.cloudbuild/ @Bolisov +/types/gapi.client.clouddebugger/ @Bolisov +/types/gapi.client.clouderrorreporting/ @Bolisov +/types/gapi.client.cloudfunctions/ @Bolisov +/types/gapi.client.cloudiot/ @Bolisov +/types/gapi.client.cloudkms/ @Bolisov +/types/gapi.client.cloudmonitoring/ @Bolisov +/types/gapi.client.cloudresourcemanager/ @Bolisov +/types/gapi.client.cloudtasks/ @Bolisov +/types/gapi.client.cloudtrace/ @Bolisov +/types/gapi.client.clouduseraccounts/ @Bolisov +/types/gapi.client.compute/ @Bolisov +/types/gapi.client.consumersurveys/ @Bolisov +/types/gapi.client.container/ @Bolisov +/types/gapi.client.content/ @Bolisov +/types/gapi.client.customsearch/ @Bolisov +/types/gapi.client.dataflow/ @Bolisov +/types/gapi.client.dataproc/ @Bolisov +/types/gapi.client.datastore/ @Bolisov +/types/gapi.client.deploymentmanager/ @Bolisov +/types/gapi.client.dfareporting/ @Bolisov +/types/gapi.client.discovery/ @Bolisov +/types/gapi.client.dlp/ @Bolisov +/types/gapi.client.dns/ @Bolisov +/types/gapi.client.doubleclickbidmanager/ @Bolisov +/types/gapi.client.doubleclicksearch/ @Bolisov +/types/gapi.client.drive/ @Bolisov +/types/gapi.client.firebasedynamiclinks/ @Bolisov +/types/gapi.client.firebaseremoteconfig/ @Bolisov +/types/gapi.client.firebaserules/ @Bolisov +/types/gapi.client.firestore/ @Bolisov +/types/gapi.client.fitness/ @Bolisov +/types/gapi.client.fusiontables/ @Bolisov +/types/gapi.client.games/ @Bolisov +/types/gapi.client.gamesconfiguration/ @Bolisov +/types/gapi.client.gamesmanagement/ @Bolisov +/types/gapi.client.genomics/ @Bolisov +/types/gapi.client.gmail/ @Bolisov +/types/gapi.client.groupsmigration/ @Bolisov +/types/gapi.client.groupssettings/ @Bolisov +/types/gapi.client.iam/ @Bolisov +/types/gapi.client.identitytoolkit/ @Bolisov +/types/gapi.client.kgsearch/ @Bolisov +/types/gapi.client.language/ @Bolisov +/types/gapi.client.licensing/ @Bolisov +/types/gapi.client.logging/ @Bolisov +/types/gapi.client.manufacturers/ @Bolisov +/types/gapi.client.mirror/ @Bolisov +/types/gapi.client.ml/ @Bolisov +/types/gapi.client.monitoring/ @Bolisov +/types/gapi.client.oauth2/ @Bolisov +/types/gapi.client.oslogin/ @Bolisov +/types/gapi.client.pagespeedonline/ @Bolisov +/types/gapi.client.partners/ @Bolisov +/types/gapi.client.people/ @Bolisov +/types/gapi.client.playcustomapp/ @Bolisov +/types/gapi.client.playmoviespartner/ @Bolisov +/types/gapi.client.plus/ @Bolisov +/types/gapi.client.plusdomains/ @Bolisov +/types/gapi.client.prediction/ @Bolisov +/types/gapi.client.proximitybeacon/ @Bolisov +/types/gapi.client.pubsub/ @Bolisov +/types/gapi.client.qpxexpress/ @Bolisov +/types/gapi.client.reseller/ @Bolisov +/types/gapi.client.resourceviews/ @Bolisov +/types/gapi.client.runtimeconfig/ @Bolisov +/types/gapi.client.safebrowsing/ @Bolisov +/types/gapi.client.script/ @Bolisov +/types/gapi.client.searchconsole/ @Bolisov +/types/gapi.client.servicecontrol/ @Bolisov +/types/gapi.client.servicemanagement/ @Bolisov +/types/gapi.client.serviceuser/ @Bolisov +/types/gapi.client.sheets/ @Bolisov +/types/gapi.client.siteverification/ @Bolisov +/types/gapi.client.slides/ @Bolisov +/types/gapi.client.sourcerepo/ @Bolisov +/types/gapi.client.spanner/ @Bolisov +/types/gapi.client.spectrum/ @Bolisov +/types/gapi.client.speech/ @Bolisov +/types/gapi.client.sqladmin/ @Bolisov +/types/gapi.client.storage/ @Bolisov +/types/gapi.client.storagetransfer/ @Bolisov +/types/gapi.client.streetviewpublish/ @Bolisov +/types/gapi.client.surveys/ @Bolisov +/types/gapi.client.tagmanager/ @Bolisov +/types/gapi.client.taskqueue/ @Bolisov +/types/gapi.client.tasks/ @Bolisov +/types/gapi.client.testing/ @Bolisov +/types/gapi.client.toolresults/ @Bolisov +/types/gapi.client.translate/ @Bolisov +/types/gapi.client.urlshortener/ @Bolisov +/types/gapi.client.vault/ @Bolisov +/types/gapi.client.videointelligence/ @Bolisov +/types/gapi.client.vision/ @Bolisov +/types/gapi.client.webfonts/ @Bolisov +/types/gapi.client.webmasters/ @Bolisov +/types/gapi.client.youtube/ @Bolisov +/types/gapi.client.youtubeanalytics/ @Bolisov +/types/gapi.client.youtubereporting/ @Bolisov /types/gapi.drive/ @baxtersa /types/gapi.pagespeedonline/ @sgtfrankieboy /types/gapi.people/ @tkrotoff @@ -929,6 +1130,7 @@ /types/gapi.youtube/ @sgtfrankieboy /types/gapi.youtubeanalytics/ @sgtfrankieboy /types/gaussian/ @scttcper +/types/gen-readlines/ @CodeAnimal /types/generic-functions/ @stpettersens /types/generic-pool/ @jerray /types/gently/ @bonnici @@ -949,7 +1151,7 @@ /types/git/ @vvakame /types/git-config/ @stpettersens /types/git-remote-origin-url/ @janslow -/types/gl-matrix/ @mattijskneppers @tatchx +/types/gl-matrix/ @mattijskneppers @tatchx @nbabanov @auzmartist /types/gldatepicker/ @qcz /types/glidejs/ @milanjaros /types/glob/ @vvakame @voy @@ -959,12 +1161,13 @@ /types/global-tunnel-ng/ @BendingBender /types/globalize/ @gcastre @afromogli /types/globalize-compiler/ @iclanton -/types/globby/ @douglasduteil +/types/globby/ @douglasduteil @ikatyang /types/globule/ @durad -/types/gm/ @ChaosinaCan +/types/gm/ @ChaosinaCan @maartenvanvliet /types/go/ @NorthwoodsSoftware /types/google-adwords-scripts/ @jafaircl /types/google-apps-script/ @motemen +/types/google-cloud__datastore/ @beaulac /types/google-cloud__storage/ @blove @nbperry /types/google-earth/ @icholy /types/google-images/ @dolanmiu @@ -976,20 +1179,22 @@ /types/google.fonts/ @danmarshall /types/google.geolocation/ @vbortone /types/google.picker/ @grapswiz -/types/google.visualization/ @danludwig @gmoore-sjcorg @danmana @mlcheng @IvanBisultanov +/types/google.visualization/ @danludwig @gmoore-sjcorg @danmana @mlcheng @IvanBisultanov @glebm /types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello /types/googlemaps.infobubble/ @Dashue /types/got/ @BendingBender @LinusU -/types/graceful-fs/ @Bartvds +/types/graceful-fs/v2/ @Bartvds +/types/graceful-fs/ @Bartvds @BendingBender /types/graham_scan/ @hberntsen /types/graphene-pk11/ @microshine /types/graphite-udp/ @EricByers -/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet +/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx /types/graphql-date/ @enaeseth /types/graphql-relay/ @arvitaly @nitintutlani @Grelinfo /types/graphql-type-json/ @schfkt /types/graphviz/ @mhfrantz /types/gravatar/ @denis-sokolov +/types/gravatar-url/ @ivangabriele /types/greasemonkey/ @kotas /types/grecaptcha/ @DethAriel /types/gregorian-calendar/ @cwalv @@ -1058,6 +1263,7 @@ /types/gulp-useref/ @tkrotoff /types/gulp-util/ @jedmao /types/gulp-watch/ @tkrotoff +/types/gulp-zip/ @dudeofawesome /types/gzip-size/ @plantain-00 /types/h2o2/ @jasonswearingen @AJamesPhillips /types/halfred/ @dherges @@ -1093,9 +1299,13 @@ /types/helmet/ @cyrilschumacher @EvanHahn @bluehatbrit /types/heredatalens/ @denyo /types/heremaps/ @Josh-ES @denyo +/types/heroku-logger/ @kylevogt +/types/hexo-bunyan/ @segayuu +/types/hexo-fs/ @segayuu +/types/hexo-log/ @segayuu /types/highcharts/ @damianog @baltie @AlbertOzimek @hanssens /types/highcharts-ng/ @scatcher -/types/highland/ @Bartvds @hgwood @iwllyu +/types/highland/ @Bartvds @hgwood @iwllyu @alvis /types/highlight.js/ @nikeee @sourrust /types/hiredis/ @titan /types/history/v2/ @sergey-buturlakin @ngbrown @@ -1107,8 +1317,8 @@ /types/hoek/ @prashaantt /types/homeworks/ @KennethanCeyer /types/hooker/ @misak113 -/types/hopscotch/ @pimterry -/types/howler/ @xperiments @tdukart +/types/hopscotch/ @pimterry @Aurimas1 +/types/howler/ @xperiments @tdukart @alien35 @nicholashza /types/hpp/ @kryops /types/html-entities/ @xstoudi /types/html-minifier/ @tkrotoff @@ -1118,7 +1328,7 @@ /types/html-webpack-template/ @bumbleblym /types/html2canvas/ @rwhepburn @tan9 /types/htmlbars-inline-precompile/ @chriskrycho -/types/htmlparser2/ @staticfunction +/types/htmlparser2/ @staticfunction @LinusU /types/htmltojsx/ @basarat /types/http-assert/ @jkeylu /types/http-aws-es/ @marcogrcr @@ -1126,6 +1336,7 @@ /types/http-errors/ @tkrotoff @BendingBender /types/http-proxy/ @SomaticIT /types/http-proxy-middleware/ @zebMcCorkle @BendingBender +/types/http-server/ @plantain-00 /types/http-status/ @misak113 /types/http-status-codes/ @JoshMcCullough /types/http-string-parser/ @pine613 @@ -1187,6 +1398,7 @@ /types/insight/ @vvakame /types/integer/ @Morfent /types/interact.js/ @dduugg @adidahiya @thasner +/types/intercom-web/ @fongandrew @salbahra /types/intercomjs/ @spencerwi /types/internal-ip/ @BendingBender /types/intl/ @RagibHasin @@ -1234,7 +1446,13 @@ /types/isomorphic-fetch/ @toddlucas /types/isotope-layout/ @avidenic /types/istanbul/ @tkrotoff +/types/istanbul-lib-coverage/ @jason0x43 +/types/istanbul-lib-hook/ @jason0x43 +/types/istanbul-lib-instrument/ @jason0x43 +/types/istanbul-lib-report/ @jason0x43 +/types/istanbul-lib-source-maps/ @jason0x43 /types/istanbul-middleware/ @hookclaw +/types/istanbul-reports/ @jason0x43 /types/ityped/ @DanielRosenwasser /types/ix.js/ @Igorbek /types/jade/ @panuhorsmalahti @@ -1265,8 +1483,13 @@ /types/jdataview/ @RReverser /types/jdenticon/ @mtr /types/jest/v16/ @NoHomey @jwbay -/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang +/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd +/types/jest-diff/ @myabc +/types/jest-docblock/ @ikatyang +/types/jest-get-type/ @myabc +/types/jest-matcher-utils/ @myabc /types/jest-matchers/ @joscha +/types/jest-validate/ @ikatyang /types/jfs/ @tlaziuk /types/jimp/ @Jack-Works /types/jjv/ @Nemo157 @@ -1275,9 +1498,10 @@ /types/jodata/ @cgwrench /types/johnny-five/ @nakakura /types/joi/v6/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW -/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt +/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku /types/joigoose/ @boothwhack /types/jointjs/ @areel @DavidDurman @DenEwout @CaselIT @ChrisMoran +/types/jpeg-js/ @DanielRosenwasser /types/jpm/ @github-account-because-they-want-it /types/jqgrid/ @lokeshpeta /types/jqrangeslider/ @qcz @@ -1326,6 +1550,7 @@ /types/jquery.dynatree/ @fdecampredon /types/jquery.elang/ @sumegizoltan /types/jquery.fancytree/ @alphaleonis @abedi-ir +/types/jquery.filtertable/ @totpero /types/jquery.finger/ @maxackley /types/jquery.flagstrap/ @felipedgarcia /types/jquery.fullscreen/ @piraveen @@ -1379,9 +1604,7 @@ /types/js-beautify/ @JoshuaKGoldberg @hansrwindhoff /types/js-clipper/ @omni360 /types/js-combinatorics/ @outring -/types/js-cookie/ @theodorejb -/types/js-data/v1/ @reppners -/types/js-data/ @reppners +/types/js-cookie/ @theodorejb @BendingBender /types/js-data-angular/ @reppners /types/js-data-http/ @reppners /types/js-fixtures/ @kazimanzurrashid @@ -1409,14 +1632,16 @@ /types/json-merge-patch/ @senyaarseniy /types/json-patch/ @vvakame /types/json-pointer/ @Bartvds -/types/json-rpc-ws/ @npenin +/types/json-rpc-ws/ @npenin @mlamp /types/json-schema/ @bcherny /types/json-socket/ @svi3c /types/json-stable-stringify/ @mhfrantz /types/json-stringify-safe/ @BendingBender /types/json2md/ @MartynasZilinskas +/types/jsonata/ @nick121212 /types/jsoneditor/ @alejo90 /types/jsoneditoronline/ @vbortone +/types/jsonfile/ @dbowring /types/jsonminify/ @no23reason /types/jsonnet/ @hookclaw /types/jsonp/ @surenkov @@ -1426,6 +1651,7 @@ /types/jsonwebtoken/ @SomaticIT @danielheim /types/jspdf/ @amberjs /types/jsplumb/ @shearnie +/types/jsqrcode/ @lordazzi /types/jsrender/ @zakki /types/jsrp/ @harryshipton /types/jss/ @Ptival @@ -1438,14 +1664,15 @@ /types/jsuri/ @coldacid @flqw /types/jsurl/ @agorshkov23 /types/jsx-chai/ @nupplaphil -/types/jszip/ @mzeiher +/types/jszip/ @mzeiher @forabi /types/jug/ @yevt /types/jui/ @easylogic /types/jui-core/ @easylogic /types/jui-grid/ @easylogic /types/jweixin/ @taoqf -/types/jwplayer/ @martinduparc +/types/jwplayer/ @martinduparc @kutomer /types/jwt-client/ @timoteoponce +/types/jwt-decode/v1/ @QuatroDevOfficial /types/jwt-decode/ @GiedriusGrabauskas @madsmadsen /types/jwt-simple/ @kenfdev @GaelMagnan /types/kafka-node/ @dansitu @bkim54 @sfrooster @amiram @@ -1455,10 +1682,11 @@ /types/karma-coverage/ @tkrotoff /types/karma-fixture/ @evictor /types/karma-jasmine/ @michelsalib +/types/karma-webpack/ @mtraynham /types/katex/ @mrand01 /types/kcors/ @Xstoudi @izayoiko /types/kdbush/ @DenisCarriere -/types/kefir/ @AyaMorisawa +/types/kefir/ @AyaMorisawa @HitoriSensei /types/kendo-ui/ @telerik /types/keyboardjs/ @vbortone @piranha771 /types/keycloak-js/ @eppsilon @@ -1472,6 +1700,7 @@ /types/klaw/ @mceachen /types/klaw-sync/ @shiftkey /types/knex/ @tkQubo @baronfel +/types/knex-postgis/ @vesse /types/knockback/ @borisyankov /types/knockout/ @EnableSoftware @BenjaminEckardt /types/knockout-amd-helpers/ @DavidSichau @@ -1498,17 +1727,20 @@ /types/koa-compose/ @jkeylu /types/koa-compress/ @hellopao /types/koa-favicon/ @hellopao -/types/koa-generic-session/ @nsimmons +/types/koa-generic-session/ @nsimmons @Ragg- /types/koa-hbs/ @jcbmln @mudkipme /types/koa-helmet/ @me /types/koa-json/ @brooklyndev /types/koa-json-error/ @mudkipme /types/koa-jwt/ @brunokrebs /types/koa-logger/ @geoffreak +/types/koa-logger-winston/ @stevehipwell /types/koa-morgan/ @vesse /types/koa-mount/ @amirsaber /types/koa-passport/ @horiuchi +/types/koa-pino-logger/ @khell /types/koa-pug/ @Xstoudi +/types/koa-range/ @strax /types/koa-redis/ @nsimmons /types/koa-route/ @migstopheles /types/koa-router/ @hellopao @schfkt @@ -1518,15 +1750,17 @@ /types/koa-static/ @hellopao /types/koa-views/ @brooklyndev /types/koa-websocket/ @me +/types/koa2-cors/ @xialeistudio +/types/koa__cors/ @Xstoudi @izayoiko @stevehipwell /types/kolite/ @borisyankov /types/konami.js/ @mareek /types/kramed/ @tonicblue /types/kss/ @giladgray /types/kue/ @drudge @amiram @pc-jedi -/types/kuromoji/ @mzsm +/types/kurento-utils/ @nenadalm +/types/kuromoji/ @mzsm @kgtkr /types/lab/ @prashaantt /types/ladda/ @dflor003 @leemicw -/types/lambda-phi/ @elitechance /types/later/ @jasond-s /types/latinize/ @GiedriusGrabauskas /types/launchpad/ @rictic @@ -1538,13 +1772,16 @@ /types/leaflet/ @alejo90 /types/leaflet-areaselect/ @awallat /types/leaflet-curve/ @onikiienko -/types/leaflet-draw/ @matt-guest @reblace +/types/leaflet-draw/ @matt-guest @reblace @YunS-Stacy /types/leaflet-editable/ @dalie /types/leaflet-fullscreen/ @DenisCarriere +/types/leaflet-geocoder-mapzen/ @leezu +/types/leaflet-gpx/ @soucekv /types/leaflet-imageoverlay-rotated/ @tkleinke /types/leaflet-label/ @Nemo157 /types/leaflet-polylinedecorator/ @soucekv /types/leaflet-providers/ @BendingBender +/types/leaflet-rotatedmarker/ @robert-prib-polestar /types/leaflet.awesome-markers/v0/ @Odrin @sebek64 /types/leaflet.awesome-markers/ @sebek64 /types/leaflet.fullscreen/ @wcomartin @@ -1577,15 +1814,17 @@ /types/loader-runner/ @e-cloud /types/loader-utils/ @Perlmint /types/lobibox/ @itboy87 +/types/local-dynamo/ @Sicilica /types/localforage-cordovasqlitedriver/ @thgreasi /types/localized-countries/ @coderslagoon +/types/localizejs-library/ @salbahra /types/locate-path/ @me /types/lockfile/v0/ @Bartvds /types/lockfile/ @Bartvds @BendingBender /types/lockr/ @droritos /types/locutus/ @hookclaw /types/lodash/v3/ @bczengel @chrootsu -/types/lodash/ @bczengel @chrootsu @stepancar @ericanderson @aj-r @ailrun +/types/lodash/ @bczengel @chrootsu @stepancar @ericanderson @aj-r @ailrun @e-cloud /types/lodash-es/ @stephenlautier /types/lodash-webpack-plugin/ @bumbleblym /types/lodash.add/ @bczengel @chrootsu @stepancar @@ -1613,6 +1852,7 @@ /types/lodash.clonewith/ @bczengel @chrootsu @stepancar /types/lodash.compact/ @bczengel @chrootsu @stepancar /types/lodash.concat/ @bczengel @chrootsu @stepancar +/types/lodash.cond/ @bczengel @chrootsu @stepancar /types/lodash.constant/ @bczengel @chrootsu @stepancar /types/lodash.countby/ @bczengel @chrootsu @stepancar /types/lodash.create/ @bczengel @chrootsu @stepancar @@ -1627,6 +1867,7 @@ /types/lodash.difference/ @bczengel @chrootsu @stepancar /types/lodash.differenceby/ @bczengel @chrootsu @stepancar /types/lodash.differencewith/ @bczengel @chrootsu @stepancar +/types/lodash.divide/ @bczengel @chrootsu @stepancar /types/lodash.drop/ @bczengel @chrootsu @stepancar /types/lodash.dropright/ @bczengel @chrootsu @stepancar /types/lodash.droprightwhile/ @bczengel @chrootsu @stepancar @@ -1646,6 +1887,8 @@ /types/lodash.findlastkey/ @bczengel @chrootsu @stepancar /types/lodash.first/ @bczengel @chrootsu @stepancar /types/lodash.flatmap/ @bczengel @chrootsu @stepancar +/types/lodash.flatmapdeep/ @bczengel @chrootsu @stepancar +/types/lodash.flatmapdepth/ @bczengel @chrootsu @stepancar /types/lodash.flatten/ @bczengel @chrootsu @stepancar /types/lodash.flattendeep/ @bczengel @chrootsu @stepancar /types/lodash.flattendepth/ @bczengel @chrootsu @stepancar @@ -1773,6 +2016,7 @@ /types/lodash.pull/ @bczengel @chrootsu @stepancar /types/lodash.pullall/ @bczengel @chrootsu @stepancar /types/lodash.pullallby/ @bczengel @chrootsu @stepancar +/types/lodash.pullallwith/ @bczengel @chrootsu @stepancar /types/lodash.pullat/ @bczengel @chrootsu @stepancar /types/lodash.random/ @bczengel @chrootsu @stepancar /types/lodash.range/ @bczengel @chrootsu @stepancar @@ -1822,6 +2066,7 @@ /types/lodash.throttle/ @bczengel @chrootsu @stepancar /types/lodash.times/ @bczengel @chrootsu @stepancar /types/lodash.toarray/ @bczengel @chrootsu @stepancar +/types/lodash.tofinite/ @bczengel @chrootsu @stepancar /types/lodash.tointeger/ @bczengel @chrootsu @stepancar /types/lodash.tolength/ @bczengel @chrootsu @stepancar /types/lodash.tolower/ @bczengel @chrootsu @stepancar @@ -1851,6 +2096,7 @@ /types/lodash.unzip/ @bczengel @chrootsu @stepancar /types/lodash.unzipwith/ @bczengel @chrootsu @stepancar /types/lodash.update/ @bczengel @chrootsu @stepancar +/types/lodash.updatewith/ @bczengel @chrootsu @stepancar /types/lodash.uppercase/ @bczengel @chrootsu @stepancar /types/lodash.upperfirst/ @bczengel @chrootsu @stepancar /types/lodash.values/ @bczengel @chrootsu @stepancar @@ -1868,16 +2114,15 @@ /types/log-symbols/ @BendingBender /types/log-update/ @BendingBender /types/log4javascript/ @Ritzlgrmft -/types/log4js/ @armorik83 /types/logat/ @krvikash35 /types/logg/ @blittle /types/loggly/ @rmartone @geoffreak -/types/loglevel/ @Pro @flqw @szmeti +/types/loglevel/ @Pro @szmeti @screendriver /types/logrotate-stream/ @rogierschouten /types/lokijs/ @TeamworkGuy2 /types/lolex/ @Nemo157 @joshuakgoldberg /types/long/ @peterkooijmans -/types/loopback/ @kattsushi +/types/loopback/ @kattsushi @enko @sequoia @drmikecrowe /types/loopback-boot/ @kattsushi /types/lorem-ipsum/ @durad /types/lory.js/ @kubosho @milkisevil @@ -1885,11 +2130,13 @@ /types/lovefield/ @freshp86 /types/lowdb/ @typicode /types/lowlight/ @NoHomey -/types/lru-cache/ @Bartvds +/types/lozad/ @plantain-00 +/types/lru-cache/ @Bartvds @BendingBender /types/lscache/ @Chris-Martinezz /types/ltx/ @PJakcson /types/luaparse/ @stpettersens -/types/lunr/ @sebastian-lenz +/types/lunr/v0/ @sebastian-lenz +/types/lunr/ @seantanly /types/lwip/ @AyaMorisawa /types/lz-string/ @M0ns1gn0r /types/magic-number/ @stpettersens @@ -1905,7 +2152,7 @@ /types/mandrill-api/ @pocesar /types/map-obj/ @BendingBender /types/mapbox/ @anahkiasen -/types/mapbox-gl/ @dobrud +/types/mapbox-gl/ @dobrud @patrickr /types/mapbox__shelf-pack/ @Perlmint /types/mapsjs/ @davismj /types/mariasql/ @bennett000 @@ -1914,7 +2161,7 @@ /types/markdown-it-container/ @hronex /types/marked/ @worr @BendingBender /types/marker-animate-unobtrusive/ @viskin -/types/markerclustererplus/ @enanox +/types/markerclustererplus/ @enanox @mxl /types/markitup/ @drillbits /types/maskedinput/ @lokeshpeta /types/masonry-layout/ @m-a-wilson @warriorrocker @@ -1931,12 +2178,13 @@ /types/mcustomscrollbar/ @flurg /types/md5/ @arcdev1 @jprogrammer /types/mdns/ @reppners +/types/mdurl/ @rokt33r /types/media-typer/ @BendingBender /types/medium-editor/ @keika299 /types/mem/ @SamVerschueren /types/memcached/ @KentarouTakeda /types/memoizee/ @juanpicado -/types/memory-cache/ @jedigo +/types/memory-cache/ @jedigo @thieman /types/memory-fs/ @e-cloud /types/memwatch-next/ @cyrilschumacher /types/meow/ @KnisterPeter @@ -1959,6 +2207,7 @@ /types/methods/ @cprecioso /types/metismenu/ @onokumus @denisname /types/metric-suffix/ @davidm77 +/types/mfiles/ @avonwyss /types/micro/ @kaoDev /types/microgears/ @marcusdb /types/micromatch/ @glen-84 @@ -1966,16 +2215,17 @@ /types/microsoft-ajax/ @pjmagee /types/microsoft-live-connect/ @jvilk /types/microsoft-sdk-soap/ @markusmauch -/types/microsoftteams/ @OfficeDev +/types/microsoftteams/ @WrathOfZombies @jayongg @ydogandjiev /types/microtime/ @vincekovacs /types/milkcocoa/ @odangosan -/types/mime/ @jedigo +/types/mime/ @jedigo @dhritzkiv /types/mime-db/ @AJamesPhillips /types/mime-types/ @Perlmint /types/mimos/ @AJamesPhillips /types/mina/ @lhk @mattanja @kant2002 /types/minimatch/ @vvakame @shantmarouti /types/minimist/ @Bartvds @Necroskillz @kamranayub +/types/minimist-options/ @ikatyang /types/minipass/ @BendingBender /types/mithril/ @spacejack @andraaspar @isiahmeadows /types/mithril-global/ @spacejack @isiahmeadows @@ -2000,7 +2250,7 @@ /types/moment-range/ @Burgov @wilgert @franjuan @MartynasZilinskas /types/moment-round/ @jacobbaskin /types/moment-timezone/ @michelsalib -/types/mongodb/ @CaselIT @alanmarcell @kikar +/types/mongodb/ @CaselIT @alanmarcell @kikar @bitjson @dante-101 /types/mongoose/ @simonxca @horiuchi @sindrenm @lukasz-zak /types/mongoose-auto-increment/ @AyaMorisawa /types/mongoose-deep-populate/ @AyaMorisawa @@ -2009,18 +2259,18 @@ /types/mongoose-promise/ @simonxca /types/mongoose-seeder/ @Crevil /types/mongoose-sequence/ @linusbrolin -/types/mongoose-simple-random/ @me +/types/mongoose-simple-random/ @rsxdalv /types/mongoose-unique-validator/ @stevehipwell /types/monk/ @wzr1337 /types/moo/ @deltaidea -/types/morgan/ @staticfunction +/types/moonjs/ @DanielRosenwasser +/types/morgan/ @staticfunction @pscanf /types/morris.js/ @mareek @sindilevich /types/mousetrap/ @qcz /types/move-concurrently/ @mgroenhoff /types/moviedb/ @basarat @0x6368656174 /types/moxios/ @itoasuka /types/mpromise/ @sgkim126 -/types/mqtt/ @PekkaPLeppanen /types/mri/ @shiftkey @j-f1 /types/ms/ @danny8002 /types/msgpack-lite/ @endel @efokschaner @@ -2032,7 +2282,7 @@ /types/multer/ @jt000 @DavidBR-SW @mxl @hyunseob /types/multer-gridfs-storage/v1/ @devconcept /types/multer-gridfs-storage/ @devconcept -/types/multer-s3/ @tcaesvk +/types/multer-s3/ @tcaesvk @galtalmor /types/multi-typeof/ @mhegazy /types/multimatch/ @stephenlautier /types/multiparty/ @kenfdev @@ -2041,14 +2291,16 @@ /types/murmurhash3js/ @dlee-nvisia /types/musicmetadata/ @Xstoudi /types/mustache/ @markashleybell +/types/mv/ @nenadalm /types/mysql/ @wjohnsto @kacepe /types/mz/ @ThomasHickman /types/n3/ @phreed -/types/nano/ @timjacobi +/types/nano/ @timjacobi @vincekovacs /types/nanoajax/ @nathancahill /types/nanomsg/ @titan /types/nanoscroller/ @zihark17 /types/nanp/ @karn +/types/nats-hemera/ @vforv /types/natsort/ @mgroenhoff /types/natural/ @dmoonfire /types/natural-sort/ @a-morales @@ -2059,14 +2311,16 @@ /types/nconf/ @jedigo @jmthibault /types/ncp/ @bartvds /types/ndarray/ @pawsong @taoqf -/types/nearley/ @deltaidea -/types/nedb/ @reppners +/types/nearley/ @deltaidea @BendingBender +/types/nedb/ @reppners @anthonynichols /types/nedb-logger/ @thisboyiscrazy /types/needle/v0/ @bigsan -/types/needle/ @bigsan @nikeee +/types/needle/v1/ @bigsan @nikeee +/types/needle/ @bigsan @nikeee @sindilevich /types/negotiator/ @BendingBender /types/neo4j/ @cyrilschumacher /types/nes/ @NoHomey +/types/net-keepalive/ @hertzg /types/netmask/ @mhfrantz /types/nexpect/ @vvakame /types/next/ @dru89 @@ -2092,12 +2346,13 @@ /types/ngtoaster/ @btesser /types/ngwysiwyg/ @patrick-mackay /types/nightmare/ @horiuchi @samyang-au -/types/noble/ @swook @wind-rider @shantanubhadoria @lukel99 @bioball +/types/nightwatch/ @rkavalap @schlesiger +/types/noble/ @swook @wind-rider @shantanubhadoria @lukel99 @bioball @keton /types/nock/ @bonnici @horiuchi /types/nodal/ @charrondev -/types/node/v6/ @WilcoBakker -/types/node/v7/ @parambirs @RobDesideri @tellnes @WilcoBakker @Tyriar -/types/node/ @parambirs @RobDesideri @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @Tyriar @DeividasBakanas +/types/node/v6/ @WilcoBakker @inlined +/types/node/v7/ @parambirs @RobDesideri @tellnes @WilcoBakker +/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis /types/node-7z/ @erkie /types/node-array-ext/ @Beng89 /types/node-cache/ @chrootsu @dthunell @@ -2112,10 +2367,11 @@ /types/node-fibers/ @caryhaynie /types/node-forge/ @westy92 @flynetworks @a-k-g /types/node-gcm/ @horiuchi +/types/node-geocoder/ @rosek86 /types/node-getopt/ @kcauchy /types/node-hid/ @mhegazy @ert78gb /types/node-hue-api/ @fjmorel -/types/node-int64/ @x3cion +/types/node-int64/ @x3cion @kevin-greene-ck /types/node-ipc/ @arvitaly /types/node-jsfl-runner/ @mrand01 /types/node-json-db/ @kuzn-ilya @@ -2125,6 +2381,7 @@ /types/node-polyglot/ @timjk /types/node-powershell/ @rodrigoff /types/node-ral/ @ssddi456 +/types/node-red/ @andersea /types/node-rsa/ @alitaheri /types/node-schedule/ @cyrilschumacher @flowpl /types/node-slack/ @tkQubo @@ -2132,7 +2389,7 @@ /types/node-sprite-generator/ @Perlmint /types/node-static/ @Morfent /types/node-statsd/ @alexturek @convoyinc -/types/node-telegram-bot-api/ @ammuench @agadar +/types/node-telegram-bot-api/ @ammuench @agadar @Dabolus /types/node-uuid/ @jeffmay /types/node-validator/ @kengorab /types/node-vault/ @YuJianrong @@ -2140,10 +2397,11 @@ /types/node-wit/ @julienduf /types/node-xmpp-client/ @PJakcson /types/node-xmpp-core/ @PJakcson -/types/node-zookeeper-client/ @plantain-00 +/types/node-zookeeper-client/ @plantain-00 @jessezhang91 /types/node_redis/ @borisyankov /types/nodegit/ @dolanmiu -/types/nodemailer/ @rogierschouten +/types/nodemailer/v3/ @rogierschouten +/types/nodemailer/ @rogierschouten @dex4er /types/nodemailer-direct-transport/ @rogierschouten /types/nodemailer-mailgun-transport/ @otociulis /types/nodemailer-pickup-transport/ @psnider @@ -2186,6 +2444,7 @@ /types/object-assign/ @chbrown /types/object-diff/ @rogierschouten /types/object-hash/ @misak113 +/types/object-map/ @wolfgang42 /types/object-path/ @pocesar /types/object-refs/ @3fd /types/oblo-util/ @Oblosys @@ -2202,6 +2461,7 @@ /types/on-headers/ @jjeffery @BendingBender /types/once/ @denis-sokolov @BendingBender /types/onetime/ @BendingBender +/types/oniguruma/ @smhxx /types/onoff/ @marcel-ernst /types/open/ @Bartvds /types/opener/ @tikurahul @@ -2209,7 +2469,7 @@ /types/openjscad/ @danmarshall /types/openlayers/v2/ @bolhovsky /types/openlayers/v3/ @osechet @matthiasdailey-ccri -/types/openlayers/ @osechet @ganlhi +/types/openlayers/ @osechet @wb14123 @ailrun @mylen /types/openstack-wrapper/ @sanjaymadane /types/opentok/ @westy92 @CatGuardian /types/opentype.js/ @danmarshall @@ -2230,6 +2490,8 @@ /types/os-tmpdir/ @mhegazy /types/osmosis/ @jurajkocan /types/osmtogeojson/ @tkqubo +/types/osrm/ @DenisCarriere +/types/owl.carousel/ @igorissen /types/owlcarousel/ @dpiatkowski /types/p-all/ @BendingBender /types/p-any/ @BendingBender @@ -2266,10 +2528,10 @@ /types/pad/ @mhegazy /types/paho-mqtt/ @amikhalev /types/pako/ @cappellin @calebegg -/types/papaparse/ @torpedro @rainshen49 +/types/papaparse/ @torpedro @rainshen49 @jfloff /types/paper/ @clark-stevenson /types/paralleljs/ @jbaldwin -/types/parse/ @dpoetzsch @jaeggerr +/types/parse/ @dpoetzsch @jaeggerr @flavionegrao /types/parse-git-config/ @leonard-thieu /types/parse-glob/ @glen-84 /types/parse-link-header/ @zelein @@ -2292,9 +2554,9 @@ /types/passport-google-oauth2/ @bluehatbrit /types/passport-http/ @krizalys /types/passport-http-bearer/ @isman-usoh -/types/passport-jwt/ @mugeso @alsiola /types/passport-local/ @SomaticIT /types/passport-local-mongoose/ @linusbrolin +/types/passport-oauth2/ @pasieronen /types/passport-oauth2-client-password/ @akaNightmare /types/passport-saml/ @cjbarth /types/passport-steam/ @kzay @@ -2308,7 +2570,8 @@ /types/path-is-absolute/ @mhegazy /types/pathfinding/ @BNedry /types/pathjs/ @lokeshpeta -/types/pathwatcher/ @vvakame +/types/pathwatcher/v0/ @vvakame +/types/pathwatcher/ @GlenCFL /types/pause/ @BendingBender /types/payment/ @apare /types/paypal-cordova-plugin/ @Justin-Credible @@ -2318,13 +2581,18 @@ /types/pdfkit/ @erichillah /types/pdfobject/ @nielsboogaard /types/pebblekitjs/ @makotokw +/types/peer-dial/ @RealTYPICAL /types/peerjs/ @nakakura /types/pegjs/ @vvakame @SrTobi @siegebell /types/pem/ @tony19 @DethAriel /types/perfect-scrollbar/ @aicest @CarbonAtom /types/persona/ @Nycto /types/pet-finder-api/ @me +/types/pg/v6/ @pspeter3 +/types/pg/ @pspeter3 /types/pg-connection-string/ @bradleyayers +/types/pg-ears/ @bradleyayers +/types/pg-escape/ @khell /types/pg-pool/ @aleung /types/pg-query-stream/ @asmarques /types/pg-types/ @waratuman @@ -2346,9 +2614,11 @@ /types/pi-spi/ @marcel-ernst /types/pick-weight/ @rsxdalv /types/pickadate/ @theodorejb @leonard-thieu +/types/picturefill/ @alaz /types/pidusage/ @cyrilschumacher -/types/pify/ @samverschueren +/types/pify/ @samverschueren @mad-mike /types/pigpio/ @manerfan +/types/pikaday/ @MidnightDesign @wake42 /types/pikaday-time/ @Sayan751 /types/pinkyswear/ @chances /types/pino/v3/ @psnider @@ -2365,6 +2635,7 @@ /types/plupload/ @patrickbussmann /types/pluralize/ @ukyo /types/png-async/ @kanreisa +/types/pngjs/ @jason0x43 /types/podcast/ @nikeee /types/podium/ @AJamesPhillips /types/point-in-polygon/ @dyst5422 @kogai @@ -2373,7 +2644,6 @@ /types/polymer/ @lgrignon @laco0416 /types/polymer-ts/ @lgrignon /types/popcorn/ @grapswiz -/types/popper.js/ @joscha @seckardt @marcfallows /types/portscanner/ @douglasduteil /types/postal/ @lokeshpeta @myitcv /types/postmark/ @benbayard @@ -2394,7 +2664,7 @@ /types/pouchdb-mapreduce/ @spaulg @geppy @fredgalvao /types/pouchdb-node/ @spaulg @geppy @fredgalvao /types/pouchdb-replication/ @trubit -/types/pouchdb-upsert/ @keithdmoore @hotforfeature +/types/pouchdb-upsert/ @keithdmoore @hotforfeature @apolkingg8 /types/power-assert/ @vvakame /types/power-assert-formatter/ @vvakame /types/precise/ @codeanimal @@ -2403,6 +2673,7 @@ /types/prelude-ls/ @AyaMorisawa /types/prettier/ @ikatyang /types/pretty-bytes/ @plantain-00 +/types/pretty-format/ @ikatyang /types/pretty-ms/ @BendingBender /types/printf/ @AluisioASG /types/priorityqueuejs/ @geoffreak @@ -2439,6 +2710,7 @@ /types/prosemirror-schema-basic/ @bradleyayers @davidka /types/prosemirror-schema-list/ @bradleyayers @davidka /types/prosemirror-state/ @bradleyayers @davidka +/types/prosemirror-tables/ @superchu @eshvedai /types/prosemirror-transform/ @bradleyayers @davidka /types/prosemirror-view/ @bradleyayers @davidka /types/protobufjs/ @panuhorsmalahti @@ -2453,6 +2725,7 @@ /types/pug/ @TonyPythoneer @19majkel94 /types/pulltorefreshjs/ @DanielRosenwasser /types/pump/ @tlaziuk +/types/puppeteer/ @marvinhagemeister /types/pure-render-decorator/ @seansfkelley /types/purl/ @danfma /types/pusher-js/ @tkqubo @@ -2483,7 +2756,7 @@ /types/rabbit.js/ @wokim /types/radium/ @alexgorbatchev @nupplaphil @asvetliakov @mihe /types/radius/ @codeanimal -/types/ramda/ @donnut @mdekrey @LiamGoodacre @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg +/types/ramda/ @donnut @mdekrey @LiamGoodacre @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @charlespwd /types/random-js/ @pistacchio /types/random-seed/ @endel /types/random-string/ @stpettersens @@ -2501,15 +2774,19 @@ /types/rc-slider/ @mantasmarcinkus @mattoni /types/rc-tree/ @johnnyreilly /types/rcloader/ @panuhorsmalahti +/types/rdf-data-model/ @rubensworks +/types/rdf-js/ @rubensworks /types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz /types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz @richseviora /types/react-app/ @prakarshpandey +/types/react-aria-menubutton/ @forabi @crohlfs /types/react-autosuggest/ @nicolas-schmitt @pjo256 @robessog @tbayne @cdeutsch +/types/react-beautiful-dnd/ @varHarrie /types/react-body-classname/ @mhegazy -/types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @katbusch +/types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @mretolaza @katbusch @vitosamson @LKay @aaronbeall /types/react-bootstrap-date-picker/ @LKay @ssi-hu-antal-bodnar /types/react-bootstrap-daterangepicker/ @ianks -/types/react-bootstrap-table/ @flaub @alelode +/types/react-bootstrap-table/ @flaub @alelode @UJosue10 /types/react-breadcrumbs/ @KostyaEsmukov /types/react-burger-menu/ @radziksh /types/react-calendar-timeline/ @radziksh @@ -2525,15 +2802,18 @@ /types/react-data-grid/v1/ @SupernaviX /types/react-data-grid/ @SupernaviX @KieranPeat @martinnov92 /types/react-datagrid/ @stephenjelfs -/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach +/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue /types/react-daterange-picker/ @uncovertruth @MartynasZilinskas /types/react-dates/ @Artur-A /types/react-daum-postcode/ @Sa-ryong /types/react-dnd-html5-backend/ @oizie /types/react-document-title/ @cleverguy25 +/types/react-dom/v15/ @MartynasZilinskas /types/react-dom/ @MartynasZilinskas +/types/react-dom-factories/ @jgoz /types/react-dropzone/v2/ @matdube @LynxEyes @goblindegook @benbayard -/types/react-dropzone/ @matdube @LynxEyes @goblindegook @benbayard @LKay +/types/react-dropzone/v3/ @matdube @LynxEyes @goblindegook @benbayard @LKay +/types/react-dropzone/ @matdube @LynxEyes @goblindegook @benbayard @LKay @codeaid /types/react-easy-chart/ @danzel /types/react-event-listener/ @asvetliakov /types/react-fa/ @flaub @patsissons @LKay @@ -2546,10 +2826,12 @@ /types/react-flexr/ @pushplay /types/react-flip-move/ @jmhain /types/react-fontawesome/ @timurrustamov @dublicator @vincaslt @gavingregory +/types/react-form/ @cameron-mcateer +/types/react-foundation/ @danielearwicker /types/react-ga/ @telshin /types/react-geosuggest/ @brmenchl /types/react-gravatar/ @invliD -/types/react-grid-layout/ @abirkholz @alitaheri @ZheyangSong +/types/react-grid-layout/ @abirkholz @alitaheri @ZheyangSong @andrewhathaway /types/react-hamburger-menu/ @grzesie2k /types/react-helmet/v4/ @evanbb @isman-usoh /types/react-helmet/ @evanbb @isman-usoh @lith-light-g @sammkj @yuit @@ -2560,7 +2842,7 @@ /types/react-i18next/v1/ @KostyaEsmukov /types/react-i18next/ @GiedriusGrabauskas /types/react-icon-base/ @apare @LKay -/types/react-icons/ @apare +/types/react-icons/ @apare @johnnyreilly @LKay /types/react-imageloader/ @stephenjelfs /types/react-infinite/ @rhysd /types/react-infinite-scroller/ @Lapanti @psrebniak @@ -2571,15 +2853,17 @@ /types/react-intl-redux/ @LKay /types/react-is-deprecated/ @seansfkelley /types/react-joyride/ @DanielRosenwasser @bendxn +/types/react-json/ @spielc /types/react-json-pretty/ @LKay /types/react-json-tree/ @gnestor -/types/react-jsonschema-form/ @iamdanfox @sirreal +/types/react-jsonschema-form/ @iamdanfox @sirreal @iplus26 /types/react-lazyload/ @m0a /types/react-leaflet/ @danzel @davschne @yuit /types/react-list/ @buptyyf /types/react-loadable/ @Kovensky @odensc /types/react-loader/ @artfuldev /types/react-maskedinput/ @LKay @lavoaster @CarlosBonetti +/types/react-mce/ @morphologue /types/react-mdl/ @bradzacher /types/react-measure/ @asvetliakov @marcfallows /types/react-mixin/ @tkqubo @@ -2587,32 +2871,40 @@ /types/react-monaco-editor/ @jnetterf /types/react-motion/ @stepancar @asvetliakov /types/react-motion-slider/ @asvetliakov -/types/react-native/ @alloy @gyzerok @huhuanming @iRoachie @timwangdev @kamal +/types/react-native/ @alloy @huhuanming @iRoachie @timwangdev @kamal /types/react-native-collapsible/ @iRoachie /types/react-native-communications/ @huhuanming /types/react-native-datepicker/ @jacobbaskin +/types/react-native-doc-viewer/ @iRoachie /types/react-native-drawer/ @jnbt /types/react-native-drawer-layout/ @jmfirth -/types/react-native-elements/ @iRoachie +/types/react-native-elements/ @iRoachie @ifiokjr /types/react-native-fbsdk/ @ifiokjr /types/react-native-fetch-blob/ @MNBuyskih /types/react-native-fs/ @pocesar /types/react-native-goby/ @MessageDream /types/react-native-google-analytics-bridge/ @huhuanming @nbperry +/types/react-native-google-signin/ @j-fro /types/react-native-keep-awake/ @huhuanming +/types/react-native-linear-gradient/ @j-fro /types/react-native-material-design-searchbar/ @iRoachie +/types/react-native-material-kit/ @iRoachie /types/react-native-material-ui/ @iRoachie +/types/react-native-modal/ @ifiokjr /types/react-native-modalbox/ @iRoachie /types/react-native-orientation/ @MoLow +/types/react-native-safari-view/ @mrand01 /types/react-native-scrollable-tab-view/ @CaiHuan /types/react-native-sensor-manager/ @SahinVardar /types/react-native-snap-carousel/ @jnbt /types/react-native-sortable-list/ @sivolobov /types/react-native-svg-uri/ @iRoachie /types/react-native-swiper/ @CaiHuan @huhuanming @mhcgrq +/types/react-native-tab-navigator/ @iRoachie +/types/react-native-tab-view/ @kaoDev /types/react-native-touch-id/ @huhuanming /types/react-native-vector-icons/ @iRoachie @timwangdev -/types/react-native-video/ @huhuanming +/types/react-native-video/ @huhuanming @abrahambotros /types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @abrahambotros @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev /types/react-notification-system/ @GiedriusGrabauskas @DeividasBakanas @LKay @sztobar /types/react-notification-system-redux/ @LKay @@ -2624,13 +2916,13 @@ /types/react-portal/ @shuntksh /types/react-props-decorators/ @tkqubo /types/react-recaptcha/ @mhegazy -/types/react-redux/ @tkqubo @seansfkelley @thasner @kenzierocks @clayne11 @tansongyang +/types/react-redux/ @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo /types/react-redux-i18n/ @clementdevos /types/react-redux-toastr/ @Smiche @artyomsv @kulmajaba /types/react-relay/ @graphcool /types/react-responsive/ @asvetliakov /types/react-router/v2/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov -/types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas +/types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen /types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga /types/react-router-bootstrap/ @vlesierse @LKay @olmobrutall /types/react-router-config/ @lith-light-g @@ -2641,67 +2933,77 @@ /types/react-router-redux/ @huy-nguyen @8398a7 /types/react-scroll/ @sudoplz @GiedriusGrabauskas /types/react-scrollbar/ @stephenjelfs -/types/react-select/ @Hesquibet @giladgray @iebaker @skirsdeda @vujevits @devrelm @MartynasZilinskas +/types/react-select/ @Hesquibet @giladgray @iebaker @skirsdeda @vujevits @devrelm @MartynasZilinskas @onatm @ninjaferret @tehbi4 /types/react-side-effect/ @remojansen /types/react-sidebar/ @jeroenvervaeke /types/react-slick/ @andrewBalekha @GiedriusGrabauskas /types/react-smooth-scrollbar/ @asvetliakov /types/react-sortable-hoc/ @NoHomey @charlesrey -/types/react-sortable-tree/ @wouterhardeman +/types/react-sortable-tree/ @wouterhardeman @jzoric /types/react-spinkit/v1/ @tkqubo @mleko @pelotom /types/react-spinkit/ @tkqubo @mleko @pelotom @zzanol /types/react-split-pane/ @rcchen /types/react-sticky/ @curtisw0 +/types/react-stripe-elements/ @dan-j /types/react-svg-pan-zoom/ @huy-nguyen /types/react-swf/ @stepancar /types/react-swipe/ @DeividasBakanas /types/react-swipeable/ @GiedriusGrabauskas @mctep /types/react-swipeable-views/ @mxl @DeividasBakanas /types/react-syntax-highlighter/ @NoHomey +/types/react-table/ @royxue @psakalo /types/react-tabs/ @danez /types/react-tag-input/ @Ogglas @jankarres /types/react-tagcloud/ @wassname /types/react-tap-event-plugin/ @mxl -/types/react-test-renderer/ @arvitaly @lochbrunner @lochbrunner @johnnyreilly +/types/react-test-renderer/v15/ @arvitaly @lochbrunner @lochbrunner @johnnyreilly +/types/react-test-renderer/ @arvitaly @lochbrunner @johnnyreilly @jgoz /types/react-tether/ @ryprice /types/react-textarea-autosize/ @asvetliakov @zry656565 /types/react-toggle/v2/ @LKay /types/react-toggle/ @LKay /types/react-tooltip/ @DeividasBakanas /types/react-touch/ @grzesie2k +/types/react-tracking/ @alloy /types/react-transition-group/v1/ @LKay /types/react-transition-group/ @LKay +/types/react-treeview/ @janslow +/types/react-truncate/ @mattvperry /types/react-user-tour/ @ccancellieri /types/react-virtual-keyboard/ @bsurai -/types/react-virtualized/ @kaoDev @guntherjh @wasd171 +/types/react-virtualized/ @kaoDev @guntherjh @wasd171 @szabolcsx /types/react-virtualized-select/ @seansfkelley /types/react-weui/ @tairan /types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 +/types/react-youtube/ @kgtkr /types/reactable/ @spielc /types/reactcss/ @chrisgervang @LKay -/types/reactstrap/ @alihammad @mfal @danilobjr +/types/reactstrap/ @alihammad @mfal @danilobjr @fabiopaiva /types/read/ @timjk +/types/read-chunk/ @crispybee /types/read-package-tree/ @mgroenhoff +/types/read-pkg-up/ @dudeofawesome /types/readdir-stream/ @Bartvds /types/readline-sync/ @jonestristand -/types/realm/ @Akim95 /types/reapop/ @Barrokgl /types/recaptcha/ @brentj73 /types/recase/ @18steps -/types/recharts/ @mthmulders @rapmue +/types/recharts/ @mthmulders @rapmue @royxue /types/recompose/ @iskandersierra @mrapogee @clayne11 /types/reconnectingwebsocket/ @nguarracino -/types/recursive-readdir/ @elisee +/types/recursive-readdir/v1/ @elisee +/types/recursive-readdir/ @elisee @MicahZoltu /types/redis/ @soywiz @CodeAnimal @MugeSo /types/redis-mock/ @BendingBender /types/redis-rate-limiter/ @westy92 /types/redis-scripto/ @westy92 /types/redlock/v2/ @chrootsu /types/redlock/ @chrootsu @BendingBender +/types/redom/ @RauliL /types/reduce-reducers/ @huy-nguyen /types/redux-action/ @newraina /types/redux-action-utils/ @tkqubo -/types/redux-actions/ @jaysoo @alexgorbatchev +/types/redux-actions/ @jaysoo @alexgorbatchev @alechill /types/redux-auth-wrapper/v1/ @LKay /types/redux-auth-wrapper/ @LKay /types/redux-batched-subscribe/ @mDibyo @@ -2712,16 +3014,17 @@ /types/redux-devtools-log-monitor/ @mc-petry /types/redux-doghouse/ @BendingBender /types/redux-first-router/ @Valbrand @viggyfresh +/types/redux-first-router-link/ @janb87 /types/redux-form/v4/ @aikoven /types/redux-form/v6/ @carsonf @aikoven @LKay @bancek -/types/redux-form/ @carsonf @aikoven @LKay @bancek +/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola /types/redux-immutable/ @oizie @sebald @gavingregory /types/redux-immutable-state-invariant/ @remojansen @highflying /types/redux-infinite-scroll/ @silkyfray /types/redux-localstorage/ @LKay /types/redux-localstorage-debounce/ @LKay /types/redux-localstorage-filter/ @LKay -/types/redux-logger/ @arusakov +/types/redux-logger/ @arusakov @kgroat /types/redux-mock-store/ @MarianPalkus /types/redux-optimistic-ui/ @asvetliakov /types/redux-pack/ @tansongyang @@ -2731,7 +3034,9 @@ /types/redux-promise-middleware/ @ianks /types/redux-recycle/ @LKay /types/redux-router/ @stepancar +/types/redux-saga-routines/ @LKay /types/redux-storage/ @asvetliakov +/types/redux-storage-engine-jsurl/ @screendriver /types/redux-ui/ @andyshuxin /types/ref/ @loyd /types/ref-array/ @loyd @@ -2744,11 +3049,12 @@ /types/remote-redux-devtools/ @ColinEberhardt @unindented /types/remove-markdown/ @RagibHasin /types/replace-ext/ @DeividasBakanas -/types/request/ @soywiz @bonnici @Bartvds @joeskeen @ccurrens +/types/request/ @soywiz @bonnici @Bartvds @joeskeen @ccurrens @lookfirst /types/request-ip/ @mrhen /types/request-promise/ @cglantschnig @joeskeen @AyaMorisawa /types/request-promise-native/ @gustavohenke -/types/requestretry/ @EricByers +/types/requestretry/ @EricByers @trainerbill +/types/require-dir/ @weekens /types/require-directory/ @Igmat /types/require-from-string/ @ikatyang /types/requirejs/ @jbaldwin @@ -2762,10 +3068,12 @@ /types/restful.js/ @tkqubo /types/restify/v4/ @blittle @stevehipwell /types/restify/ @blittle @stevehipwell +/types/restify-cookies/ @weekens /types/restify-cors-middleware/ @dthunell /types/restify-errors/ @stevehipwell /types/restify-plugins/ @KostyaTretyak /types/restler/ @cyrilschumacher +/types/restling/ @loghorn /types/resumablejs/ @DanielMcAssey /types/rethinkdb/ @alexgorbatchev /types/retry/ @krenor @@ -2784,14 +3092,13 @@ /types/riotcontrol/ @chrootsu /types/riotjs/ @vvakame /types/rison/ @impworks -/types/rivets/ @TrevorDev +/types/rivets/ @TrevorDev @matjanos /types/rollup/ @flying-sheep /types/ronomon__crypto-async/ @BendingBender -/types/rosie/ @abner +/types/rosie/ @abner @subvertallchris /types/roslib/ @Pro @skycoop /types/rot-js/ @atiaxi /types/route-parser/ @ianks @bobbuehler -/types/router5/ @sandersky /types/routie/ @Adilson /types/royalslider/ @csrakowski /types/rpio/ @DominikPalo @@ -2800,7 +3107,7 @@ /types/rsmq/ @MugeSo /types/rsmq-worker/ @MugeSo /types/rss/ @secondwtq -/types/rsvp/ @Taytay @mkohlmyr @theroncross @chriskrycho +/types/rsvp/ @chriskrycho /types/rsync/ @philippstucki /types/rtree/ @oefirouz /types/run-sequence/ @k-kagurazaka @@ -2835,7 +3142,7 @@ /types/sandboxed-module/ @svi3c /types/sane/ @BendingBender /types/sanitize-filename/ @Nemo157 -/types/sanitize-html/ @rogierschouten @afshin +/types/sanitize-html/ @rogierschouten @afshin @BehindTheMath /types/sap__xsenv/ @mad-mike /types/sass-graph/ @marvinhagemeister /types/sat/ @omni360 @@ -2881,29 +3188,34 @@ /types/semantic-ui-visibility/ @leonard-thieu /types/semaphore/ @mhfrantz /types/semver/ @Bartvds @BendingBender @LucianBuzzo +/types/semver-compare/ @vincekovacs /types/semver-diff/ @chrismbarr /types/sencha_touch/ @brian428 /types/send/ @MikeJerred /types/seneca/ @psnider /types/sequelize/v3/ @samuelneff @codeanimal @drinchev @morpheusxaut @torhal -/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @morpheusxaut +/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut /types/sequelize-fixtures/ @cschwarz +/types/sequencify/ @npenin /types/sequester/ @Strate /types/serialize-javascript/ @lith-light-g /types/serialport/ @codefoster /types/serve-favicon/ @urossmolnik /types/serve-index/ @tkrotoff /types/serve-static/ @urossmolnik +/types/server-destroy/ @gyszalai /types/session-file-store/ @blendsdk /types/set-cookie-parser/ @nickp10 /types/sha1/ @arcdev1 /types/shallowequal/ @seansfkelley /types/shapefile/ @DenisCarriere /types/sharedworker/ @nakakura -/types/sharepoint/ @baywet +/types/sharepoint/ @gandjustas @andrei-markeev @baywet @teroarvola /types/sharp/ @lith-light-g +/types/sharp-timer/v0/ @afractal /types/sharp-timer/ @afractal /types/sheetify/ @toddself +/types/shell-escape/ @nenadalm /types/shell-quote/ @jason0x43 /types/shelljs/ @nikeee @voy /types/shipit/ @cyrilschumacher @@ -2917,9 +3229,11 @@ /types/siema/ @Irmiz /types/siesta/ @bquarmby /types/sigmajs/ @qinfchen +/types/sigmund/ @BendingBender /types/signalr/ @borisyankov @keesey @GiedriusGrabauskas +/types/signalr-no-jquery/ @gjoshevski /types/signals/ @diullei -/types/signature_pad/ @AbubakerB +/types/signature_pad/ @AbubakerB @jrmihalick /types/simple-assign/ @NoHomey /types/simple-cw-node/ @vvakame /types/simple-mock/ @leonyu @@ -2961,14 +3275,15 @@ /types/smooth-scrollbar/ @asvetliakov /types/smoothie/ @mikehhawley /types/smoothscroll-polyfill/ @kryops -/types/smtp-server/ @markisme +/types/smtp-server/ @markisme @Taisiias /types/smtpapi/ @a-morales /types/snapsvg/ @lhk @mattanja @kant2002 /types/snazzy-info-window/ @milosd92 /types/snekfetch/ @DarkerTV /types/snoowrap/ @vitosamson +/types/snowboy/ @dolanmiu /types/soap/ @aleung @cagefox -/types/socket.io/ @progre @divillysausages @florentpoujol @KentarouTakeda +/types/socket.io/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi /types/socket.io-client/ @progre @divillysausages @florentpoujol /types/socket.io-redis/ @nupplaphil /types/socket.io.users/ @kataras @@ -2978,6 +3293,7 @@ /types/sockjs-client/ @vladev @arusakov @BendingBender /types/solution-center-communicator/ @dami-gg /types/sortablejs/ @Maw-Fox +/types/soundmanager2/ @elton2048 /types/source-list-map/ @e-cloud /types/source-map/ @MortenHoustonLudvigsen @rbuckton /types/source-map-support/ @Bartvds @jason0x43 @@ -2986,6 +3302,7 @@ /types/sparkly/ @BendingBender /types/sparkpost/v1/ @geoffreak /types/sparkpost/ @geoffreak @bondz +/types/sparqljs/ @AlexeyMz /types/spatialite/ @atd-schubert /types/spdy/ @tony19 /types/speakeasy/ @legendecas @mrOlorin @@ -2994,17 +3311,20 @@ /types/spectrum/ @M-Zuber /types/spin.js/ @borisyankov @theodorejb /types/split/ @marcinporebski +/types/split.js/ @icholy /types/split2/ @mugeso /types/spotify-api/ @skovmand -/types/sprintf/ @soywiz +/types/sprintf/ @soywiz @BendingBender +/types/sprintf-js/ @jasonswearingen @BendingBender /types/sql.js/ @Hozuki /types/sqlite3/ @nmalaguti @dpyro /types/sqlstring/ @marvinhagemeister /types/squirejs/ @bradleyayers /types/srp/ @Patman64 /types/ss-utils/ @mythz +/types/ssh-key-decrypt/ @BendingBender /types/ssh2/ @tkQubo @rbuckton -/types/ssh2-sftp-client/ @igrayson +/types/ssh2-sftp-client/ @igrayson @ascariandrea /types/ssh2-streams/ @rbuckton /types/sshpk/ @mabels /types/stack-mapper/ @rogierschouten @@ -3021,9 +3341,12 @@ /types/statuses/ @tkrotoff @BendingBender /types/steam/ @kant2002 /types/steed/ @Paul-Isache +/types/stemmer/ @will-ockmore /types/stompjs/ @jimic -/types/storejs/ @vbortone +/types/stoppable/ @EricByers +/types/storejs/ @vbortone @harry0000 /types/storybook__addon-actions/ @joscha +/types/storybook__addon-info/ @mkornblum /types/storybook__addon-knobs/ @joscha @martynaskadisa /types/storybook__addon-links/ @joscha /types/storybook__addon-notes/ @joscha @@ -3046,20 +3369,22 @@ /types/strip-ansi/ @mhegazy /types/strip-bom/ @mhegazy /types/strip-json-comments/ @dmoonfire +/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU /types/stripe-checkout/ @cgwrench -/types/stripe-node/ @wjohnsto @codeanimal /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/striptags/ @ccitro /types/strong-cluster-control/ @shuntksh /types/strophe/ @DavidKDeutsch /types/stylelint/ @alan-agius4 +/types/stylelint-webpack-plugin/ @bahlo /types/stylus/ @SomaticIT /types/subsume/ @BendingBender /types/succinct/ @EnableSoftware /types/sudo-block/ @BendingBender /types/suitescript/ @darrenhillconsulting /types/sumo-logger/ @forabi +/types/superagent/v2/ @varju @NicoZelaya @mxl /types/superagent/ @NicoZelaya @mxl @paplorinc /types/superagent-no-cache/ @mxl /types/superagent-prefix/ @mxl @@ -3072,10 +3397,11 @@ /types/svg-pan-zoom/v2/ @Promact /types/svg-pan-zoom/ @Yimiprod /types/svg-sprite/ @tkqubo -/types/svg2png/ @hansrwindhoff +/types/svg2png/ @hansrwindhoff @sccgithub /types/svg4everybody/ @BendingBender /types/svgjs.draggable/ @LiFeleSs /types/svgjs.resize/ @jkevingutierrez +/types/svgo/ @bradleyayers /types/swag/ @shiwano /types/swagger-express-middleware/ @alexandreroba /types/swagger-express-mw/ @micmro @@ -3101,12 +3427,14 @@ /types/sylvester/ @StephaneAlie /types/synaptic/ @ToastHawaii @austincummings /types/systeminformation/ @PixelcrabAT -/types/systemjs/ @ludohenin @NathanWalker @GiedriusGrabauskas +/types/systemjs/ @ludohenin @NathanWalker @GiedriusGrabauskas @aluanhaddad /types/table/ @evanshortiss +/types/tabris-plugin-firebase/ @eclipsesource /types/tabtab/ @vojtechhabarta +/types/tabulator/ @euginio /types/tapable/ @e-cloud /types/tape/ @Bartvds @sodatea @DennisSchwartz -/types/tar/ @SomaticIT +/types/tar/ @SomaticIT @connor4312 /types/tedious/ @rogierschouten @cjthompson /types/tedious-connection-pool/ @sandorfr /types/telebot/ @mariotsi @@ -3119,10 +3447,11 @@ /types/tether/ @adidahiya /types/tether-drop/ @adidahiya /types/tether-shepherd/ @mtgibbs -/types/text-buffer/ @vvakame +/types/text-buffer/v0/ @vvakame +/types/text-buffer/ @GlenCFL /types/text-encoding/ @pine613 /types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner -/types/thrift/ @kamek-pf +/types/thrift/ @kamek-pf @kevin-greene-ck @jessezhang91 /types/throng/ @cyrilschumacher /types/throttle/ @BendingBender /types/through/ @AndrewGaspar @@ -3145,37 +3474,39 @@ /types/title/ @fa7ad /types/tldjs/ @geoffreak /types/tmp/ @optical @Perlmint +/types/to-camel-case/ @j-f1 /types/to-markdown/ @SuperPaintman /types/to-title-case-gouch/ @stpettersens /types/toastr/ @borisyankov +/types/tocktimer/ @evanshortiss /types/tooltipster/ @stephenlautier /types/topojson/ @ricardo-mello @chenzhutian /types/torrent-stream/ @xstoudi /types/touch/ @mizunashi-mana @BendingBender /types/touch-events/ @kevinb7 -/types/tough-cookie/ @leonard-thieu +/types/tough-cookie/ @leonard-thieu @LiJinyao /types/traceback/ @misak113 /types/tracking/ @pimterry -/types/transducers-js/ @colinkahn @dphilipson +/types/transducers-js/ @colinkahn @dphilipson @NaridaL /types/transducers.js/ @dphilipson /types/traverse/ @newclear /types/traverson/ @marcinporebski /types/trayballoon/ @korve +/types/tress/ @sindilevich /types/trim/ @skysteve /types/trunk8/ @niemyjski /types/tspromise/ @soywiz /types/tunnel/ @BendingBender -/types/turf/v2/ @gcroteau -/types/turf/ @gcroteau @DenisCarriere /types/tus-js-client/ @kevhiggins /types/tv4/ @Bartvds @psnider -/types/tween.js/ @Amos47 @sunetos @jzarnikov +/types/tween.js/ @Amos47 @sunetos @jzarnikov @alexburner /types/tweenjs/ @evilangelist /types/tweezer.js/ @praxxis /types/twig/ @soywiz @enko /types/twilio/ @nickiannone @ashleybrener /types/twit/ @Volox /types/twitter/ @chitoku-k +/types/twitter-stream-channels/ @adrianbardan /types/twix/ @j3ko /types/type-check/ @hansrwindhoff /types/type-detect/ @Bartvds @@ -3203,9 +3534,10 @@ /types/undertaker/ @tkqubo @GiedriusGrabauskas /types/undertaker-registry/ @GiedriusGrabauskas /types/uniq/ @hansrwindhoff -/types/uniqid/ @me +/types/uniqid/ @idchlife /types/unique-hash-stream/ @BendingBender /types/unique-random/ @Kuniwak +/types/unist/ @bizen241 /types/unity-webapi/ @jmvrbanac /types/universal-analytics/ @Bartvds @DarkerTV /types/universal-router/ @jtmthf @@ -3220,7 +3552,9 @@ /types/uritemplate/ @teyc /types/url-assembler/ @wolfgang42 /types/url-join/ @rogierschouten @devrelm +/types/url-parse/ @ChernenkoPaul /types/url-regex/ @unindented +/types/url-search-params/ @nick121212 /types/url-template/ @marcinporebski /types/urlrouter/ @soywiz /types/urlsafe-base64/ @tkrotoff @@ -3244,7 +3578,7 @@ /types/valerie/ @conficient /types/valid-url/ @stevehipwell /types/validate.js/ @HillTravis -/types/validator/ @tgfjt @chrootsu @IOAyman @louy @kacepe +/types/validator/ @tgfjt @chrootsu @IOAyman @louy @kacepe @deptno /types/validatorjs/ @LKay /types/vanilla-tilt/ @BrunnerLivio /types/vary/ @BendingBender @@ -3257,8 +3591,9 @@ /types/vertx3-eventbus-client/ @oddeirik /types/vex-js/ @gdcohan /types/vexflow/ @rquiring @sebastianhaas @bohoffi +/types/vfile/ @bizen241 @rokt33r /types/victory/ @asvetliakov @snerks @Havret -/types/video.js/ @vbortone +/types/video.js/ @vbortone @scleriot /types/viewability-helper/ @lironzluf /types/viewerjs/ @lrh3321 /types/viewporter/ @borisyankov @@ -3271,7 +3606,7 @@ /types/vinyl-paths/ @tkQubo /types/virtual-dom/ @chbrown /types/virtual-keyboard/ @bsurai -/types/vis/ @MichaelBitard @macleodbroad-wf @adripanico @seveves @kaktus40 @mmaitre314 +/types/vis/ @MichaelBitard @macleodbroad-wf @adripanico @seveves @kaktus40 @mmaitre314 @supercargo /types/vision/ @jasonswearingen @AJamesPhillips /types/vitalsigns/ @cyrilschumacher /types/vivus/ @DanielRosenwasser @lekhmanrus @@ -3282,7 +3617,12 @@ /types/voximplant-websdk/ @aylarov /types/vue-i18n/ @aicest /types/vue-resource/ @kaorun343 +/types/vue-scrollto/ @vincekovacs /types/w2ui/ @Ptival +/types/w3c-generic-sensor/ @kenchris +/types/w3c-screen-orientation/ @kenchris +/types/w3c-web-usb/ @larsgk +/types/waitme/ @totpero /types/wake_on_lan/ @SrTobi /types/wallabyjs/ @andrewconnell /types/wallpaper/ @BendingBender @@ -3292,8 +3632,9 @@ /types/watchify/ @TeamworkGuy2 /types/watchpack/ @e-cloud /types/waterline/ @arvitaly -/types/watson-developer-cloud/ @waldo000000 +/types/watson-developer-cloud/ @waldo000000 @Naktibalda /types/waypoints/ @dominikbulaj @Koloto +/types/wcwidth/ @rokt33r /types/weapp-api/ @vargeek /types/web-animations-js/ @kritollm /types/web-bluetooth/ @urish @@ -3309,16 +3650,19 @@ /types/webgme/ @phreed /types/webix/ @mkozhukh /types/webmidi/ @lostfictions -/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 +/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @ahmed-taj /types/webpack-bundle-analyzer/ @kryops /types/webpack-chain/ @eirikurn @psachs21 +/types/webpack-chunk-hash/ @mtraynham /types/webpack-dev-middleware/ @bumbleblym -/types/webpack-dev-server/ @maestroh @daveparslow +/types/webpack-dev-server/ @maestroh @daveparslow @ZheyangSong /types/webpack-dotenv-plugin/ @kryops -/types/webpack-env/ @use-strict +/types/webpack-env/ @use-strict @rhonsby /types/webpack-fail-plugin/ @deevus /types/webpack-hot-middleware/ @bumbleblym -/types/webpack-merge/ @deevus +/types/webpack-merge/v0/ @deevus +/types/webpack-merge/ @deevus @mtraynham +/types/webpack-node-externals/ @mtraynham /types/webpack-notifier/ @bumbleblym /types/webpack-sources/ @e-cloud @chriseppstein /types/webpack-stream/ @iclanton @bumbleblym @@ -3362,14 +3706,14 @@ /types/wrench/ @soywiz /types/write-file-atomic/ @BendingBender /types/write-json-file/ @DenisCarriere -/types/ws/ @loyd @elithrar +/types/ws/ @loyd @elithrar @mlamp /types/wu/ @phiresky /types/wx-js-sdk-dt/ @agasbzj /types/x-editable/ @sirkirby /types/xadesjs/ @microshine /types/xdate/ @yamada28go /types/xdg-basedir/ @tlaziuk -/types/xlsx/ @themauveavenger +/types/xhr-mock/ @joscha /types/xml/ @YuJianrong /types/xml-parser/ @mhfrantz /types/xml2js/ @michelsalib @jasonrm @ccurrens @edwardhinkle @@ -3386,7 +3730,9 @@ /types/xsd-schema-validator/ @Goldsmith42 /types/xsockets/ @pushplay /types/xterm/ @blink1073 @LucianBuzzo +/types/xxhashjs/ @mDibyo /types/yallist/ @BendingBender +/types/yandex-maps/ @Delagen /types/yandex-money-sdk/ @chrootsu /types/yargs/ @poelstra @mizunashi-mana @pushplay @jeffkenney /types/yayson/ @Codesleuth @@ -3401,7 +3747,9 @@ /types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 /types/yui/ @giabao /types/z-schema/ @pgonzal +/types/zapier-platform-core/ @bradleyayers /types/zen-observable/ @aicest +/types/zen-push/ @daprahamian /types/zepto/ @jbaldwin /types/zeroclipboard/v1/ @ejsmith @niemyjski @balassy @leonyu /types/zeroclipboard/ @ejsmith @niemyjski @balassy @leonyu @@ -3409,5 +3757,6 @@ /types/zetapush-js/ @ghoullier /types/zip.js/ @lgrignon /types/zmq/ @davemckeown +/types/zookeeper/ @xialeistudio /types/zui/ @yuanxu /types/zynga-scroller/ @haskellcamargo From 288e9dd83f14aad2c85708b0a1ee4e1f48b999dc Mon Sep 17 00:00:00 2001 From: Tomoki Ohno Date: Thu, 19 Oct 2017 06:26:47 +0900 Subject: [PATCH 042/314] Add new definition: react-hyperscript (#20693) * Add new package: react-hyperscript * Type of function should be declared by function keyword... * Add a workaround tsc does not allow `export =`ing function because ES spec does not allow that. But react-hyperscript does that. So this workaround is required. --- types/react-hyperscript/index.d.ts | 17 ++++++++++ .../react-hyperscript-tests.ts | 31 +++++++++++++++++++ types/react-hyperscript/tsconfig.json | 23 ++++++++++++++ types/react-hyperscript/tslint.json | 1 + 4 files changed, 72 insertions(+) create mode 100644 types/react-hyperscript/index.d.ts create mode 100644 types/react-hyperscript/react-hyperscript-tests.ts create mode 100644 types/react-hyperscript/tsconfig.json create mode 100644 types/react-hyperscript/tslint.json diff --git a/types/react-hyperscript/index.d.ts b/types/react-hyperscript/index.d.ts new file mode 100644 index 0000000000..4ead727398 --- /dev/null +++ b/types/react-hyperscript/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for react-hyperscript 3.0 +// Project: https://github.com/mlmorg/react-hyperscript +// Definitions by: tock203 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { ComponentClass, StatelessComponent, ReactElement } from 'react'; + +declare namespace h {} + +declare function h

( + componentOrTag: ComponentClass

| StatelessComponent

| string, + properties?: P, + children?: ReadonlyArray> | string +): ReactElement

; + +export = h; diff --git a/types/react-hyperscript/react-hyperscript-tests.ts b/types/react-hyperscript/react-hyperscript-tests.ts new file mode 100644 index 0000000000..9782a79248 --- /dev/null +++ b/types/react-hyperscript/react-hyperscript-tests.ts @@ -0,0 +1,31 @@ +import * as React from 'react'; +import * as h from 'react-hyperscript'; + +class SomeComponent extends React.Component { + render() { + return React.createElement('div'); + } +} + +const StatelessComponent = () => React.createElement('div'); + +class MainComponent extends React.Component { + render() { + return h('div.example', [ + h('h1#heading', 'This is hyperscript'), + h('h2', 'creating React.js markup'), + h(SomeComponent, {foo: 'bar'}, [ + h('li', [ + h('a', {href: 'http://whatever.com'}, 'One list item') + ]), + h('li', 'Another list item') + ]), + h(StatelessComponent, {foo: 'bar'}, [ + h('li', [ + h('a', {href: 'http://whatever.com'}, 'One list item') + ]), + h('li', 'Another list item') + ]) + ]); + } +} diff --git a/types/react-hyperscript/tsconfig.json b/types/react-hyperscript/tsconfig.json new file mode 100644 index 0000000000..1ad5f62543 --- /dev/null +++ b/types/react-hyperscript/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-hyperscript-tests.ts" + ] +} diff --git a/types/react-hyperscript/tslint.json b/types/react-hyperscript/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-hyperscript/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 1fb244abedbe3dbfc11e31d3e9436be9062a8cbe Mon Sep 17 00:00:00 2001 From: Josh Rutherford Date: Thu, 19 Oct 2017 05:40:47 -0500 Subject: [PATCH 043/314] react-dom: add createPortal API (#20245). (#20336) * react-dom: add createPortal API. * React, React-DOM: move portal interface to types/react, update render for class components to include ReactPortal. * react-dom: add second portal test case with jsx, allow jsx in react-dom-tests. * react, react-dom createPortal api: remove undocumented arguments, properties. --- types/react-dom/index.d.ts | 5 ++++- .../{react-dom-tests.ts => react-dom-tests.tsx} | 14 ++++++++++++++ types/react-dom/tsconfig.json | 5 +++-- types/react/index.d.ts | 12 +++++++++--- 4 files changed, 30 insertions(+), 6 deletions(-) rename types/react-dom/{react-dom-tests.ts => react-dom-tests.tsx} (93%) diff --git a/types/react-dom/index.d.ts b/types/react-dom/index.d.ts index aeac0c8081..20b870a8b8 100644 --- a/types/react-dom/index.d.ts +++ b/types/react-dom/index.d.ts @@ -4,6 +4,7 @@ // AssureSign // Microsoft // MartynasZilinskas +// Josh Rutherford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -12,12 +13,14 @@ export as namespace ReactDOM; import { ReactInstance, Component, ComponentState, ReactElement, SFCElement, CElement, - DOMAttributes, DOMElement + DOMAttributes, DOMElement, ReactNode, ReactPortal } from 'react'; export function findDOMNode(instance: ReactInstance): Element; export function unmountComponentAtNode(container: Element): boolean; +export function createPortal(children: ReactNode, container: Element): ReactPortal; + export const version: string; export const render: Renderer; export const hydrate: Renderer; diff --git a/types/react-dom/react-dom-tests.ts b/types/react-dom/react-dom-tests.tsx similarity index 93% rename from types/react-dom/react-dom-tests.ts rename to types/react-dom/react-dom-tests.tsx index 08eac7afdb..3f153b0a75 100644 --- a/types/react-dom/react-dom-tests.ts +++ b/types/react-dom/react-dom-tests.tsx @@ -31,6 +31,20 @@ describe('ReactDOM', () => { ReactDOM.render(React.createElement('div'), rootElement); ReactDOM.findDOMNode(rootElement); }); + + it('createPortal', () => { + const rootElement = document.createElement('div'); + const portalTarget = document.createElement('div'); + + class ClassComponent extends React.Component { + render() { + return ReactDOM.createPortal(

, portalTarget); + } + } + + ReactDOM.createPortal(React.createElement('div'), portalTarget); + ReactDOM.render(, rootElement); + }); }); describe('ReactDOMServer', () => { diff --git a/types/react-dom/tsconfig.json b/types/react-dom/tsconfig.json index 010744a826..0d21b07029 100644 --- a/types/react-dom/tsconfig.json +++ b/types/react-dom/tsconfig.json @@ -1,7 +1,7 @@ { "files": [ "index.d.ts", - "react-dom-tests.ts", + "react-dom-tests.tsx", "server/index.d.ts", "node-stream/index.d.ts", "test-utils/index.d.ts" @@ -22,6 +22,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "jsx": "preserve" } } \ No newline at end of file diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 35feb8d0ab..93cb62fbfa 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -13,6 +13,7 @@ // Dovydas Navickas // Stéphane Goetz // Rich Seviora +// Josh Rutherford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -123,6 +124,11 @@ declare namespace React { type: keyof ReactSVG; } + interface ReactPortal { + key: Key | null; + children: ReactNode; + } + // // Factories // ---------------------------------------------------------------------- @@ -161,7 +167,7 @@ declare namespace React { // Should be Array but type aliases cannot be recursive type ReactFragment = {} | Array; - type ReactNode = ReactChild | ReactFragment | boolean | null | undefined; + type ReactNode = ReactChild | ReactFragment | ReactPortal | string | number | boolean | null | undefined; // // Top Level API @@ -280,7 +286,7 @@ declare namespace React { // tslint:enable:unified-signatures forceUpdate(callBack?: () => any): void; - render(): JSX.Element | JSX.Element[] | string | number | null | false; + render(): JSX.Element | JSX.Element[] | ReactPortal | string | number | null | false; // React.Props is now deprecated, which means that the `children` // property is not available on `P` by default, even though you can @@ -3505,7 +3511,7 @@ declare global { // tslint:disable:no-empty-interface interface Element extends React.ReactElement { } interface ElementClass extends React.Component { - render(): Element | Element[] | string | number | null | false; + render(): Element | Element[] | React.ReactPortal | string | number | null | false; } interface ElementAttributesProperty { props: {}; } interface ElementChildrenAttribute { children: {}; } From 0cbf897a5df2d58336c27291e11ae671fca63b4f Mon Sep 17 00:00:00 2001 From: Weeco <23424570+weeco@users.noreply.github.com> Date: Thu, 19 Oct 2017 16:39:30 +0200 Subject: [PATCH 044/314] Added eachAsync options for concurrency (#20541) * Added eachAsync options for concurrency * Added overload function definition for eachAsync --- types/mongoose/index.d.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index cd7bb438d4..3e1002fd3c 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -469,6 +469,11 @@ declare module "mongoose" { static Messages: Object; } + interface EachAsyncOptions { + /** defaults to 1 */ + parallel?: number; + } + /* * section querycursor.js * http://mongoosejs.com/docs/api.html#querycursor-js @@ -500,10 +505,21 @@ declare module "mongoose" { * Execute fn for every document in the cursor. If fn returns a promise, * will wait for the promise to resolve before iterating on to the next one. * Returns a promise that resolves when done. - * @param callback executed when all docs have been processed + * @param fn Function to be executed for every document in the cursor + * @param callback Executed when all docs have been processed */ eachAsync(fn: (doc: T) => any, callback?: (err: any) => void): Promise; + /** + * Execute fn for every document in the cursor. If fn returns a promise, + * will wait for the promise to resolve before iterating on to the next one. + * Returns a promise that resolves when done. + * @param fn Function to be executed for every document in the cursor + * @param options Async options (e. g. parallel function execution) + * @param callback Executed when all docs have been processed + */ + eachAsync(fn: (doc: T) => any, options: EachAsyncOptions, callback?: (err: any) => void): Promise; + /** * Registers a transform function which subsequently maps documents retrieved * via the streams interface or .next() From 4aa4400332de149258fda1bc4f3fe4de6686bfb9 Mon Sep 17 00:00:00 2001 From: Yoga Aliarham Date: Thu, 19 Oct 2017 21:48:52 +0700 Subject: [PATCH 045/314] Update ioredis type definitions (add pfcount, pfadd, pfmerge interfaces) (#20669) * Update ioredis type definitions * Add contributor name * Update interface order --- types/ioredis/index.d.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 7a36c4b7a6..8353b4e563 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/luin/ioredis // Definitions by: York Yao // Christopher Eck +// Yoga Aliarham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* =================== USAGE =================== @@ -325,16 +326,22 @@ declare module IORedis { evalsha(args: any[], callback?: ResCallbackT): any; evalsha(...args: any[]): any; script(args: any[], callback?: ResCallbackT): any; - script(...args: any[]): any; script(key: string, callback?: ResCallbackT): any; + script(...args: any[]): any; quit(args: any[], callback?: ResCallbackT): any; quit(...args: any[]): any; - scan(...args: any[]): any; scan(args: any[], callback?: ResCallbackT): any; - hscan(...args: any[]): any; + scan(...args: any[]): any; hscan(args: any[], callback?: ResCallbackT): any; - zscan(...args: any[]): any; + hscan(...args: any[]): any; zscan(args: any[], callback?: ResCallbackT): any; + zscan(...args: any[]): any; + pfmerge(args: any[], callback?: ResCallbackT): any; + pfmerge(...args: any[]): any; + pfadd(args: any[], callback?: ResCallbackT): any; + pfadd(...args: any[]): any; + pfcount(args: any[], callback?: ResCallbackT): any; + pfcount(...args: any[]): any; pipeline(): Pipeline; pipeline(commands: string[][]): Pipeline; From 68a737fd800032531f3f87ac9c48b540b81dd600 Mon Sep 17 00:00:00 2001 From: mattywong Date: Thu, 19 Oct 2017 23:04:18 +0800 Subject: [PATCH 046/314] [@types/next] Update Router.push() method to include UrlLike type (#20671) * [@types/next] Update Router.push() method to include UrlLike type Allow a valid UrlLike object instead of only a string type e.g ``` Router.push({ pathname: '/pathname', query: { prop1: '', prop2: '', }, }); ``` https://github.com/zeit/next.js/#with-url-object-1 * Update router.d.ts --- types/next/router.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/next/router.d.ts b/types/next/router.d.ts index 021b0dd3dc..a1d58bb42a 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -1,4 +1,7 @@ import * as React from 'react'; +import * as url from 'url'; + +type UrlLike = url.UrlObject | url.Url; export interface EventChangeOptions { shallow?: boolean; @@ -20,8 +23,8 @@ export interface SingletonRouter { // router methods reload(route: string): Promise; back(): void; - push(url: string, as?: string, options?: EventChangeOptions): Promise; - replace(url: string, as?: string, options?: EventChangeOptions): Promise; + push(url: string|UrlLike, as?: string|UrlLike, options?: EventChangeOptions): Promise; + replace(url: string|UrlLike, as?: string|UrlLike, options?: EventChangeOptions): Promise; prefetch(url: string): Promise>; // router events From 77eac5484737119fc124ee602659e7179f9a342f Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Thu, 19 Oct 2017 11:09:17 -0400 Subject: [PATCH 047/314] [lodash] Better chaining wrappers, overload clean-up (#19356) * [lodash] improved iterateee parameters, simplified forEach overloads * Changed ListIterator to StringIterator, cleaned up more issues with flatMap * Even more flatMap cleanup * Making wrapper types simpler and more accurate (not done) * Fixed type inference for forEach callback arguments * Converted explicit wrapper types, implemented differenceWith * Updated more functions to use new-style wrappers * Finished updating the remaining methods * Fixed lint errors * Fixed parameter type inference when using `any` (#19228) * Fixed test errors * Fixed issues with _.get * Fixed issues with _.get * consider this * removed duplicate type, added TODO * More _.get fixes * Fixed issues with mapValues with a single parameter * Modified lodash-tests to have minimal diff with upstream * Improved backwards compatibility --- types/lodash/index.d.ts | 14419 +++++++++++++-------------------- types/lodash/lodash-tests.ts | 3032 +++---- types/lodash/tslint.json | 17 +- 3 files changed, 7058 insertions(+), 10410 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 58698cb4f3..ac954c6107 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -8,7 +8,7 @@ // Junyoung Clare Jang , // e-cloud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.2 /** ### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) @@ -244,7 +244,7 @@ Methods: export = _; export as namespace _; -declare var _: _.LoDashStatic; +declare let _: _.LoDashStatic; type PartialObject = Partial; @@ -253,46 +253,74 @@ declare namespace _ { interface LoDashStatic { /** - * Creates a lodash object which wraps the given value to enable intuitive method chaining. + * Creates a lodash object which wraps value to enable implicit method chain sequences. + * Methods that operate on and return arrays, collections, and functions can be chained together. + * Methods that retrieve a single value or may return a primitive value will automatically end the + * chain sequence and return the unwrapped value. Otherwise, the value must be unwrapped with value(). * - * In addition to Lo-Dash methods, wrappers also have the following Array methods: - * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift + * Explicit chain sequences, which must be unwrapped with value(), may be enabled using _.chain. * - * Chaining is supported in custom builds as long as the value method is implicitly or - * explicitly included in the build. + * The execution of chained methods is lazy, that is, it's deferred until value() is + * implicitly or explicitly called. * - * The chainable wrapper functions are: - * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, - * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, - * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, - * keyBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, - * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, - * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, - * toArray, transform, union, uniq, unset, unshift, unzip, values, where, without, wrap, and zip + * Lazy evaluation allows several methods to support shortcut fusion. Shortcut fusion + * is an optimization to merge iteratee calls; this avoids the creation of intermediate + * arrays and can greatly reduce the number of iteratee executions. Sections of a chain + * sequence qualify for shortcut fusion if the section is applied to an array and iteratees + * accept only one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. * - * The non-chainable wrapper functions are: - * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, - * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, - * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, - * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, - * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, - * sortedIndex, runInContext, template, unescape, uniqueId, and value + * Chaining is supported in custom builds as long as the value() method is directly or + * indirectly included in the build. * - * The wrapper functions first and last return wrapped values when n is provided, otherwise - * they return unwrapped values. + * In addition to lodash methods, wrappers have Array and String methods. + * The wrapper Array methods are: + * concat, join, pop, push, shift, sort, splice, and unshift. + * The wrapper String methods are: + * replace and split. * - * Explicit chaining can be enabled by using the _.chain method. + * The wrapper methods that support shortcut fusion are: + * at, compact, drop, dropRight, dropWhile, filter, find, findLast, head, initial, last, + * map, reject, reverse, slice, tail, take, takeRight, takeRightWhile, takeWhile, and toArray + * + * The chainable wrapper methods are: + * after, ary, assign, assignIn, assignInWith, assignWith, at, before, bind, bindAll, bindKey, + * castArray, chain, chunk, commit, compact, concat, conforms, constant, countBy, create, + * curry, debounce, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, + * drop, dropRight, dropRightWhile, dropWhile, extend, extendWith, fill, filter, flatMap, + * flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, flow, flowRight, + * fromPairs, functions, functionsIn, groupBy, initial, intersection, intersectionBy, intersectionWith, + * invert, invertBy, invokeMap, iteratee, keyBy, keys, keysIn, map, mapKeys, mapValues, + * matches, matchesProperty, memoize, merge, mergeWith, method, methodOf, mixin, negate, + * nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, partial, partialRight, + * partition, pick, pickBy, plant, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, + * push, range, rangeRight, rearg, reject, remove, rest, reverse, sampleSize, set, setWith, + * shuffle, slice, sort, sortBy, sortedUniq, sortedUniqBy, splice, spread, tail, take, + * takeRight, takeRightWhile, takeWhile, tap, throttle, thru, toArray, toPairs, toPairsIn, + * toPath, toPlainObject, transform, unary, union, unionBy, unionWith, uniq, uniqBy, uniqWith, + * unset, unshift, unzip, unzipWith, update, updateWith, values, valuesIn, without, wrap, + * xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, and zipWith. + * + * The wrapper methods that are not chainable by default are: + * add, attempt, camelCase, capitalize, ceil, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, + * conformsTo, deburr, defaultTo, divide, each, eachRight, endsWith, eq, escape, escapeRegExp, + * every, find, findIndex, findKey, findLast, findLastIndex, findLastKey, first, floor, forEach, + * forEachRight, forIn, forInRight, forOwn, forOwnRight, get, gt, gte, has, hasIn, head, + * identity, includes, indexOf, inRange, invoke, isArguments, isArray, isArrayBuffer, + * isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, + * isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, + * isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, + * isSafeInteger, isSet, isString, isUndefined, isTypedArray, isWeakMap, isWeakSet, join, + * kebabCase, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, max, maxBy, mean, meanBy, + * min, minBy, multiply, noConflict, noop, now, nth, pad, padEnd, padStart, parseInt, pop, + * random, reduce, reduceRight, repeat, result, round, runInContext, sample, shift, size, + * snakeCase, some, sortedIndex, sortedIndexBy, sortedLastIndex, sortedLastIndexBy, startCase, + * startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, + * template, times, toFinite, toInteger, toJSON, toLength, toLower, toNumber, toSafeInteger, + * toString, toUpper, trim, trimEnd, trimStart, truncate, unescape, uniqueId, upperCase, + * upperFirst, value, and words. **/ - (value: number): LoDashImplicitWrapper; - (value: string): LoDashImplicitStringWrapper; - (value: boolean): LoDashImplicitWrapper; - (value: null | undefined): LoDashImplicitWrapper; - (value: number[]): LoDashImplicitNumberArrayWrapper; - (value: T[]): LoDashImplicitArrayWrapper; - (value: T[] | null | undefined): LoDashImplicitNillableArrayWrapper; - (value: T): LoDashImplicitObjectWrapper; - (value: T | null | undefined): LoDashImplicitNillableObjectWrapper; - (value: any): LoDashImplicitWrapper; + (value: T): LoDashImplicitWrapper; /** * The semantic version number. @@ -368,7 +396,7 @@ declare namespace _ { * @param value The value to cache. * @return Returns the cache object. */ - set(key: string, value: any): _.Dictionary; + set(key: string, value: any): Dictionary; /** * Removes all key-value entries from the map. @@ -379,66 +407,26 @@ declare namespace _ { new (): MapCache; } - interface LoDashWrapperBase { } + interface LoDashWrapper { } - interface LoDashImplicitWrapperBase extends LoDashWrapperBase { } - - interface LoDashExplicitWrapperBase extends LoDashWrapperBase { } - - interface LoDashImplicitWrapper extends LoDashImplicitWrapperBase> { } - - interface LoDashExplicitWrapper extends LoDashExplicitWrapperBase> { } - - interface LoDashImplicitStringWrapper extends LoDashImplicitWrapper { } - - interface LoDashExplicitStringWrapper extends LoDashExplicitWrapper { } - - interface LoDashImplicitObjectWrapperBase extends LoDashImplicitWrapperBase { } - - interface LoDashImplicitObjectWrapper extends LoDashImplicitObjectWrapperBase> { } - - interface LoDashImplicitNillableObjectWrapper extends LoDashImplicitObjectWrapperBase> { } - - interface LoDashExplicitObjectWrapperBase extends LoDashExplicitWrapperBase { } - - interface LoDashExplicitObjectWrapper extends LoDashExplicitObjectWrapperBase> { } - - interface LoDashExplicitNillableObjectWrapper extends LoDashExplicitObjectWrapperBase> { } - - interface LoDashImplicitArrayWrapperBase extends LoDashImplicitWrapperBase { - pop(): T | undefined; - push(...items: T[]): TWrapper; - shift(): T | undefined; - sort(compareFn?: (a: T, b: T) => number): TWrapper; - splice(start: number): TWrapper; - splice(start: number, deleteCount: number, ...items: T[]): TWrapper; - unshift(...items: T[]): TWrapper; + interface LoDashImplicitWrapper extends LoDashWrapper { + pop(this: LoDashImplicitWrapper | null | undefined>): T | undefined; + push(this: LoDashImplicitWrapper | null | undefined>, ...items: T[]): this; + shift(this: LoDashImplicitWrapper | null | undefined>): T | undefined; + sort(this: LoDashImplicitWrapper | null | undefined>, compareFn?: (a: T, b: T) => number): this; + splice(this: LoDashImplicitWrapper | null | undefined>, start: number, deleteCount?: number, ...items: T[]): this; + unshift(this: LoDashImplicitWrapper | null | undefined>, ...items: T[]): this; } - interface LoDashImplicitArrayWrapper extends LoDashImplicitArrayWrapperBase> { } - - interface LoDashImplicitNillableArrayWrapper extends LoDashImplicitArrayWrapperBase> { } - - interface LoDashImplicitNumberArrayWrapperBase extends LoDashImplicitArrayWrapperBase { } - - interface LoDashImplicitNumberArrayWrapper extends LoDashImplicitArrayWrapper { } - - interface LoDashExplicitArrayWrapperBase extends LoDashExplicitWrapperBase { - pop(): LoDashExplicitObjectWrapper; - push(...items: T[]): TWrapper; - shift(): LoDashExplicitObjectWrapper; - sort(compareFn?: (a: T, b: T) => number): TWrapper; - splice(start: number): TWrapper; - splice(start: number, deleteCount: number, ...items: T[]): TWrapper; - unshift(...items: T[]): TWrapper; + interface LoDashExplicitWrapper extends LoDashWrapper { + pop(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; + push(this: LoDashExplicitWrapper | null | undefined>, ...items: T[]): this; + shift(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; + sort(this: LoDashExplicitWrapper | null | undefined>, compareFn?: (a: T, b: T) => number): this; + splice(this: LoDashExplicitWrapper | null | undefined>, start: number, deleteCount?: number, ...items: T[]): this; + unshift(this: LoDashExplicitWrapper | null | undefined>, ...items: T[]): this; } - interface LoDashExplicitArrayWrapper extends LoDashExplicitArrayWrapperBase> { } - - interface LoDashExplicitNillableArrayWrapper extends LoDashExplicitArrayWrapperBase> { } - - interface LoDashExplicitNumberArrayWrapper extends LoDashExplicitArrayWrapper { } - /********* * Array * *********/ @@ -459,32 +447,24 @@ declare namespace _ { ): T[][]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.chunk */ - chunk(size?: number): LoDashImplicitArrayWrapper; + chunk( + this: LoDashImplicitWrapper | null | undefined>, + size?: number, + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.chunk */ - chunk(size?: number): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.chunk - */ - chunk(size?: number): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.chunk - */ - chunk(size?: number): LoDashExplicitArrayWrapper; + chunk( + this: LoDashExplicitWrapper | null | undefined>, + size?: number, + ): LoDashExplicitWrapper; } //_.compact @@ -499,35 +479,21 @@ declare namespace _ { compact(array?: List | null | undefined): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.compact */ - compact(): LoDashImplicitArrayWrapper; + compact(this: LoDashImplicitWrapper | null | undefined>): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.compact */ - compact(): LoDashImplicitArrayWrapper; + compact(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.compact - */ - compact(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.compact - */ - compact(): LoDashExplicitArrayWrapper; - } - - //_.concat DUMMY + //_.concat interface LoDashStatic { /** * Creates a new array concatenating `array` with any additional arrays @@ -550,7 +516,21 @@ declare namespace _ { * console.log(array); * // => [1] */ - concat(array: List, ...values: Array>): T[]; + concat(array: Many, ...values: Array>): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.compact + */ + concat(this: LoDashImplicitWrapper>, ...values: Array>): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.compact + */ + concat(this: LoDashExplicitWrapper>, ...values: Array>): LoDashExplicitWrapper; } //_.difference @@ -569,32 +549,24 @@ declare namespace _ { ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.difference */ - difference(...values: Array>): LoDashImplicitArrayWrapper; + difference( + this: LoDashImplicitWrapper | null | undefined>, + ...values: Array> + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.difference */ - difference(...values: Array>): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.difference - */ - difference(...values: Array>): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.difference - */ - difference(...values: Array>): LoDashExplicitArrayWrapper; + difference( + this: LoDashExplicitWrapper | null | undefined>, + ...values: Array> + ): LoDashExplicitWrapper; } //_.differenceBy @@ -612,16 +584,7 @@ declare namespace _ { differenceBy( array: List | null | undefined, values?: List, - iteratee?: ((value: T) => any)|string - ): T[]; - - /** - * @see _.differenceBy - */ - differenceBy( - array: List | null | undefined, - values?: List, - iteratee?: W + iteratee?: ValueIteratee ): T[]; /** @@ -629,19 +592,9 @@ declare namespace _ { */ differenceBy( array: List | null | undefined, - values1?: List, - values2?: List, - iteratee?: ((value: T) => any)|string - ): T[]; - - /** - * @see _.differenceBy - */ - differenceBy( - array: List | null | undefined, - values1?: List, - values2?: List, - iteratee?: W + values1: List, + values2: List, + iteratee?: ValueIteratee ): T[]; /** @@ -649,33 +602,10 @@ declare namespace _ { */ differenceBy( array: List | null | undefined, - values1?: List, - values2?: List, - values3?: List, - iteratee?: ((value: T) => any)|string - ): T[]; - - /** - * @see _.differenceBy - */ - differenceBy( - array: List | null | undefined, - values1?: List, - values2?: List, - values3?: List, - iteratee?: W - ): T[]; - - /** - * @see _.differenceBy - */ - differenceBy( - array: List | null | undefined, - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: W + values1: List, + values2: List, + values3: List, + iteratee?: ValueIteratee ): T[]; /** @@ -683,11 +613,11 @@ declare namespace _ { */ differenceBy( array: List | null | undefined, - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: ((value: T) => any)|string + values1: List, + values2: List, + values3: List, + values4: List, + iteratee?: ValueIteratee ): T[]; /** @@ -695,25 +625,12 @@ declare namespace _ { */ differenceBy( array: List | null | undefined, - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: ((value: T) => any)|string - ): T[]; - - /** - * @see _.differenceBy - */ - differenceBy( - array: List | null | undefined, - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: W + values1: List, + values2: List, + values3: List, + values4: List, + values5: List, + iteratee?: ValueIteratee ): T[]; /** @@ -721,447 +638,141 @@ declare namespace _ { */ differenceBy( array: List | null | undefined, - ...values: any[] + ...values: Array | ValueIteratee> ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.differenceBy */ differenceBy( + this: LoDashImplicitWrapper | null | undefined>, values?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; /** * @see _.differenceBy */ differenceBy( - values1?: List, - values2?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + values1: List, + values2: List, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; /** * @see _.differenceBy */ differenceBy( - values1?: List, - values2?: List, - values3?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + values1: List, + values2: List, + values3: List, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; /** * @see _.differenceBy */ differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + values1: List, + values2: List, + values3: List, + values4: List, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; /** * @see _.differenceBy */ differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + values1: List, + values2: List, + values3: List, + values4: List, + values5: List, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; /** * @see _.differenceBy */ differenceBy( - ...values: any[] - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + ...values: Array | ValueIteratee> + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.differenceBy */ differenceBy( + this: LoDashExplicitWrapper | null | undefined>, values?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; /** * @see _.differenceBy */ differenceBy( - values1?: List, - values2?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + this: LoDashExplicitWrapper | null | undefined>, + values1: List, + values2: List, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; /** * @see _.differenceBy */ differenceBy( - values1?: List, - values2?: List, - values3?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + this: LoDashExplicitWrapper | null | undefined>, + values1: List, + values2: List, + values3: List, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; /** * @see _.differenceBy */ differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + this: LoDashExplicitWrapper | null | undefined>, + values1: List, + values2: List, + values3: List, + values4: List, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; /** * @see _.differenceBy */ differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: ((value: T) => any)|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: W - ): LoDashImplicitArrayWrapper; + this: LoDashExplicitWrapper | null | undefined>, + values1: List, + values2: List, + values3: List, + values4: List, + values5: List, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; /** * @see _.differenceBy */ differenceBy( - ...values: any[] - ): LoDashImplicitArrayWrapper; + this: LoDashExplicitWrapper | null | undefined>, + ...values: Array | ValueIteratee> + ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.differenceBy - */ - differenceBy( - values?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - ...values: any[] - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.differenceBy - */ - differenceBy( - values?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: ((value: T) => any)|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - values1?: List, - values2?: List, - values3?: List, - values4?: List, - values5?: List, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.differenceBy - */ - differenceBy( - ...values: any[] - ): LoDashExplicitArrayWrapper; - } - - //_.differenceWith DUMMY + //_.differenceWith interface LoDashStatic { /** * Creates an array of unique `array` values not included in the other @@ -1171,18 +782,67 @@ declare namespace _ { * @static * @memberOf _ * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. + * @param {...Array} [values] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * - * _.difference([3, 2, 1], [4, 2]); - * // => [3, 1] + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] */ - differenceWith( - array: List, - ...values: any[] - ): any[]; + differenceWith( + array: List | null | undefined, + values?: List, + comparator?: Comparator + ): T[]; + + /** + * @see _.differenceWith + */ + differenceWith( + array: List | null | undefined, + ...values: Array | Comparator>, + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.differenceWith + */ + differenceWith( + this: LoDashImplicitWrapper | null | undefined>, + values?: List, + comparator?: Comparator + ): LoDashImplicitWrapper; + + /** + * @see _.differenceWith + */ + differenceWith( + this: LoDashImplicitWrapper | null | undefined>, + ...values: Array | Comparator>, + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.differenceWith + */ + differenceWith( + this: LoDashExplicitWrapper | null | undefined>, + values?: List, + comparator?: Comparator + ): LoDashExplicitWrapper; + + /** + * @see _.differenceWith + */ + differenceWith( + this: LoDashExplicitWrapper | null | undefined>, + ...values: Array | Comparator>, + ): LoDashExplicitWrapper; } //_.drop @@ -1197,32 +857,18 @@ declare namespace _ { drop(array: List | null | undefined, n?: number): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.drop */ - drop(n?: number): LoDashImplicitArrayWrapper; + drop(this: LoDashImplicitWrapper | null | undefined>, n?: number): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.drop */ - drop(n?: number): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.drop - */ - drop(n?: number): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.drop - */ - drop(n?: number): LoDashExplicitArrayWrapper; + drop(this: LoDashExplicitWrapper | null | undefined>, n?: number): LoDashExplicitWrapper; } //_.dropRight @@ -1240,32 +886,18 @@ declare namespace _ { ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.dropRight */ - dropRight(n?: number): LoDashImplicitArrayWrapper; + dropRight(this: LoDashImplicitWrapper | null | undefined>, n?: number): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.dropRight */ - dropRight(n?: number): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.dropRight - */ - dropRight(n?: number): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.dropRight - */ - dropRight(n?: number): LoDashExplicitArrayWrapper; + dropRight(this: LoDashExplicitWrapper | null | undefined>, n?: number): LoDashExplicitWrapper; } //_.dropRightWhile @@ -1288,118 +920,30 @@ declare namespace _ { * @param thisArg The this binding of predicate. * @return Returns the slice of array. */ - dropRightWhile( - array: List | null | undefined, - predicate?: ListIterator - ): TValue[]; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - array: List | null | undefined, - predicate?: string - ): TValue[]; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - array: List | null | undefined, - predicate?: TWhere - ): TValue[]; + dropRightWhile( + array: List | null | undefined, + predicate?: ListIteratee + ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.dropRightWhile */ - dropRightWhile( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: TWhere - ): LoDashImplicitArrayWrapper; + dropRightWhile( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.dropRightWhile */ - dropRightWhile( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: TWhere - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.dropRightWhile - */ - dropRightWhile( - predicate?: TWhere - ): LoDashExplicitArrayWrapper; + dropRightWhile( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashExplicitWrapper; } //_.dropWhile @@ -1422,118 +966,30 @@ declare namespace _ { * @param thisArg The this binding of predicate. * @return Returns the slice of array. */ - dropWhile( - array: List | null | undefined, - predicate?: ListIterator - ): TValue[]; - - /** - * @see _.dropWhile - */ - dropWhile( - array: List | null | undefined, - predicate?: string - ): TValue[]; - - /** - * @see _.dropWhile - */ - dropWhile( - array: List | null | undefined, - predicate?: TWhere - ): TValue[]; + dropWhile( + array: List | null | undefined, + predicate?: ListIteratee + ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.dropWhile */ - dropWhile( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: TWhere - ): LoDashImplicitArrayWrapper; + dropWhile( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.dropWhile */ - dropWhile( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: TWhere - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.dropWhile - */ - dropWhile( - predicate?: TWhere - ): LoDashExplicitArrayWrapper; + dropWhile( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashExplicitWrapper; } //_.fill @@ -1551,9 +1007,7 @@ declare namespace _ { */ fill( array: any[] | null | undefined, - value: T, - start?: number, - end?: number + value: T ): T[]; /** @@ -1561,54 +1015,104 @@ declare namespace _ { */ fill( array: List | null | undefined, - value: T, - start?: number, - end?: number + value: T ): List; + + /** + * @see _.fill + */ + fill( + array: U[] | null | undefined, + value: T, + start?: number, + end?: number + ): Array; + + /** + * @see _.fill + */ + fill( + array: List | null | undefined, + value: T, + start?: number, + end?: number + ): List; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.fill */ fill( - value: T, - start?: number, - end?: number - ): LoDashImplicitArrayWrapper; - } + this: LoDashImplicitWrapper, + value: T + ): LoDashImplicitWrapper; - interface LoDashImplicitObjectWrapperBase { /** * @see _.fill */ fill( + this: LoDashImplicitWrapper | null | undefined>, + value: T + ): LoDashImplicitWrapper>; + + /** + * @see _.fill + */ + fill( + this: LoDashImplicitWrapper, value: T, start?: number, end?: number - ): LoDashImplicitObjectWrapper>; + ): LoDashImplicitWrapper>; + + /** + * @see _.fill + */ + fill( + this: LoDashImplicitWrapper | null | undefined>, + value: T, + start?: number, + end?: number + ): LoDashImplicitWrapper>; } - interface LoDashExplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.fill */ fill( - value: T, - start?: number, - end?: number - ): LoDashExplicitArrayWrapper; - } + this: LoDashExplicitWrapper, + value: T + ): LoDashExplicitWrapper; - interface LoDashExplicitObjectWrapperBase { /** * @see _.fill */ fill( + this: LoDashExplicitWrapper | null | undefined>, + value: T + ): LoDashExplicitWrapper>; + + /** + * @see _.fill + */ + fill( + this: LoDashExplicitWrapper, value: T, start?: number, end?: number - ): LoDashExplicitObjectWrapper>; + ): LoDashExplicitWrapper>; + + /** + * @see _.fill + */ + fill( + this: LoDashExplicitWrapper | null | undefined>, + value: T, + start?: number, + end?: number + ): LoDashExplicitWrapper>; } //_.findIndex @@ -1633,129 +1137,29 @@ declare namespace _ { */ findIndex( array: List | null | undefined, - predicate?: ListIterator, + predicate?: ListIteratee, fromIndex?: number ): number; + } + interface LoDashImplicitWrapper { /** * @see _.findIndex */ findIndex( - array: List | null | undefined, - predicate?: string, - fromIndex?: number - ): number; - - /** - * @see _.findIndex - */ - findIndex( - array: List | null | undefined, - predicate?: W, + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee, fromIndex?: number ): number; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.findIndex */ - findIndex( - predicate?: ListIterator, - fromIndex?: number - ): number; - - /** - * @see _.findIndex - */ - findIndex( - predicate?: string, - fromIndex?: number - ): number; - - /** - * @see _.findIndex - */ - findIndex( - predicate?: W, - fromIndex?: number - ): number; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.findIndex - */ - findIndex( - predicate?: ListIterator, - fromIndex?: number - ): number; - - /** - * @see _.findIndex - */ - findIndex( - predicate?: string, - fromIndex?: number - ): number; - - /** - * @see _.findIndex - */ - findIndex( - predicate?: W, - fromIndex?: number - ): number; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.findIndex - */ - findIndex( - predicate?: ListIterator, - fromIndex?: number - ): LoDashExplicitWrapper; - - /** - * @see _.findIndex - */ - findIndex( - predicate?: string, - fromIndex?: number - ): LoDashExplicitWrapper; - - /** - * @see _.findIndex - */ - findIndex( - predicate?: W, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.findIndex - */ - findIndex( - predicate?: ListIterator, - fromIndex?: number - ): LoDashExplicitWrapper; - - /** - * @see _.findIndex - */ - findIndex( - predicate?: string, - fromIndex?: number - ): LoDashExplicitWrapper; - - /** - * @see _.findIndex - */ - findIndex( - predicate?: W, + findIndex( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee, fromIndex?: number ): LoDashExplicitWrapper; } @@ -1781,185 +1185,53 @@ declare namespace _ { */ findLastIndex( array: List | null | undefined, - predicate?: ListIterator, + predicate?: ListIteratee, fromIndex?: number ): number; + } + interface LoDashImplicitWrapper { /** * @see _.findLastIndex */ findLastIndex( - array: List | null | undefined, - predicate?: string, - fromIndex?: number - ): number; - - /** - * @see _.findLastIndex - */ - findLastIndex( - array: List | null | undefined, - predicate?: W, + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee, fromIndex?: number ): number; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.findLastIndex */ - findLastIndex( - predicate?: ListIterator, - fromIndex?: number - ): number; - - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: string, - fromIndex?: number - ): number; - - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: W, - fromIndex?: number - ): number; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: ListIterator, - fromIndex?: number - ): number; - - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: string, - fromIndex?: number - ): number; - - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: W, - fromIndex?: number - ): number; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: ListIterator, - fromIndex?: number - ): LoDashExplicitWrapper; - - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: string, - fromIndex?: number - ): LoDashExplicitWrapper; - - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: W, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: ListIterator, - fromIndex?: number - ): LoDashExplicitWrapper; - - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: string, - fromIndex?: number - ): LoDashExplicitWrapper; - - /** - * @see _.findLastIndex - */ - findLastIndex( - predicate?: W, + findLastIndex( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee, fromIndex?: number ): LoDashExplicitWrapper; } //_.first interface LoDashStatic { - /** - * @see _.head - */ - first(array: List | null | undefined): T | undefined; + first: typeof _.head; // tslint:disable-line:no-unnecessary-qualifier } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.head */ - first(): string | undefined; + first(this: LoDashImplicitWrapper | null | undefined>): T | undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.head */ - first(): T | undefined; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.head - */ - first(): T | undefined; - } - - interface LoDashExplicitWrapper { - /** - * @see _.head - */ - first(): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.head - */ - first(): T; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.head - */ - first(): T; + first(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } interface RecursiveArray extends Array> {} - interface ListOfRecursiveArraysOrValues extends List> {} //_.flatten @@ -1978,53 +1250,30 @@ declare namespace _ { * @see _.flatten */ flatten(array: List> | null | undefined): T[]; - - /** - * @see _.flatten - */ - flatten(array: ListOfRecursiveArraysOrValues | null | undefined): RecursiveArray; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.flatten */ - flatten(): LoDashImplicitArrayWrapper; + flatten(this: LoDashImplicitWrapper | null | undefined>, isDeep: boolean): LoDashImplicitWrapper; + + /** + * @see _.flatten + */ + flatten(this: LoDashImplicitWrapper> | null | undefined>): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.flatten */ - flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; - } + flatten(this: LoDashExplicitWrapper | null | undefined>, isDeep: boolean): LoDashExplicitWrapper; - interface LoDashImplicitObjectWrapperBase { /** * @see _.flatten */ - flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.flatten - */ - flatten(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.flatten - */ - flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.flatten - */ - flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + flatten(this: LoDashExplicitWrapper> | null | undefined>): LoDashExplicitWrapper; } //_.flattenDeep @@ -2038,46 +1287,18 @@ declare namespace _ { flattenDeep(array: ListOfRecursiveArraysOrValues | null | undefined): T[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.flattenDeep */ - flattenDeep(): LoDashImplicitArrayWrapper; + flattenDeep(this: LoDashImplicitWrapper | null | undefined>): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.flattenDeep */ - flattenDeep(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.flattenDeep - */ - flattenDeep(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.flattenDeep - */ - flattenDeep(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.flattenDeep - */ - flattenDeep(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.flattenDeep - */ - flattenDeep(): LoDashExplicitArrayWrapper; + flattenDeep(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } // _.flattenDepth @@ -2092,6 +1313,20 @@ declare namespace _ { flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; } + interface LoDashImplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDepth(this: LoDashImplicitWrapper | null | undefined>, depth?: number): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDepth(this: LoDashExplicitWrapper | null | undefined>, depth?: number): LoDashExplicitWrapper; + } + //_.fromPairs interface LoDashStatic { /** @@ -2109,7 +1344,7 @@ declare namespace _ { * // => { 'fred': 30, 'barney': 40 } */ fromPairs( - array: List<[_.StringRepresentable, T]> | null | undefined + array: List<[StringRepresentable, T]> | null | undefined ): Dictionary; /** @@ -2120,20 +1355,37 @@ declare namespace _ { ): Dictionary; } - //_.fromPairs DUMMY - interface LoDashImplicitArrayWrapperBase { + //_.fromPairs + interface LoDashImplicitWrapper { /** * @see _.fromPairs */ - fromPairs(): LoDashImplicitObjectWrapper; - } + fromPairs( + this: LoDashImplicitWrapper | null | undefined> + ): LoDashImplicitWrapper>; - //_.fromPairs DUMMY - interface LoDashExplicitArrayWrapperBase { + /** + @see _.fromPairs + */ + fromPairs( + this: LoDashImplicitWrapper | null | undefined> + ): LoDashImplicitWrapper>; + } + //_.fromPairs + interface LoDashExplicitWrapper { /** * @see _.fromPairs */ - fromPairs(): LoDashExplicitObjectWrapper; + fromPairs( + this: LoDashExplicitWrapper | null | undefined> + ): LoDashExplicitWrapper>; + + /** + @see _.fromPairs + */ + fromPairs( + this: LoDashExplicitWrapper | null | undefined> + ): LoDashExplicitWrapper>; } //_.head @@ -2149,46 +1401,18 @@ declare namespace _ { head(array: List | null | undefined): T | undefined; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.head */ - head(): string | undefined; + head(this: LoDashImplicitWrapper | null | undefined>): T | undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.head */ - head(): T | undefined; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.head - */ - head(): T | undefined; - } - - interface LoDashExplicitWrapper { - /** - * @see _.head - */ - head(): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.head - */ - head(): T; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.head - */ - head(): T; + head(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } //_.indexOf @@ -2223,277 +1447,28 @@ declare namespace _ { ): number; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.indexOf */ - indexOf( + indexOf( + this: LoDashImplicitWrapper | null | undefined>, value: T, fromIndex?: boolean|number ): number; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.indexOf */ - indexOf( - value: TValue, - fromIndex?: boolean|number - ): number; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.indexOf - */ - indexOf( + indexOf( + this: LoDashExplicitWrapper | null | undefined>, value: T, fromIndex?: boolean|number ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.indexOf - */ - indexOf( - value: TValue, - fromIndex?: boolean|number - ): LoDashExplicitWrapper; - } - - //_.intersectionBy DUMMY - interface LoDashStatic { - /** - * 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). - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} 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( - array: List, - ...values: any[] - ): any[]; - } - - //_.intersectionWith DUMMY - interface LoDashStatic { - /** - * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared 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( - array: List, - ...values: any[] - ): any[]; - } - - //_.join - interface LoDashStatic { - /** - * 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( - array: List | null | undefined, - separator?: string - ): string; - } - - interface LoDashImplicitWrapper { - /** - * @see _.join - */ - join(separator?: string): string; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.join - */ - join(separator?: string): string; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.join - */ - join(separator?: string): string; - } - - interface LoDashExplicitWrapper { - /** - * @see _.join - */ - join(separator?: string): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.join - */ - join(separator?: string): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.join - */ - join(separator?: string): LoDashExplicitWrapper; - } - - //_.pullAll DUMMY - interface LoDashStatic { - /** - * This method is like `_.pull` except that it accepts an array of values to remove. - * - * **Note:** Unlike `_.difference`, this method mutates `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3, 1, 2, 3]; - * - * _.pull(array, [2, 3]); - * console.log(array); - * // => [1, 1] - */ - pullAll( - array: List, - ...values: any[] - ): any[]; - } - - //_.pullAllBy DUMMY - interface LoDashStatic { - /** - * 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`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} 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( - array: List, - ...values: any[] - ): any[]; - } - - type Comparator = (arrVal: T, othVal: T) => boolean; - - //_.pullAllWith - interface LoDashStatic { - /** - * 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`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} 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( - array: List, - values: List, - comparator?: Comparator - ): List; - } - - //_.reverse DUMMY - interface LoDashStatic { - /** - * 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). - * - * @memberOf _ - * @category Array - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.reverse(array); - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - reverse( - array: List, - ...values: any[] - ): any[]; - } - //_.sortedIndexOf interface LoDashStatic { /** @@ -2517,42 +1492,26 @@ declare namespace _ { ): number; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.sortedIndexOf */ - sortedIndexOf( + sortedIndexOf( + this: LoDashImplicitWrapper | null | undefined>, value: T ): number; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.sortedIndexOf */ - sortedIndexOf( - value: TValue - ): number; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sortedIndexOf - */ - sortedIndexOf( + sortedIndexOf( + this: LoDashExplicitWrapper | null | undefined>, value: T ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.sortedIndexOf - */ - sortedIndexOf( - value: TValue - ): LoDashExplicitWrapper; - } - //_.initial interface LoDashStatic { /** @@ -2564,32 +1523,18 @@ declare namespace _ { initial(array: List | null | undefined): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.initial */ - initial(): LoDashImplicitArrayWrapper; + initial(this: LoDashImplicitWrapper | null | undefined>): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.initial */ - initial(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.initial - */ - initial(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.initial - */ - initial(): LoDashExplicitArrayWrapper; + initial(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } //_.intersection @@ -2601,35 +1546,244 @@ declare namespace _ { * @param arrays The arrays to inspect. * @return Returns the new array of shared values. */ - intersection(...arrays: Array | null | undefined>): T[]; + intersection(...arrays: Array>): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.intersection */ - intersection(...arrays: Array>): LoDashImplicitArrayWrapper; + intersection( + this: LoDashImplicitWrapper>, + ...arrays: Array> + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.intersection */ - intersection(...arrays: Array>): LoDashImplicitArrayWrapper; + intersection( + this: LoDashExplicitWrapper>, + ...arrays: Array> + ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapperBase { + //_.intersectionBy + interface LoDashStatic { /** - * @see _.intersection + * 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). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} 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 }] */ - intersection(...arrays: Array>): LoDashExplicitArrayWrapper; + intersectionBy( + array?: List | null | undefined, + values?: List, + iteratee?: ValueIteratee + ): T[]; + + /** + * @see _.intersectionBy + */ + intersectionBy( + array?: List | null | undefined, + ...values: Array | ValueIteratee>, + ): T[]; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** - * @see _.intersection + * @see _.intersectionBy */ - intersection(...arrays: Array>): LoDashExplicitArrayWrapper; + intersectionBy( + this: LoDashImplicitWrapper | null | undefined>, + values?: List, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; + + /** + * @see _.intersectionBy + */ + intersectionBy( + this: LoDashImplicitWrapper | null | undefined>, + ...values: Array | ValueIteratee>, + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.intersectionBy + */ + intersectionBy( + this: LoDashExplicitWrapper | null | undefined>, + values?: List, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; + + /** + * @see _.intersectionBy + */ + intersectionBy( + this: LoDashExplicitWrapper | null | undefined>, + ...values: Array | ValueIteratee>, + ): LoDashExplicitWrapper; + } + + //_.intersectionWith + interface LoDashStatic { + /** + * 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. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [values] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} 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 }] + */ + intersectionWith( + array: List | null | undefined, + values?: List, + comparator?: Comparator + ): T[]; + + /** + * @see _.differenceWith + */ + intersectionWith( + array: List | null | undefined, + ...values: Array | Comparator>, + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.intersectionWith + */ + intersectionWith( + this: LoDashImplicitWrapper | null | undefined>, + values?: List, + comparator?: Comparator + ): LoDashImplicitWrapper; + + /** + * @see _.intersectionWith + */ + intersectionWith( + this: LoDashImplicitWrapper | null | undefined>, + ...values: Array | Comparator>, + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.intersectionWith + */ + intersectionWith( + this: LoDashExplicitWrapper | null | undefined>, + values?: List, + comparator?: Comparator + ): LoDashExplicitWrapper; + + /** + * @see _.intersectionWith + */ + intersectionWith( + this: LoDashExplicitWrapper | null | undefined>, + ...values: Array | Comparator>, + ): LoDashExplicitWrapper; + } + + //_.join + interface LoDashStatic { + /** + * 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( + array: List | null | undefined, + separator?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.join + */ + join(separator?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.join + */ + join(separator?: string): LoDashExplicitWrapper; + } + + //_.reverse + interface LoDashStatic { + /** + * 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). + * + * @memberOf _ + * @category Array + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + reverse>( + array: TList, + ): TList; + } + + //_.prototype.reverse + interface LoDashWrapper { + /** + * Reverses the wrapped array so the first element becomes the last, the second element becomes the second to + * last, and so on. + * + * Note: This method mutates the wrapped array. + * + * @return Returns the new reversed lodash wrapper instance. + */ + reverse(): this; } //_.last @@ -2643,46 +1797,18 @@ declare namespace _ { last(array: List | null | undefined): T | undefined; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.last */ - last(): string | undefined; + last(this: LoDashImplicitWrapper | null | undefined>): T | undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.last */ - last(): T | undefined; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.last - */ - last(): T | undefined; - } - - interface LoDashExplicitWrapper { - /** - * @see _.last - */ - last(): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.last - */ - last(): T; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.last - */ - last(): T; + last(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } //_.lastIndexOf @@ -2698,47 +1824,29 @@ declare namespace _ { lastIndexOf( array: List | null | undefined, value: T, - fromIndex?: boolean|number + fromIndex?: true|number ): number; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** - * @see _.lastIndexOf + * @see _.indexOf */ - lastIndexOf( + lastIndexOf( + this: LoDashImplicitWrapper | null | undefined>, value: T, - fromIndex?: boolean|number + fromIndex?: true|number ): number; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** - * @see _.lastIndexOf + * @see _.indexOf */ - lastIndexOf( - value: TResult, - fromIndex?: boolean|number - ): number; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.lastIndexOf - */ - lastIndexOf( + lastIndexOf( + this: LoDashExplicitWrapper | null | undefined>, value: T, - fromIndex?: boolean|number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.lastIndexOf - */ - lastIndexOf( - value: TResult, - fromIndex?: boolean|number + fromIndex?: true|number ): LoDashExplicitWrapper; } @@ -2757,40 +1865,24 @@ declare namespace _ { ): T | undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.nth */ - nth( + nth( + this: LoDashImplicitWrapper | null | undefined>, n?: number ): T | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.nth */ - nth( - n?:number - ): TResult | undefined; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.nth - */ - nth( - n?:number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.nth - */ - nth( - n?:number - ): LoDashExplicitWrapper; + nth( + this: LoDashExplicitWrapper | null | undefined>, + n?: number + ): LoDashExplicitWrapper; } //_.pull @@ -2818,32 +1910,24 @@ declare namespace _ { ): List; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitWrapper { /** * @see _.pull */ - pull(...values: T[]): LoDashImplicitArrayWrapper; + pull( + this: LoDashImplicitWrapper>, + ...values: T[] + ): this; } - interface LoDashImplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.pull */ - pull(...values: TValue[]): LoDashImplicitObjectWrapper>; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.pull - */ - pull(...values: T[]): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.pull - */ - pull(...values: TValue[]): LoDashExplicitObjectWrapper>; + pull( + this: LoDashExplicitWrapper>, + ...values: T[] + ): this; } //_.pullAt @@ -2859,37 +1943,203 @@ declare namespace _ { * @return Returns the new array of removed elements. */ pullAt( - array: List, + array: T[], ...indexes: Array> ): T[]; - } - interface LoDashImplicitArrayWrapper { /** * @see _.pullAt */ - pullAt(...indexes: Array>): LoDashImplicitArrayWrapper; + pullAt( + array: List, + ...indexes: Array> + ): List; } - interface LoDashImplicitObjectWrapper { + interface LoDashWrapper { /** * @see _.pullAt */ - pullAt(...indexes: Array>): LoDashImplicitArrayWrapper; + pullAt(...indexes: Array>): this; } - interface LoDashExplicitArrayWrapper { + //_.pullAll + interface LoDashStatic { /** - * @see _.pullAt + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] */ - pullAt(...indexes: Array>): LoDashExplicitArrayWrapper; + pullAll( + array: T[], + values?: List, + ): T[]; + + /** + * @see _.pullAll + */ + pullAll( + array: List, + values?: List, + ): List; } - interface LoDashExplicitObjectWrapper { + interface LoDashImplicitWrapper { /** - * @see _.pullAt + * @see _.pullAll */ - pullAt(...indexes: Array>): LoDashExplicitArrayWrapper; + pullAll( + this: LoDashImplicitWrapper>, + values?: List + ): this; + } + + interface LoDashExplicitWrapper { + /** + * @see _.pullAll + */ + pullAll( + this: LoDashExplicitWrapper>, + values?: List + ): this; + } + + //_.pullAllBy + interface LoDashStatic { + /** + * 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`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} 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( + array: T[], + values?: List, + iteratee?: ValueIteratee + ): T[]; + + /** + * @see _.pullAllBy + */ + pullAllBy( + array: List, + values?: List, + iteratee?: ValueIteratee + ): List; + } + + interface LoDashImplicitWrapper { + /** + * @see _.pullAllBy + */ + pullAllBy( + this: LoDashImplicitWrapper>, + values?: List, + iteratee?: ValueIteratee + ): this; + } + + interface LoDashExplicitWrapper { + /** + * @see _.pullAllBy + */ + pullAllBy( + this: LoDashExplicitWrapper>, + values?: List, + iteratee?: ValueIteratee + ): this; + } + + //_.pullAllWith + interface LoDashStatic { + /** + * 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`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} 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 }] + */ + pullAllWith( + array: T[], + values?: List, + comparator?: Comparator + ): T[]; + + /** + * @see _.pullAllWith + */ + pullAllWith( + array: List, + values?: List, + comparator?: Comparator + ): List; + } + + interface LoDashImplicitWrapper { + /** + * @see _.pullAllWith + */ + pullAllWith( + this: LoDashImplicitWrapper>, + values?: List, + comparator?: Comparator + ): this; + } + + interface LoDashExplicitWrapper { + /** + * @see _.pullAllWith + */ + pullAllWith( + this: LoDashExplicitWrapper>, + values?: List, + comparator?: Comparator + ): this; } //_.remove @@ -2916,116 +2166,28 @@ declare namespace _ { */ remove( array: List, - predicate?: ListIterator + predicate?: ListIteratee ): T[]; + } + interface LoDashImplicitWrapper { /** * @see _.remove */ remove( - array: List, - predicate?: string - ): T[]; - - /** - * @see _.remove - */ - remove( - array: List, - predicate?: W - ): T[]; + this: LoDashImplicitWrapper>, + predicate?: ListIteratee + ): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashExplicitWrapper { /** * @see _.remove */ - remove( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: W - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.remove - */ - remove( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: W - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.remove - */ - remove( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: W - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.remove - */ - remove( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: W - ): LoDashExplicitArrayWrapper; + remove( + this: LoDashExplicitWrapper>, + predicate?: ListIteratee + ): LoDashExplicitWrapper; } //_.tail @@ -3033,40 +2195,24 @@ declare namespace _ { /** * Gets all but the first element of array. * - * @alias _.tail - * * @param array The array to query. * @return Returns the slice of array. */ tail(array: List | null | undefined): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.tail */ - tail(): LoDashImplicitArrayWrapper; + tail(this: LoDashImplicitWrapper | null | undefined>): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.tail */ - tail(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.tail - */ - tail(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.tail - */ - tail(): LoDashExplicitArrayWrapper; + tail(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } //_.slice @@ -3080,30 +2226,32 @@ declare namespace _ { * @return Returns the slice of array. */ slice( - array: T[] | null | undefined, + array: List | null | undefined, start?: number, end?: number ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.slice */ - slice( + slice( + this: LoDashImplicitWrapper | null | undefined>, start?: number, end?: number - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; } - interface LoDashExplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.slice */ - slice( + slice( + this: LoDashExplicitWrapper | null | undefined>, start?: number, end?: number - ): LoDashExplicitArrayWrapper; + ): LoDashExplicitWrapper; } //_.sortedIndex @@ -3132,56 +2280,22 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { - /** - * @see _.sortedIndex - */ - sortedIndex( - value: string - ): number; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T - ): number; - } - - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.sortedIndex */ sortedIndex( + this: LoDashImplicitWrapper | null | undefined>, value: T ): number; } - interface LoDashExplicitWrapper { - /** - * @see _.sortedIndex - */ - sortedIndex( - value: string - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.sortedIndex */ sortedIndex( + this: LoDashExplicitWrapper | null | undefined>, value: T ): LoDashExplicitWrapper; } @@ -3211,202 +2325,32 @@ declare namespace _ { * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 0 */ - sortedIndexBy( - array: List | null | undefined, - value: T, - iteratee: (x: T) => TSort - ): number; - - /** - * @see _.sortedIndexBy - */ sortedIndexBy( array: List | null | undefined, value: T, - iteratee: (x: T) => any - ): number; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - array: List | null | undefined, - value: T, - iteratee: string - ): number; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - array: List | null | undefined, - value: T, - iteratee: W - ): number; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - array: List | null | undefined, - value: T, - iteratee: Object + iteratee?: ValueIteratee ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.sortedIndexBy */ - sortedIndexBy( - value: string, - iteratee: (x: string) => TSort + sortedIndexBy( + this: LoDashImplicitWrapper | null | undefined>, + value: T, + iteratee?: ValueIteratee ): number; } - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: (x: T) => TSort - ): number; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: string - ): number; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: W - ): number; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: (x: T) => TSort - ): number; - + interface LoDashExplicitWrapper { /** * @see _.sortedIndexBy */ sortedIndexBy( + this: LoDashExplicitWrapper | null | undefined>, value: T, - iteratee: (x: T) => any - ): number; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: string - ): number; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: W - ): number; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: Object - ): number; - } - - interface LoDashExplicitWrapper { - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: string, - iteratee: (x: string) => TSort - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: (x: T) => TSort - ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: string - ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: W - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: (x: T) => TSort - ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: (x: T) => any - ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: string - ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: W - ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndexBy - */ - sortedIndexBy( - value: T, - iteratee: Object + iteratee?: ValueIteratee ): LoDashExplicitWrapper; } @@ -3434,56 +2378,22 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: string - ): number; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T - ): number; - } - - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.sortedLastIndex */ sortedLastIndex( + this: LoDashImplicitWrapper | null | undefined>, value: T ): number; } - interface LoDashExplicitWrapper { - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: string - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.sortedLastIndex */ sortedLastIndex( + this: LoDashExplicitWrapper | null | undefined>, value: T ): LoDashExplicitWrapper; } @@ -3508,206 +2418,36 @@ declare namespace _ { * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 1 */ - sortedLastIndexBy( - array: List | null | undefined, - value: T, - iteratee: (x: T) => TSort - ): number; - - /** - * @see _.sortedLastIndexBy - */ sortedLastIndexBy( array: List | null | undefined, value: T, - iteratee: (x: T) => any - ): number; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - array: List | null | undefined, - value: T, - iteratee: string - ): number; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - array: List | null | undefined, - value: T, - iteratee: W - ): number; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - array: List | null | undefined, - value: T, - iteratee: Object + iteratee: ValueIteratee ): number; } - interface LoDashImplicitWrapper { - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: string, - iteratee: (x: string) => TSort - ): number; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: (x: T) => TSort - ): number; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: string - ): number; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: W - ): number; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: (x: T) => TSort - ): number; - + interface LoDashImplicitWrapper { /** * @see _.sortedLastIndexBy */ sortedLastIndexBy( + this: LoDashImplicitWrapper | null | undefined>, value: T, - iteratee: (x: T) => any - ): number; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: string - ): number; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: W - ): number; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: Object + iteratee: ValueIteratee ): number; } - interface LoDashExplicitWrapper { - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: string, - iteratee: (x: string) => TSort - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: (x: T) => TSort - ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: string - ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: W - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: (x: T) => TSort - ): LoDashExplicitWrapper; - + interface LoDashExplicitWrapper { /** * @see _.sortedLastIndexBy */ sortedLastIndexBy( + this: LoDashExplicitWrapper | null | undefined>, value: T, - iteratee: (x: T) => any - ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: string - ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: W - ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndexBy - */ - sortedLastIndexBy( - value: T, - iteratee: Object + iteratee: ValueIteratee ): LoDashExplicitWrapper; } - //_.sortedLastIndexOf DUMMY + //_.sortedLastIndexOf interface LoDashStatic { /** * This method is like `_.lastIndexOf` except that it performs a binary @@ -3730,40 +2470,24 @@ declare namespace _ { ): number; } - //_.tail - interface LoDashStatic { + interface LoDashImplicitWrapper { /** - * @see _.rest + * @see _.sortedLastIndexOf */ - tail(array: List | null | undefined): T[]; + sortedLastIndexOf( + this: LoDashImplicitWrapper | null | undefined>, + value: T + ): number; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** - * @see _.rest + * @see _.sortedLastIndexOf */ - tail(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.rest - */ - tail(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.rest - */ - tail(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.rest - */ - tail(): LoDashExplicitArrayWrapper; + sortedLastIndexOf( + this: LoDashExplicitWrapper | null | undefined>, + value: T + ): LoDashExplicitWrapper; } //_.take @@ -3781,32 +2505,24 @@ declare namespace _ { ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.take */ - take(n?: number): LoDashImplicitArrayWrapper; + take( + this: LoDashImplicitWrapper | null | undefined>, + n?: number + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.take */ - take(n?: number): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.take - */ - take(n?: number): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.take - */ - take(n?: number): LoDashExplicitArrayWrapper; + take( + this: LoDashExplicitWrapper | null | undefined>, + n?: number + ): LoDashExplicitWrapper; } //_.takeRight @@ -3824,32 +2540,24 @@ declare namespace _ { ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.takeRight */ - takeRight(n?: number): LoDashImplicitArrayWrapper; + takeRight( + this: LoDashImplicitWrapper | null | undefined>, + n?: number + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.takeRight */ - takeRight(n?: number): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.takeRight - */ - takeRight(n?: number): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.takeRight - */ - takeRight(n?: number): LoDashExplicitArrayWrapper; + takeRight( + this: LoDashExplicitWrapper | null | undefined>, + n?: number + ): LoDashExplicitWrapper; } //_.takeRightWhile @@ -3872,118 +2580,30 @@ declare namespace _ { * @param thisArg The this binding of predicate. * @return Returns the slice of array. */ - takeRightWhile( - array: List | null | undefined, - predicate?: ListIterator - ): TValue[]; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - array: List | null | undefined, - predicate?: string - ): TValue[]; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - array: List | null | undefined, - predicate?: TWhere - ): TValue[]; + takeRightWhile( + array: List | null | undefined, + predicate?: ListIteratee + ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.takeRightWhile */ - takeRightWhile( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: TWhere - ): LoDashImplicitArrayWrapper; + takeRightWhile( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.takeRightWhile */ - takeRightWhile( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: TWhere - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.takeRightWhile - */ - takeRightWhile( - predicate?: TWhere - ): LoDashExplicitArrayWrapper; + takeRightWhile( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashExplicitWrapper; } //_.takeWhile @@ -4006,118 +2626,30 @@ declare namespace _ { * @param thisArg The this binding of predicate. * @return Returns the slice of array. */ - takeWhile( - array: List | null | undefined, - predicate?: ListIterator - ): TValue[]; - - /** - * @see _.takeWhile - */ - takeWhile( - array: List | null | undefined, - predicate?: string - ): TValue[]; - - /** - * @see _.takeWhile - */ - takeWhile( - array: List | null | undefined, - predicate?: TWhere - ): TValue[]; + takeWhile( + array: List | null | undefined, + predicate?: ListIteratee + ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.takeWhile */ - takeWhile( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: TWhere - ): LoDashImplicitArrayWrapper; + takeWhile( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.takeWhile */ - takeWhile( - predicate?: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: TWhere - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.takeWhile - */ - takeWhile( - predicate?: TWhere - ): LoDashExplicitArrayWrapper; + takeWhile( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashExplicitWrapper; } //_.union @@ -4132,42 +2664,24 @@ declare namespace _ { union(...arrays: Array | null | undefined>): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.union */ - union(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; - - /** - * @see _.union - */ - union(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; + union( + this: LoDashImplicitWrapper | null | undefined>, + ...arrays: Array | null | undefined> + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.union */ - union(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.union - */ - union(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; - - /** - * @see _.union - */ - union(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.union - */ - union(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; + union( + this: LoDashExplicitWrapper | null | undefined>, + ...arrays: Array | null | undefined> + ): LoDashExplicitWrapper; } //_.unionBy @@ -4183,504 +2697,258 @@ declare namespace _ { */ unionBy( arrays: List | null | undefined, - iteratee?: (value: T) => any + iteratee?: ValueIteratee ): T[]; /** * @see _.unionBy */ - unionBy( + unionBy( + arrays1: List | null | undefined, + arrays2: List | null | undefined, + iteratee?: ValueIteratee + ): T[]; + + /** + * @see _.unionBy + */ + unionBy( + arrays1: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + iteratee?: ValueIteratee + ): T[]; + + /** + * @see _.unionBy + */ + unionBy( + arrays1: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + iteratee?: ValueIteratee + ): T[]; + + /** + * @see _.unionBy + */ + unionBy( + arrays1: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, + ...iteratee: Array | List | null | undefined> + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.unionBy + */ + unionBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; + + /** + * @see _.unionBy + */ + unionBy( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; + + /** + * @see _.unionBy + */ + unionBy( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; + + /** + * @see _.unionBy + */ + unionBy( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; + + /** + * @see _.unionBy + */ + unionBy( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, + ...iteratee: Array | List | null | undefined> + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.unionBy + */ + unionBy( + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; + + /** + * @see _.unionBy + */ + unionBy( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; + + /** + * @see _.unionBy + */ + unionBy( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; + + /** + * @see _.unionBy + */ + unionBy( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; + + /** + * @see _.unionBy + */ + unionBy( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, + ...iteratee: Array | List | null | undefined> + ): LoDashExplicitWrapper; + } + + //_.unionWith + interface LoDashStatic { + /** + * 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). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} 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( arrays: List | null | undefined, - iteratee?: W + comparator?: Comparator ): T[]; /** * @see _.unionBy */ - unionBy( - arrays1: List | null | undefined, - arrays2: List | null | undefined, - iteratee?: (value: T) => any - ): T[]; - - /** - * @see _.unionBy - */ - unionBy( - arrays1: List | null | undefined, - arrays2: List | null | undefined, - iteratee?: W - ): T[]; - - /** - * @see _.unionBy - */ - unionBy( - arrays1: List | null | undefined, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee?: (value: T) => any - ): T[]; - - /** - * @see _.unionBy - */ - unionBy( - arrays1: List | null | undefined, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee?: W - ): T[]; - - /** - * @see _.unionBy - */ - unionBy( - arrays1: List | null | undefined, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: (value: T) => any - ): T[]; - - /** - * @see _.unionBy - */ - unionBy( - arrays1: List | null | undefined, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: W - ): T[]; - - /** - * @see _.unionBy - */ - unionBy( - arrays1: List | null | undefined, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: (value: T) => any - ): T[]; - - /** - * @see _.unionBy - */ - unionBy( - arrays1: List | null | undefined, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: W - ): T[]; - - /** - * @see _.unionBy - */ - unionBy( + unionWith( arrays: List | null | undefined, - ...iteratee: any[] + arrays2: List | null | undefined, + comparator?: Comparator + ): T[]; + + /** + * @see _.unionWith + */ + unionWith( + arrays: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + ...comparator: Array | List | null | undefined> ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** - * @see _.unionBy + * @see _.unionWith */ - unionBy( - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; + unionWith( + this: LoDashImplicitWrapper | null | undefined>, + comparator?: Comparator + ): LoDashImplicitWrapper; /** - * @see _.unionBy + * @see _.unionWith */ - unionBy( - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( + unionWith( + this: LoDashImplicitWrapper | null | undefined>, arrays2: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; + comparator?: Comparator + ): LoDashImplicitWrapper; /** - * @see _.unionBy + * @see _.unionWith */ - unionBy( - arrays2: List | null | undefined, - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( + unionWith( + this: LoDashImplicitWrapper | null | undefined>, arrays2: List | null | undefined, arrays3: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - ...iteratee: any[] - ): LoDashImplicitArrayWrapper; + ...comparator: Array | List | null | undefined> + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** - * @see _.unionBy + * @see _.unionWith */ - unionBy( - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; + unionWith( + this: LoDashExplicitWrapper | null | undefined>, + comparator?: Comparator + ): LoDashExplicitWrapper; /** - * @see _.unionBy + * @see _.unionWith */ - unionBy( - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( + unionWith( + this: LoDashExplicitWrapper | null | undefined>, arrays2: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; + comparator?: Comparator + ): LoDashExplicitWrapper; /** - * @see _.unionBy + * @see _.unionWith */ - unionBy( - arrays2: List | null | undefined, - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( + unionWith( + this: LoDashExplicitWrapper | null | undefined>, arrays2: List | null | undefined, arrays3: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: W - ): LoDashImplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - ...iteratee: any[] - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.unionBy - */ - unionBy( - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - ...iteratee: any[] - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.unionBy - */ - unionBy( - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: (value: T) => any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee?: W - ): LoDashExplicitArrayWrapper; - - /** - * @see _.unionBy - */ - unionBy( - ...iteratee: any[] - ): LoDashExplicitArrayWrapper; + ...comparator: Array | List | null | undefined> + ): LoDashExplicitWrapper; } //_.uniq @@ -4704,72 +2972,20 @@ declare namespace _ { uniq( array: List | null | undefined ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List | null | undefined - ): T[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.uniq */ - uniq(): LoDashImplicitArrayWrapper; + uniq(this: LoDashImplicitWrapper | null | undefined>): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.uniq */ - uniq(): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - uniq(): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.uniq - */ - uniq(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.uniq - */ - uniq(): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.uniq - */ - uniq(): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq(): LoDashExplicitArrayWrapper; + uniq(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } //_.uniqBy @@ -4794,206 +3010,100 @@ declare namespace _ { * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ - uniqBy( - array: TString, + uniqBy( + array: string | null | undefined, iteratee: StringIterator - ): TString[]; + ): string[]; /** * @see _.uniqBy */ uniqBy( array: List | null | undefined, - iteratee: ListIterator - ): T[]; - - /** - * @see _.uniqBy - */ - uniqBy( - array: List | null | undefined, - iteratee: ListIterator - ): T[]; - - /** - * @see _.uniqBy - */ - uniqBy( - array: List | null | undefined, - iteratee: string - ): T[]; - - /** - * @see _.uniqBy - */ - uniqBy( - array: List | null | undefined, - iteratee: Object - ): T[]; - - /** - * @see _.uniqBy - */ - uniqBy( - array: List | null | undefined, - iteratee: TWhere + iteratee: ListIteratee ): T[]; } - interface LoDashImplicitStringWrapper { + interface LoDashImplicitWrapper { /** * @see _.uniqBy */ uniqBy( + this: LoDashImplicitWrapper, iteratee: StringIterator - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee: ListIteratee + ): LoDashImplicitWrapper; } - interface LoDashExplicitStringWrapper { + interface LoDashExplicitWrapper { /** * @see _.uniqBy */ uniqBy( + this: LoDashExplicitWrapper, iteratee: StringIterator - ): LoDashExplicitArrayWrapper; - } - - interface LoDashImplicitWrapper { - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: ListIterator - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: ListIterator - ): LoDashImplicitArrayWrapper; + ): LoDashExplicitWrapper; /** * @see _.uniqBy */ uniqBy( - iteratee: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: TWhere - ): LoDashImplicitArrayWrapper; + this: LoDashExplicitWrapper | null | undefined>, + iteratee: ListIteratee + ): LoDashExplicitWrapper; } - interface LoDashExplicitWrapper { + //_.uniqWith + interface LoDashStatic { /** - * @see _.uniqBy + * 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). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} 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 }] */ - uniqBy( - iteratee: ListIterator - ): LoDashExplicitArrayWrapper; + uniqWith( + array: List | null | undefined, + comparator?: Comparator + ): T[]; } - interface LoDashExplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** - * @see _.uniqBy + * @see _.uniqWith */ - uniqBy( - iteratee: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: TWhere - ): LoDashExplicitArrayWrapper; + uniqWith( + this: LoDashImplicitWrapper | null | undefined>, + comparator?: Comparator + ): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** - * @see _.uniqBy + * @see _.uniqWith */ - uniqBy( - iteratee: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: Object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniqBy - */ - uniqBy( - iteratee: TWhere - ): LoDashExplicitArrayWrapper; + uniqWith( + this: LoDashExplicitWrapper | null | undefined>, + comparator?: Comparator + ): LoDashExplicitWrapper; } //_.sortedUniq @@ -5015,72 +3125,20 @@ declare namespace _ { sortedUniq( array: List | null | undefined ): T[]; - - /** - * @see _.sortedUniq - */ - sortedUniq( - array: List | null | undefined - ): T[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.sortedUniq */ - sortedUniq(): LoDashImplicitArrayWrapper; + sortedUniq(this: LoDashImplicitWrapper | null | undefined>): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.sortedUniq */ - sortedUniq(): LoDashImplicitArrayWrapper; - - /** - * @see _.sortedUniq - */ - sortedUniq(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - sortedUniq(): LoDashImplicitArrayWrapper; - - /** - * @see _.sortedUniq - */ - sortedUniq(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.sortedUniq - */ - sortedUniq(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sortedUniq - */ - sortedUniq(): LoDashExplicitArrayWrapper; - - /** - * @see _.sortedUniq - */ - sortedUniq(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.sortedUniq - */ - sortedUniq(): LoDashExplicitArrayWrapper; - - /** - * @see _.sortedUniq - */ - sortedUniq(): LoDashExplicitArrayWrapper; + sortedUniq(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } //_.sortedUniqBy @@ -5100,259 +3158,54 @@ declare namespace _ { * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); * // => [1.1, 2.2] */ - sortedUniqBy( - array: TString, + sortedUniqBy( + array: string | null | undefined, iteratee: StringIterator - ): TString[]; + ): string[]; /** * @see _.sortedUniqBy */ sortedUniqBy( array: List | null | undefined, - iteratee: ListIterator - ): T[]; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - array: List | null | undefined, - iteratee: ListIterator - ): T[]; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - array: List | null | undefined, - iteratee: string - ): T[]; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - array: List | null | undefined, - iteratee: Object - ): T[]; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - array: List | null | undefined, - iteratee: TWhere + iteratee: ListIteratee ): T[]; } - interface LoDashImplicitStringWrapper { + interface LoDashImplicitWrapper { /** * @see _.sortedUniqBy */ sortedUniqBy( + this: LoDashImplicitWrapper, iteratee: StringIterator - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee: ListIteratee + ): LoDashImplicitWrapper; } - interface LoDashExplicitStringWrapper { + interface LoDashExplicitWrapper { /** * @see _.sortedUniqBy */ sortedUniqBy( + this: LoDashExplicitWrapper, iteratee: StringIterator - ): LoDashExplicitArrayWrapper; - } - - interface LoDashImplicitWrapper { - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: ListIterator - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: ListIterator - ): LoDashImplicitArrayWrapper; + ): LoDashExplicitWrapper; /** * @see _.sortedUniqBy */ sortedUniqBy( - iteratee: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: TWhere - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: ListIterator - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: TWhere - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: Object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortedUniqBy - */ - sortedUniqBy( - iteratee: TWhere - ): LoDashExplicitArrayWrapper; - } - - //_.unionWith DUMMY - interface LoDashStatic { - /** - * 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). - * - * @static - * @memberOf _ - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} 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( - array: List, - ...values: any[] - ): any[]; - } - - //_.uniqWith DUMMY - interface LoDashStatic { - /** - * 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). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} 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( - array: List, - ...values: any[] - ): any[]; + this: LoDashExplicitWrapper | null | undefined>, + iteratee: ListIteratee + ): LoDashExplicitWrapper; } //_.unzip @@ -5364,35 +3217,21 @@ declare namespace _ { * @param array The array of grouped elements to process. * @return Returns the new array of regrouped elements. */ - unzip(array: List> | null | undefined): T[][]; + unzip(array: T[][] | List> | null | undefined): T[][]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.unzip */ - unzip(): LoDashImplicitArrayWrapper; + unzip(this: LoDashImplicitWrapper> | null | undefined>): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.unzip */ - unzip(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.unzip - */ - unzip(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.unzip - */ - unzip(): LoDashExplicitArrayWrapper; + unzip(this: LoDashExplicitWrapper> | null | undefined>): LoDashExplicitWrapper; } //_.unzipWith @@ -5407,28 +3246,51 @@ declare namespace _ { * @param thisArg The this binding of iteratee. * @return Returns the new array of regrouped elements. */ - unzipWith( - array: List> | null | undefined, - iteratee?: MemoIterator + unzipWith( + array: List> | null | undefined, + iteratee: (...values: T[]) => TResult ): TResult[]; - } - interface LoDashImplicitArrayWrapperBase { /** * @see _.unzipWith */ - unzipWith( - iteratee?: MemoIterator - ): LoDashImplicitArrayWrapper; + unzipWith( + array: List> | null | undefined + ): T[][]; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.unzipWith */ - unzipWith( - iteratee?: MemoIterator - ): LoDashImplicitArrayWrapper; + unzipWith( + this: LoDashImplicitWrapper> | null | undefined>, + iteratee: (...values: T[]) => TResult + ): LoDashImplicitWrapper; + + /** + * @see _.unzipWith + */ + unzipWith( + this: LoDashImplicitWrapper> | null | undefined> + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + this: LoDashExplicitWrapper> | null | undefined>, + iteratee: (...values: T[]) => TResult + ): LoDashExplicitWrapper; + + /** + * @see _.unzipWith + */ + unzipWith( + this: LoDashExplicitWrapper> | null | undefined> + ): LoDashExplicitWrapper; } //_.without @@ -5446,32 +3308,24 @@ declare namespace _ { ): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.without */ - without(...values: T[]): LoDashImplicitArrayWrapper; + without( + this: LoDashImplicitWrapper | null | undefined>, + ...values: T[] + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.without */ - without(...values: T[]): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.without - */ - without(...values: T[]): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.without - */ - without(...values: T[]): LoDashExplicitArrayWrapper; + without( + this: LoDashExplicitWrapper | null | undefined>, + ...values: T[] + ): LoDashExplicitWrapper; } //_.xor @@ -5485,35 +3339,27 @@ declare namespace _ { xor(...arrays: Array | null | undefined>): T[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.xor */ - xor(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; + xor( + this: LoDashImplicitWrapper | null | undefined>, + ...arrays: Array | null | undefined> + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.xor */ - xor(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; + xor( + this: LoDashExplicitWrapper | null | undefined>, + ...arrays: Array | null | undefined> + ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.xor - */ - xor(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.xor - */ - xor(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; - } - - //_.xorBy DUMMY + //_.xorBy interface LoDashStatic { /** * This method is like `_.xor` except that it accepts `iteratee` which is @@ -5535,13 +3381,90 @@ declare namespace _ { * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ - xorBy( - array: List, - ...values: any[] - ): any[]; + xorBy( + arrays?: List | null | undefined, + iteratee?: ValueIteratee + ): T[]; + + /** + * @see _.xorBy + */ + xorBy( + arrays: List | null | undefined, + arrays2: List | null | undefined, + iteratee?: ValueIteratee + ): T[]; + + /** + * @see _.xorBy + */ + xorBy( + arrays: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + ...iteratee: Array | List | null | undefined> + ): T[]; } - //_.xorWith DUMMY + interface LoDashImplicitWrapper { + /** + * @see _.xor + */ + xorBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; + + /** + * @see _.xorBy + */ + xorBy( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + iteratee?: ValueIteratee + ): LoDashImplicitWrapper; + + /** + * @see _.xorBy + */ + xorBy( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + ...iteratee: Array | List | null | undefined> + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.xorBy + */ + xorBy( + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; + + /** + * @see _.xorBy + */ + xorBy( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + iteratee?: ValueIteratee + ): LoDashExplicitWrapper; + + /** + * @see _.xorBy + */ + xorBy( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + ...iteratee: Array | List | null | undefined> + ): LoDashExplicitWrapper; + } + + //_.xorWith interface LoDashStatic { /** * This method is like `_.xor` except that it accepts `comparator` which is @@ -5562,10 +3485,87 @@ declare namespace _ { * _.xorWith(objects, others, _.isEqual); * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ - xorWith( - array: List, - ...values: any[] - ): any[]; + xorWith( + arrays?: List | null | undefined, + comparator?: Comparator + ): T[]; + + /** + * @see _.xorWith + */ + xorWith( + arrays: List | null | undefined, + arrays2: List | null | undefined, + comparator?: Comparator + ): T[]; + + /** + * @see _.xorWith + */ + xorWith( + arrays: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + ...comparator: Array | List | null | undefined> + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.xorWith + */ + xorWith( + this: LoDashImplicitWrapper | null | undefined>, + comparator?: Comparator + ): LoDashImplicitWrapper; + + /** + * @see _.xorWith + */ + xorWith( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + comparator?: Comparator + ): LoDashImplicitWrapper; + + /** + * @see _.xorWith + */ + xorWith( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + ...comparator: Array | List | null | undefined> + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.xorWith + */ + xorWith( + this: LoDashExplicitWrapper | null | undefined>, + comparator?: Comparator + ): LoDashExplicitWrapper; + + /** + * @see _.xorWith + */ + xorWith( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + comparator?: Comparator + ): LoDashExplicitWrapper; + + /** + * @see _.xorWith + */ + xorWith( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + ...comparator: Array | List | null | undefined> + ): LoDashExplicitWrapper; } //_.zip @@ -5580,32 +3580,24 @@ declare namespace _ { zip(...arrays: Array | null | undefined>): T[][]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.zip */ - zip(...arrays: Array | null | undefined>): _.LoDashImplicitArrayWrapper; + zip( + this: LoDashImplicitWrapper | null | undefined>, + ...arrays: Array | null | undefined> + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.zip */ - zip(...arrays: Array | null | undefined>): _.LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.zip - */ - zip(...arrays: Array | null | undefined>): _.LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.zip - */ - zip(...arrays: Array | null | undefined>): _.LoDashExplicitArrayWrapper; + zip( + this: LoDashExplicitWrapper | null | undefined>, + ...arrays: Array | null | undefined> + ): LoDashExplicitWrapper; } //_.zipObject @@ -5618,10 +3610,24 @@ declare namespace _ { * @param values The property values. * @return Returns the new object. */ - zipObject( - props: List|List>, - values?: List + zipObject( + props: List, + values: List ): TResult; + + /** + * @see _.zipObject + */ + zipObject( + props: List|List>, + values?: List + ): any; + + /** + * @see _.zipObject + */ + zipObject(): {}; + /** * This method is like _.zipObject except that it supports property paths. * @@ -5629,204 +3635,83 @@ declare namespace _ { * @param values The property values. * @return Returns the new object. */ - zipObjectDeep( - props: List|List>, - values?: List - ): TResult; - - /** - * @see _.zipObject - */ - zipObject( - props: List|List>, - values?: List - ): TResult; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - props: List|List>, - values?: List - ): TResult; - - /** - * @see _.zipObject - */ - zipObject( - props: List|List>, - values?: List - ): _.Dictionary; - /** - * @see _.zipObjectDeep - */ zipObjectDeep( props: List|List>, values?: List - ): _.Dictionary; + ): any; + + /** + * @see _.zipObjectDeep + */ + zipObjectDeep(): {}; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitWrapper { /** * @see _.zipObject */ - zipObject( - values?: List - ): _.LoDashImplicitObjectWrapper; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - zipObject( - values?: List - ): _.LoDashImplicitObjectWrapper; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - values?: List - ): _.LoDashImplicitObjectWrapper; + zipObject( + this: LoDashImplicitWrapper>, + values: List + ): LoDashImplicitWrapper; /** * @see _.zipObject */ zipObject( + this: LoDashImplicitWrapper|List>>, values?: List - ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + ): LoDashImplicitWrapper; + /** * @see _.zipObjectDeep */ zipObjectDeep( + this: LoDashImplicitWrapper|List>>, values?: List - ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + ): LoDashImplicitWrapper; + + /** + * @see _.zipObjectDeep + */ + zipObjectDeep( + this: LoDashImplicitWrapper|List>>, + values?: List + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.zipObject */ - zipObject( - values?: List - ): _.LoDashImplicitObjectWrapper; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - zipObject( - values?: List - ): _.LoDashImplicitObjectWrapper; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - values?: List - ): _.LoDashImplicitObjectWrapper; + zipObject( + this: LoDashExplicitWrapper>, + values: List + ): LoDashExplicitWrapper; /** * @see _.zipObject */ zipObject( + this: LoDashExplicitWrapper|List>>, values?: List - ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + ): LoDashExplicitWrapper; + /** * @see _.zipObjectDeep */ zipObjectDeep( + this: LoDashExplicitWrapper|List>>, values?: List - ): _.LoDashImplicitObjectWrapper<_.Dictionary>; - } + ): LoDashExplicitWrapper; - interface LoDashExplicitArrayWrapper { - /** - * @see _.zipObject - */ - zipObject( - values?: List - ): _.LoDashExplicitObjectWrapper; /** * @see _.zipObjectDeep */ - zipObjectDeep( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - zipObject( + zipObjectDeep( + this: LoDashExplicitWrapper|List>>, values?: List - ): _.LoDashExplicitObjectWrapper; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - zipObject( - values?: List - ): _.LoDashExplicitObjectWrapper<_.Dictionary>; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - values?: List - ): _.LoDashExplicitObjectWrapper<_.Dictionary>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.zipObject - */ - zipObject( - values?: List - ): _.LoDashExplicitObjectWrapper; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - zipObject( - values?: List - ): _.LoDashExplicitObjectWrapper; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - zipObject( - values?: List - ): _.LoDashExplicitObjectWrapper<_.Dictionary>; - /** - * @see _.zipObjectDeep - */ - zipObjectDeep( - values?: List - ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + ): LoDashExplicitWrapper; } //_.zipWith @@ -5840,14 +3725,179 @@ declare namespace _ { * @param {*} [thisArg] The `this` binding of `iteratee`. * @return Returns the new array of grouped elements. */ - zipWith(...args: any[]): TResult[]; - } + zipWith( + ...arrays: Array | null | undefined> + ): T[][]; - interface LoDashImplicitArrayWrapper { /** * @see _.zipWith */ - zipWith(...args: any[]): LoDashImplicitArrayWrapper; + zipWith( + arrays: List | null | undefined, + iteratee: (value1: T) => TResult + ): TResult[]; + + /** + * @see _.zipWith + */ + zipWith( + arrays: List | null | undefined, + arrays2: List | null | undefined, + iteratee: (value1: T, value2: T) => TResult + ): TResult[]; + + /** + * @see _.zipWith + */ + zipWith( + arrays: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + iteratee: (value1: T, value2: T, value3: T) => TResult + ): TResult[]; + + /** + * @see _.zipWith + */ + zipWith( + arrays: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + iteratee: (value1: T, value2: T, value3: T, value4: T) => TResult + ): TResult[]; + + /** + * @see _.zipWith + */ + zipWith( + arrays: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, + ...iteratee: Array<((...group: T[]) => TResult) | List | null | undefined> + ): TResult[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.zipWith + */ + zipWith( + this: LoDashImplicitWrapper | null | undefined>, + ...arrays: Array | null | undefined> + ): LoDashImplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashImplicitWrapper | null | undefined>, + iteratee: (value1: T) => TResult + ): LoDashImplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + iteratee: (value1: T, value2: T) => TResult + ): LoDashImplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + iteratee: (value1: T, value2: T, value3: T) => TResult + ): LoDashImplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + iteratee: (value1: T, value2: T, value3: T, value4: T) => TResult + ): LoDashImplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashImplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, + ...iteratee: Array<((...group: T[]) => TResult) | List | null | undefined> + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.zipWith + */ + zipWith( + this: LoDashExplicitWrapper | null | undefined>, + ...arrays: Array | null | undefined> + ): LoDashExplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashExplicitWrapper | null | undefined>, + iteratee: (value1: T) => TResult + ): LoDashExplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + iteratee: (value1: T, value2: T) => TResult + ): LoDashExplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + iteratee: (value1: T, value2: T, value3: T) => TResult + ): LoDashExplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + iteratee: (value1: T, value2: T, value3: T, value4: T) => TResult + ): LoDashExplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashExplicitWrapper | null | undefined>, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, + ...iteratee: Array<((...group: T[]) => TResult) | List | null | undefined> + ): LoDashExplicitWrapper; } /********* @@ -5862,66 +3912,21 @@ declare namespace _ { * @param value The value to wrap. * @return Returns the new lodash wrapper instance. */ - chain(value: number): LoDashExplicitWrapper; - chain(value: string): LoDashExplicitWrapper; - chain(value: boolean): LoDashExplicitWrapper; - chain(value: null | undefined): LoDashExplicitWrapper; - chain(value: T[]): LoDashExplicitArrayWrapper; - chain(value: ReadonlyArray): LoDashExplicitArrayWrapper; - chain(value: T[] | null | undefined): LoDashExplicitNillableArrayWrapper; - chain(value: ReadonlyArray | null | undefined): LoDashExplicitNillableArrayWrapper; - chain(value: T): LoDashExplicitObjectWrapper; - chain(value: T | null | undefined): LoDashExplicitObjectWrapper; - chain(value: any): LoDashExplicitWrapper; + chain(value: T): LoDashExplicitWrapper; } - interface LoDashImplicitStringWrapper { + interface LoDashImplicitWrapper { /** * @see _.chain */ - chain(): LoDashExplicitStringWrapper; + chain(): LoDashExplicitWrapper; } - interface LoDashImplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.chain */ - chain(): LoDashExplicitWrapper; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.chain - */ - chain(): LoDashExplicitArrayWrapper; - } - - interface LoDashImplicitNillableArrayWrapper { - /** - * @see _.chain - */ - chain(): LoDashExplicitNillableArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.chain - */ - chain(): LoDashExplicitObjectWrapper; - } - - interface LoDashImplicitNillableObjectWrapper { - /** - * @see _.chain - */ - chain(): LoDashExplicitNillableObjectWrapper; - } - - interface LoDashExplicitWrapperBase { - /** - * @see _.chain - */ - chain(): TWrapper; + chain(): this; } //_.tap @@ -5942,22 +3947,13 @@ declare namespace _ { ): T; } - interface LoDashImplicitWrapperBase { + interface LoDashWrapper { /** * @see _.tap */ tap( - interceptor: (value: T) => void - ): TWrapper; - } - - interface LoDashExplicitWrapperBase { - /** - * @see _.tap - */ - tap( - interceptor: (value: T) => void - ): TWrapper; + interceptor: (value: TValue) => void + ): this; } //_.thru @@ -5976,237 +3972,57 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.thru */ - thru( - interceptor: (value: T) => TResult): LoDashImplicitWrapper; - - /** - * @see _.thru - */ - thru( - interceptor: (value: T) => TResult): LoDashImplicitWrapper; - - /** - * @see _.thru - */ - thru( - interceptor: (value: T) => TResult): LoDashImplicitWrapper; - - /** - * @see _.thru - */ - thru( - interceptor: (value: T) => TResult): LoDashImplicitObjectWrapper; - - /** - * @see _.thru - */ - thru( - interceptor: (value: T) => TResult[]): LoDashImplicitArrayWrapper; + thru(interceptor: (value: TValue) => TResult): LoDashImplicitWrapper; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.thru */ - thru( - interceptor: (value: T) => TResult - ): LoDashExplicitWrapper; - - /** - * @see _.thru - */ - thru( - interceptor: (value: T) => TResult - ): LoDashExplicitWrapper; - - /** - * @see _.thru - */ - thru( - interceptor: (value: T) => TResult - ): LoDashExplicitWrapper; - - /** - * @see _.thru - */ - thru( - interceptor: (value: T) => TResult - ): LoDashExplicitObjectWrapper; - - /** - * @see _.thru - */ - thru( - interceptor: (value: T) => TResult[] - ): LoDashExplicitArrayWrapper; + thru(interceptor: (value: TValue) => TResult): LoDashExplicitWrapper; } //_.prototype.commit - interface LoDashImplicitWrapperBase { + interface LoDashWrapper { /** * Executes the chained sequence and returns the wrapped result. * * @return Returns the new lodash wrapper instance. */ - commit(): TWrapper; - } - - interface LoDashExplicitWrapperBase { - /** - * @see _.commit - */ - commit(): TWrapper; - } - - //_.prototype.concat - interface LoDashImplicitWrapperBase { - /** - * Creates a new array joining a wrapped array with any additional arrays and/or values. - * - * @param items - * @return Returns the new concatenated array. - */ - concat(...items: Array>): LoDashImplicitArrayWrapper; - - /** - * @see _.concat - */ - concat(...items: Array>): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapperBase { - /** - * @see _.concat - */ - concat(...items: Array>): LoDashExplicitArrayWrapper; - - /** - * @see _.concat - */ - concat(...items: Array>): LoDashExplicitArrayWrapper; + commit(): this; } //_.prototype.plant - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * Creates a clone of the chained sequence planting value as the wrapped value. * @param value The value to plant as the wrapped value. * @return Returns the new lodash wrapper instance. */ - plant(value: number): LoDashImplicitWrapper; - - /** - * @see _.plant - */ - plant(value: string): LoDashImplicitStringWrapper; - - /** - * @see _.plant - */ - plant(value: boolean): LoDashImplicitWrapper; - - /** - * @see _.plant - */ - plant(value: number[]): LoDashImplicitNumberArrayWrapper; - - /** - * @see _.plant - */ - plant(value: T[]): LoDashImplicitArrayWrapper; - - /** - * @see _.plant - */ - plant(value: ReadonlyArray): LoDashImplicitArrayWrapper; - - /** - * @see _.plant - */ - plant(value: T): LoDashImplicitObjectWrapper; - - /** - * @see _.plant - */ - plant(value: any): LoDashImplicitWrapper; + plant(value: T): LoDashImplicitWrapper; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.plant */ - plant(value: number): LoDashExplicitWrapper; - - /** - * @see _.plant - */ - plant(value: string): LoDashExplicitStringWrapper; - - /** - * @see _.plant - */ - plant(value: boolean): LoDashExplicitWrapper; - - /** - * @see _.plant - */ - plant(value: number[]): LoDashExplicitNumberArrayWrapper; - - /** - * @see _.plant - */ - plant(value: T[]): LoDashExplicitArrayWrapper; - - /** - * @see _.plant - */ - plant(value: ReadonlyArray): LoDashExplicitArrayWrapper; - - /** - * @see _.plant - */ - plant(value: T): LoDashExplicitObjectWrapper; - - /** - * @see _.plant - */ - plant(value: any): LoDashExplicitWrapper; - } - - //_.prototype.reverse - interface LoDashImplicitArrayWrapper { - /** - * Reverses the wrapped array so the first element becomes the last, the second element becomes the second to - * last, and so on. - * - * Note: This method mutates the wrapped array. - * - * @return Returns the new reversed lodash wrapper instance. - */ - reverse(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.reverse - */ - reverse(): LoDashExplicitArrayWrapper; + plant(value: T): LoDashExplicitWrapper; } //_.prototype.toJSON - interface LoDashWrapperBase { + interface LoDashWrapper { /** * @see _.value */ - toJSON(): T; + toJSON(): TValue; } //_.prototype.toString - interface LoDashWrapperBase { + interface LoDashWrapper { /** * Produces the result of coercing the unwrapped value to a string. * @@ -6216,7 +4032,7 @@ declare namespace _ { } //_.prototype.value - interface LoDashWrapperBase { + interface LoDashWrapper { /** * Executes the chained sequence to extract the unwrapped value. * @@ -6224,15 +4040,15 @@ declare namespace _ { * * @return Returns the resolved unwrapped value. */ - value(): T; + value(): TValue; } //_.valueOf - interface LoDashWrapperBase { + interface LoDashWrapper { /** * @see _.value */ - valueOf(): T; + valueOf(): TValue; } /************** @@ -6245,42 +4061,58 @@ declare namespace _ { * 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 collection The collection to iterate over. + * @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( - collection: List|Dictionary | null | undefined, + object: List | Dictionary | null | undefined, ...props: Array> ): T[]; - } - interface LoDashImplicitArrayWrapperBase { /** * @see _.at */ - at(...props: Array>): LoDashImplicitArrayWrapper; + at( + object: T | null | undefined, + ...props: Array> + ): Array; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.at */ - at(...props: Array>): LoDashImplicitArrayWrapper; - } + at( + this: LoDashImplicitWrapper | Dictionary | null | undefined>, + ...props: Array> + ): LoDashImplicitWrapper; - interface LoDashExplicitArrayWrapperBase { /** * @see _.at */ - at(...props: Array>): LoDashExplicitArrayWrapper; + at( + this: LoDashImplicitWrapper, + ...props: Array> + ): LoDashImplicitWrapper>; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.at */ - at(...props: Array>): LoDashExplicitArrayWrapper; + at( + this: LoDashExplicitWrapper | Dictionary | null | undefined>, + ...props: Array> + ): LoDashExplicitWrapper; + + /** + * @see _.at + */ + at( + this: LoDashExplicitWrapper, + ...props: Array> + ): LoDashExplicitWrapper>; } //_.countBy @@ -6307,15 +4139,7 @@ declare namespace _ { */ countBy( collection: List | null | undefined, - iteratee?: ListIterator - ): Dictionary; - - /** - * @see _.countBy - */ - countBy( - collection: Dictionary | null | undefined, - iteratee?: DictionaryIterator + iteratee?: ListIteratee ): Dictionary; /** @@ -6323,260 +4147,146 @@ declare namespace _ { */ countBy( collection: NumericDictionary | null | undefined, - iteratee?: NumericDictionaryIterator + iteratee?: NumericDictionaryIteratee ): Dictionary; /** * @see _.countBy */ - countBy( - collection: List|Dictionary|NumericDictionary | null | undefined, - iteratee?: string - ): Dictionary; - - /** - * @see _.countBy - */ - countBy( - collection: List|Dictionary|NumericDictionary | null | undefined, - iteratee?: W - ): Dictionary; - - /** - * @see _.countBy - */ - countBy( - collection: List|Dictionary|NumericDictionary | null | undefined, - iteratee?: Object + countBy( + collection: T | null | undefined, + iteratee?: ObjectIteratee ): Dictionary; } - interface LoDashImplicitWrapper { - /** - * @see _.countBy - */ - countBy( - iteratee?: ListIterator - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.countBy - */ - countBy( - iteratee?: ListIterator - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.countBy - */ - countBy( - iteratee?: string - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.countBy - */ - countBy( - iteratee?: W - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.countBy */ countBy( - iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator - ): LoDashImplicitObjectWrapper>; + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashImplicitWrapper>; /** * @see _.countBy */ - countBy( - iteratee?: string - ): LoDashImplicitObjectWrapper>; + countBy( + this: LoDashImplicitWrapper, + iteratee?: ObjectIteratee + ): LoDashImplicitWrapper>; - /** - * @see _.countBy - */ - countBy( - iteratee?: W - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashExplicitWrapper { - /** - * @see _.countBy - */ - countBy( - iteratee?: ListIterator - ): LoDashExplicitObjectWrapper>; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.countBy - */ - countBy( - iteratee?: ListIterator - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.countBy - */ - countBy( - iteratee?: string - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.countBy - */ - countBy( - iteratee?: W - ): LoDashExplicitObjectWrapper>; - } - - interface LoDashExplicitObjectWrapperBase { /** * @see _.countBy */ countBy( - iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator - ): LoDashExplicitObjectWrapper>; + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: NumericDictionaryIteratee + ): LoDashImplicitWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.countBy + */ + countBy( + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashExplicitWrapper>; /** * @see _.countBy */ - countBy( - iteratee?: string - ): LoDashExplicitObjectWrapper>; + countBy( + this: LoDashExplicitWrapper, + iteratee?: ObjectIteratee + ): LoDashExplicitWrapper>; /** * @see _.countBy */ - countBy( - iteratee?: W - ): LoDashExplicitObjectWrapper>; + countBy( + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: NumericDictionaryIteratee + ): LoDashExplicitWrapper>; } //_.each interface LoDashStatic { - each: typeof _.forEach; + each: typeof _.forEach; // tslint:disable-line:no-unnecessary-qualifier } - interface LoDashImplicitWrapper { + interface LoDashWrapper { + /** + * @see _.forEach + */ + each( + this: LoDashWrapper, + iteratee?: ArrayIterator + ): this; + /** * @see _.forEach */ each( - iteratee: StringIterator - ): LoDashImplicitWrapper; - } + this: LoDashWrapper, + iteratee?: StringIterator + ): this; - interface LoDashImplicitArrayWrapperBase { /** * @see _.forEach */ - each( - iteratee: ListIterator - ): TWrapper; - } + each( + this: LoDashWrapper | null | undefined>, + iteratee?: ListIterator + ): this; - interface LoDashImplicitObjectWrapperBase { /** * @see _.forEach */ - each( - iteratee?: ListIterator|DictionaryIterator - ): TWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.forEach - */ - each( - iteratee: StringIterator - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.forEach - */ - each( - iteratee: ListIterator - ): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.forEach - */ - each( - iteratee?: ListIterator|DictionaryIterator - ): TWrapper; + each( + this: LoDashWrapper, + iteratee?: ObjectIterator + ): this; } //_.eachRight interface LoDashStatic { - eachRight: typeof _.forEachRight; + eachRight: typeof _.forEachRight; // tslint:disable-line:no-unnecessary-qualifier } - interface LoDashImplicitWrapper { + interface LoDashWrapper { + /** + * @see _.forEachRight + */ + eachRight( + this: LoDashWrapper, + iteratee?: ArrayIterator + ): this; + /** * @see _.forEachRight */ eachRight( - iteratee: StringIterator - ): LoDashImplicitWrapper; - } + this: LoDashWrapper, + iteratee?: StringIterator + ): this; - interface LoDashImplicitArrayWrapperBase { /** * @see _.forEachRight */ - eachRight( - iteratee: ListIterator - ): TWrapper; - } + eachRight( + this: LoDashWrapper | null | undefined>, + iteratee?: ListIterator + ): this; - interface LoDashImplicitObjectWrapperBase { /** * @see _.forEachRight */ - eachRight( - iteratee?: ListIterator|DictionaryIterator - ): TWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.forEachRight - */ - eachRight( - iteratee: StringIterator - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.forEachRight - */ - eachRight( - iteratee: ListIterator - ): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.forEachRight - */ - eachRight( - iteratee?: ListIterator|DictionaryIterator - ): TWrapper; + eachRight( + this: LoDashWrapper, + iteratee?: ObjectIterator + ): this; } //_.every @@ -6591,15 +4301,7 @@ declare namespace _ { */ every( collection: List | null | undefined, - predicate?: ListIterator - ): boolean; - - /** - * @see _.every - */ - every( - collection: Dictionary | null | undefined, - predicate?: DictionaryIterator + predicate?: ListIteratee ): boolean; /** @@ -6607,107 +4309,67 @@ declare namespace _ { */ every( collection: NumericDictionary | null | undefined, - predicate?: NumericDictionaryIterator + predicate?: NumericDictionaryIteratee + ): boolean; + + /** + * @see _.every + */ + every( + collection: T | null | undefined, + predicate?: ObjectIteratee + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.every + */ + every( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): boolean; + + /** + * @see _.every + */ + every( + this: LoDashImplicitWrapper, + predicate?: ObjectIteratee ): boolean; /** * @see _.every */ every( - collection: List|Dictionary|NumericDictionary | null | undefined, - predicate?: string|any[]|PartialObject + this: LoDashImplicitWrapper | null | undefined>, + predicate?: NumericDictionaryIteratee ): boolean; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.every */ - every( - predicate?: ListIterator|NumericDictionaryIterator - ): boolean; - - /** - * @see _.every - */ - every( - predicate?: string|any[] - ): boolean; - - /** - * @see _.every - */ - every( - predicate?: PartialObject - ): boolean; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.every - */ - every( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator - ): boolean; - - /** - * @see _.every - */ - every( - predicate?: string|any[] - ): boolean; - - /** - * @see _.every - */ - every( - predicate?: PartialObject - ): boolean; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.every - */ - every( - predicate?: ListIterator|NumericDictionaryIterator + every( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee ): LoDashExplicitWrapper; /** * @see _.every */ - every( - predicate?: string|any[] + every( + this: LoDashExplicitWrapper, + predicate?: ObjectIteratee ): LoDashExplicitWrapper; /** * @see _.every */ - every( - predicate?: PartialObject - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.every - */ - every( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - every( - predicate?: string|any[] - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - every( - predicate?: PartialObject + every( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: NumericDictionaryIteratee ): LoDashExplicitWrapper; } @@ -6731,132 +4393,126 @@ declare namespace _ { * @param thisArg The this binding of predicate. * @return Returns the new filtered array. */ - filter( - collection: List | null | undefined, - predicate: ListIteratorTypeGuard - ): S[]; - - /** - * @see _.filter - */ - filter( - collection: List | null | undefined, - predicate?: ListIterator - ): T[]; - - /** - * @see _.filter - */ - filter( - collection: Dictionary | null | undefined, - predicate: DictionaryIteratorTypeGuard - ): S[]; - - /** - * @see _.filter - */ - filter( - collection: Dictionary | null | undefined, - predicate?: DictionaryIterator - ): T[]; - - /** - * @see _.filter - */ filter( collection: string | null | undefined, - predicate?: StringIterator + predicate?: StringIterator ): string[]; + /** + * @see _.filter + */ + filter( + collection: List | null | undefined, + predicate: ListIteratorTypeGuard + ): S[]; + /** * @see _.filter */ filter( - collection: List|Dictionary | null | undefined, - predicate: string | [string, any] | RegExp | PartialObject + collection: List | null | undefined, + predicate?: ListIteratee ): T[]; + + /** + * @see _.filter + */ + filter( + collection: T | null | undefined, + predicate: ObjectIteratorTypeGuard + ): S[]; + + /** + * @see _.filter + */ + filter( + collection: T | null | undefined, + predicate?: ObjectIteratee + ): Array; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.filter */ filter( - predicate?: StringIterator - ): LoDashImplicitArrayWrapper; - } + this: LoDashImplicitWrapper, + predicate?: StringIterator + ): LoDashImplicitWrapper; - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.filter - */ - filter( - predicate: ListIteratorTypeGuard - ): LoDashImplicitArrayWrapper; - - /** - * @see _.filter - */ - filter( - predicate: ListIterator | string | [string, any] | RegExp | PartialObject - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { /** * @see _.filter */ filter( + this: LoDashImplicitWrapper | null | undefined>, predicate: ListIteratorTypeGuard - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; /** * @see _.filter */ filter( - predicate: ListIterator | DictionaryIterator | string | [string, any] | RegExp | PartialObject - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashImplicitWrapper; + + /** + * @see _.filter + */ + filter( + this: LoDashImplicitWrapper, + predicate: ObjectIteratorTypeGuard + ): LoDashImplicitWrapper; + + /** + * @see _.filter + */ + filter( + this: LoDashImplicitWrapper, + predicate?: ObjectIteratee + ): LoDashImplicitWrapper>; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.filter */ filter( - predicate?: StringIterator - ): LoDashExplicitArrayWrapper; - } + this: LoDashExplicitWrapper, + predicate?: StringIterator + ): LoDashExplicitWrapper; - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.filter - */ - filter( - predicate: ListIteratorTypeGuard - ): LoDashExplicitArrayWrapper; - - /** - * @see _.filter - */ - filter( - predicate: ListIterator | string | [string, any] | RegExp | PartialObject - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { /** * @see _.filter */ filter( + this: LoDashExplicitWrapper | null | undefined>, predicate: ListIteratorTypeGuard - ): LoDashExplicitArrayWrapper; + ): LoDashExplicitWrapper; /** * @see _.filter */ filter( - predicate: ListIterator | DictionaryIterator | string | [string, any] | RegExp | PartialObject - ): LoDashExplicitArrayWrapper; + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashExplicitWrapper; + + /** + * @see _.filter + */ + filter( + this: LoDashExplicitWrapper, + predicate: ObjectIteratorTypeGuard + ): LoDashExplicitWrapper; + + /** + * @see _.filter + */ + filter( + this: LoDashExplicitWrapper, + predicate?: ObjectIteratee + ): LoDashExplicitWrapper>; } //_.find @@ -6890,43 +4546,35 @@ declare namespace _ { */ find( collection: List | null | undefined, - predicate?: ListIterator, + predicate?: ListIteratee, fromIndex?: number ): T|undefined; /** * @see _.find */ - find( - collection: Dictionary | null | undefined, - predicate: DictionaryIteratorTypeGuard, + find( + collection: T | null | undefined, + predicate: ObjectIteratorTypeGuard, fromIndex?: number ): S|undefined; /** * @see _.find */ - find( - collection: Dictionary | null | undefined, - predicate?: DictionaryIterator, + find( + collection: T | null | undefined, + predicate?: ObjectIteratee, fromIndex?: number - ): T|undefined; - - /** - * @see _.find - */ - find( - collection: List|Dictionary | null | undefined, - predicate?: string | PartialObject | [string, any], - fromIndex?: number - ): T|undefined; + ): T[keyof T]|undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.find */ - find( + find( + this: LoDashImplicitWrapper | null | undefined>, predicate: ListIteratorTypeGuard, fromIndex?: number ): S|undefined; @@ -6934,30 +4582,67 @@ declare namespace _ { /** * @see _.find */ - find( - predicate?: ListIterator | string | PartialObject | [string, any], + find( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee, fromIndex?: number ): T|undefined; - } - interface LoDashImplicitObjectWrapperBase { /** * @see _.find */ - find( - predicate?: ListIterator | DictionaryIterator | string | PartialObject | [string, any], + find( + this: LoDashImplicitWrapper, + predicate: ObjectIteratorTypeGuard, fromIndex?: number - ): TResult|undefined; - } + ): S|undefined; - interface LoDashExplicitWrapperBase { /** * @see _.find */ - find( - predicate?: ListIterator | string | PartialObject | [string, any], + find( + this: LoDashImplicitWrapper, + predicate?: ObjectIteratee, fromIndex?: number - ): any; + ): T[keyof T]|undefined; + } + + interface LoDashExplicitWrapper { + /** + * @see _.find + */ + find( + this: LoDashExplicitWrapper | null | undefined>, + predicate: ListIteratorTypeGuard, + fromIndex?: number + ): LoDashExplicitWrapper; + + /** + * @see _.find + */ + find( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee, + fromIndex?: number + ): LoDashExplicitWrapper; + + /** + * @see _.find + */ + find( + this: LoDashExplicitWrapper, + predicate: ObjectIteratorTypeGuard, + fromIndex?: number + ): LoDashExplicitWrapper; + + /** + * @see _.find + */ + find( + this: LoDashExplicitWrapper, + predicate?: ObjectIteratee, + fromIndex?: number + ): LoDashExplicitWrapper; } //_.findLast @@ -6981,74 +4666,103 @@ declare namespace _ { */ findLast( collection: List | null | undefined, - predicate?: ListIterator, + predicate?: ListIteratee, fromIndex?: number ): T|undefined; + /** + * @see _.findLast + */ + findLast( + collection: T | null | undefined, + predicate: ObjectIteratorTypeGuard, + fromIndex?: number + ): S|undefined; + + /** + * @see _.findLast + */ + findLast( + collection: T | null | undefined, + predicate?: ObjectIteratee, + fromIndex?: number + ): T[keyof T]|undefined; + } + + interface LoDashImplicitWrapper { /** * @see _.findLast */ findLast( - collection: Dictionary | null | undefined, - predicate: DictionaryIteratorTypeGuard, - fromIndex?: number - ): S|undefined; - - /** - * @see _.findLast - */ - findLast( - collection: Dictionary | null | undefined, - predicate?: DictionaryIterator, - fromIndex?: number - ): T|undefined; - - /** - * @see _.findLast - */ - findLast( - collection: List|Dictionary | null | undefined, - predicate?: string | PartialObject | [string, any], - fromIndex?: number - ): T|undefined; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.findLast - */ - findLast( + this: LoDashImplicitWrapper | null | undefined>, predicate: ListIteratorTypeGuard, fromIndex?: number + ): S | undefined; + + /** + * @see _.findLast + */ + findLast( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee, + fromIndex?: number + ): T | undefined; + + /** + * @see _.findLast + */ + findLast( + this: LoDashImplicitWrapper, + predicate: ObjectIteratorTypeGuard, + fromIndex?: number ): S|undefined; /** * @see _.findLast */ - findLast( - predicate?: ListIterator | string | PartialObject | [string, any], + findLast( + this: LoDashImplicitWrapper, + predicate?: ObjectIteratee, fromIndex?: number - ): T|undefined; + ): T[keyof T]|undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.findLast */ - findLast( - predicate?: ListIterator | DictionaryIterator | string | PartialObject | [string, any], + findLast( + this: LoDashExplicitWrapper | null | undefined>, + predicate: ListIteratorTypeGuard, fromIndex?: number - ): TResult|undefined; - } + ): LoDashExplicitWrapper; - interface LoDashExplicitWrapperBase { /** * @see _.findLast */ - findLast( - predicate?: ListIterator | string | PartialObject | [string, any], + findLast( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee, fromIndex?: number - ): any; + ): LoDashExplicitWrapper; + + /** + * @see _.findLast + */ + findLast( + this: LoDashExplicitWrapper, + predicate: ObjectIteratorTypeGuard, + fromIndex?: number + ): LoDashExplicitWrapper; + + /** + * @see _.findLast + */ + findLast( + this: LoDashExplicitWrapper, + predicate?: ObjectIteratee, + fromIndex?: number + ): LoDashExplicitWrapper; } //_.flatMap @@ -7071,15 +4785,7 @@ declare namespace _ { */ flatMap( collection: List | null | undefined, - iteratee: ListIterator> | string - ): TResult[]; - - /** - * @see _.flatMap - */ - flatMap( - collection: Dictionary | null | undefined, - iteratee: DictionaryIterator> | string + iteratee: ListIterator> ): TResult[]; /** @@ -7087,17 +4793,25 @@ declare namespace _ { */ flatMap( collection: NumericDictionary | null | undefined, - iteratee: NumericDictionaryIterator> | string + iteratee: NumericDictionaryIterator> ): TResult[]; /** * @see _.flatMap */ - flatMap( - collection: object | null | undefined, - iteratee?: ObjectIterator> | string + flatMap( + collection: T | null | undefined, + iteratee: ObjectIterator> ): TResult[]; + /** + * @see _.flatMap + */ + flatMap( + collection: object | null | undefined, + iteratee: string + ): any[]; + /** * @see _.flatMap */ @@ -7107,130 +4821,94 @@ declare namespace _ { ): boolean[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.flatMap */ - flatMap( - iteratee: StringIterator> - ): LoDashImplicitArrayWrapper; + flatMap(this: LoDashImplicitWrapper> | Dictionary> | NumericDictionary> | null | undefined>): LoDashImplicitWrapper; - /** - * @see _.flatMap - */ - flatMap(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.flatMap - */ - flatMap( - iteratee: ListIterator>|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMap - */ - flatMap( - iteratee: object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMap - */ - flatMap(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { /** * @see _.flatMap */ flatMap( - iteratee: ListIterator>|DictionaryIterator>|NumericDictionaryIterator> - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + iteratee: ListIterator> + ): LoDashImplicitWrapper; /** * @see _.flatMap */ - flatMap( - iteratee: ObjectIterator>|string - ): LoDashImplicitArrayWrapper; + flatMap( + this: LoDashImplicitWrapper, + iteratee: ObjectIterator> + ): LoDashImplicitWrapper; - /** - * @see _.flatMap - */ - flatMap( - iteratee: object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMap - */ - flatMap(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.flatMap - */ - flatMap( - iteratee: StringIterator> - ): LoDashExplicitArrayWrapper; - - /** - * @see _.flatMap - */ - flatMap(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.flatMap - */ - flatMap( - iteratee: ListIterator>|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.flatMap - */ - flatMap( - iteratee: object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.flatMap - */ - flatMap(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { /** * @see _.flatMap */ flatMap( - iteratee: ListIterator>|DictionaryIterator>|NumericDictionaryIterator> - ): LoDashExplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + iteratee: NumericDictionaryIterator> + ): LoDashImplicitWrapper; /** * @see _.flatMap */ - flatMap( - iteratee: ObjectIterator>|string - ): LoDashExplicitArrayWrapper; + flatMap( + iteratee: string + ): LoDashImplicitWrapper; /** * @see _.flatMap */ flatMap( iteratee: object - ): LoDashExplicitArrayWrapper; + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flatMap + */ + flatMap(this: LoDashExplicitWrapper> | Dictionary> | NumericDictionary> | null | undefined>): LoDashExplicitWrapper; /** * @see _.flatMap */ - flatMap(): LoDashExplicitArrayWrapper; + flatMap( + this: LoDashExplicitWrapper | null | undefined>, + iteratee: ListIterator> + ): LoDashExplicitWrapper; + + /** + * @see _.flatMap + */ + flatMap( + this: LoDashExplicitWrapper | null | undefined>, + iteratee: NumericDictionaryIterator> + ): LoDashExplicitWrapper; + + /** + * @see _.flatMap + */ + flatMap( + this: LoDashExplicitWrapper, + iteratee: ObjectIterator> + ): LoDashExplicitWrapper; + + /** + * @see _.flatMap + */ + flatMap( + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.flatMap + */ + flatMap( + iteratee: object + ): LoDashExplicitWrapper; } //_.flatMapDeep @@ -7256,7 +4934,7 @@ declare namespace _ { * // => [1, 1, 2, 2] */ flatMapDeep( - collection: List> | Dictionary> | NumericDictionary> | null | undefined + collection: List | T> | Dictionary | T> | NumericDictionary | T> | null | undefined ): T[]; /** @@ -7264,15 +4942,7 @@ declare namespace _ { */ flatMapDeep( collection: List | null | undefined, - iteratee: ListIterator> | string - ): TResult[]; - - /** - * @see _.flatMapDeep - */ - flatMapDeep( - collection: Dictionary | null | undefined, - iteratee: DictionaryIterator> | string + iteratee: ListIterator | TResult> ): TResult[]; /** @@ -7280,17 +4950,25 @@ declare namespace _ { */ flatMapDeep( collection: NumericDictionary | null | undefined, - iteratee: NumericDictionaryIterator> | string + iteratee: NumericDictionaryIterator | TResult> ): TResult[]; /** * @see _.flatMapDeep */ - flatMapDeep( - collection: object | null | undefined, - iteratee?: ObjectIterator> | string + flatMapDeep( + collection: T | null | undefined, + iteratee: ObjectIterator | TResult> ): TResult[]; + /** + * @see _.flatMapDeep + */ + flatMapDeep( + collection: object | null | undefined, + iteratee: string + ): any[]; + /** * @see _.flatMapDeep */ @@ -7300,130 +4978,102 @@ declare namespace _ { ): boolean[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.flatMapDeep */ - flatMapDeep( - iteratee: StringIterator> - ): LoDashImplicitArrayWrapper; + flatMapDeep( + this: LoDashImplicitWrapper | T> | Dictionary | T> | NumericDictionary | T> | null | undefined> + ): LoDashImplicitWrapper; - /** - * @see _.flatMapDeep - */ - flatMapDeep(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.flatMapDeep - */ - flatMapDeep( - iteratee: ListIterator>|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMapDeep - */ - flatMapDeep( - iteratee: object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMapDeep - */ - flatMapDeep(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { /** * @see _.flatMapDeep */ flatMapDeep( - iteratee: ListIterator>|DictionaryIterator>|NumericDictionaryIterator> - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + iteratee: ListIterator | TResult> + ): LoDashImplicitWrapper; - /** - * @see _.flatMapDeep - */ - flatMapDeep( - iteratee: ObjectIterator>|string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMapDeep - */ - flatMapDeep( - iteratee: object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMapDeep - */ - flatMapDeep(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.flatMapDeep - */ - flatMapDeep( - iteratee: StringIterator> - ): LoDashExplicitArrayWrapper; - - /** - * @see _.flatMapDeep - */ - flatMapDeep(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.flatMapDeep - */ - flatMapDeep( - iteratee: ListIterator>|string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.flatMapDeep - */ - flatMapDeep( - iteratee: object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.flatMapDeep - */ - flatMapDeep(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { /** * @see _.flatMapDeep */ flatMapDeep( - iteratee: ListIterator>|DictionaryIterator>|NumericDictionaryIterator> - ): LoDashExplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + iteratee: NumericDictionaryIterator | TResult> + ): LoDashImplicitWrapper; /** * @see _.flatMapDeep */ - flatMapDeep( - iteratee: ObjectIterator>|string - ): LoDashExplicitArrayWrapper; + flatMapDeep( + this: LoDashImplicitWrapper, + iteratee: ObjectIterator | TResult> + ): LoDashImplicitWrapper; /** * @see _.flatMapDeep */ flatMapDeep( - iteratee: object - ): LoDashExplicitArrayWrapper; + this: LoDashImplicitWrapper, + iteratee: string + ): LoDashImplicitWrapper; /** * @see _.flatMapDeep */ - flatMapDeep(): LoDashExplicitArrayWrapper; + flatMapDeep( + this: LoDashImplicitWrapper, + iteratee: object + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flatMapDeep + */ + flatMapDeep( + this: LoDashExplicitWrapper | T> | Dictionary | T> | NumericDictionary | T> | null | undefined> + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDeep + */ + flatMapDeep( + this: LoDashExplicitWrapper | null | undefined>, + iteratee: ListIterator | TResult> + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDeep + */ + flatMapDeep( + this: LoDashExplicitWrapper | null | undefined>, + iteratee: NumericDictionaryIterator | TResult> + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDeep + */ + flatMapDeep( + this: LoDashExplicitWrapper, + iteratee: ObjectIterator | TResult> + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDeep + */ + flatMapDeep( + this: LoDashExplicitWrapper, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDeep + */ + flatMapDeep( + this: LoDashExplicitWrapper, + iteratee: object + ): LoDashExplicitWrapper; } //_.flatMapDepth @@ -7450,8 +5100,7 @@ declare namespace _ { * // => [[1, 1], [2, 2]] */ flatMapDepth( - collection: List> | Dictionary> | NumericDictionary> | null | undefined, - depth?: number + collection: List | T> | Dictionary | T> | NumericDictionary | T> | null | undefined ): T[]; /** @@ -7459,16 +5108,7 @@ declare namespace _ { */ flatMapDepth( collection: List | null | undefined, - iteratee: ListIterator> | string, - depth?: number - ): TResult[]; - - /** - * @see _.flatMapDepth - */ - flatMapDepth( - collection: Dictionary | null | undefined, - iteratee: DictionaryIterator> | string, + iteratee: ListIterator | TResult>, depth?: number ): TResult[]; @@ -7477,19 +5117,28 @@ declare namespace _ { */ flatMapDepth( collection: NumericDictionary | null | undefined, - iteratee: NumericDictionaryIterator> | string, + iteratee: NumericDictionaryIterator | TResult>, depth?: number ): TResult[]; /** * @see _.flatMapDepth */ - flatMapDepth( - collection: object | null | undefined, - iteratee?: ObjectIterator> | string, + flatMapDepth( + collection: T | null | undefined, + iteratee: ObjectIterator | TResult>, depth?: number ): TResult[]; + /** + * @see _.flatMapDepth + */ + flatMapDepth( + collection: object | null | undefined, + iteratee: string, + depth?: number + ): any[]; + /** * @see _.flatMapDepth */ @@ -7500,142 +5149,112 @@ declare namespace _ { ): boolean[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.flatMapDepth */ - flatMapDepth( - iteratee: StringIterator>, - depth?: number - ): LoDashImplicitArrayWrapper; + flatMapDepth( + this: LoDashImplicitWrapper | T> | Dictionary | T> | NumericDictionary | T> | null | undefined> + ): LoDashImplicitWrapper; - /** - * @see _.flatMapDepth - */ - flatMapDepth(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.flatMapDepth - */ - flatMapDepth( - iteratee: ListIterator>|string, - depth?: number - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMapDepth - */ - flatMapDepth( - iteratee: object, - depth?: number - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMapDepth - */ - flatMapDepth(): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { /** * @see _.flatMapDepth */ flatMapDepth( - iteratee: ListIterator>|DictionaryIterator>|NumericDictionaryIterator>, + this: LoDashImplicitWrapper | null | undefined>, + iteratee: ListIterator | TResult>, depth?: number - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; - /** - * @see _.flatMapDepth - */ - flatMapDepth( - iteratee: ObjectIterator>|string, - depth?: number - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMapDepth - */ - flatMapDepth( - iteratee: object, - depth?: number - ): LoDashImplicitArrayWrapper; - - /** - * @see _.flatMapDepth - */ - flatMapDepth(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.flatMapDepth - */ - flatMapDepth( - iteratee: StringIterator>, - depth?: number - ): LoDashExplicitArrayWrapper; - - /** - * @see _.flatMapDepth - */ - flatMapDepth(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.flatMapDepth - */ - flatMapDepth( - iteratee: ListIterator>|string, - depth?: number - ): LoDashExplicitArrayWrapper; - - /** - * @see _.flatMapDepth - */ - flatMapDepth( - iteratee: object, - depth?: number - ): LoDashExplicitArrayWrapper; - - /** - * @see _.flatMapDepth - */ - flatMapDepth(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { /** * @see _.flatMapDepth */ flatMapDepth( - iteratee: ListIterator>|DictionaryIterator>|NumericDictionaryIterator>, + this: LoDashImplicitWrapper | null | undefined>, + iteratee: NumericDictionaryIterator | TResult>, depth?: number - ): LoDashExplicitArrayWrapper; + ): LoDashImplicitWrapper; /** * @see _.flatMapDepth */ - flatMapDepth( - iteratee: ObjectIterator>|string, + flatMapDepth( + this: LoDashImplicitWrapper, + iteratee: ObjectIterator | TResult>, depth?: number - ): LoDashExplicitArrayWrapper; + ): LoDashImplicitWrapper; /** * @see _.flatMapDepth */ flatMapDepth( - iteratee: object, + this: LoDashImplicitWrapper, + iteratee: string, depth?: number - ): LoDashExplicitArrayWrapper; + ): LoDashImplicitWrapper; /** * @see _.flatMapDepth */ - flatMapDepth(): LoDashExplicitArrayWrapper; + flatMapDepth( + this: LoDashImplicitWrapper, + iteratee: object, + depth?: number + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flatMapDepth + */ + flatMapDepth( + this: LoDashExplicitWrapper | T> | Dictionary | T> | NumericDictionary | T> | null | undefined> + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDepth + */ + flatMapDepth( + this: LoDashExplicitWrapper | null | undefined>, + iteratee: ListIterator | TResult>, + depth?: number + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDepth + */ + flatMapDepth( + this: LoDashExplicitWrapper | null | undefined>, + iteratee: NumericDictionaryIterator | TResult>, + depth?: number + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDepth + */ + flatMapDepth( + this: LoDashExplicitWrapper, + iteratee: ObjectIterator | TResult>, + depth?: number + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDepth + */ + flatMapDepth( + this: LoDashExplicitWrapper, + iteratee: string, + depth?: number + ): LoDashExplicitWrapper; + + /** + * @see _.flatMapDepth + */ + flatMapDepth( + this: LoDashExplicitWrapper, + iteratee: object, + depth?: number + ): LoDashExplicitWrapper; } //_.forEach @@ -7654,6 +5273,46 @@ declare namespace _ { * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. */ + forEach( + collection: T[], + iteratee?: ArrayIterator + ): T[]; + + /** + * @see _.forEach + */ + forEach( + collection: string, + iteratee?: StringIterator + ): string; + + /** + * @see _.forEach + */ + forEach( + collection: List, + iteratee?: ListIterator + ): List; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator + ): T; + + /** + * @see _.forEach + */ + forEach( + collection: TArray & (T[] | null | undefined), + iteratee?: ArrayIterator + ): TArray; + + /** + * @see _.forEach + */ forEach( collection: TString, iteratee?: StringIterator @@ -7670,72 +5329,44 @@ declare namespace _ { /** * @see _.forEach */ - forEach | null | undefined>( - collection: TDictionary & (Dictionary | null | undefined), - iteratee?: DictionaryIterator - ): TDictionary; + forEach( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; + } + interface LoDashWrapper { /** * @see _.forEach */ - forEach( - collection: T, - iteratee?: ObjectIterator - ): T; - } + forEach( + this: LoDashWrapper, + iteratee?: ArrayIterator + ): this; - interface LoDashImplicitWrapper { /** * @see _.forEach */ forEach( - iteratee: StringIterator - ): LoDashImplicitWrapper; - } + this: LoDashWrapper, + iteratee?: StringIterator + ): this; - interface LoDashImplicitArrayWrapperBase { /** * @see _.forEach */ - forEach( - iteratee: ListIterator - ): TWrapper; - } + forEach( + this: LoDashWrapper | null | undefined>, + iteratee?: ListIterator + ): this; - interface LoDashImplicitObjectWrapperBase { /** * @see _.forEach */ - forEach( - iteratee?: ListIterator|DictionaryIterator - ): TWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.forEach - */ - forEach( - iteratee: StringIterator - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.forEach - */ - forEach( - iteratee: ListIterator - ): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.forEach - */ - forEach( - iteratee?: ListIterator|DictionaryIterator - ): TWrapper; + forEach( + this: LoDashWrapper, + iteratee?: ObjectIterator + ): this; } //_.forEachRight @@ -7749,6 +5380,46 @@ declare namespace _ { * @param iteratee The function called per iteration. * @param thisArg The this binding of callback. */ + forEachRight( + collection: T[], + iteratee?: ArrayIterator + ): T[]; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: string, + iteratee?: StringIterator + ): string; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: List, + iteratee?: ListIterator + ): List; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator + ): T; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: TArray & (T[] | null | undefined), + iteratee?: ArrayIterator + ): TArray; + + /** + * @see _.forEachRight + */ forEachRight( collection: TString, iteratee?: StringIterator @@ -7765,72 +5436,44 @@ declare namespace _ { /** * @see _.forEachRight */ - forEachRight | null | undefined>( - collection: TDictionary & (Dictionary | null | undefined), - iteratee?: DictionaryIterator - ): TDictionary; + forEachRight( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; + } + interface LoDashWrapper { /** * @see _.forEachRight */ - forEachRight( - collection: T, - iteratee?: ObjectIterator - ): T; - } + forEachRight( + this: LoDashWrapper, + iteratee?: ArrayIterator + ): this; - interface LoDashImplicitWrapper { /** * @see _.forEachRight */ forEachRight( - iteratee: StringIterator - ): LoDashImplicitWrapper; - } + this: LoDashWrapper, + iteratee?: StringIterator + ): this; - interface LoDashImplicitArrayWrapperBase { /** * @see _.forEachRight */ - forEachRight( - iteratee: ListIterator - ): TWrapper; - } + forEachRight( + this: LoDashWrapper | null | undefined>, + iteratee?: ListIterator + ): this; - interface LoDashImplicitObjectWrapperBase { /** * @see _.forEachRight */ - forEachRight( - iteratee?: ListIterator|DictionaryIterator - ): TWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.forEachRight - */ - forEachRight( - iteratee: StringIterator - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.forEachRight - */ - forEachRight( - iteratee: ListIterator - ): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.forEachRight - */ - forEachRight( - iteratee?: ListIterator|DictionaryIterator - ): TWrapper; + forEachRight( + this: LoDashWrapper, + iteratee?: ObjectIterator + ): this; } //_.groupBy @@ -7855,226 +5498,102 @@ declare namespace _ { * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ - groupBy( - collection: TString, - iteratee?: StringIterator - ): Dictionary; + groupBy( + collection: string | null | undefined, + iteratee?: StringIterator + ): Dictionary; /** * @see _.groupBy */ - groupBy( + groupBy( collection: List | null | undefined, - iteratee?: ListIterator + iteratee?: ListIteratee ): Dictionary; /** * @see _.groupBy */ groupBy( - collection: List | null | undefined, - iteratee?: ListIterator + collection: NumericDictionary | null | undefined, + iteratee?: NumericDictionaryIteratee ): Dictionary; /** * @see _.groupBy */ - groupBy( - collection: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): Dictionary; - - /** - * @see _.groupBy - */ - groupBy( - collection: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): Dictionary; - - /** - * @see _.groupBy - */ - groupBy( - collection: List|Dictionary | null | undefined, - iteratee?: string - ): Dictionary; - - /** - * @see _.groupBy - */ - groupBy( - collection: List|Dictionary | null | undefined, - iteratee?: string - ): Dictionary; - - /** - * @see _.groupBy - */ - groupBy( - collection: List|Dictionary | null | undefined, - iteratee?: TWhere - ): Dictionary; - - /** - * @see _.groupBy - */ - groupBy( - collection: List|Dictionary | null | undefined, - iteratee?: Object - ): Dictionary; + groupBy( + collection: T | null | undefined, + iteratee?: ObjectIteratee + ): Dictionary>; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.groupBy */ - groupBy( - iteratee?: ListIterator - ): LoDashImplicitObjectWrapper>; + groupBy( + this: LoDashImplicitWrapper, + iteratee?: StringIterator + ): LoDashImplicitWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashImplicitWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + this: LoDashImplicitWrapper, + iteratee?: ObjectIteratee + ): LoDashImplicitWrapper>>; + + /** + * @see _.groupBy + */ + groupBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: NumericDictionaryIteratee + ): LoDashImplicitWrapper>; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.groupBy */ - groupBy( - iteratee?: ListIterator - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: string - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: TWhere - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.groupBy - */ - groupBy( - iteratee?: ListIterator|DictionaryIterator - ): LoDashImplicitObjectWrapper>; + groupBy( + this: LoDashExplicitWrapper, + iteratee?: StringIterator + ): LoDashExplicitWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: ListIterator|DictionaryIterator - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: string - ): LoDashImplicitObjectWrapper>; + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashExplicitWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: string - ): LoDashImplicitObjectWrapper>; + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: NumericDictionaryIteratee + ): LoDashExplicitWrapper>; /** * @see _.groupBy */ - groupBy( - iteratee?: TWhere - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: Object - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashExplicitWrapper { - /** - * @see _.groupBy - */ - groupBy( - iteratee?: ListIterator - ): LoDashExplicitObjectWrapper>; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.groupBy - */ - groupBy( - iteratee?: ListIterator - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: string - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: TWhere - ): LoDashExplicitObjectWrapper>; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.groupBy - */ - groupBy( - iteratee?: ListIterator|DictionaryIterator - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: ListIterator|DictionaryIterator - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: string - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: string - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: TWhere - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.groupBy - */ - groupBy( - iteratee?: Object - ): LoDashExplicitObjectWrapper>; + groupBy( + this: LoDashExplicitWrapper, + iteratee?: ObjectIteratee + ): LoDashExplicitWrapper>>; } //_.includes @@ -8093,77 +5612,30 @@ declare namespace _ { target: T, fromIndex?: number ): boolean; - - /** - * @see _.includes - */ - includes( - collection: string | null | undefined, - target: string, - fromIndex?: number - ): boolean; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.includes */ - includes( + includes( + this: LoDashImplicitWrapper | Dictionary | null | undefined>, target: T, fromIndex?: number ): boolean; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.includes */ - includes( - target: TValue, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitWrapper { - /** - * @see _.includes - */ - includes( - target: string, - fromIndex?: number - ): boolean; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.includes - */ - includes( + includes( + this: LoDashExplicitWrapper | Dictionary | null | undefined>, target: T, fromIndex?: number ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.includes - */ - includes( - target: TValue, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.includes - */ - includes( - target: string, - fromIndex?: number - ): LoDashExplicitWrapper; - } - //_.keyBy interface LoDashStatic { /** @@ -8188,190 +5660,76 @@ declare namespace _ { */ keyBy( collection: List | null | undefined, - iteratee?: ListIterator + iteratee?: ListIteratee ): Dictionary; + /** + * @see _.keyBy + */ + keyBy( + collection: T | null | undefined, + iteratee?: ObjectIteratee + ): Dictionary; + /** * @see _.keyBy */ keyBy( collection: NumericDictionary | null | undefined, - iteratee?: NumericDictionaryIterator - ): Dictionary; - - /** - * @see _.keyBy - */ - keyBy( - collection: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): Dictionary; - - /** - * @see _.keyBy - */ - keyBy( - collection: List|NumericDictionary|Dictionary | null | undefined, - iteratee?: string - ): Dictionary; - - /** - * @see _.keyBy - */ - keyBy( - collection: List|NumericDictionary|Dictionary | null | undefined, - iteratee?: W - ): Dictionary; - - /** - * @see _.keyBy - */ - keyBy( - collection: List|NumericDictionary|Dictionary | null | undefined, - iteratee?: Object + iteratee?: NumericDictionaryIteratee ): Dictionary; } - interface LoDashImplicitStringWrapper { - /** - * @see _.keyBy - */ - keyBy( - iteratee?: StringIterator | undefined - ): LoDashImplicitObjectWrapper> - } - - interface LoDashExplicitStringWrapper { - /** - * @see _.keyBy - */ - keyBy( - iteratee?: StringIterator | undefined - ): LoDashExplicitObjectWrapper> - } - - interface LoDashImplicitWrapper { - /** - * @see _.keyBy - */ - keyBy( - iteratee?: ListIterator - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.keyBy - */ - keyBy( - iteratee?: ListIterator - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.keyBy - */ - keyBy( - iteratee?: string - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.keyBy - */ - keyBy( - iteratee?: W - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.keyBy */ keyBy( - iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator - ): LoDashImplicitObjectWrapper>; + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashImplicitWrapper>; + + /** + * @see _.keyBy + */ + keyBy( + this: LoDashImplicitWrapper, + iteratee?: ObjectIteratee + ): LoDashImplicitWrapper>; /** * @see _.keyBy */ keyBy( - iteratee?: string - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.keyBy - */ - keyBy( - iteratee?: W - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.keyBy - */ - keyBy( - iteratee?: Object - ): LoDashImplicitObjectWrapper>; + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: NumericDictionaryIteratee + ): LoDashImplicitWrapper>; } - interface LoDashExplicitWrapper { - /** - * @see _.keyBy - */ - keyBy( - iteratee?: ListIterator - ): LoDashExplicitObjectWrapper>; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.keyBy - */ - keyBy( - iteratee?: ListIterator - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.keyBy - */ - keyBy( - iteratee?: string - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.keyBy - */ - keyBy( - iteratee?: W - ): LoDashExplicitObjectWrapper>; - } - - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.keyBy */ keyBy( - iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator - ): LoDashExplicitObjectWrapper>; + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashExplicitWrapper>; + + /** + * @see _.keyBy + */ + keyBy( + this: LoDashExplicitWrapper, + iteratee?: ObjectIteratee + ): LoDashExplicitWrapper>; /** * @see _.keyBy */ keyBy( - iteratee?: string - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.keyBy - */ - keyBy( - iteratee?: W - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.keyBy - */ - keyBy( - iteratee?: Object - ): LoDashExplicitObjectWrapper>; + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: NumericDictionaryIteratee + ): LoDashExplicitWrapper>; } //_.invoke @@ -8382,62 +5740,28 @@ declare namespace _ { * @param path The path of the method to invoke. * @param args The arguments to invoke the method with. **/ - invoke( - object: TObject, - path: Many, - ...args: any[]): TResult; - - /** - * @see _.invoke - **/ - invoke( - object: Dictionary|TValue[], - path: Many, - ...args: any[]): TResult; - - /** - * @see _.invoke - **/ - invoke( + invoke( object: any, path: Many, - ...args: any[]): TResult; + ...args: any[]): any; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitWrapper { /** * @see _.invoke **/ - invoke( + invoke( path: Many, - ...args: any[]): TResult; + ...args: any[]): any; } - interface LoDashImplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.invoke **/ - invoke( + invoke( path: Many, - ...args: any[]): TResult; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.invoke - **/ - invoke( - path: Many, - ...args: any[]): TResult; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.invoke - **/ - invoke( - path: Many, - ...args: any[]): TResult; + ...args: any[]): LoDashExplicitWrapper; } //_.invokeMap @@ -8451,130 +5775,50 @@ declare namespace _ { * @param methodName The name of the method to invoke. * @param args Arguments to invoke the method with. **/ - invokeMap( - collection: TValue[] | null | undefined, + invokeMap( + collection: object | null | undefined, methodName: string, - ...args: any[]): TResult[]; - - /** - * @see _.invokeMap - **/ - invokeMap( - collection: Dictionary | null | undefined, - methodName: string, - ...args: any[]): TResult[]; + ...args: any[]): any[]; /** * @see _.invokeMap **/ invokeMap( - collection: Array<{}> | null | undefined, - methodName: string, - ...args: any[]): TResult[]; - - /** - * @see _.invokeMap - **/ - invokeMap( - collection: Dictionary<{}> | null | undefined, - methodName: string, - ...args: any[]): TResult[]; - - /** - * @see _.invokeMap - **/ - invokeMap( - collection: TValue[] | null | undefined, - method: (...args: any[]) => TResult, - ...args: any[]): TResult[]; - - /** - * @see _.invokeMap - **/ - invokeMap( - collection: Dictionary | null | undefined, - method: (...args: any[]) => TResult, - ...args: any[]): TResult[]; - - /** - * @see _.invokeMap - **/ - invokeMap( - collection: Array<{}> | null | undefined, - method: (...args: any[]) => TResult, - ...args: any[]): TResult[]; - - /** - * @see _.invokeMap - **/ - invokeMap( - collection: Dictionary<{}> | null | undefined, + collection: object | null | undefined, method: (...args: any[]) => TResult, ...args: any[]): TResult[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.invokeMap **/ - invokeMap( + invokeMap( methodName: string, - ...args: any[]): LoDashImplicitArrayWrapper; + ...args: any[]): LoDashImplicitWrapper; /** * @see _.invokeMap **/ invokeMap( method: (...args: any[]) => TResult, - ...args: any[]): LoDashImplicitArrayWrapper; + ...args: any[]): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.invokeMap **/ - invokeMap( + invokeMap( methodName: string, - ...args: any[]): LoDashImplicitArrayWrapper; + ...args: any[]): LoDashExplicitWrapper; /** * @see _.invokeMap **/ invokeMap( method: (...args: any[]) => TResult, - ...args: any[]): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.invokeMap - **/ - invokeMap( - methodName: string, - ...args: any[]): LoDashExplicitArrayWrapper; - - /** - * @see _.invokeMap - **/ - invokeMap( - method: (...args: any[]) => TResult, - ...args: any[]): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.invokeMap - **/ - invokeMap( - methodName: string, - ...args: any[]): LoDashExplicitArrayWrapper; - - /** - * @see _.invokeMap - **/ - invokeMap( - method: (...args: any[]) => TResult, - ...args: any[]): LoDashExplicitArrayWrapper; + ...args: any[]): LoDashExplicitWrapper; } //_.map @@ -8613,33 +5857,28 @@ declare namespace _ { /** * @see _.map */ - map(collection: List | null | undefined): T[]; + map(collection: List | Dictionary | null | undefined): T[]; /** * @see _.map */ - map( + map( collection: Dictionary | null | undefined, iteratee: DictionaryIterator ): TResult[]; /** @see _.map */ map( - collection: Dictionary | null | undefined, + collection: List | Dictionary | null | undefined, iteratee: K - ): T[K][]; + ): Array; /** @see _.map */ - map(collection: Dictionary | null | undefined): T[]; - - map( + map( collection: NumericDictionary | null | undefined, iteratee?: NumericDictionaryIterator ): TResult[]; - /** @see _.map */ - map(collection: List | null | undefined, iteratee: K): T[K][]; - /** * @see _.map */ @@ -8651,125 +5890,114 @@ declare namespace _ { /** * @see _.map */ - map( + map( collection: List|Dictionary|NumericDictionary | null | undefined, - iteratee?: TObject + iteratee?: object ): boolean[]; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.map */ - map( + map( + this: LoDashImplicitWrapper | null | undefined>, iteratee: ListIterator - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; /** * @see _.map */ - map(): LoDashImplicitArrayWrapper; + map(this: LoDashImplicitWrapper | Dictionary | null | undefined>): LoDashImplicitWrapper; + + /** + * @see _.map + */ + map( + this: LoDashImplicitWrapper | null | undefined>, + iteratee: DictionaryIterator + ): LoDashImplicitWrapper; /** @see _.map */ - map(iteratee: K): LoDashImplicitArrayWrapper; + map( + this: LoDashImplicitWrapper | Dictionary | null | undefined>, + iteratee: K + ): LoDashImplicitWrapper>; + + /** @see _.map */ + map( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: NumericDictionaryIterator + ): LoDashImplicitWrapper; /** * @see _.map */ - map( - iteratee: string - ): LoDashImplicitArrayWrapper; + map( + this: LoDashImplicitWrapper | Dictionary | NumericDictionary | null | undefined>, + iteratee?: string + ): LoDashImplicitWrapper; /** * @see _.map */ - map( - iteratee: TObject - ): LoDashImplicitArrayWrapper; + map( + this: LoDashImplicitWrapper | Dictionary | NumericDictionary | null | undefined>, + iteratee?: object + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.map */ - map( - iteratee: ListIterator|DictionaryIterator - ): LoDashImplicitArrayWrapper; - - /** @see _.map */ - map(): LoDashImplicitArrayWrapper; - - /** @see _.map */ - map(iteratee: K): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - map( - iteratee: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - map( - iteratee: TObject - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.map - */ - map( + map( + this: LoDashExplicitWrapper | null | undefined>, iteratee: ListIterator - ): LoDashExplicitArrayWrapper; + ): LoDashExplicitWrapper; + + /** + * @see _.map + */ + map(this: LoDashExplicitWrapper | Dictionary | null | undefined>): LoDashExplicitWrapper; + + /** + * @see _.map + */ + map( + this: LoDashExplicitWrapper | null | undefined>, + iteratee: DictionaryIterator + ): LoDashExplicitWrapper; /** @see _.map */ - map(): LoDashExplicitArrayWrapper; - - /** @see _.map */ - map(iteratee: K): LoDashExplicitArrayWrapper; + map( + this: LoDashExplicitWrapper | Dictionary | null | undefined>, + iteratee: K + ): LoDashExplicitWrapper>; /** * @see _.map */ - map( - iteratee: string - ): LoDashExplicitArrayWrapper; + map( + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: NumericDictionaryIterator + ): LoDashExplicitWrapper; /** * @see _.map */ - map( - iteratee: TObject - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.map - */ - map( - iteratee: ListIterator|DictionaryIterator - ): LoDashExplicitArrayWrapper; - - /** @see _.map */ - map(): LoDashExplicitArrayWrapper; + map( + this: LoDashExplicitWrapper | Dictionary | NumericDictionary | null | undefined>, + iteratee?: string + ): LoDashExplicitWrapper; /** * @see _.map */ - map( - iteratee: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.map - */ - map( - iteratee: TObject - ): LoDashExplicitArrayWrapper; + map( + this: LoDashExplicitWrapper | Dictionary | NumericDictionary | null | undefined>, + iteratee?: object + ): LoDashExplicitWrapper; } //_.partition @@ -8795,123 +6023,52 @@ declare namespace _ { **/ partition( collection: List | null | undefined, - callback: ListIterator): T[][]; + callback: ValueIteratee + ): T[][]; /** * @see _.partition - **/ - partition( - collection: Dictionary | null | undefined, - callback: DictionaryIterator): T[][]; - - /** - * @see _.partition - **/ - partition( - collection: List | null | undefined, - whereValue: W): T[][]; - - /** - * @see _.partition - **/ - partition( - collection: Dictionary | null | undefined, - whereValue: W): T[][]; - - /** - * @see _.partition - **/ - partition( - collection: List | null | undefined, - path: string, - srcValue: any): T[][]; - - /** - * @see _.partition - **/ - partition( - collection: Dictionary | null | undefined, - path: string, - srcValue: any): T[][]; - - /** - * @see _.partition - **/ - partition( - collection: List | null | undefined, - pluckValue: string): T[][]; - - /** - * @see _.partition - **/ - partition( - collection: Dictionary | null | undefined, - pluckValue: string): T[][]; + */ + partition( + collection: T | null | undefined, + callback: ValueIteratee + ): Array>; } - interface LoDashImplicitStringWrapper { + interface LoDashImplicitWrapper { /** * @see _.partition */ - partition( - callback: ListIterator): LoDashImplicitArrayWrapper; + partition( + this: LoDashImplicitWrapper | null | undefined>, + callback: ValueIteratee + ): LoDashImplicitWrapper; + + /** + * @see _.partition + */ + partition( + this: LoDashImplicitWrapper, + callback: ValueIteratee + ): LoDashImplicitWrapper>>; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.partition */ - partition( - callback: ListIterator): LoDashImplicitArrayWrapper; - /** - * @see _.partition - */ - partition( - whereValue: W): LoDashImplicitArrayWrapper; - /** - * @see _.partition - */ - partition( - path: string, - srcValue: any): LoDashImplicitArrayWrapper; - /** - * @see _.partition - */ - partition( - pluckValue: string): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.partition - */ - partition( - callback: ListIterator): LoDashImplicitArrayWrapper; + partition( + this: LoDashExplicitWrapper | null | undefined>, + callback: ValueIteratee + ): LoDashExplicitWrapper; /** * @see _.partition */ - partition( - callback: DictionaryIterator): LoDashImplicitArrayWrapper; - - /** - * @see _.partition - */ - partition( - whereValue: W): LoDashImplicitArrayWrapper; - - /** - * @see _.partition - */ - partition( - path: string, - srcValue: any): LoDashImplicitArrayWrapper; - - /** - * @see _.partition - */ - partition( - pluckValue: string): LoDashImplicitArrayWrapper; + partition( + this: LoDashExplicitWrapper, + callback: ValueIteratee + ): LoDashExplicitWrapper>>; } //_.reduce @@ -8925,125 +6082,212 @@ declare namespace _ { * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param accumulator Initial value of the accumulator. - * @param thisArg The this binding of callback. * @return Returns the accumulated value. **/ reduce( collection: T[] | null | undefined, - callback: MemoIterator, - accumulator: TResult): TResult; + callback: MemoListIterator, + accumulator: TResult + ): TResult; /** - * @see _.reduce - **/ + * @see _.reduce + **/ reduce( collection: List | null | undefined, - callback: MemoIterator, - accumulator: TResult): TResult; + callback: MemoListIterator>, + accumulator: TResult + ): TResult; /** - * @see _.reduce - **/ - reduce( - collection: Dictionary | null | undefined, - callback: MemoIterator, - accumulator: TResult): TResult; + * @see _.reduce + **/ + reduce( + collection: T | null | undefined, + callback: MemoObjectIterator, + accumulator: TResult + ): TResult; /** - * @see _.reduce - **/ + * @see _.reduce + **/ reduce( collection: NumericDictionary | null | undefined, - callback: MemoIterator, - accumulator: TResult): TResult; + callback: MemoListIterator>, + accumulator: TResult + ): TResult; /** - * @see _.reduce - **/ + * @see _.reduce + **/ reduce( collection: T[] | null | undefined, - callback: MemoIterator): TResult | undefined; + callback: MemoListIterator + ): TResult | undefined; /** * @see _.reduce **/ reduce( collection: List | null | undefined, - callback: MemoIterator): TResult | undefined; + callback: MemoListIterator> + ): TResult | undefined; /** - * @see _.reduce - **/ - reduce( - collection: Dictionary | null | undefined, - callback: MemoIterator): TResult | undefined; + * @see _.reduce + **/ + reduce( + collection: T | null | undefined, + callback: MemoObjectIterator + ): TResult | undefined; /** * @see _.reduce **/ reduce( collection: NumericDictionary | null | undefined, - callback: MemoIterator): TResult | undefined; + callback: MemoListIterator> + ): TResult | undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.reduce **/ - reduce( - callback: MemoIterator, - accumulator: TResult): TResult; - - /** - * @see _.reduce - **/ - reduce( - callback: MemoIterator): TResult | undefined; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.reduce - **/ - reduce( - callback: MemoIterator, - accumulator: TResult): TResult; - - /** - * @see _.reduce - **/ - reduce( - callback: MemoIterator): TResult | undefined; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.reduce - **/ - reduce( - callback: MemoIterator, - accumulator: TResult): LoDashExplicitObjectWrapper; - - /** - * @see _.reduce - **/ - reduce( - callback: MemoIterator): LoDashExplicitObjectWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /**LoDashExplicitWrapper - * @see _.reduce - */ - reduce( - callback: MemoIterator, - accumulator: TResult): LoDashExplicitWrapper; + reduce( + this: LoDashImplicitWrapper, + callback: MemoListIterator, + accumulator: TResult + ): TResult; /** * @see _.reduce - */ - reduce( - callback: MemoIterator): LoDashExplicitWrapper; + **/ + reduce( + this: LoDashImplicitWrapper | null | undefined>, + callback: MemoListIterator>, + accumulator: TResult + ): TResult; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashImplicitWrapper, + callback: MemoObjectIterator, + accumulator: TResult + ): TResult; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashImplicitWrapper | null | undefined>, + callback: MemoListIterator>, + accumulator: TResult + ): TResult; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashImplicitWrapper, + callback: MemoListIterator + ): TResult | undefined; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashImplicitWrapper | null | undefined>, + callback: MemoListIterator> + ): TResult | undefined; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashImplicitWrapper, + callback: MemoObjectIterator + ): TResult | undefined; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashImplicitWrapper | null | undefined>, + callback: MemoListIterator> + ): TResult | undefined; + } + + interface LoDashExplicitWrapper { + /** + * @see _.reduce + **/ + reduce( + this: LoDashExplicitWrapper, + callback: MemoListIterator, + accumulator: TResult + ): LoDashExplicitWrapper; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashExplicitWrapper | null | undefined>, + callback: MemoListIterator>, + accumulator: TResult + ): LoDashExplicitWrapper; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashExplicitWrapper, + callback: MemoObjectIterator, + accumulator: TResult + ): LoDashExplicitWrapper; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashExplicitWrapper | null | undefined>, + callback: MemoListIterator>, + accumulator: TResult + ): LoDashExplicitWrapper; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashExplicitWrapper, + callback: MemoListIterator + ): LoDashExplicitWrapper; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashExplicitWrapper | null | undefined>, + callback: MemoListIterator> + ): LoDashExplicitWrapper; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashExplicitWrapper, + callback: MemoObjectIterator + ): LoDashExplicitWrapper; + + /** + * @see _.reduce + **/ + reduce( + this: LoDashExplicitWrapper | null | undefined>, + callback: MemoListIterator> + ): LoDashExplicitWrapper; } //_.reduceRight @@ -9054,50 +6298,212 @@ declare namespace _ { * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param accumulator Initial value of the accumulator. - * @param thisArg The this binding of callback. * @return The accumulated value. **/ reduceRight( collection: T[] | null | undefined, - callback: MemoIterator, - accumulator: TResult): TResult; + callback: MemoListIterator, + accumulator: TResult + ): TResult; /** * @see _.reduceRight **/ reduceRight( collection: List | null | undefined, - callback: MemoIterator, - accumulator: TResult): TResult; + callback: MemoListIterator>, + accumulator: TResult + ): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: T | null | undefined, + callback: MemoObjectIterator, + accumulator: TResult + ): TResult; /** * @see _.reduceRight **/ reduceRight( - collection: Dictionary | null | undefined, - callback: MemoIterator, - accumulator: TResult): TResult; + collection: NumericDictionary | null | undefined, + callback: MemoListIterator>, + accumulator: TResult + ): TResult; /** * @see _.reduceRight **/ reduceRight( collection: T[] | null | undefined, - callback: MemoIterator): TResult | undefined; + callback: MemoListIterator + ): TResult | undefined; /** * @see _.reduceRight **/ reduceRight( collection: List | null | undefined, - callback: MemoIterator): TResult | undefined; + callback: MemoListIterator> + ): TResult | undefined; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: T | null | undefined, + callback: MemoObjectIterator + ): TResult | undefined; /** * @see _.reduceRight **/ reduceRight( - collection: Dictionary | null | undefined, - callback: MemoIterator): TResult | undefined; + collection: NumericDictionary | null | undefined, + callback: MemoListIterator> + ): TResult | undefined; + } + + interface LoDashImplicitWrapper { + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashImplicitWrapper, + callback: MemoListIterator, + accumulator: TResult + ): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashImplicitWrapper | null | undefined>, + callback: MemoListIterator>, + accumulator: TResult + ): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashImplicitWrapper, + callback: MemoObjectIterator, + accumulator: TResult + ): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashImplicitWrapper | null | undefined>, + callback: MemoListIterator>, + accumulator: TResult + ): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashImplicitWrapper, + callback: MemoListIterator + ): TResult | undefined; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashImplicitWrapper | null | undefined>, + callback: MemoListIterator> + ): TResult | undefined; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashImplicitWrapper, + callback: MemoObjectIterator + ): TResult | undefined; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashImplicitWrapper | null | undefined>, + callback: MemoListIterator> + ): TResult | undefined; + } + + interface LoDashExplicitWrapper { + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashExplicitWrapper, + callback: MemoListIterator, + accumulator: TResult + ): LoDashExplicitWrapper; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashExplicitWrapper | null | undefined>, + callback: MemoListIterator>, + accumulator: TResult + ): LoDashExplicitWrapper; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashExplicitWrapper, + callback: MemoObjectIterator, + accumulator: TResult + ): LoDashExplicitWrapper; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashExplicitWrapper | null | undefined>, + callback: MemoListIterator>, + accumulator: TResult + ): LoDashExplicitWrapper; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashExplicitWrapper, + callback: MemoListIterator + ): LoDashExplicitWrapper; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashExplicitWrapper | null | undefined>, + callback: MemoListIterator> + ): LoDashExplicitWrapper; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashExplicitWrapper, + callback: MemoObjectIterator + ): LoDashExplicitWrapper; + + /** + * @see _.reduceRight + **/ + reduceRight( + this: LoDashExplicitWrapper | null | undefined>, + callback: MemoListIterator> + ): LoDashExplicitWrapper; } //_.reject @@ -9111,144 +6517,78 @@ declare namespace _ { * @param thisArg The this binding of predicate. * @return Returns the new filtered array. */ - reject( - collection: List | null | undefined, - predicate?: ListIterator - ): T[]; - - /** - * @see _.reject - */ - reject( - collection: Dictionary | null | undefined, - predicate?: DictionaryIterator - ): T[]; - - /** - * @see _.reject - */ reject( collection: string | null | undefined, - predicate?: StringIterator + predicate?: StringIterator ): string[]; /** * @see _.reject */ reject( - collection: List|Dictionary | null | undefined, - predicate: string + collection: List | null | undefined, + predicate?: ListIteratee ): T[]; /** * @see _.reject */ - reject( - collection: List|Dictionary | null | undefined, - predicate: W - ): T[]; + reject( + collection: T | null | undefined, + predicate?: ObjectIteratee + ): Array; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.reject */ reject( - predicate?: StringIterator - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.reject - */ - reject( - predicate: ListIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.reject - */ - reject( - predicate: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.reject - */ - reject(predicate: W): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.reject - */ - reject( - predicate: ListIterator|DictionaryIterator - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper, + predicate?: StringIterator + ): LoDashImplicitWrapper; /** * @see _.reject */ reject( - predicate: string - ): LoDashImplicitArrayWrapper; + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashImplicitWrapper; /** * @see _.reject */ - reject(predicate: W): LoDashImplicitArrayWrapper; + reject( + this: LoDashImplicitWrapper, + predicate?: ObjectIteratee + ): LoDashImplicitWrapper>; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.reject */ reject( - predicate?: StringIterator - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.reject - */ - reject( - predicate: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.reject - */ - reject( - predicate: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.reject - */ - reject(predicate: W): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.reject - */ - reject( - predicate: ListIterator|DictionaryIterator - ): LoDashExplicitArrayWrapper; + this: LoDashExplicitWrapper, + predicate?: StringIterator + ): LoDashExplicitWrapper; /** * @see _.reject */ reject( - predicate: string - ): LoDashExplicitArrayWrapper; + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashExplicitWrapper; /** * @see _.reject */ - reject(predicate: W): LoDashExplicitArrayWrapper; + reject( + this: LoDashExplicitWrapper, + predicate?: ObjectIteratee + ): LoDashExplicitWrapper>; } //_.sample @@ -9260,50 +6600,68 @@ declare namespace _ { * @return Returns the random element. */ sample( - collection: List | Dictionary | NumericDictionary | object | null | undefined + collection: List | Dictionary | NumericDictionary | null | undefined ): T | undefined; - } - interface LoDashImplicitWrapper { /** * @see _.sample */ - sample(): string | undefined; - } + sample( + collection: T + ): T[keyof T]; - interface LoDashImplicitArrayWrapperBase { /** * @see _.sample */ - sample(): T | undefined; + sample( + collection: T | null | undefined + ): T[keyof T] | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.sample */ - sample(): T | undefined; - } + sample( + this: LoDashImplicitWrapper | Dictionary | NumericDictionary | null | undefined> + ): T | undefined; - interface LoDashExplicitWrapper { /** * @see _.sample */ - sample(): LoDashExplicitWrapper; - } + sample( + this: LoDashImplicitWrapper, + ): T[keyof T]; - interface LoDashExplicitArrayWrapperBase { /** * @see _.sample */ - sample(): TWrapper; + sample( + this: LoDashImplicitWrapper + ): T[keyof T] | undefined; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.sample */ - sample(): TWrapper; + sample( + this: LoDashExplicitWrapper | Dictionary | NumericDictionary | null | undefined> + ): LoDashExplicitWrapper; + + /** + * @see _.sample + */ + sample( + this: LoDashExplicitWrapper, + ): LoDashExplicitWrapper; + + /** + * @see _.sample + */ + sample( + this: LoDashExplicitWrapper + ): LoDashExplicitWrapper; } //_.sampleSize @@ -9323,72 +6681,46 @@ declare namespace _ { /** * @see _.sampleSize */ - sampleSize( - collection: O | null | undefined, + sampleSize( + collection: T | null | undefined, n?: number - ): T[]; + ): Array; + } + interface LoDashImplicitWrapper { /** * @see _.sampleSize */ sampleSize( - collection: Object | null | undefined, + this: LoDashImplicitWrapper|Dictionary|NumericDictionary | null | undefined>, n?: number - ): T[]; - } + ): LoDashImplicitWrapper; - interface LoDashImplicitWrapper { /** * @see _.sampleSize */ - sampleSize( + sampleSize( + this: LoDashImplicitWrapper, n?: number - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper>; } - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.sampleSize - */ - sampleSize( - n?: number - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.sampleSize */ sampleSize( + this: LoDashExplicitWrapper|Dictionary|NumericDictionary | null | undefined>, n?: number - ): LoDashImplicitArrayWrapper; - } + ): LoDashExplicitWrapper; - interface LoDashExplicitWrapper { /** * @see _.sampleSize */ - sampleSize( + sampleSize( + this: LoDashExplicitWrapper, n?: number - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sampleSize - */ - sampleSize( - n?: number - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.sampleSize - */ - sampleSize( - n?: number - ): LoDashExplicitArrayWrapper; + ): LoDashExplicitWrapper>; } //_.shuffle @@ -9399,54 +6731,36 @@ declare namespace _ { * @param collection The collection to shuffle. * @return Returns the new shuffled array. */ - shuffle(collection: List|Dictionary | null | undefined): T[]; + shuffle(collection: List | null | undefined): T[]; /** * @see _.shuffle */ - shuffle(collection: string | null | undefined): string[]; + shuffle(collection: T | null | undefined): Array; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.shuffle */ - shuffle(): LoDashImplicitArrayWrapper; + shuffle(this: LoDashImplicitWrapper | null | undefined>): LoDashImplicitWrapper; + + /** + * @see _.shuffle + */ + shuffle(this: LoDashImplicitWrapper): LoDashImplicitWrapper>; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.shuffle */ - shuffle(): LoDashImplicitArrayWrapper; - } + shuffle(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; - interface LoDashImplicitObjectWrapperBase { /** * @see _.shuffle */ - shuffle(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.shuffle - */ - shuffle(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.shuffle - */ - shuffle(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.shuffle - */ - shuffle(): LoDashExplicitArrayWrapper; + shuffle(this: LoDashExplicitWrapper): LoDashExplicitWrapper>; } //_.size @@ -9458,50 +6772,17 @@ declare namespace _ { * @param collection The collection to inspect. * @return Returns the size of collection. */ - size(collection: List|Dictionary | null | undefined): number; - - /** - * @see _.size - */ - size(collection: string | null | undefined): number; + size(collection: object | string | null | undefined): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.size */ size(): number; } - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.size - */ - size(): number; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.size - */ - size(): number; - } - - interface LoDashExplicitWrapper { - /** - * @see _.size - */ - size(): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.size - */ - size(): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.size */ @@ -9520,15 +6801,15 @@ declare namespace _ { */ some( collection: List | null | undefined, - predicate?: ListIterator + predicate?: ListIteratee ): boolean; /** * @see _.some */ - some( - collection: Dictionary | null | undefined, - predicate?: DictionaryIterator + some( + collection: T | null | undefined, + predicate?: ObjectIteratee ): boolean; /** @@ -9536,146 +6817,59 @@ declare namespace _ { */ some( collection: NumericDictionary | null | undefined, - predicate?: NumericDictionaryIterator + predicate?: NumericDictionaryIteratee + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.some + */ + some( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ListIteratee ): boolean; /** * @see _.some */ - some( - collection: Object | null | undefined, - predicate?: ObjectIterator + some( + this: LoDashImplicitWrapper, + predicate?: ObjectIteratee ): boolean; /** * @see _.some */ some( - collection: List|Dictionary|NumericDictionary | null | undefined, - predicate?: string|[string, any] + this: LoDashImplicitWrapper | null | undefined>, + predicate?: NumericDictionaryIteratee ): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.some + */ + some( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ListIteratee + ): LoDashExplicitWrapper; /** * @see _.some */ - some( - collection: Object | null | undefined, - predicate?: string|[string, any] - ): boolean; + some( + this: LoDashExplicitWrapper, + predicate?: ObjectIteratee + ): LoDashExplicitWrapper; /** * @see _.some */ some( - collection: List|Dictionary|NumericDictionary | null | undefined, - predicate?: PartialObject - ): boolean; - - /** - * @see _.some - */ - some( - collection: List|Dictionary|NumericDictionary | null | undefined, - predicate?: PartialObject - ): boolean; - - /** - * @see _.some - */ - some( - collection: Object | null | undefined, - predicate?: PartialObject - ): boolean; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.some - */ - some( - predicate?: ListIterator|NumericDictionaryIterator - ): boolean; - - /** - * @see _.some - */ - some( - predicate?: string|[string, any] - ): boolean; - - /** - * @see _.some - */ - some( - predicate?: PartialObject - ): boolean; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.some - */ - some( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator|ObjectIterator - ): boolean; - /** - * @see _.some - */ - some( - predicate?: string|[string, any] - ): boolean; - - /** - * @see _.some - */ - some( - predicate?: PartialObject - ): boolean; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.some - */ - some( - predicate?: ListIterator|NumericDictionaryIterator - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - some( - predicate?: string|[string, any] - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - some( - predicate?: PartialObject - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.some - */ - some( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator|ObjectIterator - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - some( - predicate?: string|[string, any] - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - some( - predicate?: PartialObject + this: LoDashExplicitWrapper | null | undefined>, + predicate?: NumericDictionaryIteratee ): LoDashExplicitWrapper; } @@ -9714,163 +6908,54 @@ declare namespace _ { * }); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ - sortBy( - collection: List | null | undefined, - iteratee?: ListIterator - ): T[]; - - /** - * @see _.sortBy - */ - sortBy( - collection: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): T[]; - - /** - * @see _.sortBy - */ - sortBy( - collection: List|Dictionary | null | undefined, - iteratee: string - ): T[]; - - /** - * @see _.sortBy - */ - sortBy( - collection: List|Dictionary | null | undefined, - whereValue: W - ): T[]; - - /** - * @see _.sortBy - */ - sortBy( - collection: List|Dictionary | null | undefined - ): T[]; - - /** - * @see _.sortBy - */ sortBy( collection: List | null | undefined, - iteratees: Array|string|Object> + ...iteratees: Array>> ): T[]; + /** + * @see _.sortBy + */ + sortBy( + collection: T | null | undefined, + ...iteratees: Array>> + ): Array; + } + + interface LoDashImplicitWrapper { /** * @see _.sortBy */ sortBy( - collection: List | null | undefined, - ...iteratees: Array|Object|string> - ): T[]; + this: LoDashImplicitWrapper | null | undefined>, + ...iteratees: Array>> + ): LoDashImplicitWrapper; + + /** + * @see _.sortBy + */ + sortBy( + this: LoDashImplicitWrapper, + ...iteratees: Array>> + ): LoDashImplicitWrapper>; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.sortBy */ - sortBy( - iteratee?: ListIterator - ): LoDashImplicitArrayWrapper; + sortBy( + this: LoDashExplicitWrapper | null | undefined>, + ...iteratees: Array>> + ): LoDashExplicitWrapper; /** * @see _.sortBy */ - sortBy(iteratee: string): LoDashImplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(whereValue: W): LoDashImplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(): LoDashImplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(...iteratees: Array|Object|string>): LoDashImplicitArrayWrapper; - - /** - * @see _.sortBy - **/ - sortBy(iteratees: Array|string|Object>): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.sortBy - */ - sortBy( - iteratee?: ListIterator|DictionaryIterator - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(iteratee: string): LoDashImplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(whereValue: W): LoDashImplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sortBy - */ - sortBy( - iteratee?: ListIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(iteratee: string): LoDashExplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(whereValue: W): LoDashExplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.sortBy - */ - sortBy( - iteratee?: ListIterator|DictionaryIterator - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(iteratee: string): LoDashExplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(whereValue: W): LoDashExplicitArrayWrapper; - - /** - * @see _.sortBy - */ - sortBy(): LoDashExplicitArrayWrapper; + sortBy( + this: LoDashExplicitWrapper, + ...iteratees: Array>> + ): LoDashExplicitWrapper>; } //_.orderBy @@ -9902,9 +6987,9 @@ declare namespace _ { * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ - orderBy( + orderBy( collection: List | null | undefined, - iteratees?: Many|string|W>, + iteratees?: Many>, orders?: Many ): T[]; @@ -9913,16 +6998,34 @@ declare namespace _ { */ orderBy( collection: List | null | undefined, - iteratees?: Many|string|Object>, + iteratees?: Many>, orders?: Many ): T[]; /** * @see _.orderBy */ - orderBy( + orderBy( + collection: T | null | undefined, + iteratees?: Many>, + orders?: Many + ): Array; + + /** + * @see _.orderBy + */ + orderBy( + collection: T | null | undefined, + iteratees?: Many>, + orders?: Many + ): Array; + + /** + * @see _.orderBy + */ + orderBy( collection: NumericDictionary | null | undefined, - iteratees?: Many|string|W>, + iteratees?: Many>, orders?: Many ): T[]; @@ -9931,167 +7034,121 @@ declare namespace _ { */ orderBy( collection: NumericDictionary | null | undefined, - iteratees?: Many|string|Object>, - orders?: Many - ): T[]; - - /** - * @see _.orderBy - */ - orderBy( - collection: Dictionary | null | undefined, - iteratees?: Many|string|W>, - orders?: Many - ): T[]; - - /** - * @see _.orderBy - */ - orderBy( - collection: Dictionary | null | undefined, - iteratees?: Many|string|Object>, + iteratees?: Many>, orders?: Many ): T[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.orderBy */ - orderBy( - iteratees?: Many|string>, + orderBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratees?: Many>, orders?: Many - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; + + /** + * @see _.orderBy + */ + orderBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratees?: Many>, + orders?: Many + ): LoDashImplicitWrapper; + + /** + * @see _.orderBy + */ + orderBy( + this: LoDashImplicitWrapper, + iteratees?: Many>, + orders?: Many + ): LoDashImplicitWrapper>; + + /** + * @see _.orderBy + */ + orderBy( + this: LoDashImplicitWrapper, + iteratees?: Many>, + orders?: Many + ): LoDashImplicitWrapper>; + + /** + * @see _.orderBy + */ + orderBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratees?: Many>, + orders?: Many + ): LoDashImplicitWrapper; + + /** + * @see _.orderBy + */ + orderBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratees?: Many>, + orders?: Many + ): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.orderBy */ - orderBy( - iteratees?: Many|string|W>, + orderBy( + this: LoDashExplicitWrapper | null | undefined>, + iteratees?: Many>, orders?: Many - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string|W>, - orders?: Many - ): LoDashImplicitArrayWrapper; + ): LoDashExplicitWrapper; /** * @see _.orderBy */ orderBy( - iteratees?: Many|string|Object>, + this: LoDashExplicitWrapper | null | undefined>, + iteratees?: Many>, orders?: Many - ): LoDashImplicitArrayWrapper; + ): LoDashExplicitWrapper; /** * @see _.orderBy */ - orderBy( - iteratees?: Many|string|W>, + orderBy( + this: LoDashExplicitWrapper, + iteratees?: Many>, orders?: Many - ): LoDashImplicitArrayWrapper; + ): LoDashExplicitWrapper>; + + /** + * @see _.orderBy + */ + orderBy( + this: LoDashExplicitWrapper, + iteratees?: Many>, + orders?: Many + ): LoDashExplicitWrapper>; /** * @see _.orderBy */ orderBy( - iteratees?: Many|string|Object>, + this: LoDashExplicitWrapper | null | undefined>, + iteratees?: Many>, orders?: Many - ): LoDashImplicitArrayWrapper; - - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string|W>, - orders?: Many - ): LoDashImplicitArrayWrapper; + ): LoDashExplicitWrapper; /** * @see _.orderBy */ orderBy( - iteratees?: Many|string|Object>, + this: LoDashExplicitWrapper | null | undefined>, + iteratees?: Many>, orders?: Many - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string>, - orders?: Many - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string|W|(ListIterator|string|W)>, - orders?: Many - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string|W>, - orders?: Many - ): LoDashExplicitArrayWrapper; - - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string|Object>, - orders?: Many - ): LoDashExplicitArrayWrapper; - - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string|W>, - orders?: Many - ): LoDashExplicitArrayWrapper; - - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string|Object>, - orders?: Many - ): LoDashExplicitArrayWrapper; - - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string|W>, - orders?: Many - ): LoDashExplicitArrayWrapper; - - /** - * @see _.orderBy - */ - orderBy( - iteratees?: Many|string|Object>, - orders?: Many - ): LoDashExplicitArrayWrapper; + ): LoDashExplicitWrapper; } /******** @@ -10108,14 +7165,14 @@ declare namespace _ { now(): number; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.now */ now(): number; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.now */ @@ -10135,24 +7192,24 @@ declare namespace _ { * @param func The function to restrict. * @return Returns the new restricted function. */ - after( + after any>( n: number, func: TFunc ): TFunc; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.after **/ - after(func: TFunc): LoDashImplicitObjectWrapper; + after any>(func: TFunc): LoDashImplicitWrapper; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.after **/ - after(func: TFunc): LoDashExplicitObjectWrapper; + after any>(func: TFunc): LoDashExplicitWrapper; } //_.ary @@ -10164,29 +7221,24 @@ declare namespace _ { * @param n The arity cap. * @returns Returns the new function. */ - ary( - func: Function, + ary( + func: (...args: any[]) => any, n?: number - ): TResult; - - ary( - func: T, - n?: number - ): TResult; + ): (...args: any[]) => any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.ary */ - ary(n?: number): LoDashImplicitObjectWrapper; + ary(n?: number): LoDashImplicitWrapper<(...args: any[]) => any>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.ary */ - ary(n?: number): LoDashExplicitObjectWrapper; + ary(n?: number): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.before @@ -10200,41 +7252,35 @@ declare namespace _ { * @param func The function to restrict. * @return Returns the new restricted function. */ - before( + before any>( n: number, func: TFunc ): TFunc; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.before **/ - before(func: TFunc): LoDashImplicitObjectWrapper; + before any>(func: TFunc): LoDashImplicitWrapper; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.before **/ - before(func: TFunc): LoDashExplicitObjectWrapper; + before any>(func: TFunc): LoDashExplicitWrapper; } //_.bind interface FunctionBind { placeholder: any; - ( - func: T, + ( + func: (...args: any[]) => any, thisArg: any, ...partials: any[] - ): TResult; - - ( - func: Function, - thisArg: any, - ...partials: any[] - ): TResult; + ): (...args: any[]) => any; } interface LoDashStatic { @@ -10255,24 +7301,24 @@ declare namespace _ { bind: FunctionBind; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.bind */ - bind( + bind( thisArg: any, ...partials: any[] - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper<(...args: any[]) => any>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.bind */ - bind( + bind( thisArg: any, ...partials: any[] - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.bindAll @@ -10295,35 +7341,22 @@ declare namespace _ { ): T; } - interface LoDashImplicitObjectWrapper { + interface LoDashWrapper { /** * @see _.bindAll */ - bindAll(...methodNames: Array>): LoDashImplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.bindAll - */ - bindAll(...methodNames: Array>): LoDashExplicitObjectWrapper; + bindAll(...methodNames: Array>): this; } //_.bindKey interface FunctionBindKey { placeholder: any; - ( - object: T, - key: any, + ( + object: object, + key: string, ...partials: any[] - ): TResult; - - ( - object: Object, - key: any, - ...partials: any[] - ): TResult; + ): (...args: any[]) => any; } interface LoDashStatic { @@ -10345,64 +7378,24 @@ declare namespace _ { bindKey: FunctionBindKey; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.bindKey */ - bindKey( - key: any, + bindKey( + key: string, ...partials: any[] - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper<(...args: any[]) => any>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.bindKey */ - bindKey( - key: any, + bindKey( + key: string, ...partials: any[] - ): LoDashExplicitObjectWrapper; - } - - //_.createCallback - interface LoDashStatic { - /** - * Produces a callback bound to an optional thisArg. If func is a property name the created - * callback will return the property value for a given element. If func is an object the created - * callback will return true for elements that contain the equivalent object properties, - * otherwise it will return false. - * @param func The value to convert to a callback. - * @param thisArg The this binding of the created callback. - * @param argCount The number of arguments the callback accepts. - * @return A callback function. - **/ - createCallback( - func: string, - argCount?: number): () => any; - - /** - * @see _.createCallback - **/ - createCallback( - func: Dictionary, - argCount?: number): () => boolean; - } - - interface LoDashImplicitWrapper { - /** - * @see _.createCallback - **/ - createCallback( - argCount?: number): LoDashImplicitObjectWrapper<() => any>; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.createCallback - **/ - createCallback( - argCount?: number): LoDashImplicitObjectWrapper<() => any>; + ): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.curry @@ -10412,45 +7405,50 @@ declare namespace _ { * 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(func: (t1: T1) => R): + curry(func: (t1: T1) => R, arity?: number): 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. */ - curry(func: (t1: T1, t2: T2) => R): + curry(func: (t1: T1, t2: T2) => R, arity?: number): 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. */ - curry(func: (t1: T1, t2: T2, t3: T3) => R): + curry(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): 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. */ - curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): 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. */ - curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): CurriedFunction5; /** * Creates a function that accepts one or more arguments of func that when called either invokes func returning @@ -10460,9 +7458,7 @@ declare namespace _ { * @param arity The arity of func. * @return Returns the new curried function. */ - curry( - func: Function, - arity?: number): TResult; + curry(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; } interface CurriedFunction1 { @@ -10499,42 +7495,109 @@ declare namespace _ { (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; } - interface RightCurriedFunction1{ - ():RightCurriedFunction1 - (t1:T1):R - } - interface RightCurriedFunction2{ - ():RightCurriedFunction2 - (t2:T2):RightCurriedFunction1 - (t1:T1,t2:T2):R + interface RightCurriedFunction1 { + (): RightCurriedFunction1; + (t1: T1): R; } - interface RightCurriedFunction3{ - ():RightCurriedFunction3 - (t3:T3):RightCurriedFunction2 - (t2:T2,t3:T3):RightCurriedFunction1 - (t1:T1,t2:T2,t3:T3):R + interface RightCurriedFunction2 { + (): RightCurriedFunction2; + (t2: T2): RightCurriedFunction1; + (t1: T1, t2: T2): R; } - interface RightCurriedFunction4{ - ():RightCurriedFunction4 - (t4:T4):RightCurriedFunction3 - (t3:T3,t4:T4):RightCurriedFunction2 - (t2:T2,t3:T3,t4:T4):RightCurriedFunction1 - (t1:T1,t2:T2,t3:T3,t4:T4):R + interface RightCurriedFunction3 { + (): RightCurriedFunction3; + (t3: T3): RightCurriedFunction2; + (t2: T2, t3: T3): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; } - interface RightCurriedFunction5{ - ():RightCurriedFunction5 - (t5:T5):RightCurriedFunction4 - (t4:T4,t5:T5):RightCurriedFunction3 - (t3:T3,t4:T4,t5:T5):RightCurriedFunction2 - (t2:T2,t3:T3,t4:T4,t5:T5):RightCurriedFunction1 - (t1:T1,t2:T2,t3:T3,t4:T4,t5:T5):R + interface RightCurriedFunction4 { + (): RightCurriedFunction4; + (t4: T4): RightCurriedFunction3; + (t3: T3, t4: T4): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; + } + interface RightCurriedFunction5 { + (): RightCurriedFunction5; + (t5: T5): RightCurriedFunction4; + (t4: T4, t5: T5): RightCurriedFunction3; + (t3: T3, t4: T4, t5: T5): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.curry **/ - curry(arity?: number): LoDashImplicitObjectWrapper; + curry(this: LoDashImplicitWrapper<(t1: T1) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curry + **/ + curry(this: LoDashImplicitWrapper<(t1: T1, t2: T2) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curry + **/ + curry(this: LoDashImplicitWrapper<(t1: T1, t2: T2, t3: T3) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curry + **/ + curry(this: LoDashImplicitWrapper<(t1: T1, t2: T2, t3: T3, t4: T4) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curry + **/ + curry(this: LoDashImplicitWrapper<(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curry + **/ + curry(arity?: number): LoDashImplicitWrapper<(...args: any[]) => any>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.curry + **/ + curry(this: LoDashExplicitWrapper<(t1: T1) => R>): + LoDashExplicitWrapper>; + + /** + * @see _.curry + **/ + curry(this: LoDashExplicitWrapper<(t1: T1, t2: T2) => R>): + LoDashExplicitWrapper>; + + /** + * @see _.curry + **/ + curry(this: LoDashExplicitWrapper<(t1: T1, t2: T2, t3: T3) => R>): + LoDashExplicitWrapper>; + + /** + * @see _.curry + **/ + curry(this: LoDashExplicitWrapper<(t1: T1, t2: T2, t3: T3, t4: T4) => R>): + LoDashExplicitWrapper>; + + /** + * @see _.curry + **/ + curry(this: LoDashExplicitWrapper<(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R>): + LoDashExplicitWrapper>; + + /** + * @see _.curry + **/ + curry(arity?: number): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.curryRight @@ -10543,41 +7606,46 @@ declare namespace _ { * 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(func: (t1: T1) => R): + curryRight(func: (t1: T1) => R, arity?: number): 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. */ - curryRight(func: (t1: T1, t2: T2) => R): + curryRight(func: (t1: T1, t2: T2) => R, arity?: number): 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. */ - curryRight(func: (t1: T1, t2: T2, t3: T3) => R): + curryRight(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): 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. */ - curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): 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. */ - curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): RightCurriedFunction5; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight @@ -10586,16 +7654,81 @@ declare namespace _ { * @param arity The arity of func. * @return Returns the new curried function. */ - curryRight( - func: Function, - arity?: number): TResult; + curryRight(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.curryRight **/ - curryRight(arity?: number): LoDashImplicitObjectWrapper; + curryRight(this: LoDashImplicitWrapper<(t1: T1) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(this: LoDashImplicitWrapper<(t1: T1, t2: T2) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(this: LoDashImplicitWrapper<(t1: T1, t2: T2, t3: T3) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(this: LoDashImplicitWrapper<(t1: T1, t2: T2, t3: T3, t4: T4) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(this: LoDashImplicitWrapper<(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R>, arity?: number): + LoDashImplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(arity?: number): LoDashImplicitWrapper<(...args: any[]) => any>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.curryRight + **/ + curryRight(this: LoDashExplicitWrapper<(t1: T1) => R>, arity?: number): + LoDashExplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(this: LoDashExplicitWrapper<(t1: T1, t2: T2) => R>, arity?: number): + LoDashExplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(this: LoDashExplicitWrapper<(t1: T1, t2: T2, t3: T3) => R>, arity?: number): + LoDashExplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(this: LoDashExplicitWrapper<(t1: T1, t2: T2, t3: T3, t4: T4) => R>, arity?: number): + LoDashExplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(this: LoDashExplicitWrapper<(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R>, arity?: number): + LoDashExplicitWrapper>; + + /** + * @see _.curryRight + **/ + curryRight(arity?: number): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.debounce @@ -10637,31 +7770,31 @@ declare namespace _ { * @param options.trailing Specify invoking on the trailing edge of the timeout. * @return Returns the new debounced function. */ - debounce( + debounce any>( func: T, wait?: number, options?: DebounceSettings ): T & Cancelable; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.debounce */ debounce( wait?: number, options?: DebounceSettings - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.debounce */ debounce( wait?: number, options?: DebounceSettings - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; } //_.defer @@ -10674,20 +7807,20 @@ declare namespace _ { * @param args The arguments to invoke the function with. * @return Returns the timer id. */ - defer( - func: T, + defer( + func: (...args: any[]) => any, ...args: any[] ): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.defer */ defer(...args: any[]): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.defer */ @@ -10704,14 +7837,14 @@ declare namespace _ { * @param args The arguments to invoke the function with. * @return Returns the timer id. */ - delay( - func: T, + delay( + func: (...args: any[]) => any, wait: number, ...args: any[] ): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.delay */ @@ -10721,7 +7854,7 @@ declare namespace _ { ): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.delay */ @@ -10749,21 +7882,14 @@ declare namespace _ { * flipped('a', 'b', 'c', 'd'); * // => ['d', 'c', 'b', 'a'] */ - flip(func: T): T; + flip any>(func: T): T; } - interface LoDashImplicitObjectWrapper { + interface LoDashWrapper { /** * @see _.flip */ - flip(): LoDashImplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.flip - */ - flip(): LoDashExplicitObjectWrapper; + flip(): this; } //_.flow @@ -10811,30 +7937,93 @@ declare namespace _ { flow(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; flow(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; // generic function - flow(...funcs: Function[]): TResult; - flow(funcs: Function[]): TResult; + flow(...funcs: Array any>>): (...args: any[]) => any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.flow */ - flow(...funcs: Function[]): LoDashImplicitObjectWrapper; - /** - * @see _.flow - */ - flow(funcs: Function[]): LoDashImplicitObjectWrapper; + // 0-argument first function + flow(this: LoDashImplicitWrapper<() => R1>, f2: (a: R1) => R2): LoDashImplicitWrapper<() => R2>; + flow(this: LoDashImplicitWrapper<() => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashImplicitWrapper<() => R3>; + flow(this: LoDashImplicitWrapper<() => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashImplicitWrapper<() => R4>; + flow(this: LoDashImplicitWrapper<() => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): LoDashImplicitWrapper<() => R5>; + flow(this: LoDashImplicitWrapper<() => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): LoDashImplicitWrapper<() => R6>; + flow(this: LoDashImplicitWrapper<() => 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): LoDashImplicitWrapper<() => R7>; + // 1-argument first function + flow(this: LoDashImplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2): LoDashImplicitWrapper<(a1: A1) => R2>; + flow(this: LoDashImplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashImplicitWrapper<(a1: A1) => R3>; + flow(this: LoDashImplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashImplicitWrapper<(a1: A1) => R4>; + flow(this: LoDashImplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): LoDashImplicitWrapper<(a1: A1) => R5>; + flow(this: LoDashImplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): LoDashImplicitWrapper<(a1: A1) => R6>; + flow(this: LoDashImplicitWrapper<(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): LoDashImplicitWrapper<(a1: A1) => R7>; + // 2-argument first function + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2) => R1>, f2: (a: R1) => R2): LoDashImplicitWrapper<(a1: A1, a2: A2) => R2>; + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashImplicitWrapper<(a1: A1, a2: A2) => R3>; + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashImplicitWrapper<(a1: A1, a2: A2) => R4>; + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): LoDashImplicitWrapper<(a1: A1, a2: A2) => R5>; + flow(this: LoDashImplicitWrapper<(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): LoDashImplicitWrapper<(a1: A1, a2: A2) => R6>; + flow(this: LoDashImplicitWrapper<(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): LoDashImplicitWrapper<(a1: A1, a2: A2) => R7>; + // 3-argument first function + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R1>, f2: (a: R1) => R2): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R2>; + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R3>; + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R4>; + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R5>; + flow(this: LoDashImplicitWrapper<(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): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R6>; + flow(this: LoDashImplicitWrapper<(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): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3) => R7>; + // 4-argument first function + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R1>, f2: (a: R1) => R2): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R2>; + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R3>; + flow(this: LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R4>; + flow(this: LoDashImplicitWrapper<(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): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R5>; + flow(this: LoDashImplicitWrapper<(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): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R6>; + flow(this: LoDashImplicitWrapper<(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): LoDashImplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R7>; + // generic function + flow(...funcs: Array any>>): LoDashImplicitWrapper<(...args: any[]) => any>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.flow */ - flow(...funcs: Function[]): LoDashExplicitObjectWrapper; - /** - * @see _.flow - */ - flow(funcs: Function[]): LoDashExplicitObjectWrapper; + // 0-argument first function + flow(this: LoDashExplicitWrapper<() => R1>, f2: (a: R1) => R2): LoDashExplicitWrapper<() => R2>; + flow(this: LoDashExplicitWrapper<() => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashExplicitWrapper<() => R3>; + flow(this: LoDashExplicitWrapper<() => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashExplicitWrapper<() => R4>; + flow(this: LoDashExplicitWrapper<() => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): LoDashExplicitWrapper<() => R5>; + flow(this: LoDashExplicitWrapper<() => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): LoDashExplicitWrapper<() => R6>; + flow(this: LoDashExplicitWrapper<() => 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): LoDashExplicitWrapper<() => R7>; + // 1-argument first function + flow(this: LoDashExplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2): LoDashExplicitWrapper<(a1: A1) => R2>; + flow(this: LoDashExplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashExplicitWrapper<(a1: A1) => R3>; + flow(this: LoDashExplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashExplicitWrapper<(a1: A1) => R4>; + flow(this: LoDashExplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): LoDashExplicitWrapper<(a1: A1) => R5>; + flow(this: LoDashExplicitWrapper<(a1: A1) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): LoDashExplicitWrapper<(a1: A1) => R6>; + flow(this: LoDashExplicitWrapper<(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): LoDashExplicitWrapper<(a1: A1) => R7>; + // 2-argument first function + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2) => R1>, f2: (a: R1) => R2): LoDashExplicitWrapper<(a1: A1, a2: A2) => R2>; + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashExplicitWrapper<(a1: A1, a2: A2) => R3>; + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashExplicitWrapper<(a1: A1, a2: A2) => R4>; + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): LoDashExplicitWrapper<(a1: A1, a2: A2) => R5>; + flow(this: LoDashExplicitWrapper<(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): LoDashExplicitWrapper<(a1: A1, a2: A2) => R6>; + flow(this: LoDashExplicitWrapper<(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): LoDashExplicitWrapper<(a1: A1, a2: A2) => R7>; + // 3-argument first function + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R1>, f2: (a: R1) => R2): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R2>; + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R3>; + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R4>; + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R5>; + flow(this: LoDashExplicitWrapper<(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): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R6>; + flow(this: LoDashExplicitWrapper<(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): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3) => R7>; + // 4-argument first function + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R1>, f2: (a: R1) => R2): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R2>; + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R3>; + flow(this: LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R1>, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R4>; + flow(this: LoDashExplicitWrapper<(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): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R5>; + flow(this: LoDashExplicitWrapper<(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): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R6>; + flow(this: LoDashExplicitWrapper<(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): LoDashExplicitWrapper<(a1: A1, a2: A2, a3: A3, a4: A4) => R7>; + // generic function + flow(...funcs: Array any>>): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.flowRight @@ -10846,37 +8035,25 @@ declare namespace _ { * @param funcs Functions to invoke. * @return Returns the new function. */ - flowRight(...funcs: Function[]): TResult; - /** - * @see _.flowRight - */ - flowRight(funcs: Function[]): TResult; + flowRight(...funcs: Array any>>): (...args: any[]) => any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.flowRight */ - flowRight(...funcs: Function[]): LoDashImplicitObjectWrapper; - /** - * @see _.flowRight - */ - flowRight(funcs: Function[]): LoDashImplicitObjectWrapper; + flowRight(...funcs: Array any>>): LoDashImplicitWrapper<(...args: any[]) => any>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.flowRight */ - flowRight(...funcs: Function[]): LoDashExplicitObjectWrapper; - /** - * @see _.flowRight - */ - flowRight(funcs: Function[]): LoDashExplicitObjectWrapper; + flowRight(...funcs: Array any>>): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.memoize - interface MemoizedFunction extends Function { + interface MemoizedFunction { cache: MapCache; } @@ -10892,23 +8069,23 @@ declare namespace _ { * @return Returns the new memoizing function. */ memoize: { - (func: T, resolver?: Function): T & MemoizedFunction; + any>(func: T, resolver?: (...args: any[]) => any): T & MemoizedFunction; Cache: MapCacheConstructor; }; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.memoize */ - memoize(resolver?: Function): LoDashImplicitObjectWrapper; + memoize(resolver?: (...args: any[]) => any): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.memoize */ - memoize(resolver?: Function): LoDashExplicitObjectWrapper; + memoize(resolver?: (...args: any[]) => any): LoDashExplicitWrapper; } //_.overArgs (was _.modArgs) @@ -10921,42 +8098,24 @@ declare namespace _ { * of functions. * @return Returns the new function. */ - overArgs( - func: T, - ...transforms: Function[] - ): TResult; - - /** - * @see _.overArgs - */ - overArgs( - func: T, - transforms: Function[] - ): TResult; + overArgs( + func: (...args: any[]) => any, + ...transforms: Array any>> + ): (...args: any[]) => any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.overArgs */ - overArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; - - /** - * @see _.overArgs - */ - overArgs(transforms: Function[]): LoDashImplicitObjectWrapper; + overArgs(...transforms: Array any>>): LoDashImplicitWrapper<(...args: any[]) => any>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.overArgs */ - overArgs(...transforms: Function[]): LoDashExplicitObjectWrapper; - - /** - * @see _.overArgs - */ - overArgs(transforms: Function[]): LoDashExplicitObjectWrapper; + overArgs(...transforms: Array any>>): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.negate @@ -10968,36 +8127,14 @@ declare namespace _ { * @param predicate The predicate to negate. * @return Returns the new function. */ - negate(predicate: T): (...args: any[]) => boolean; - - /** - * @see _.negate - */ - negate(predicate: T): TResult; + negate any>(predicate: T): T; } - interface LoDashImplicitObjectWrapper { + interface LoDashWrapper { /** * @see _.negate */ - negate(): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; - - /** - * @see _.negate - */ - negate(): LoDashImplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.negate - */ - negate(): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; - - /** - * @see _.negate - */ - negate(): LoDashExplicitObjectWrapper; + negate(): this; } //_.once @@ -11009,21 +8146,14 @@ declare namespace _ { * @param func The function to restrict. * @return Returns the new restricted function. */ - once(func: T): T; + once any>(func: T): T; } - interface LoDashImplicitObjectWrapper { + interface LoDashWrapper { /** * @see _.once */ - once(): LoDashImplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.once - */ - once(): LoDashExplicitObjectWrapper; + once(): this; } //_.partial @@ -11039,6 +8169,20 @@ declare namespace _ { partial: Partial; } + interface LoDashImplicitWrapper { + /** + * @see _.partial + */ + partial: ImplicitPartial; + } + + interface LoDashExplicitWrapper { + /** + * @see _.partial + */ + partial: ExplicitPartial; + } + type PH = LoDashStatic; type Function0 = () => R; @@ -11085,7 +8229,89 @@ declare namespace _ { (func: Function4, plc1: PH, arg2: T2, arg3: T3, arg4: T4): Function1; (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; // catch-all - (func: Function, ...args: any[]): Function; + (func: (...args: any[]) => any, ...args: any[]): (...args: any[]) => any; + } + + interface ImplicitPartial { + // arity 0 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + // arity 1 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1): LoDashImplicitWrapper>; + // arity 2 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, arg2: T2): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2): LoDashImplicitWrapper>; + // arity 3 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, arg2: T2): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, plc2: PH, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, arg2: T2, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, arg3: T3): LoDashImplicitWrapper>; + // arity 4 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, arg2: T2): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, plc2: PH, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, arg2: T2, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, plc2: PH, plc3: PH, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, plc3: PH, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, arg2: T2, plc3: PH, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, plc3: PH, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, plc2: PH, arg3: T3, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, arg3: T3, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, plc1: PH, arg2: T2, arg3: T3, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, arg3: T3, arg4: T4): LoDashImplicitWrapper>; + // catch-all + (...args: any[]): LoDashImplicitWrapper<(...args: any[]) => any>; + } + + interface ExplicitPartial { + // arity 0 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + // arity 1 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1): LoDashExplicitWrapper>; + // arity 2 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, arg2: T2): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2): LoDashExplicitWrapper>; + // arity 3 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, arg2: T2): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, plc2: PH, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, arg2: T2, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, arg3: T3): LoDashExplicitWrapper>; + // arity 4 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, arg2: T2): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, plc2: PH, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, arg2: T2, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, plc2: PH, plc3: PH, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, plc3: PH, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, arg2: T2, plc3: PH, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, plc3: PH, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, plc2: PH, arg3: T3, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, arg3: T3, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, plc1: PH, arg2: T2, arg3: T3, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, arg3: T3, arg4: T4): LoDashExplicitWrapper>; + // catch-all + (...args: any[]): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.partialRight @@ -11100,6 +8326,20 @@ declare namespace _ { partialRight: PartialRight; } + interface LoDashImplicitWrapper { + /** + * @see _.partialRight + */ + partialRight: ImplicitPartialRight; + } + + interface LoDashExplicitWrapper { + /** + * @see _.partialRight + */ + partialRight: ExplicitPartialRight; + } + interface PartialRight { // arity 0 (func: Function0): Function0; @@ -11138,7 +8378,89 @@ declare namespace _ { (func: Function4, arg2: T2, arg3: T3, arg4: T4): Function1; (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; // catch-all - (func: Function, ...args: any[]): Function; + (func: (...args: any[]) => any, ...args: any[]): (...args: any[]) => any; + } + + interface ImplicitPartialRight { + // arity 0 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + // arity 1 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1): LoDashImplicitWrapper>; + // arity 2 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg2: T2): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2): LoDashImplicitWrapper>; + // arity 3 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, plc3: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg2: T2, plc3: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, plc3: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg2: T2, arg3: T3): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, arg3: T3): LoDashImplicitWrapper>; + // arity 4 + (this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, plc3: PH, plc4: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg2: T2, plc3: PH, plc4: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, plc3: PH, plc4: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg3: T3, plc4: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, arg3: T3, plc4: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg2: T2, arg3: T3, plc4: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, arg3: T3, plc4: PH): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, plc3: PH, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg2: T2, plc3: PH, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, plc3: PH, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg3: T3, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, plc2: PH, arg3: T3, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg2: T2, arg3: T3, arg4: T4): LoDashImplicitWrapper>; + (this: LoDashImplicitWrapper>, arg1: T1, arg2: T2, arg3: T3, arg4: T4): LoDashImplicitWrapper>; + // catch-all + (...args: any[]): LoDashImplicitWrapper<(...args: any[]) => any>; + } + + interface ExplicitPartialRight { + // arity 0 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + // arity 1 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1): LoDashExplicitWrapper>; + // arity 2 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg2: T2): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2): LoDashExplicitWrapper>; + // arity 3 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, plc3: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg2: T2, plc3: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, plc3: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg2: T2, arg3: T3): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, arg3: T3): LoDashExplicitWrapper>; + // arity 4 + (this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, plc3: PH, plc4: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg2: T2, plc3: PH, plc4: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, plc3: PH, plc4: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg3: T3, plc4: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, arg3: T3, plc4: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg2: T2, arg3: T3, plc4: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, arg3: T3, plc4: PH): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, plc3: PH, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg2: T2, plc3: PH, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, plc3: PH, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg3: T3, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, plc2: PH, arg3: T3, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg2: T2, arg3: T3, arg4: T4): LoDashExplicitWrapper>; + (this: LoDashExplicitWrapper>, arg1: T1, arg2: T2, arg3: T3, arg4: T4): LoDashExplicitWrapper>; + // catch-all + (...args: any[]): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.rearg @@ -11151,24 +8473,21 @@ declare namespace _ { * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. * @return Returns the new function. */ - rearg(func: Function, indexes: number[]): TResult; - - /** - * @see _.rearg - */ - rearg(func: Function, ...indexes: number[]): TResult; + rearg(func: (...args: any[]) => any, ...indexes: Array>): (...args: any[]) => any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.rearg */ - rearg(indexes: number[]): LoDashImplicitObjectWrapper; + rearg(...indexes: Array>): LoDashImplicitWrapper<(...args: any[]) => any>; + } + interface LoDashExplicitWrapper { /** * @see _.rearg */ - rearg(...indexes: number[]): LoDashImplicitObjectWrapper; + rearg(...indexes: Array>): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.rest @@ -11183,32 +8502,24 @@ declare namespace _ { * @param start The start position of the rest parameter. * @return Returns the new function. */ - rest( - func: Function, + rest( + func: (...args: any[]) => any, start?: number - ): TResult; - - /** - * @see _.rest - */ - rest( - func: TFunc, - start?: number - ): TResult; + ): (...args: any[]) => any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.rest */ - rest(start?: number): LoDashImplicitObjectWrapper; + rest(start?: number): LoDashImplicitWrapper<(...args: any[]) => any>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.rest */ - rest(start?: number): LoDashExplicitObjectWrapper; + rest(start?: number): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.spread @@ -11222,26 +8533,36 @@ declare namespace _ { * @param func The function to spread arguments over. * @return Returns the new function. */ - spread(func: F): T; + spread(func: (...args: any[]) => TResult): (...args: any[]) => TResult; /** * @see _.spread */ - spread(func: Function): T; + spread(func: (...args: any[]) => TResult, start: number): (...args: any[]) => TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.spread */ - spread(): LoDashImplicitObjectWrapper; + spread(this: LoDashImplicitWrapper<(...args: any[]) => TResult>): LoDashImplicitWrapper<(...args: any[]) => TResult>; + + /** + * @see _.spread + */ + spread(this: LoDashImplicitWrapper<(...args: any[]) => TResult>, start: number): LoDashImplicitWrapper<(...args: any[]) => TResult>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.spread */ - spread(): LoDashExplicitObjectWrapper; + spread(this: LoDashExplicitWrapper<(...args: any[]) => TResult>): LoDashExplicitWrapper<(...args: any[]) => TResult>; + + /** + * @see _.spread + */ + spread(this: LoDashExplicitWrapper<(...args: any[]) => TResult>, start: number): LoDashExplicitWrapper<(...args: any[]) => TResult>; } //_.throttle @@ -11274,31 +8595,31 @@ declare namespace _ { * @param options.trailing Specify invoking on the trailing edge of the timeout. * @return Returns the new throttled function. */ - throttle( + throttle any>( func: T, wait?: number, options?: ThrottleSettings ): T & Cancelable; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.throttle */ throttle( wait?: number, options?: ThrottleSettings - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.throttle */ throttle( wait?: number, options?: ThrottleSettings - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; } //_.unary @@ -11317,21 +8638,21 @@ declare namespace _ { * _.map(['6', '8', '10'], _.unary(parseInt)); * // => [6, 8, 10] */ - unary(func: T): T; + unary(func: (arg1: T, ...args: any[]) => TResult): (arg1: T) => TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.unary */ - unary(): LoDashImplicitObjectWrapper; + unary(this: LoDashImplicitWrapper<(arg1: T, ...args: any[]) => TResult>): LoDashImplicitWrapper<(arg1: T) => TResult>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.unary */ - unary(): LoDashExplicitObjectWrapper; + unary(this: LoDashExplicitWrapper<(arg1: T, ...args: any[]) => TResult>): LoDashExplicitWrapper<(arg1: T) => TResult>; } //_.wrap @@ -11345,98 +8666,53 @@ declare namespace _ { * @param wrapper The wrapper function. * @return Returns the new function. */ - wrap( - value: V, - wrapper: W - ): R; + wrap( + value: T, + wrapper: (value: T, ...args: TArgs[]) => TResult + ): (...args: TArgs[]) => TResult; /** * @see _.wrap */ - wrap( - value: V, - wrapper: Function - ): R; - - /** - * @see _.wrap - */ - wrap( - value: any, - wrapper: Function - ): R; + wrap( + value: T, + wrapper: (value: T, ...args: any[]) => TResult + ): (...args: any[]) => TResult; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.wrap */ - wrap(wrapper: W): LoDashImplicitObjectWrapper; + wrap( + wrapper: (value: TValue, ...args: TArgs[]) => TResult + ): LoDashImplicitWrapper<(...args: TArgs[]) => TResult>; /** * @see _.wrap */ - wrap(wrapper: Function): LoDashImplicitObjectWrapper; + wrap( + wrapper: (value: TValue, ...args: any[]) => TResult + ): LoDashImplicitWrapper<(...args: any[]) => TResult>; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.wrap */ - wrap(wrapper: W): LoDashImplicitObjectWrapper; + /** + * @see _.wrap + */ + wrap( + wrapper: (value: TValue, ...args: TArgs[]) => TResult + ): LoDashExplicitWrapper<(...args: TArgs[]) => TResult>; /** * @see _.wrap */ - wrap(wrapper: Function): LoDashImplicitObjectWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.wrap - */ - wrap(wrapper: W): LoDashImplicitObjectWrapper; - - /** - * @see _.wrap - */ - wrap(wrapper: Function): LoDashImplicitObjectWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.wrap - */ - wrap(wrapper: W): LoDashExplicitObjectWrapper; - - /** - * @see _.wrap - */ - wrap(wrapper: Function): LoDashExplicitObjectWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.wrap - */ - wrap(wrapper: W): LoDashExplicitObjectWrapper; - - /** - * @see _.wrap - */ - wrap(wrapper: Function): LoDashExplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.wrap - */ - wrap(wrapper: W): LoDashExplicitObjectWrapper; - - /** - * @see _.wrap - */ - wrap(wrapper: Function): LoDashExplicitObjectWrapper; + wrap( + wrapper: (value: TValue, ...args: any[]) => TResult + ): LoDashExplicitWrapper<(...args: any[]) => TResult>; } /******** @@ -11454,46 +8730,18 @@ declare namespace _ { castArray(value?: Many): T[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.castArray */ - castArray(): LoDashImplicitArrayWrapper; + castArray(this: LoDashImplicitWrapper>): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.castArray */ - castArray(): TWrapper; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.castArray - */ - castArray(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.castArray - */ - castArray(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.castArray - */ - castArray(): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.castArray - */ - castArray(): LoDashExplicitArrayWrapper; + castArray(this: LoDashExplicitWrapper>): LoDashExplicitWrapper; } //_.clone @@ -11512,46 +8760,18 @@ declare namespace _ { clone(value: T): T; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.clone */ - clone(): T; + clone(): TValue; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.clone */ - clone(): TArray; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.clone - */ - clone(): TObject; - } - - interface LoDashExplicitWrapper { - /** - * @see _.clone - */ - clone(): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.clone - */ - clone(): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.clone - */ - clone(): TWrapper; + clone(): this; } //_.cloneDeep @@ -11565,50 +8785,22 @@ declare namespace _ { cloneDeep(value: T): T; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.cloneDeep */ - cloneDeep(): T; + cloneDeep(): TValue; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.cloneDeep */ - cloneDeep(): TArray; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.cloneDeep - */ - cloneDeep(): TObject; - } - - interface LoDashExplicitWrapper { - /** - * @see _.cloneDeep - */ - cloneDeep(): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.cloneDeep - */ - cloneDeep(): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.cloneDeep - */ - cloneDeep(): TWrapper; + cloneDeep(): this; } //_.cloneDeepWith - type CloneDeepWithCustomizer = (value: TValue, key?: number|string, object?: any, stack?: any) => TResult; + type CloneDeepWithCustomizer = (value: any, key: number | string | undefined, object: TObject | undefined, stack: any) => any; interface LoDashStatic { /** @@ -11618,118 +8810,47 @@ declare namespace _ { * @param customizer The function to customize cloning. * @return Returns the deep cloned value. */ - cloneDeepWith( - value: any, - customizer?: CloneDeepWithCustomizer - ): TResult; - - /** - * @see _.clonDeepeWith - */ - cloneDeepWith( + cloneDeepWith( value: T, - customizer?: CloneDeepWithCustomizer - ): TResult; + customizer: CloneDeepWithCustomizer + ): any; + + /** + * @see _.cloneDeepWith + */ + cloneDeepWith(value: T): T; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.cloneDeepWith */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): TResult; + cloneDeepWith( + customizer: CloneDeepWithCustomizer + ): any; + + /** + * @see _.cloneDeepWith + */ + cloneDeepWith(): TValue; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.cloneDeepWith */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): TResult; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.cloneDeepWith - */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): TResult; - } - - interface LoDashExplicitWrapper { - /** - * @see _.cloneDeepWith - */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): LoDashExplicitWrapper; + cloneDeepWith( + customizer: CloneDeepWithCustomizer + ): LoDashExplicitWrapper; /** * @see _.cloneDeepWith */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): LoDashExplicitArrayWrapper; - - /** - * @see _.cloneDeepWith - */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): LoDashExplicitObjectWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.cloneDeepWith - */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): LoDashExplicitWrapper; - - /** - * @see _.cloneDeepWith - */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): LoDashExplicitArrayWrapper; - - /** - * @see _.cloneDeepWith - */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): LoDashExplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.cloneDeepWith - */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): LoDashExplicitWrapper; - - /** - * @see _.cloneDeepWith - */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): LoDashExplicitArrayWrapper; - - /** - * @see _.cloneDeepWith - */ - cloneDeepWith( - customizer?: CloneDeepWithCustomizer - ): LoDashExplicitObjectWrapper; + cloneDeepWith(): this; } //_.cloneWith - type CloneWithCustomizer = (value: TValue, key?: number|string, object?: any, stack?: any) => TResult; + type CloneWithCustomizer = (value: TValue, key: number | string | undefined, object: any, stack: any) => TResult; interface LoDashStatic { /** @@ -11740,9 +8861,9 @@ declare namespace _ { * @param customizer The function to customize cloning. * @return Returns the cloned value. */ - cloneWith( - value: any, - customizer?: CloneWithCustomizer + cloneWith( + value: T, + customizer: CloneWithCustomizer ): TResult; /** @@ -11750,111 +8871,62 @@ declare namespace _ { */ cloneWith( value: T, - customizer?: CloneWithCustomizer - ): TResult; + customizer: CloneWithCustomizer + ): TResult | T; + + /** + * @see _.cloneWith + */ + cloneWith(value: T): T; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { + /** + * @see _.cloneWith + */ + cloneWith( + customizer: CloneWithCustomizer + ): TResult; + /** * @see _.cloneWith */ cloneWith( - customizer?: CloneWithCustomizer - ): TResult; - } + customizer: CloneWithCustomizer + ): TResult | TValue; - interface LoDashImplicitArrayWrapperBase { /** * @see _.cloneWith */ - cloneWith( - customizer?: CloneWithCustomizer - ): TResult; + cloneWith(): TValue; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.cloneWith */ - cloneWith( - customizer?: CloneWithCustomizer - ): TResult; - } - - interface LoDashExplicitWrapper { - /** - * @see _.cloneWith - */ - cloneWith( - customizer?: CloneWithCustomizer + cloneWith( + customizer: CloneWithCustomizer ): LoDashExplicitWrapper; /** * @see _.cloneWith */ cloneWith( - customizer?: CloneWithCustomizer - ): LoDashExplicitArrayWrapper; + customizer: CloneWithCustomizer + ): LoDashExplicitWrapper; /** * @see _.cloneWith */ - cloneWith( - customizer?: CloneWithCustomizer - ): LoDashExplicitObjectWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.cloneWith - */ - cloneWith( - customizer?: CloneWithCustomizer - ): LoDashExplicitWrapper; - - /** - * @see _.cloneWith - */ - cloneWith( - customizer?: CloneWithCustomizer - ): LoDashExplicitArrayWrapper; - - /** - * @see _.cloneWith - */ - cloneWith( - customizer?: CloneWithCustomizer - ): LoDashExplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.cloneWith - */ - cloneWith( - customizer?: CloneWithCustomizer - ): LoDashExplicitWrapper; - - /** - * @see _.cloneWith - */ - cloneWith( - customizer?: CloneWithCustomizer - ): LoDashExplicitArrayWrapper; - - /** - * @see _.cloneWith - */ - cloneWith( - customizer?: CloneWithCustomizer - ): LoDashExplicitObjectWrapper; + cloneWith(): this; } /** * An object containing predicate functions for each property of T */ type ConformsPredicateObject = { - [P in keyof T]: (val: T[P]) => boolean; + [P in keyof T]?: (val: T[P]) => boolean; }; //_.conforms @@ -11863,7 +8935,21 @@ declare namespace _ { * Creates a function that invokes the predicate properties of `source` with the corresponding * property values of a given object, returning true if all predicates return truthy, else false. */ - conforms(source: ConformsPredicateObject): (Target: T) => boolean; + conforms(source: ConformsPredicateObject): (value: T) => boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.conforms + */ + conforms(this: LoDashImplicitWrapper>): LoDashImplicitWrapper<(value: T) => boolean>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.conforms + */ + conforms(this: LoDashExplicitWrapper>): LoDashExplicitWrapper<(value: T) => boolean>; } //_.conformsTo @@ -11877,6 +8963,20 @@ declare namespace _ { conformsTo(object: T, source: ConformsPredicateObject): boolean; } + interface LoDashImplicitWrapper { + /** + * @see _.conformsTo + */ + conformsTo(source: ConformsPredicateObject): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.conformsTo + */ + conformsTo(source: ConformsPredicateObject): LoDashExplicitWrapper; + } + type CondPair = [(val: T) => boolean, (val: T) => R] //_.cond @@ -11951,18 +9051,18 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** - * @see _.isEqual + * @see _.eq */ eq( other: any ): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** - * @see _.isEqual + * @see _.eq */ eq( other: any @@ -11984,14 +9084,14 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.gt */ gt(other: any): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.gt */ @@ -12013,14 +9113,14 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.gte */ gte(other: any): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.gte */ @@ -12038,14 +9138,14 @@ declare namespace _ { isArguments(value?: any): value is IArguments; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isArguments */ isArguments(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isArguments */ @@ -12068,14 +9168,14 @@ declare namespace _ { isArray(value?: any): value is any[]; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isArray */ isArray(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isArray */ @@ -12093,14 +9193,14 @@ declare namespace _ { isArrayBuffer(value?: any): value is ArrayBuffer; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isArrayBuffer */ isArrayBuffer(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isArrayBuffer */ @@ -12139,27 +9239,22 @@ declare namespace _ { /** * @see _.isArrayLike */ - isArrayLike(value?: Function): value is never; + isArrayLike(value?: ((...args: any[]) => any) | Function | null | undefined): value is never; /** * @see _.isArrayLike */ - isArrayLike(value: T | Function): value is T & { length: number }; - - /** - * DEPRECATED - */ - isArrayLike(value?: any): value is any[]; + isArrayLike(value: any): value is { length: number }; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isArrayLike */ isArrayLike(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isArrayLike */ @@ -12197,27 +9292,22 @@ declare namespace _ { /** * @see _.isArrayLike */ - isArrayLikeObject(value?: Function | string | boolean | number): value is never; + isArrayLikeObject(value?: ((...args: any[]) => any) | Function | string | boolean | number | null | undefined): value is never; /** * @see _.isArrayLike */ - isArrayLikeObject(value: T | Function | string | boolean | number): value is T & { length: number }; - - /** - * DEPRECATED - */ - isArrayLikeObject(value?: any): value is any[]; + isArrayLikeObject(value: T | string | boolean | number | null | undefined): value is T & { length: number }; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isArrayLikeObject */ isArrayLikeObject(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isArrayLikeObject */ @@ -12235,14 +9325,14 @@ declare namespace _ { isBoolean(value?: any): value is boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isBoolean */ isBoolean(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isBoolean */ @@ -12260,14 +9350,14 @@ declare namespace _ { isBuffer(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isBuffer */ isBuffer(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isBuffer */ @@ -12285,14 +9375,14 @@ declare namespace _ { isDate(value?: any): value is Date; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isDate */ isDate(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isDate */ @@ -12310,14 +9400,14 @@ declare namespace _ { isElement(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isElement */ isElement(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isElement */ @@ -12336,14 +9426,14 @@ declare namespace _ { isEmpty(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isEmpty */ isEmpty(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isEmpty */ @@ -12385,7 +9475,7 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isEqual */ @@ -12394,7 +9484,7 @@ declare namespace _ { ): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isEqual */ @@ -12445,7 +9535,7 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isEqualWith */ @@ -12455,7 +9545,7 @@ declare namespace _ { ): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isEqualWith */ @@ -12477,14 +9567,14 @@ declare namespace _ { isError(value: any): value is Error; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isError */ isError(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isError */ @@ -12504,14 +9594,14 @@ declare namespace _ { isFinite(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isFinite */ isFinite(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isFinite */ @@ -12526,17 +9616,17 @@ declare namespace _ { * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ - isFunction(value?: any): value is Function; + isFunction(value?: any): value is ((...args: any[]) => any) | Function; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isFunction */ isFunction(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isFunction */ @@ -12572,14 +9662,14 @@ declare namespace _ { isInteger(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isInteger */ isInteger(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isInteger */ @@ -12615,14 +9705,14 @@ declare namespace _ { isLength(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isLength */ isLength(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isLength */ @@ -12637,17 +9727,17 @@ declare namespace _ { * @param value The value to check. * @returns Returns true if value is correctly classified, else false. */ - isMap(value?: any): value is Map; + isMap(value?: any): value is Map; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isMap */ isMap(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isMap */ @@ -12680,14 +9770,14 @@ declare namespace _ { * _.isMatch(object, { 'age': 36 }); * // => false */ - isMatch(object: Object, source: Object): boolean; + isMatch(object: object, source: object): boolean; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.isMatch */ - isMatch(source: Object): boolean; + isMatch(source: object): boolean; } //_.isMatchWith @@ -12725,14 +9815,14 @@ declare namespace _ { * _.isMatchWith(object, source, customizer); * // => true */ - isMatchWith(object: Object, source: Object, customizer: isMatchWithCustomizer): boolean; + isMatchWith(object: object, source: object, customizer: isMatchWithCustomizer): boolean; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.isMatchWith */ - isMatchWith(source: Object, customizer: isMatchWithCustomizer): boolean; + isMatchWith(source: object, customizer: isMatchWithCustomizer): boolean; } //_.isNaN @@ -12748,14 +9838,14 @@ declare namespace _ { isNaN(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isNaN */ isNaN(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isNaN */ @@ -12770,17 +9860,17 @@ declare namespace _ { * * @retrun Returns true if value is a native function, else false. */ - isNative(value: any): value is Function; + isNative(value: any): value is ((...args: any[]) => any) | Function; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isNative */ isNative(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isNative */ @@ -12811,14 +9901,14 @@ declare namespace _ { isNil(value: any): value is null | undefined; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isNil */ isNil(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isNil */ @@ -12836,14 +9926,14 @@ declare namespace _ { isNull(value: any): value is null; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isNull */ isNull(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isNull */ @@ -12863,14 +9953,14 @@ declare namespace _ { isNumber(value?: any): value is number; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isNumber */ isNumber(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isNumber */ @@ -12889,14 +9979,14 @@ declare namespace _ { isObject(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isObject */ isObject(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isObject */ @@ -12931,14 +10021,14 @@ declare namespace _ { isObjectLike(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isObjectLike */ isObjectLike(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isObjectLike */ @@ -12959,14 +10049,14 @@ declare namespace _ { isPlainObject(value?: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isPlainObject */ isPlainObject(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isPlainObject */ @@ -12984,14 +10074,14 @@ declare namespace _ { isRegExp(value?: any): value is RegExp; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isRegExp */ isRegExp(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isRegExp */ @@ -13028,14 +10118,14 @@ declare namespace _ { isSafeInteger(value: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isSafeInteger */ isSafeInteger(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isSafeInteger */ @@ -13050,17 +10140,17 @@ declare namespace _ { * @param value The value to check. * @returns Returns true if value is correctly classified, else false. */ - isSet(value?: any): value is Set; + isSet(value?: any): value is Set; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isSet */ isSet(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isSet */ @@ -13078,14 +10168,14 @@ declare namespace _ { isString(value?: any): value is string; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isString */ isString(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isString */ @@ -13113,14 +10203,14 @@ declare namespace _ { isSymbol(value: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isSymbol */ isSymbol(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isSymbol */ @@ -13138,14 +10228,14 @@ declare namespace _ { isTypedArray(value: any): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isTypedArray */ isTypedArray(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isTypedArray */ @@ -13163,14 +10253,14 @@ declare namespace _ { isUndefined(value: any): value is undefined; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * see _.isUndefined */ isUndefined(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * see _.isUndefined */ @@ -13185,17 +10275,17 @@ declare namespace _ { * @param value The value to check. * @returns Returns true if value is correctly classified, else false. */ - isWeakMap(value?: any): value is WeakMap; + isWeakMap(value?: any): value is WeakMap; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isSet */ isWeakMap(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isSet */ @@ -13213,14 +10303,14 @@ declare namespace _ { isWeakSet(value?: any): value is WeakSet; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.isWeakSet */ isWeakSet(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.isWeakSet */ @@ -13242,14 +10332,14 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.lt */ lt(other: any): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.lt */ @@ -13271,14 +10361,14 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.lte */ lte(other: any): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.lte */ @@ -13293,59 +10383,41 @@ declare namespace _ { * @param value The value to convert. * @return Returns the converted array. */ - toArray(value: List|Dictionary|NumericDictionary): T[]; + toArray(value: List | Dictionary | NumericDictionary | null | undefined): T[]; /** * @see _.toArray */ - toArray(value: TValue): TResult[]; + toArray(value: T): Array; /** * @see _.toArray */ - toArray(value?: any): TResult[]; + toArray(): any[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.toArray */ - toArray(): LoDashImplicitArrayWrapper; + toArray(this: LoDashImplicitWrapper | Dictionary | NumericDictionary | null | undefined>): LoDashImplicitWrapper; + + /** + * @see _.toArray + */ + toArray(): LoDashImplicitWrapper>; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.toArray */ - toArray(): LoDashImplicitArrayWrapper; - } + toArray(this: LoDashExplicitWrapper | Dictionary | NumericDictionary | null | undefined>): LoDashExplicitWrapper; - interface LoDashImplicitObjectWrapperBase { /** * @see _.toArray */ - toArray(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.toArray - */ - toArray(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.toArray - */ - toArray(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.toArray - */ - toArray(): LoDashExplicitArrayWrapper; + toArray(): LoDashExplicitWrapper>; } //_.toPlainObject @@ -13357,14 +10429,21 @@ declare namespace _ { * @param value The value to convert. * @return Returns the converted plain object. */ - toPlainObject(value?: any): TResult; + toPlainObject(value?: any): any; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.toPlainObject */ - toPlainObject(): LoDashImplicitObjectWrapper; + toPlainObject(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toPlainObject + */ + toPlainObject(): LoDashExplicitWrapper; } //_.toFinite @@ -13395,14 +10474,14 @@ declare namespace _ { toFinite(value: any): number; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.toFinite */ - toFinite(): LoDashImplicitWrapper; + toFinite(): number; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.toFinite */ @@ -13438,14 +10517,14 @@ declare namespace _ { toInteger(value: any): number; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.toInteger */ - toInteger(): LoDashImplicitWrapper; + toInteger(): number; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.toInteger */ @@ -13482,14 +10561,14 @@ declare namespace _ { toLength(value: any): number; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.toLength */ - toLength(): LoDashImplicitWrapper; + toLength(): number; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.toLength */ @@ -13523,14 +10602,14 @@ declare namespace _ { toNumber(value: any): number; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.toNumber */ - toNumber(): LoDashImplicitWrapper; + toNumber(): number; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.toNumber */ @@ -13565,21 +10644,21 @@ declare namespace _ { toSafeInteger(value: any): number; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.toSafeInteger */ - toSafeInteger(): LoDashImplicitWrapper; + toSafeInteger(): number; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.toSafeInteger */ toSafeInteger(): LoDashExplicitWrapper; } - //_.toString DUMMY + //_.toString interface LoDashStatic { /** * Converts `value` to a string if it's not one. An empty string is returned @@ -13623,14 +10702,14 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.add */ add(addend: number): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.add */ @@ -13652,14 +10731,14 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.ceil */ ceil(precision?: number): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.ceil */ @@ -13681,14 +10760,14 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.divide */ divide(divisor: number): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.divide */ @@ -13710,14 +10789,14 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.floor */ floor(precision?: number): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.floor */ @@ -13741,18 +10820,18 @@ declare namespace _ { ): T | undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.max */ - max(): T | undefined; + max(this: LoDashImplicitWrapper | null | undefined>): T | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.max */ - max(): T | undefined; + max(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } //_.maxBy @@ -13781,78 +10860,28 @@ declare namespace _ { */ maxBy( collection: List | null | undefined, - iteratee?: ListIterator - ): T | undefined; - - /** - * @see _.maxBy - */ - maxBy( - collection: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): T | undefined; - - /** - * @see _.maxBy - */ - maxBy( - collection: List|Dictionary | null | undefined, - iteratee?: string - ): T | undefined; - - /** - * @see _.maxBy - */ - maxBy( - collection: List|Dictionary | null | undefined, - whereValue?: TObject + iteratee?: ListIteratee ): T | undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.maxBy */ - maxBy( - iteratee?: ListIterator - ): T | undefined; - - /** - * @see _.maxBy - */ - maxBy( - iteratee?: string - ): T | undefined; - - /** - * @see _.maxBy - */ - maxBy( - whereValue?: TObject + maxBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ListIteratee ): T | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.maxBy */ maxBy( - iteratee?: ListIterator|DictionaryIterator - ): T | undefined; - - /** - * @see _.maxBy - */ - maxBy( - iteratee?: string - ): T | undefined; - - /** - * @see _.maxBy - */ - maxBy( - whereValue?: TObject - ): T | undefined; + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashExplicitWrapper; } //_.mean @@ -13870,11 +10899,25 @@ declare namespace _ { * _.mean([4, 2, 8, 6]); * // => 5 */ - mean( - collection: List | null | undefined + mean( + collection: List | null | undefined ): number; } + interface LoDashImplicitWrapper { + /** + * @see _.mean + */ + mean(): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.mean + */ + mean(): LoDashExplicitWrapper; + } + //_.meanBy interface LoDashStatic { /** @@ -13891,27 +10934,30 @@ declare namespace _ { * _.mean([{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }], 'n'); * // => 5 */ - meanBy( - collection: List | null | undefined, - iteratee?: ListIterator | string - ): number; - - meanBy( - collection: Dictionary | null | undefined, - iteratee?: DictionaryIterator | string - ): number; + meanBy( + collection: List | null | undefined, + iteratee?: ListIteratee + ): number; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** - * @see _.mean + * @see _.meanBy */ - mean(): number; + meanBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): number; + } + interface LoDashExplicitWrapper { /** - * @see _.mean + * @see _.meanBy */ - mean(): number; + meanBy( + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashExplicitWrapper; } //_.min @@ -13931,18 +10977,18 @@ declare namespace _ { ): T | undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.min */ - min(): T | undefined; + min(this: LoDashImplicitWrapper | null | undefined>): T | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.min */ - min(): T | undefined; + min(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper; } //_.minBy @@ -13971,78 +11017,28 @@ declare namespace _ { */ minBy( collection: List | null | undefined, - iteratee?: ListIterator - ): T | undefined; - - /** - * @see _.minBy - */ - minBy( - collection: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): T | undefined; - - /** - * @see _.minBy - */ - minBy( - collection: List|Dictionary | null | undefined, - iteratee?: string - ): T | undefined; - - /** - * @see _.minBy - */ - minBy( - collection: List|Dictionary | null | undefined, - whereValue?: TObject + iteratee?: ListIteratee ): T | undefined; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.minBy */ - minBy( - iteratee?: ListIterator - ): T | undefined; - - /** - * @see _.minBy - */ - minBy( - iteratee?: string - ): T | undefined; - - /** - * @see _.minBy - */ - minBy( - whereValue?: TObject + minBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ListIteratee ): T | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.minBy */ minBy( - iteratee?: ListIterator|DictionaryIterator - ): T | undefined; - - /** - * @see _.minBy - */ - minBy( - iteratee?: string - ): T | undefined; - - /** - * @see _.minBy - */ - minBy( - whereValue?: TObject - ): T | undefined; + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashExplicitWrapper; } //_.multiply @@ -14059,14 +11055,14 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.multiply */ multiply(multiplicand: number): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.multiply */ @@ -14088,14 +11084,14 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.round */ round(precision?: number): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.round */ @@ -14117,46 +11113,17 @@ declare namespace _ { * _.sum([4, 2, 8, 6]); * // => 20 */ - sum(collection: List | null | undefined): number; - - /** - * @see _.sum - */ - sum(collection: List|Dictionary | null | undefined): number; + sum(collection: List | null | undefined): number; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.sum */ sum(): number; } - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.sum - **/ - sum(): number; - - /** - * @see _.sum - */ - sum(): number; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sum - */ - sum(): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.sum - */ - sum(): LoDashExplicitWrapper; - + interface LoDashExplicitWrapper { /** * @see _.sum */ @@ -14189,112 +11156,28 @@ declare namespace _ { */ sumBy( collection: List | null | undefined, - iteratee: ListIterator - ): number; - - /** - * @see _.sumBy - */ - sumBy( - collection: List<{}> | null | undefined, - iteratee: string - ): number; - - /** - * @see _.sumBy - */ - sumBy( - collection: List | null | undefined - ): number; - - /** - * @see _.sumBy - */ - sumBy( - collection: List<{}> | null | undefined, - iteratee: Dictionary<{}> + iteratee?: ((value: T) => number) | string ): number; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.sumBy */ - sumBy( - iteratee: ListIterator + sumBy( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ((value: T) => number) | string ): number; - - /** - * @see _.sumBy - */ - sumBy(iteratee: string): number; - - /** - * @see _.sumBy - */ - sumBy(iteratee: Dictionary<{}>): number; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.sumBy */ - sumBy( - iteratee: ListIterator - ): number; - - /** - * @see _.sumBy - */ - sumBy(iteratee: string): number; - - /** - * @see _.sumBy - */ - sumBy(iteratee: Dictionary<{}>): number; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.sumBy - */ - sumBy( - iteratee: ListIterator + sumBy( + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ((value: T) => number) | string ): LoDashExplicitWrapper; - - /** - * @see _.sumBy - */ - sumBy(iteratee: string): LoDashExplicitWrapper; - - /** - * @see _.sumBy - */ - sumBy(): LoDashExplicitWrapper; - - /** - * @see _.sumBy - */ - sumBy(iteratee: Dictionary<{}>): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.sumBy - */ - sumBy( - iteratee: ListIterator - ): LoDashExplicitWrapper; - - /** - * @see _.sumBy - */ - sumBy(iteratee: string): LoDashExplicitWrapper; - - /** - * @see _.sumBy - */ - sumBy(iteratee: Dictionary<{}>): LoDashExplicitWrapper; } /********** @@ -14323,7 +11206,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.subtract */ @@ -14332,7 +11215,7 @@ declare namespace _ { ): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.subtract */ @@ -14368,7 +11251,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.clamp */ @@ -14378,7 +11261,7 @@ declare namespace _ { ): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.clamp */ @@ -14402,46 +11285,28 @@ declare namespace _ { inRange( n: number, start: number, - end: number - ): boolean; - - /** - * @see _.inRange - */ - inRange( - n: number, - end: number + end?: number ): boolean; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.inRange */ inRange( start: number, - end: number + end?: number ): boolean; - - /** - * @see _.inRange - */ - inRange(end: number): boolean; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.inRange */ inRange( start: number, - end: number + end?: number ): LoDashExplicitWrapper; - - /** - * @see _.inRange - */ - inRange(end: number): LoDashExplicitWrapper; } //_.random @@ -14476,7 +11341,7 @@ declare namespace _ { random(floating?: boolean): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.random */ @@ -14491,7 +11356,7 @@ declare namespace _ { random(floating?: boolean): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.random */ @@ -14585,19 +11450,19 @@ declare namespace _ { /** * @see _.assign */ - assign( + assign( object: any, ...otherArgs: any[] - ): TResult; + ): any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.assign */ assign( source: TSource - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assign @@ -14605,7 +11470,7 @@ declare namespace _ { assign( source1: TSource1, source2: TSource2 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assign @@ -14614,7 +11479,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assign @@ -14624,26 +11489,26 @@ declare namespace _ { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assign */ - assign(): LoDashImplicitObjectWrapper; + assign(): LoDashImplicitWrapper; /** * @see _.assign */ - assign(...otherArgs: any[]): LoDashImplicitObjectWrapper; + assign(...otherArgs: any[]): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.assign */ assign( source: TSource - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assign @@ -14651,7 +11516,7 @@ declare namespace _ { assign( source1: TSource1, source2: TSource2 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assign @@ -14660,7 +11525,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assign @@ -14670,17 +11535,17 @@ declare namespace _ { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assign */ - assign(): LoDashExplicitObjectWrapper; + assign(): LoDashExplicitWrapper; /** * @see _.assign */ - assign(...otherArgs: any[]): LoDashExplicitObjectWrapper; + assign(...otherArgs: any[]): LoDashExplicitWrapper; } interface LoDashStatic { @@ -14763,14 +11628,14 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.assignWith */ assignWith( source: TSource, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assignWith @@ -14779,7 +11644,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assignWith @@ -14789,7 +11654,7 @@ declare namespace _ { source2: TSource2, source3: TSource3, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assignWith @@ -14800,27 +11665,27 @@ declare namespace _ { source3: TSource3, source4: TSource4, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignWith */ - assignWith(): LoDashImplicitObjectWrapper; + assignWith(): LoDashImplicitWrapper; /** * @see _.assignWith */ - assignWith(...otherArgs: any[]): LoDashImplicitObjectWrapper; + assignWith(...otherArgs: any[]): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.assignWith */ assignWith( source: TSource, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assignWith @@ -14829,7 +11694,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assignWith @@ -14839,7 +11704,7 @@ declare namespace _ { source2: TSource2, source3: TSource3, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assignWith @@ -14850,17 +11715,17 @@ declare namespace _ { source3: TSource3, source4: TSource4, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignWith */ - assignWith(): LoDashExplicitObjectWrapper; + assignWith(): LoDashExplicitWrapper; /** * @see _.assignWith */ - assignWith(...otherArgs: any[]): LoDashExplicitObjectWrapper; + assignWith(...otherArgs: any[]): LoDashExplicitWrapper; } //_.assignIn @@ -14943,13 +11808,13 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.assignIn */ assignIn( source: TSource - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assignIn @@ -14957,7 +11822,7 @@ declare namespace _ { assignIn( source1: TSource1, source2: TSource2 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assignIn @@ -14966,7 +11831,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assignIn @@ -14976,26 +11841,26 @@ declare namespace _ { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignIn */ - assignIn(): LoDashImplicitObjectWrapper; + assignIn(): LoDashImplicitWrapper; /** * @see _.assignIn */ - assignIn(...otherArgs: any[]): LoDashImplicitObjectWrapper; + assignIn(...otherArgs: any[]): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.assignIn */ assignIn( source: TSource - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assignIn @@ -15003,7 +11868,7 @@ declare namespace _ { assignIn( source1: TSource1, source2: TSource2 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assignIn @@ -15012,7 +11877,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assignIn @@ -15022,17 +11887,17 @@ declare namespace _ { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignIn */ - assignIn(): LoDashExplicitObjectWrapper; + assignIn(): LoDashExplicitWrapper; /** * @see _.assignIn */ - assignIn(...otherArgs: any[]): LoDashExplicitObjectWrapper; + assignIn(...otherArgs: any[]): LoDashExplicitWrapper; } //_.assignInWith @@ -15119,14 +11984,14 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.assignInWith */ assignInWith( source: TSource, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assignInWith @@ -15135,7 +12000,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assignInWith @@ -15145,7 +12010,7 @@ declare namespace _ { source2: TSource2, source3: TSource3, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see assignInWith @@ -15156,27 +12021,27 @@ declare namespace _ { source3: TSource3, source4: TSource4, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignInWith */ - assignInWith(): LoDashImplicitObjectWrapper; + assignInWith(): LoDashImplicitWrapper; /** * @see _.assignInWith */ - assignInWith(...otherArgs: any[]): LoDashImplicitObjectWrapper; + assignInWith(...otherArgs: any[]): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.assignInWith */ assignInWith( source: TSource, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assignInWith @@ -15185,7 +12050,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assignInWith @@ -15195,7 +12060,7 @@ declare namespace _ { source2: TSource2, source3: TSource3, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see assignInWith @@ -15206,17 +12071,17 @@ declare namespace _ { source3: TSource3, source4: TSource4, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignInWith */ - assignInWith(): LoDashExplicitObjectWrapper; + assignInWith(): LoDashExplicitWrapper; /** * @see _.assignInWith */ - assignInWith(...otherArgs: any[]): LoDashExplicitObjectWrapper; + assignInWith(...otherArgs: any[]): LoDashExplicitWrapper; } //_.create @@ -15229,24 +12094,24 @@ declare namespace _ { * @param properties The properties to assign to the object. * @return Returns the new object. */ - create( + create( prototype: T, properties?: U ): T & U; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.create */ - create(properties?: U): LoDashImplicitObjectWrapper; + create(properties?: U): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.create */ - create(properties?: U): LoDashExplicitObjectWrapper; + create(properties?: U): LoDashExplicitWrapper; } //_.defaults @@ -15305,19 +12170,19 @@ declare namespace _ { /** * @see _.defaults */ - defaults( + defaults( object: any, ...sources: any[] - ): TResult; + ): any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.defaults */ defaults( source: TSource - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.defaults @@ -15325,7 +12190,7 @@ declare namespace _ { defaults( source1: TSource1, source2: TSource2 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.defaults @@ -15334,7 +12199,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.defaults @@ -15344,26 +12209,26 @@ declare namespace _ { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.defaults */ - defaults(): LoDashImplicitObjectWrapper; + defaults(): LoDashImplicitWrapper; /** * @see _.defaults */ - defaults(...sources: any[]): LoDashImplicitObjectWrapper; + defaults(...sources: any[]): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.defaults */ defaults( source: TSource - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.defaults @@ -15371,7 +12236,7 @@ declare namespace _ { defaults( source1: TSource1, source2: TSource2 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.defaults @@ -15380,7 +12245,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.defaults @@ -15390,17 +12255,17 @@ declare namespace _ { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.defaults */ - defaults(): LoDashExplicitObjectWrapper; + defaults(): LoDashExplicitWrapper; /** * @see _.defaults */ - defaults(...sources: any[]): LoDashExplicitObjectWrapper; + defaults(...sources: any[]): LoDashExplicitWrapper; } //_.defaultsDeep @@ -15411,16 +12276,23 @@ declare namespace _ { * @param sources The source objects. * @return Returns object. **/ - defaultsDeep( - object: T, - ...sources: any[]): TResult; + defaultsDeep( + object: any, + ...sources: any[]): any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.defaultsDeep **/ - defaultsDeep(...sources: any[]): LoDashImplicitObjectWrapper; + defaultsDeep(...sources: any[]): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.defaultsDeep + **/ + defaultsDeep(...sources: any[]): LoDashExplicitWrapper; } //_.entries @@ -15428,23 +12300,36 @@ declare namespace _ { /** * @see _.toPairs */ - entries(object?: T): [string, any][]; + entries(object?: Dictionary): Array<[string, T]>; - entries(object?: T): [string, TResult][]; - } - - interface LoDashImplicitObjectWrapper { /** * @see _.toPairs */ - entries(): LoDashImplicitArrayWrapper<[string, TResult]>; + entries(object?: object): Array<[string, any]>; } - interface LoDashExplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.toPairs */ - entries(): LoDashExplicitArrayWrapper<[string, TResult]>; + entries(this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + + /** + * @see _.toPairs + */ + entries(): LoDashImplicitWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toPairs + */ + entries(this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + + /** + * @see _.toPairs + */ + entries(): LoDashExplicitWrapper>; } //_.entriesIn @@ -15452,23 +12337,36 @@ declare namespace _ { /** * @see _.toPairsIn */ - entriesIn(object?: T): [string, any][]; + entriesIn(object?: Dictionary): Array<[string, T]>; - entriesIn(object?: T): [string, TResult][]; - } - - interface LoDashImplicitObjectWrapper { /** * @see _.toPairsIn */ - entriesIn(): LoDashImplicitArrayWrapper<[string, TResult]>; + entriesIn(object?: object): Array<[string, any]>; } - interface LoDashExplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.toPairsIn */ - entriesIn(): LoDashExplicitArrayWrapper<[string, TResult]>; + entriesIn(this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + + /** + * @see _.toPairsIn + */ + entriesIn(): LoDashImplicitWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toPairsIn + */ + entriesIn(this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + + /** + * @see _.toPairsIn + */ + entriesIn(): LoDashExplicitWrapper>; } // _.extend @@ -15525,13 +12423,13 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.assignIn */ extend( source: TSource - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignIn @@ -15539,7 +12437,7 @@ declare namespace _ { extend( source1: TSource1, source2: TSource2 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignIn @@ -15548,7 +12446,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignIn @@ -15558,26 +12456,26 @@ declare namespace _ { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignIn */ - extend(): LoDashImplicitObjectWrapper; + extend(): LoDashImplicitWrapper; /** * @see _.assignIn */ - extend(...otherArgs: any[]): LoDashImplicitObjectWrapper; + extend(...otherArgs: any[]): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.assignIn */ extend( source: TSource - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignIn @@ -15585,7 +12483,7 @@ declare namespace _ { extend( source1: TSource1, source2: TSource2 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignIn @@ -15594,7 +12492,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignIn @@ -15604,17 +12502,17 @@ declare namespace _ { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignIn */ - extend(): LoDashExplicitObjectWrapper; + extend(): LoDashExplicitWrapper; /** * @see _.assignIn */ - extend(...otherArgs: any[]): LoDashExplicitObjectWrapper; + extend(...otherArgs: any[]): LoDashExplicitWrapper; } interface LoDashStatic { @@ -15674,14 +12572,14 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.assignInWith */ extendWith( source: TSource, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignInWith @@ -15690,7 +12588,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignInWith @@ -15700,7 +12598,7 @@ declare namespace _ { source2: TSource2, source3: TSource3, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignInWith @@ -15711,27 +12609,27 @@ declare namespace _ { source3: TSource3, source4: TSource4, customizer: AssignCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.assignInWith */ - extendWith(): LoDashImplicitObjectWrapper; + extendWith(): LoDashImplicitWrapper; /** * @see _.assignInWith */ - extendWith(...otherArgs: any[]): LoDashImplicitObjectWrapper; + extendWith(...otherArgs: any[]): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.assignInWith */ extendWith( source: TSource, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignInWith @@ -15740,7 +12638,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignInWith @@ -15750,7 +12648,7 @@ declare namespace _ { source2: TSource2, source3: TSource3, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignInWith @@ -15761,17 +12659,17 @@ declare namespace _ { source3: TSource3, source4: TSource4, customizer: AssignCustomizer - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.assignInWith */ - extendWith(): LoDashExplicitObjectWrapper; + extendWith(): LoDashExplicitWrapper; /** * @see _.assignInWith */ - extendWith(...otherArgs: any[]): LoDashExplicitObjectWrapper; + extendWith(...otherArgs: any[]): LoDashExplicitWrapper; } //_.findKey @@ -15794,93 +12692,29 @@ declare namespace _ { * @param thisArg The this binding of predicate. * @return Returns the key of the matched element, else undefined. */ - findKey( - object: TObject, - predicate?: DictionaryIterator - ): string | undefined; - - /** - * @see _.findKey - */ - findKey( - object: TObject, - predicate?: ObjectIterator - ): string | undefined; - - /** - * @see _.findKey - */ - findKey( - object: TObject, - predicate?: string - ): string | undefined; - - /** - * @see _.findKey - */ - findKey, TObject>( - object: TObject, - predicate?: TWhere + findKey( + object: T | null | undefined, + predicate?: ObjectIteratee ): string | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.findKey */ - findKey( - predicate?: DictionaryIterator - ): string | undefined; - - /** - * @see _.findKey - */ - findKey( - predicate?: ObjectIterator - ): string | undefined; - - /** - * @see _.findKey - */ - findKey( - predicate?: string - ): string | undefined; - - /** - * @see _.findKey - */ - findKey>( - predicate?: TWhere + findKey( + this: LoDashImplicitWrapper, + predicate?: ObjectIteratee ): string | undefined; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.findKey */ - findKey( - predicate?: DictionaryIterator - ): LoDashExplicitWrapper; - - /** - * @see _.findKey - */ - findKey( - predicate?: ObjectIterator - ): LoDashExplicitWrapper; - - /** - * @see _.findKey - */ - findKey( - predicate?: string - ): LoDashExplicitWrapper; - - /** - * @see _.findKey - */ - findKey>( - predicate?: TWhere + findKey( + this: LoDashExplicitWrapper, + predicate?: ObjectIteratee ): LoDashExplicitWrapper; } @@ -15903,93 +12737,29 @@ declare namespace _ { * @param thisArg The this binding of predicate. * @return Returns the key of the matched element, else undefined. */ - findLastKey( - object: TObject, - predicate?: DictionaryIterator - ): string | undefined; - - /** - * @see _.findLastKey - */ - findLastKey( - object: TObject, - predicate?: ObjectIterator - ): string | undefined; - - /** - * @see _.findLastKey - */ - findLastKey( - object: TObject, - predicate?: string - ): string; - - /** - * @see _.findLastKey - */ - findLastKey, TObject>( - object: TObject, - predicate?: TWhere + findLastKey( + object: T | null | undefined, + predicate?: ObjectIteratee ): string | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.findLastKey */ - findLastKey( - predicate?: DictionaryIterator - ): string; - - /** - * @see _.findLastKey - */ - findLastKey( - predicate?: ObjectIterator - ): string | undefined; - - /** - * @see _.findLastKey - */ - findLastKey( - predicate?: string - ): string | undefined; - - /** - * @see _.findLastKey - */ - findLastKey>( - predicate?: TWhere + findLastKey( + this: LoDashImplicitWrapper, + predicate?: ObjectIteratee ): string | undefined; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.findLastKey */ - findLastKey( - predicate?: DictionaryIterator - ): LoDashExplicitWrapper; - - /** - * @see _.findLastKey - */ - findLastKey( - predicate?: ObjectIterator - ): LoDashExplicitWrapper; - - /** - * @see _.findLastKey - */ - findLastKey( - predicate?: string - ): LoDashExplicitWrapper; - - /** - * @see _.findLastKey - */ - findLastKey>( - predicate?: TWhere + findLastKey( + this: LoDashExplicitWrapper, + predicate?: ObjectIteratee ): LoDashExplicitWrapper; } @@ -16006,43 +12776,27 @@ declare namespace _ { * @return Returns object. */ forIn( - object: Dictionary, - iteratee?: DictionaryIterator - ): Dictionary; + object: T, + iteratee?: ObjectIterator + ): T; /** * @see _.forIn */ forIn( - object: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): Dictionary | null | undefined; - - /** - * @see _.forIn - */ - forIn( - object: T, - iteratee?: ObjectIterator - ): T; + object: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashWrapper { /** * @see _.forIn */ - forIn( - iteratee?: DictionaryIterator - ): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.forIn - */ - forIn( - iteratee?: DictionaryIterator - ): TWrapper; + forIn( + this: LoDashWrapper, + iteratee?: ObjectIterator + ): this; } //_.forInRight @@ -16056,43 +12810,27 @@ declare namespace _ { * @return Returns object. */ forInRight( - object: Dictionary, - iteratee?: DictionaryIterator - ): Dictionary; + object: T, + iteratee?: ObjectIterator + ): T; /** * @see _.forInRight */ forInRight( - object: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): Dictionary | null | undefined; - - /** - * @see _.forInRight - */ - forInRight( - object: T, - iteratee?: ObjectIterator - ): T; + object: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashWrapper { /** * @see _.forInRight */ - forInRight( - iteratee?: DictionaryIterator - ): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.forInRight - */ - forInRight( - iteratee?: DictionaryIterator - ): TWrapper; + forInRight( + this: LoDashWrapper, + iteratee?: ObjectIterator + ): this; } //_.forOwn @@ -16108,43 +12846,27 @@ declare namespace _ { * @return Returns object. */ forOwn( - object: Dictionary, - iteratee?: DictionaryIterator - ): Dictionary; + object: T, + iteratee?: ObjectIterator + ): T; /** * @see _.forOwn */ forOwn( - object: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): Dictionary | null | undefined; - - /** - * @see _.forOwn - */ - forOwn( - object: T, - iteratee?: ObjectIterator - ): T; + object: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashWrapper { /** * @see _.forOwn */ - forOwn( - iteratee?: DictionaryIterator - ): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.forOwn - */ - forOwn( - iteratee?: DictionaryIterator - ): TWrapper; + forOwn( + this: LoDashWrapper, + iteratee?: ObjectIterator + ): this; } //_.forOwnRight @@ -16158,43 +12880,27 @@ declare namespace _ { * @return Returns object. */ forOwnRight( - object: Dictionary, - iteratee?: DictionaryIterator - ): Dictionary; + object: T, + iteratee?: ObjectIterator + ): T; /** * @see _.forOwnRight */ forOwnRight( - object: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): Dictionary | null | undefined; - - /** - * @see _.forOwnRight - */ - forOwnRight( - object: T, - iteratee?: ObjectIterator - ): T; + object: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashWrapper { /** * @see _.forOwnRight */ - forOwnRight( - iteratee?: DictionaryIterator - ): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.forOwnRight - */ - forOwnRight( - iteratee?: DictionaryIterator - ): TWrapper; + forOwnRight( + this: LoDashWrapper, + iteratee?: ObjectIterator + ): this; } //_.functions @@ -16220,21 +12926,21 @@ declare namespace _ { * _.functions(new Foo); * // => ['a', 'b'] */ - functions(object: any): string[]; + functions(object: any): string[]; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.functions */ - functions(): _.LoDashImplicitArrayWrapper; + functions(): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.functions */ - functions(): _.LoDashExplicitArrayWrapper; + functions(): LoDashExplicitWrapper; } //_.functionsIn @@ -16263,18 +12969,18 @@ declare namespace _ { functionsIn(object: any): string[]; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.functionsIn */ - functionsIn(): _.LoDashImplicitArrayWrapper; + functionsIn(): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.functionsIn */ - functionsIn(): _.LoDashExplicitArrayWrapper; + functionsIn(): LoDashExplicitWrapper; } //_.get @@ -16288,80 +12994,155 @@ declare namespace _ { * @param defaultValue The value returned if the resolved value is undefined. * @return Returns the resolved value. */ - get( + get( object: TObject, - path: Many, - defaultValue?: TResult - ): TResult; + path: TKey | [TKey] + ): TObject[TKey]; /** * @see _.get */ - get( + get( + object: TObject | null | undefined, + path: TKey | [TKey] + ): TObject[TKey] | undefined; + + /** + * @see _.get + */ + get( + object: TObject | null | undefined, + path: TKey | [TKey], + defaultValue: TDefault + ): TObject[TKey] | TDefault; + + /** + * @see _.get + */ + get( + object: null | undefined, + path: Many, + defaultValue: TDefault + ): TDefault; + + /** + * @see _.get + */ + get( + object: null | undefined, + path: Many + ): undefined; + + /** + * @see _.get + */ + get( object: any, path: Many, - defaultValue?: TResult - ): TResult; + defaultValue?: any + ): any; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { + /** + * @see _.get + */ + get( + path: TKey | [TKey] + ): TValue[TKey]; + + /** + * @see _.get + */ + get( + this: LoDashImplicitWrapper, + path: TKey | [TKey], + ): TObject[TKey] | undefined; + + /** + * @see _.get + */ + get( + this: LoDashImplicitWrapper, + path: TKey | [TKey], + defaultValue: TDefault + ): TObject[TKey] | TDefault; + + /** + * @see _.get + */ + get( + this: LoDashImplicitWrapper, + path: Many, + defaultValue: TDefault + ): TDefault; + + /** + * @see _.get + */ + get( + this: LoDashImplicitWrapper, + path: Many + ): undefined; + /** * @see _.get */ get( path: Many, - defaultValue?: TResult - ): TResult; + defaultValue?: any + ): any; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.get */ - get( + get( + path: TKey | [TKey] + ): LoDashExplicitWrapper; + + /** + * @see _.get + */ + get( + this: LoDashExplicitWrapper, + path: TKey | [TKey], + ): LoDashExplicitWrapper; + + /** + * @see _.get + */ + get( + this: LoDashExplicitWrapper, + path: TKey | [TKey], + defaultValue: TDefault + ): LoDashExplicitWrapper; + + /** + * @see _.get + */ + get( + this: LoDashExplicitWrapper, path: Many, - defaultValue?: TResult - ): TResult; - } + defaultValue: TDefault + ): LoDashExplicitWrapper; - interface LoDashImplicitObjectWrapperBase { /** * @see _.get */ - get( - path: Many, - defaultValue?: TResult - ): TResult; - } + get( + this: LoDashExplicitWrapper, + path: Many + ): LoDashExplicitWrapper; - interface LoDashExplicitWrapper { /** * @see _.get */ - get( + get( path: Many, defaultValue?: any - ): TResultWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.get - */ - get( - path: Many, - defaultValue?: any - ): TResultWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.get - */ - get( - path: Many, - defaultValue?: any - ): TResultWrapper; + ): LoDashExplicitWrapper; } //_.has @@ -16392,20 +13173,20 @@ declare namespace _ { * _.has(other, 'a'); * // => false */ - has( + has( object: T, path: Many ): boolean; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.has */ has(path: Many): boolean; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.has */ @@ -16439,20 +13220,20 @@ declare namespace _ { * _.hasIn(object, 'b'); * // => false */ - hasIn( + hasIn( object: T, path: Many ): boolean; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.hasIn */ hasIn(path: Many): boolean; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.hasIn */ @@ -16469,37 +13250,26 @@ declare namespace _ { * @param multiValue Allow multiple values per key. * @return Returns the new inverted object. */ - invert( - object: T, - multiValue?: boolean - ): TResult; + invert( + object: object + ): Dictionary; + } + interface LoDashImplicitWrapper { /** * @see _.invert */ - invert( - object: Object, - multiValue?: boolean - ): TResult; + invert(): LoDashImplicitWrapper>; } - interface LoDashImplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.invert */ - invert(multiValue?: boolean): LoDashImplicitObjectWrapper; + invert(): LoDashExplicitWrapper>; } - interface LoDashExplicitObjectWrapper { - /** - * @see _.invert - */ - invert(multiValue?: boolean): LoDashExplicitObjectWrapper; - } - - //_.inverBy - type InvertByIterator = (value: T) => any; - + //_.invertBy interface LoDashStatic { /** * This method is like _.invert except that the inverted object is generated from the results of running each @@ -16510,116 +13280,54 @@ declare namespace _ { * @param interatee The iteratee invoked per element. * @return Returns the new inverted object. */ - invertBy( - object: Object, - interatee?: InvertByIterator|string + invertBy( + object: List | Dictionary | NumericDictionary | null | undefined, + interatee?: ValueIteratee ): Dictionary; + /** + * @see _.invertBy + */ + invertBy( + object: T | null | undefined, + interatee?: ValueIteratee + ): Dictionary; + } + + interface LoDashImplicitWrapper { /** * @see _.invertBy */ invertBy( - object: _.Dictionary|_.NumericDictionary, - interatee?: InvertByIterator|string - ): Dictionary; + this: LoDashImplicitWrapper | Dictionary | NumericDictionary | null | undefined>, + interatee?: ValueIteratee + ): LoDashImplicitWrapper>; /** * @see _.invertBy */ - invertBy( - object: Object, - interatee?: W - ): Dictionary; - - /** - * @see _.invertBy - */ - invertBy( - object: _.Dictionary, - interatee?: W - ): Dictionary; + invertBy( + this: LoDashImplicitWrapper, + interatee?: ValueIteratee + ): LoDashImplicitWrapper>; } - interface LoDashImplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.invertBy */ - invertBy( - interatee?: InvertByIterator - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.invertBy - */ - invertBy( - interatee?: InvertByIterator|string - ): LoDashImplicitObjectWrapper>; + invertBy( + this: LoDashExplicitWrapper | Dictionary | NumericDictionary | null | undefined>, + interatee?: ValueIteratee + ): LoDashExplicitWrapper>; /** * @see _.invertBy */ - invertBy( - interatee?: W - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.invertBy - */ - invertBy( - interatee?: InvertByIterator|string - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.invertBy - */ - invertBy( - interatee?: W - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashExplicitWrapper { - /** - * @see _.invertBy - */ - invertBy( - interatee?: InvertByIterator - ): LoDashExplicitObjectWrapper>; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.invertBy - */ - invertBy( - interatee?: InvertByIterator|string - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.invertBy - */ - invertBy( - interatee?: W - ): LoDashExplicitObjectWrapper>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.invertBy - */ - invertBy( - interatee?: InvertByIterator|string - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.invertBy - */ - invertBy( - interatee?: W - ): LoDashExplicitObjectWrapper>; + invertBy( + this: LoDashExplicitWrapper, + interatee?: ValueIteratee + ): LoDashExplicitWrapper>; } //_.keys @@ -16635,18 +13343,18 @@ declare namespace _ { keys(object?: any): string[]; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.keys */ - keys(): LoDashImplicitArrayWrapper; + keys(): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.keys */ - keys(): LoDashExplicitArrayWrapper; + keys(): LoDashExplicitWrapper; } //_.keysIn @@ -16662,18 +13370,18 @@ declare namespace _ { keysIn(object?: any): string[]; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.keysIn */ - keysIn(): LoDashImplicitArrayWrapper; + keysIn(): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.keysIn */ - keysIn(): LoDashExplicitArrayWrapper; + keysIn(): LoDashExplicitWrapper; } //_.mapKeys @@ -16687,126 +13395,78 @@ declare namespace _ { * @param thisArg The this binding of iteratee. * @return Returns the new mapped object. */ - mapKeys( + mapKeys( object: List | null | undefined, - iteratee?: ListIterator - ): Dictionary; - - /** - * @see _.mapKeys - */ - mapKeys( - object: Dictionary | null | undefined, - iteratee?: DictionaryIterator - ): Dictionary; - - /** - * @see _.mapKeys - */ - mapKeys( - object: List|Dictionary | null | undefined, - iteratee?: TObject + iteratee?: ListIteratee ): Dictionary; /** * @see _.mapKeys */ mapKeys( - object: List|Dictionary | null | undefined, - iteratee?: string + object: Dictionary | null | undefined, + iteratee?: DictionaryIteratee ): Dictionary; - } - - interface LoDashImplicitArrayWrapperBase { - /** - * @see _.mapKeys - */ - mapKeys( - iteratee?: ListIterator - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.mapKeys - */ - mapKeys( - iteratee?: TObject - ): LoDashImplicitObjectWrapper>; /** * @see _.mapKeys */ mapKeys( - iteratee?: string - ): LoDashImplicitObjectWrapper>; + object: object | null | undefined, + iteratee?: ObjectIteratee + ): Dictionary; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.mapKeys */ - mapKeys( - iteratee?: ListIterator|DictionaryIterator - ): LoDashImplicitObjectWrapper>; + mapKeys( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashImplicitWrapper>; /** * @see _.mapKeys */ - mapKeys( - iteratee?: TObject - ): LoDashImplicitObjectWrapper>; - - /** - * @see _.mapKeys - */ - mapKeys( - iteratee?: string - ): LoDashImplicitObjectWrapper>; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.mapKeys - */ - mapKeys( - iteratee?: ListIterator - ): LoDashExplicitObjectWrapper>; - - /** - * @see _.mapKeys - */ - mapKeys( - iteratee?: TObject - ): LoDashExplicitObjectWrapper>; + mapKeys( + this: LoDashImplicitWrapper | null | undefined>, + iteratee?: DictionaryIteratee + ): LoDashImplicitWrapper>; /** * @see _.mapKeys */ mapKeys( - iteratee?: string - ): LoDashExplicitObjectWrapper>; + this: LoDashImplicitWrapper, + iteratee?: ObjectIteratee + ): LoDashImplicitWrapper>; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.mapKeys */ - mapKeys( - iteratee?: ListIterator|DictionaryIterator - ): LoDashExplicitObjectWrapper>; + mapKeys( + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: ListIteratee + ): LoDashExplicitWrapper>; /** * @see _.mapKeys */ - mapKeys( - iteratee?: TObject - ): LoDashExplicitObjectWrapper>; + mapKeys( + this: LoDashExplicitWrapper | null | undefined>, + iteratee?: DictionaryIteratee + ): LoDashExplicitWrapper>; /** * @see _.mapKeys */ - mapKeys( - iteratee?: string - ): LoDashExplicitObjectWrapper>; + mapKeys( + this: LoDashExplicitWrapper, + iteratee?: ObjectIteratee + ): LoDashExplicitWrapper>; } //_.mapValues @@ -16830,56 +13490,171 @@ declare namespace _ { * @param {Object} [thisArg] The `this` binding of `iteratee`. * @return {Object} Returns the new mapped object. */ - mapValues(obj: Dictionary | null | undefined, callback: ObjectIterator): Dictionary; - mapValues(obj: Dictionary | null | undefined, where: Dictionary): Dictionary; - mapValues(obj: T | null | undefined, pluck?: string): TMapped; - mapValues(obj: T | null | undefined, callback: ObjectIterator): T; + mapValues(obj: T | null | undefined, callback: ObjectIterator): { [P in keyof T]: TResult }; + + /** + * @see _.mapValues + */ + mapValues(obj: T | null | undefined, iteratee: object): { [P in keyof T]: boolean }; + + /** + * @see _.mapValues + */ + mapValues(obj: Dictionary | null | undefined, iteratee: TKey): Dictionary; + + /** + * @see _.mapValues + */ + mapValues(obj: T | null | undefined, iteratee: string): { [P in keyof T]: any }; + + /** + * @see _.mapValues + */ + mapValues(obj: string | null | undefined, callback: StringIterator): NumericDictionary; + + /** + * @see _.mapValues + */ + mapValues(obj: Dictionary | null | undefined): Dictionary; + + /** + * @see _.mapValues + */ + mapValues(obj: T): T; + + /** + * @see _.mapValues + */ + mapValues(obj: T | null | undefined): T | {}; + + /** + * @see _.mapValues + */ + mapValues(obj: string | null | undefined): NumericDictionary; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.mapValues - * TValue is the type of the property values of T. - * TResult is the type output by the ObjectIterator function */ - mapValues(callback: ObjectIterator): LoDashImplicitObjectWrapper>; + mapValues( + this: LoDashImplicitWrapper, + callback: ObjectIterator + ): LoDashImplicitWrapper<{ [P in keyof T]: TResult }>; /** * @see _.mapValues - * TResult is the type of the property specified by pluck. - * T should be a Dictionary> */ - mapValues(pluck?: string): LoDashImplicitObjectWrapper>; + mapValues( + this: LoDashImplicitWrapper, + iteratee: object + ): LoDashImplicitWrapper<{ [P in keyof T]: boolean }>; /** * @see _.mapValues - * TResult is the type of the properties of each object in the values of T - * T should be a Dictionary> */ - mapValues(where: Dictionary): LoDashImplicitArrayWrapper; + mapValues( + this: LoDashImplicitWrapper | null | undefined>, + iteratee: TKey + ): LoDashImplicitWrapper>; + + /** + * @see _.mapValues + */ + mapValues( + this: LoDashImplicitWrapper, + iteratee: string + ): LoDashImplicitWrapper<{ [P in keyof T]: any }>; + + /** + * @see _.mapValues + */ + mapValues( + this: LoDashImplicitWrapper, + callback: StringIterator + ): LoDashImplicitWrapper>; + + /** + * @see _.mapValues + */ + mapValues(this: LoDashImplicitWrapper | null | undefined>): LoDashImplicitWrapper>; + + /** + * @see _.mapValues + */ + mapValues(this: LoDashImplicitWrapper): LoDashImplicitWrapper; + + /** + * @see _.mapValues + */ + mapValues(this: LoDashImplicitWrapper): LoDashImplicitWrapper; + + /** + * @see _.mapValues + */ + mapValues(this: LoDashImplicitWrapper): LoDashImplicitWrapper>; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.mapValues - * TValue is the type of the property values of T. - * TResult is the type output by the ObjectIterator function */ - mapValues(callback: ObjectIterator): LoDashExplicitObjectWrapper>; + mapValues( + this: LoDashExplicitWrapper, + callback: ObjectIterator + ): LoDashExplicitWrapper<{ [P in keyof T]: TResult }>; /** * @see _.mapValues - * TResult is the type of the property specified by pluck. - * T should be a Dictionary> */ - mapValues(pluck?: string): LoDashExplicitObjectWrapper>; + mapValues( + this: LoDashExplicitWrapper, + iteratee: object + ): LoDashExplicitWrapper<{ [P in keyof T]: boolean }>; /** * @see _.mapValues - * TResult is the type of the properties of each object in the values of T - * T should be a Dictionary> */ - mapValues(where: Dictionary): LoDashExplicitObjectWrapper; + mapValues( + this: LoDashExplicitWrapper | null | undefined>, + iteratee: TKey + ): LoDashExplicitWrapper>; + + /** + * @see _.mapValues + */ + mapValues( + this: LoDashExplicitWrapper, + iteratee: string + ): LoDashExplicitWrapper<{ [P in keyof T]: any }>; + + /** + * @see _.mapValues + */ + mapValues( + this: LoDashExplicitWrapper, + callback: StringIterator + ): LoDashExplicitWrapper>; + + /** + * @see _.mapValues + */ + mapValues(this: LoDashExplicitWrapper | null | undefined>): LoDashExplicitWrapper>; + + /** + * @see _.mapValues + */ + mapValues(this: LoDashExplicitWrapper): LoDashExplicitWrapper; + + /** + * @see _.mapValues + */ + mapValues(this: LoDashExplicitWrapper): LoDashExplicitWrapper; + + /** + * @see _.mapValues + */ + mapValues(this: LoDashExplicitWrapper): LoDashExplicitWrapper>; } //_.merge @@ -16951,19 +13726,19 @@ declare namespace _ { /** * @see _.merge */ - merge( + merge( object: any, ...otherArgs: any[] - ): TResult; + ): any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.merge */ merge( source: TSource - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.merge @@ -16971,7 +13746,7 @@ declare namespace _ { merge( source1: TSource1, source2: TSource2 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.merge @@ -16980,7 +13755,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.merge @@ -16990,23 +13765,23 @@ declare namespace _ { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.merge */ - merge( + merge( ...otherArgs: any[] - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.merge */ merge( source: TSource - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.merge @@ -17014,7 +13789,7 @@ declare namespace _ { merge( source1: TSource1, source2: TSource2 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.merge @@ -17023,20 +13798,20 @@ declare namespace _ { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.merge */ merge( - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; /** * @see _.merge */ - merge( + merge( ...otherArgs: any[] - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; } //_.mergeWith @@ -17120,20 +13895,20 @@ declare namespace _ { /** * @see _.mergeWith */ - mergeWith( + mergeWith( object: any, ...otherArgs: any[] - ): TResult; + ): any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.mergeWith */ mergeWith( source: TSource, customizer: MergeWithCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.mergeWith @@ -17142,7 +13917,7 @@ declare namespace _ { source1: TSource1, source2: TSource2, customizer: MergeWithCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.mergeWith @@ -17152,7 +13927,7 @@ declare namespace _ { source2: TSource2, source3: TSource3, customizer: MergeWithCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.mergeWith @@ -17163,14 +13938,14 @@ declare namespace _ { source3: TSource3, source4: TSource4, customizer: MergeWithCustomizer - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; /** * @see _.mergeWith */ - mergeWith( + mergeWith( ...otherArgs: any[] - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; } //_.omit @@ -17194,28 +13969,30 @@ declare namespace _ { * // => { 'b': '2' } */ - omit( + omit( object: T | null | undefined, - ...predicate: Array> - ): TResult; + ...props: Array> + ): PartialObject; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.omit */ - omit( - ...predicate: Array> - ): LoDashImplicitObjectWrapper; + omit( + this: LoDashImplicitWrapper, + ...props: Array> + ): LoDashImplicitWrapper>; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.omit */ - omit( + omit( + this: LoDashExplicitWrapper, ...predicate: Array> - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper>; } //_.omitBy @@ -17238,28 +14015,30 @@ declare namespace _ { * _.omitBy(object, _.isNumber); * // => { 'b': '2' } */ - omitBy( + omitBy( object: T | null | undefined, - predicate: ObjectIterator - ): TResult; + predicate: ValueKeyIteratee + ): PartialObject; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.omitBy */ - omitBy( - predicate: ObjectIterator - ): LoDashImplicitObjectWrapper; + omitBy( + this: LoDashImplicitWrapper, + predicate: ValueKeyIteratee + ): LoDashImplicitWrapper>; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.omitBy */ - omitBy( - predicate: ObjectIterator - ): LoDashExplicitObjectWrapper; + omitBy( + this: LoDashExplicitWrapper, + predicate: ValueKeyIteratee + ): LoDashExplicitWrapper>; } //_.pick @@ -17281,35 +14060,37 @@ declare namespace _ { * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ - pick( + pick( object: T | null | undefined, ...predicate: Array> - ): TResult; + ): PartialObject; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.pick */ - pick( + pick( + this: LoDashImplicitWrapper, ...predicate: Array> - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper>; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.pick */ - pick( + pick( + this: LoDashExplicitWrapper, ...predicate: Array> - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper>; } //_.pickBy interface LoDashStatic { /** * Creates an object composed of the `object` properties `predicate` returns - * truthy for. The predicate is invoked with one argument: (value). + * truthy for. The predicate is invoked with two arguments: (value, key). * * @static * @memberOf _ @@ -17324,28 +14105,30 @@ declare namespace _ { * _.pickBy(object, _.isNumber); * // => { 'a': 1, 'c': 3 } */ - pickBy( + pickBy( object: T | null | undefined, - predicate?: ObjectIterator - ): TResult; + predicate?: ValueKeyIteratee + ): PartialObject; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.pickBy */ - pickBy( - predicate?: ObjectIterator - ): LoDashImplicitObjectWrapper; + pickBy( + this: LoDashImplicitWrapper, + predicate?: ValueKeyIteratee + ): LoDashImplicitWrapper>; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.pickBy */ - pickBy( - predicate?: ObjectIterator - ): LoDashExplicitObjectWrapper; + pickBy( + this: LoDashExplicitWrapper, + predicate?: ValueKeyIteratee + ): LoDashExplicitWrapper>; } //_.result @@ -17359,15 +14142,6 @@ declare namespace _ { * @param defaultValue The value returned if the resolved value is undefined. * @return Returns the resolved value. */ - result( - object: TObject, - path: Many, - defaultValue?: TResult|((...args: any[]) => TResult) - ): TResult; - - /** - * @see _.result - */ result( object: any, path: Many, @@ -17375,7 +14149,7 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.result */ @@ -17385,54 +14159,14 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.result */ result( path: Many, defaultValue?: TResult|((...args: any[]) => TResult) - ): TResult; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.result - */ - result( - path: Many, - defaultValue?: TResult|((...args: any[]) => TResult) - ): TResult; - } - - interface LoDashExplicitWrapper { - /** - * @see _.result - */ - result( - path: Many, - defaultValue?: any - ): TResultWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.result - */ - result( - path: Many, - defaultValue?: any - ): TResultWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.result - */ - result( - path: Many, - defaultValue?: any - ): TResultWrapper; + ): LoDashExplicitWrapper; } //_.set @@ -17447,65 +14181,56 @@ declare namespace _ { * @param value The value to set. * @return Returns object. */ - set( - object: Object, + set( + object: T, path: Many, value: any - ): TResult; + ): T; /** * @see _.set */ - set( - object: Object, + set( + object: object, path: Many, - value: V - ): TResult; - - /** - * @see _.set - */ - set( - object: O, - path: Many, - value: V + value: any ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { + /** + * @see _.set + */ + set( + path: Many, + value: any + ): this; + /** * @see _.set */ set( path: Many, value: any - ): LoDashImplicitObjectWrapper; - - /** - * @see _.set - */ - set( - path: Many, - value: V - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { + /** + * @see _.set + */ + set( + path: Many, + value: any + ): this; + /** * @see _.set */ set( path: Many, value: any - ): LoDashExplicitObjectWrapper; - - /** - * @see _.set - */ - set( - path: Many, - value: V - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; } //_.setWith @@ -17523,72 +14248,59 @@ declare namespace _ { * @parem customizer The function to customize assigned values. * @return Returns object. */ - setWith( - object: O, - path: Many, - value: V, - customizer?: SetWithCustomizer - ): TResult; - - /** - * @see _.setWith - */ - setWith( - object: any, + setWith( + object: T, path: Many, value: any, - customizer?: SetWithCustomizer - ): TResult; + customizer?: SetWithCustomizer + ): T; - /** - * @see _.setWith - */ - setWith( - object: any, + setWith( + object: T, path: Many, - value: V, - customizer?: SetWithCustomizer + value: any, + customizer?: SetWithCustomizer ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { + /** + * @see _.setWith + */ + setWith( + path: Many, + value: any, + customizer?: SetWithCustomizer + ): this; + /** * @see _.setWith */ setWith( path: Many, value: any, - customizer?: SetWithCustomizer - ): LoDashImplicitObjectWrapper; - - /** - * @see _.setWith - */ - setWith( - path: Many, - value: V, - customizer?: SetWithCustomizer - ): LoDashImplicitObjectWrapper; + customizer?: SetWithCustomizer + ): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { + /** + * @see _.setWith + */ + setWith( + path: Many, + value: any, + customizer?: SetWithCustomizer + ): this; + /** * @see _.setWith */ setWith( path: Many, value: any, - customizer?: SetWithCustomizer - ): LoDashExplicitObjectWrapper; - - /** - * @see _.setWith - */ - setWith( - path: Many, - value: V, - customizer?: SetWithCustomizer - ): LoDashExplicitObjectWrapper; + customizer?: SetWithCustomizer + ): LoDashExplicitWrapper; } //_.toPairs @@ -17599,23 +14311,36 @@ declare namespace _ { * @param object The object to query. * @return Returns the new array of key-value pairs. */ - toPairs(object?: T): [string, any][]; + toPairs(object?: Dictionary): Array<[string, T]>; - toPairs(object?: T): [string, TResult][]; - } - - interface LoDashImplicitObjectWrapper { /** * @see _.toPairs */ - toPairs(): LoDashImplicitArrayWrapper<[string, TResult]>; + toPairs(object?: object): Array<[string, any]>; } - interface LoDashExplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.toPairs */ - toPairs(): LoDashExplicitArrayWrapper<[string, TResult]>; + toPairs(this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + + /** + * @see _.toPairs + */ + toPairs(): LoDashImplicitWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toPairs + */ + toPairs(this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + + /** + * @see _.toPairs + */ + toPairs(): LoDashExplicitWrapper>; } //_.toPairsIn @@ -17626,23 +14351,36 @@ declare namespace _ { * @param object The object to query. * @return Returns the new array of key-value pairs. */ - toPairsIn(object?: T): [string, any][]; + toPairsIn(object?: Dictionary): Array<[string, T]>; - toPairsIn(object?: T): [string, TResult][]; - } - - interface LoDashImplicitObjectWrapper { /** * @see _.toPairsIn */ - toPairsIn(): LoDashImplicitArrayWrapper<[string, TResult]>; + toPairsIn(object?: object): Array<[string, any]>; } - interface LoDashExplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.toPairsIn */ - toPairsIn(): LoDashExplicitArrayWrapper<[string, TResult]>; + toPairsIn(this: LoDashImplicitWrapper>): LoDashImplicitWrapper>; + + /** + * @see _.toPairsIn + */ + toPairsIn(): LoDashImplicitWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toPairsIn + */ + toPairsIn(this: LoDashExplicitWrapper>): LoDashExplicitWrapper>; + + /** + * @see _.toPairsIn + */ + toPairsIn(): LoDashExplicitWrapper>; } //_.transform @@ -17661,7 +14399,7 @@ declare namespace _ { */ transform( object: T[], - iteratee?: MemoVoidArrayIterator, + iteratee: MemoVoidArrayIterator, accumulator?: TResult[] ): TResult[]; @@ -17670,7 +14408,16 @@ declare namespace _ { */ transform( object: T[], - iteratee?: MemoVoidArrayIterator>, + iteratee: MemoVoidArrayIterator>, + accumulator: Dictionary + ): Dictionary; + + /** + * @see _.transform + */ + transform( + object: Dictionary, + iteratee: MemoVoidDictionaryIterator>, accumulator?: Dictionary ): Dictionary; @@ -17679,54 +14426,123 @@ declare namespace _ { */ transform( object: Dictionary, - iteratee?: MemoVoidDictionaryIterator>, - accumulator?: Dictionary - ): Dictionary; - - /** - * @see _.transform - */ - transform( - object: Dictionary, - iteratee?: MemoVoidDictionaryIterator, - accumulator?: TResult[] + iteratee: MemoVoidDictionaryIterator, + accumulator: TResult[] ): TResult[]; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.transform - */ - transform( - iteratee?: MemoVoidArrayIterator, - accumulator?: TResult[] - ): LoDashImplicitArrayWrapper; /** * @see _.transform */ - transform( - iteratee?: MemoVoidArrayIterator>, - accumulator?: Dictionary - ): LoDashImplicitObjectWrapper>; + transform( + object: any[], + ): any[]; + + /** + * @see _.transform + */ + transform( + object: object, + ): Dictionary; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.transform */ transform( - iteratee?: MemoVoidDictionaryIterator>, - accumulator?: Dictionary - ): LoDashImplicitObjectWrapper>; + this: LoDashImplicitWrapper, + iteratee: MemoVoidArrayIterator, + accumulator?: TResult[] + ): LoDashImplicitWrapper; /** * @see _.transform */ transform( - iteratee?: MemoVoidDictionaryIterator, + this: LoDashImplicitWrapper, + iteratee: MemoVoidArrayIterator>, + accumulator: Dictionary + ): LoDashImplicitWrapper>; + + /** + * @see _.transform + */ + transform( + this: LoDashImplicitWrapper>, + iteratee: MemoVoidDictionaryIterator>, + accumulator?: Dictionary + ): LoDashImplicitWrapper>; + + /** + * @see _.transform + */ + transform( + this: LoDashImplicitWrapper>, + iteratee: MemoVoidDictionaryIterator, + accumulator: TResult[] + ): LoDashImplicitWrapper; + + /** + * @see _.transform + */ + transform( + this: LoDashImplicitWrapper, + ): LoDashImplicitWrapper; + + /** + * @see _.transform + */ + transform(): LoDashImplicitWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.transform + */ + transform( + this: LoDashExplicitWrapper, + iteratee: MemoVoidArrayIterator, accumulator?: TResult[] - ): LoDashImplicitArrayWrapper; + ): LoDashExplicitWrapper; + + /** + * @see _.transform + */ + transform( + this: LoDashExplicitWrapper, + iteratee: MemoVoidArrayIterator>, + accumulator?: Dictionary + ): LoDashExplicitWrapper>; + + /** + * @see _.transform + */ + transform( + this: LoDashExplicitWrapper>, + iteratee: MemoVoidDictionaryIterator>, + accumulator?: Dictionary + ): LoDashExplicitWrapper>; + + /** + * @see _.transform + */ + transform( + this: LoDashExplicitWrapper>, + iteratee: MemoVoidDictionaryIterator, + accumulator?: TResult[] + ): LoDashExplicitWrapper; + + /** + * @see _.transform + */ + transform( + this: LoDashExplicitWrapper, + ): LoDashExplicitWrapper; + + /** + * @see _.transform + */ + transform(): LoDashExplicitWrapper>; } //_.unset @@ -17740,20 +14556,20 @@ declare namespace _ { * @param path The path of the property to unset. * @return Returns true if the property is deleted, else false. */ - unset( - object: T, + unset( + object: any, path: Many ): boolean; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.unset */ unset(path: Many): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.unset */ @@ -17771,74 +14587,31 @@ declare namespace _ { * @param updater The function to produce the updated value. * @return Returns object. */ - update( - object: Object, + update( + object: object, path: Many, - updater: Function - ): TResult; - - /** - * @see _.update - */ - update( - object: Object, - path: Many, - updater: U - ): TResult; - - /** - * @see _.update - */ - update( - object: O, - path: Many, - updater: Function - ): TResult; - - /** - * @see _.update - */ - update( - object: O, - path: Many, - updater: U - ): TResult; + updater: (value: any) => any + ): any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.update */ - update( + update( path: Many, - updater: any - ): LoDashImplicitObjectWrapper; - - /** - * @see _.update - */ - update( - path: Many, - updater: U - ): LoDashImplicitObjectWrapper; + updater: (value: any) => any + ): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.update */ - update( + update( path: Many, - updater: any - ): LoDashExplicitObjectWrapper; - - /** - * @see _.update - */ - update( - path: Many, - updater: U - ): LoDashExplicitObjectWrapper; + updater: (value: any) => any + ): LoDashExplicitWrapper; } //_.updateWith @@ -17867,44 +14640,62 @@ declare namespace _ { * _.updateWith(object, '[0][1]', _.constant('a'), Object); * // => { '0': { '1': 'a' } } */ - updateWith( - object: O, - path: Many, - updater: (oldValue: any) => any, - customizer?: SetWithCustomizer - ): TResult; - - /** - * @see _.updateWith - */ - updateWith( - object: any, - path: Many, - updater: (oldValue: any) => any, - customizer?: SetWithCustomizer - ): TResult; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.updateWith - */ - updateWith( + updateWith( + object: T, path: Many, updater: (oldValue: any) => any, customizer?: SetWithCustomizer - ): LoDashImplicitObjectWrapper; + ): T; + + /** + * @see _.updateWith + */ + updateWith( + object: T, + path: Many, + updater: (oldValue: any) => any, + customizer?: SetWithCustomizer + ): TResult; } - interface LoDashExplicitObjectWrapper { + interface LoDashImplicitWrapper { + /** + * @see _.updateWith + */ + updateWith( + path: Many, + updater: (oldValue: any) => any, + customizer?: SetWithCustomizer + ): this; + /** * @see _.updateWith */ updateWith( path: Many, updater: (oldValue: any) => any, - customizer?: SetWithCustomizer - ): LoDashExplicitObjectWrapper; + customizer?: SetWithCustomizer + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.updateWith + */ + updateWith( + path: Many, + updater: (oldValue: any) => any, + customizer?: SetWithCustomizer + ): this; + + /** + * @see _.updateWith + */ + updateWith( + path: Many, + updater: (oldValue: any) => any, + customizer?: SetWithCustomizer + ): LoDashExplicitWrapper; } //_.values @@ -17915,61 +14706,51 @@ declare namespace _ { * @param object The object to query. * @return Returns an array of property values. */ - values(object?: Dictionary|NumericDictionary|List | null | undefined): T[]; + values(object: Dictionary|NumericDictionary|List | null | undefined): T[]; /** * @see _.values */ - values(object?: any): T[]; + values(object: T | null | undefined): Array; + + /** + * @see _.values + */ + values(object: any): any[]; } - interface LoDashImplicitStringWrapper { + interface LoDashImplicitWrapper { /** * @see _.values */ - values(): LoDashImplicitArrayWrapper; + values(this: LoDashImplicitWrapper | NumericDictionary | List | null | undefined>): LoDashImplicitWrapper; + + /** + * @see _.values + */ + values(this: LoDashImplicitWrapper): LoDashImplicitWrapper>; + + /** + * @see _.values + */ + values(): LoDashImplicitWrapper; } - interface LoDashImplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.values */ - values(): LoDashImplicitArrayWrapper; - } + values(this: LoDashExplicitWrapper | NumericDictionary | List | null | undefined>): LoDashExplicitWrapper; - interface LoDashImplicitArrayWrapperBase { /** * @see _.values */ - values(): LoDashImplicitArrayWrapper; - } + values(this: LoDashExplicitWrapper): LoDashExplicitWrapper>; - interface LoDashImplicitObjectWrapperBase { /** * @see _.values */ - values(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.values - */ - values(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.values - */ - values(): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.values - */ - values(): LoDashExplicitArrayWrapper; + values(): LoDashExplicitWrapper; } //_.valuesIn @@ -17980,26 +14761,36 @@ declare namespace _ { * @param object The object to query. * @return Returns the array of property values. */ - valuesIn(object?: Dictionary): T[]; + valuesIn(object: Dictionary|NumericDictionary|List | null | undefined): T[]; /** * @see _.valuesIn */ - valuesIn(object?: any): T[]; + valuesIn(object: T | null | undefined): Array; } - interface LoDashImplicitObjectWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.valuesIn */ - valuesIn(): LoDashImplicitArrayWrapper; + valuesIn(this: LoDashImplicitWrapper | NumericDictionary | List | null | undefined>): LoDashImplicitWrapper; + + /** + * @see _.valuesIn + */ + valuesIn(this: LoDashImplicitWrapper): LoDashImplicitWrapper>; } - interface LoDashExplicitObjectWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.valuesIn */ - valuesIn(): LoDashExplicitArrayWrapper; + valuesIn(this: LoDashExplicitWrapper | NumericDictionary | List | null | undefined>): LoDashExplicitWrapper; + + /** + * @see _.valuesIn + */ + valuesIn(this: LoDashExplicitWrapper): LoDashExplicitWrapper>; } /********** @@ -18017,14 +14808,14 @@ declare namespace _ { camelCase(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.camelCase */ camelCase(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.camelCase */ @@ -18042,14 +14833,14 @@ declare namespace _ { capitalize(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.capitalize */ capitalize(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.capitalize */ @@ -18068,14 +14859,14 @@ declare namespace _ { deburr(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.deburr */ deburr(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.deburr */ @@ -18099,7 +14890,7 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.endsWith */ @@ -18109,7 +14900,7 @@ declare namespace _ { ): boolean; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.endsWith */ @@ -18141,14 +14932,14 @@ declare namespace _ { escape(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.escape */ escape(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.escape */ @@ -18167,14 +14958,14 @@ declare namespace _ { escapeRegExp(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.escapeRegExp */ escapeRegExp(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.escapeRegExp */ @@ -18192,14 +14983,14 @@ declare namespace _ { kebabCase(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.kebabCase */ kebabCase(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.kebabCase */ @@ -18217,14 +15008,14 @@ declare namespace _ { lowerCase(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.lowerCase */ lowerCase(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.lowerCase */ @@ -18242,14 +15033,14 @@ declare namespace _ { lowerFirst(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.lowerFirst */ lowerFirst(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.lowerFirst */ @@ -18274,7 +15065,7 @@ declare namespace _ { ): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.pad */ @@ -18284,7 +15075,7 @@ declare namespace _ { ): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.pad */ @@ -18312,7 +15103,7 @@ declare namespace _ { ): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.padEnd */ @@ -18322,7 +15113,7 @@ declare namespace _ { ): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.padEnd */ @@ -18350,7 +15141,7 @@ declare namespace _ { ): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.padStart */ @@ -18360,7 +15151,7 @@ declare namespace _ { ): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.padStart */ @@ -18388,14 +15179,14 @@ declare namespace _ { ): number; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.parseInt */ parseInt(radix?: number): number; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.parseInt */ @@ -18417,20 +15208,22 @@ declare namespace _ { ): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.repeat */ repeat(n?: number): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.repeat */ repeat(n?: number): LoDashExplicitWrapper; } + type ReplaceFunction = (match: string, ...args: any[]) => string; + //_.replace interface LoDashStatic { /** @@ -18445,84 +15238,50 @@ declare namespace _ { */ replace( string: string, + pattern: RegExp | string, + replacement: ReplaceFunction | string + ): string; + + /** + * @see _.replace + */ + replace( + pattern: RegExp | string, + replacement: ReplaceFunction | string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.replace + */ + replace( pattern: RegExp|string, - replacement: Function|string + replacement: ReplaceFunction | string ): string; /** * @see _.replace */ replace( - pattern?: RegExp|string, - replacement?: Function|string + replacement: ReplaceFunction | string ): string; } - interface LoDashImplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.replace */ replace( - pattern?: RegExp|string, - replacement?: Function|string - ): string; - - /** - * @see _.replace - */ - replace( - replacement?: Function|string - ): string; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.replace - */ - replace( - pattern?: RegExp|string, - replacement?: Function|string - ): string; - - /** - * @see _.replace - */ - replace( - replacement?: Function|string - ): string; - } - - interface LoDashExplicitWrapper { - /** - * @see _.replace - */ - replace( - pattern?: RegExp|string, - replacement?: Function|string + pattern: RegExp | string, + replacement: ReplaceFunction | string ): LoDashExplicitWrapper; /** * @see _.replace */ replace( - replacement?: Function|string - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.replace - */ - replace( - pattern?: RegExp|string, - replacement?: Function|string - ): LoDashExplicitWrapper; - - /** - * @see _.replace - */ - replace( - replacement?: Function|string + replacement: ReplaceFunction | string ): LoDashExplicitWrapper; } @@ -18537,14 +15296,14 @@ declare namespace _ { snakeCase(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.snakeCase */ snakeCase(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.snakeCase */ @@ -18570,24 +15329,24 @@ declare namespace _ { ): string[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.split */ split( separator?: RegExp|string, limit?: number - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.split */ split( separator?: RegExp|string, limit?: number - ): LoDashExplicitArrayWrapper; + ): LoDashExplicitWrapper; } //_.startCase @@ -18601,14 +15360,14 @@ declare namespace _ { startCase(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.startCase */ startCase(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.startCase */ @@ -18632,7 +15391,7 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.startsWith */ @@ -18642,7 +15401,7 @@ declare namespace _ { ): boolean; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.startsWith */ @@ -18661,7 +15420,7 @@ declare namespace _ { } interface TemplateExecutor { - (data?: Object): string; + (data?: object): string; source: string; } @@ -18693,23 +15452,23 @@ declare namespace _ { * @return Returns the compiled template function. */ template( - string: string, + string?: string, options?: TemplateOptions ): TemplateExecutor; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.template */ template(options?: TemplateOptions): TemplateExecutor; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.template */ - template(options?: TemplateOptions): LoDashExplicitObjectWrapper; + template(options?: TemplateOptions): LoDashExplicitWrapper; } //_.toLower @@ -18723,14 +15482,14 @@ declare namespace _ { toLower(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.toLower */ toLower(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.toLower */ @@ -18748,14 +15507,14 @@ declare namespace _ { toUpper(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.toUpper */ toUpper(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.toUpper */ @@ -18777,14 +15536,14 @@ declare namespace _ { ): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.trim */ trim(chars?: string): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.trim */ @@ -18806,14 +15565,14 @@ declare namespace _ { ): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.trimEnd */ trimEnd(chars?: string): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.trimEnd */ @@ -18835,14 +15594,14 @@ declare namespace _ { ): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.trimStart */ trimStart(chars?: string): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.trimStart */ @@ -18874,14 +15633,14 @@ declare namespace _ { ): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.truncate */ truncate(options?: TruncateOptions): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.truncate */ @@ -18903,14 +15662,14 @@ declare namespace _ { unescape(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.unescape */ unescape(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.unescape */ @@ -18928,14 +15687,14 @@ declare namespace _ { upperCase(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.upperCase */ upperCase(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.upperCase */ @@ -18953,14 +15712,14 @@ declare namespace _ { upperFirst(string?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.upperFirst */ upperFirst(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.upperFirst */ @@ -18982,18 +15741,18 @@ declare namespace _ { ): string[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.words */ words(pattern?: string|RegExp): string[]; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.words */ - words(pattern?: string|RegExp): LoDashExplicitArrayWrapper; + words(pattern?: string|RegExp): LoDashExplicitWrapper; } /*********** @@ -19012,18 +15771,18 @@ declare namespace _ { attempt(func: (...args: any[]) => TResult, ...args: any[]): TResult|Error; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.attempt */ attempt(...args: any[]): TResult|Error; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.attempt */ - attempt(...args: any[]): LoDashExplicitObjectWrapper; + attempt(...args: any[]): LoDashExplicitWrapper; } //_.constant @@ -19037,18 +15796,18 @@ declare namespace _ { constant(value: T): () => T; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.constant */ - constant(): LoDashImplicitObjectWrapper<() => TResult>; + constant(): LoDashImplicitWrapper<() => TValue>; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.constant */ - constant(): LoDashExplicitObjectWrapper<() => TResult>; + constant(): LoDashExplicitWrapper<() => TValue>; } //_.defaultTo @@ -19063,20 +15822,44 @@ declare namespace _ { * @returns Returns the resolved value. */ defaultTo(value: T | null | undefined, defaultValue: T): T; - } - interface LoDashImplicitWrapperBase { /** * @see _.defaultTo */ - defaultTo(value: TResult): LoDashImplicitObjectWrapper; + defaultTo( + value: T | null | undefined, + defaultValue: TDefault + ): T | TDefault; } - interface LoDashExplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.defaultTo */ - defaultTo(value: TResult): LoDashExplicitObjectWrapper; + defaultTo(this: LoDashImplicitWrapper, defaultValue: T): T; + + /** + * @see _.defaultTo + */ + defaultTo( + this: LoDashImplicitWrapper, + defaultValue: TDefault + ): T | TDefault; + } + + interface LoDashExplicitWrapper { + /** + * @see _.defaultTo + */ + defaultTo(this: LoDashExplicitWrapper, defaultValue: T): LoDashExplicitWrapper; + + /** + * @see _.defaultTo + */ + defaultTo( + this: LoDashExplicitWrapper, + defaultValue: TDefault + ): LoDashExplicitWrapper; } //_.identity @@ -19095,46 +15878,18 @@ declare namespace _ { identity(): undefined; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.identity */ - identity(): T; + identity(): TValue; } - interface LoDashImplicitArrayWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.identity */ - identity(): TArray; - } - - interface LoDashImplicitObjectWrapperBase { - /** - * @see _.identity - */ - identity(): TObject; - } - - interface LoDashExplicitWrapper { - /** - * @see _.identity - */ - identity(): LoDashExplicitWrapper; - } - - interface LoDashExplicitArrayWrapperBase { - /** - * @see _.identity - */ - identity(): TWrapper; - } - - interface LoDashExplicitObjectWrapperBase { - /** - * @see _.identity - */ - identity(): TWrapper; + identity(): this; } //_.iteratee @@ -19168,66 +15923,32 @@ declare namespace _ { * _.filter(users, 'age > 36'); * // => [{ 'user': 'fred', 'age': 40 }] */ - iteratee( - func: TFunction + iteratee any>( + func: TFunction | string | object ): TFunction; /** * @see _.iteratee */ - iteratee( - func: string - ): (object: any) => TResult; - - /** - * @see _.iteratee - */ - iteratee( - func: Object - ): (object: any) => boolean; - - /** - * @see _.iteratee - */ - iteratee(): (value: TResult) => TResult; + iteratee(): typeof _.identity; // tslint:disable-line:no-unnecessary-qualifier } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.iteratee */ - iteratee(): LoDashImplicitObjectWrapper<(object: any) => TResult>; + iteratee any>( + this: LoDashImplicitWrapper + ): LoDashImplicitWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.iteratee */ - iteratee(): LoDashImplicitObjectWrapper<(object: any) => boolean>; - - /** - * @see _.iteratee - */ - iteratee(): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; - } - - interface LoDashExplicitWrapper { - /** - * @see _.iteratee - */ - iteratee(): LoDashExplicitObjectWrapper<(object: any) => TResult>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.iteratee - */ - iteratee(): LoDashExplicitObjectWrapper<(object: any) => boolean>; - - /** - * @see _.iteratee - */ - iteratee(): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + iteratee any>( + this: LoDashExplicitWrapper + ): LoDashExplicitWrapper; } //_.matches @@ -19251,18 +15972,18 @@ declare namespace _ { matches(source: T): (value: V) => boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.matches */ - matches(): LoDashImplicitObjectWrapper<(value: V) => boolean>; + matches(): LoDashImplicitWrapper<(value: V) => boolean>; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.matches */ - matches(): LoDashExplicitObjectWrapper<(value: V) => boolean>; + matches(): LoDashExplicitWrapper<(value: V) => boolean>; } //_.matchesProperty @@ -19291,36 +16012,36 @@ declare namespace _ { ): (value: V) => boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.matchesProperty */ matchesProperty( srcValue: SrcValue - ): LoDashImplicitObjectWrapper<(value: any) => boolean>; + ): LoDashImplicitWrapper<(value: any) => boolean>; /** * @see _.matchesProperty */ matchesProperty( srcValue: SrcValue - ): LoDashImplicitObjectWrapper<(value: Value) => boolean>; + ): LoDashImplicitWrapper<(value: Value) => boolean>; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.matchesProperty */ matchesProperty( srcValue: SrcValue - ): LoDashExplicitObjectWrapper<(value: any) => boolean>; + ): LoDashExplicitWrapper<(value: any) => boolean>; /** * @see _.matchesProperty */ matchesProperty( srcValue: SrcValue - ): LoDashExplicitObjectWrapper<(value: Value) => boolean>; + ): LoDashExplicitWrapper<(value: Value) => boolean>; } //_.method @@ -19333,66 +16054,24 @@ declare namespace _ { * @param args The arguments to invoke the method with. * @return Returns the new function. */ - method( + method( path: string|StringRepresentable[], ...args: any[] - ): (object: TObject) => TResult; - - /** - * @see _.method - */ - method( - path: string|StringRepresentable[], - ...args: any[] - ): (object: any) => TResult; + ): (object: any) => any; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.method */ - method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; - - /** - * @see _.method - */ - method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; + method(...args: any[]): LoDashImplicitWrapper<(object: any) => any>; } - interface LoDashImplicitArrayWrapper { + interface LoDashExplicitWrapper { /** * @see _.method */ - method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; - - /** - * @see _.method - */ - method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; - } - - interface LoDashExplicitWrapper { - /** - * @see _.method - */ - method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; - - /** - * @see _.method - */ - method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.method - */ - method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; - - /** - * @see _.method - */ - method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; + method(...args: any[]): LoDashExplicitWrapper<(object: any) => any>; } //_.methodOf @@ -19405,36 +16084,28 @@ declare namespace _ { * @param args The arguments to invoke the method with. * @return Returns the new function. */ - methodOf( - object: TObject, + methodOf( + object: object, ...args: any[] - ): (path: Many) => TResult; - - /** - * @see _.methodOf - */ - methodOf( - object: {}, - ...args: any[] - ): (path: Many) => TResult; + ): (path: Many) => any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.methodOf */ - methodOf( + methodOf( ...args: any[] - ): LoDashImplicitObjectWrapper<(path: Many) => TResult>; + ): LoDashImplicitWrapper<(path: Many) => any>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.methodOf */ - methodOf( + methodOf( ...args: any[] - ): LoDashExplicitObjectWrapper<(path: Many) => TResult>; + ): LoDashExplicitWrapper<(path: Many) => any>; } //_.mixin @@ -19456,53 +16127,53 @@ declare namespace _ { * @param options.chain Specify whether the functions added are chainable. * @return Returns object. */ - mixin( + mixin( object: TObject, - source: Dictionary, + source: Dictionary<(...args: any[]) => any>, options?: MixinOptions - ): TResult; + ): TObject; /** * @see _.mixin */ mixin( - source: Dictionary, + source: Dictionary<(...args: any[]) => any>, options?: MixinOptions - ): TResult; + ): LoDashStatic; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.mixin */ - mixin( - source: Dictionary, + mixin( + source: Dictionary<(...args: any[]) => any>, options?: MixinOptions - ): LoDashImplicitObjectWrapper; + ): this; /** * @see _.mixin */ - mixin( + mixin( options?: MixinOptions - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.mixin */ - mixin( - source: Dictionary, + mixin( + source: Dictionary<(...args: any[]) => any>, options?: MixinOptions - ): LoDashExplicitObjectWrapper; + ): this; /** * @see _.mixin */ - mixin( + mixin( options?: MixinOptions - ): LoDashExplicitObjectWrapper; + ): LoDashExplicitWrapper; } //_.noConflict @@ -19515,18 +16186,18 @@ declare namespace _ { noConflict(): typeof _; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.noConflict */ noConflict(): typeof _; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.noConflict */ - noConflict(): LoDashExplicitObjectWrapper; + noConflict(): LoDashExplicitWrapper; } //_.noop @@ -19539,18 +16210,18 @@ declare namespace _ { noop(...args: any[]): void; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.noop */ noop(...args: any[]): void; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.noop */ - noop(...args: any[]): _.LoDashExplicitWrapper; + noop(...args: any[]): LoDashExplicitWrapper; } //_.nthArg @@ -19561,21 +16232,21 @@ declare namespace _ { * @param n The index of the argument to return. * @return Returns the new function. */ - nthArg(n?: number): TResult; + nthArg(n?: number): (...args: any[]) => any; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.nthArg */ - nthArg(): LoDashImplicitObjectWrapper; + nthArg(): LoDashImplicitWrapper<(...args: any[]) => any>; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.nthArg */ - nthArg(): LoDashExplicitObjectWrapper; + nthArg(): LoDashExplicitWrapper<(...args: any[]) => any>; } //_.over @@ -19587,35 +16258,27 @@ declare namespace _ { * @param iteratees The iteratees to invoke. * @return Returns the new function. */ - over(...iteratees: Array>): (...args: any[]) => TResult[]; + over(...iteratees: Array TResult>>): (...args: any[]) => TResult[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitWrapper { /** * @see _.over */ - over(...iteratees: Array>): LoDashImplicitObjectWrapper<(...args: any[]) => TResult[]>; + over( + this: LoDashImplicitWrapper TResult>>, + ...iteratees: Array TResult>> + ): LoDashImplicitWrapper<(...args: any[]) => TResult[]>; } - interface LoDashImplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.over */ - over(...iteratees: Array>): LoDashImplicitObjectWrapper<(...args: any[]) => TResult[]>; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.over - */ - over(...iteratees: Array>): LoDashExplicitObjectWrapper<(...args: any[]) => TResult[]>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.over - */ - over(...iteratees: Array>): LoDashExplicitObjectWrapper<(...args: any[]) => TResult[]>; + over( + this: LoDashExplicitWrapper TResult>>, + ...iteratees: Array TResult>> + ): LoDashExplicitWrapper<(...args: any[]) => TResult[]>; } //_.overEvery @@ -19627,35 +16290,21 @@ declare namespace _ { * @param predicates The predicates to check. * @return Returns the new function. */ - overEvery(...predicates: Array>): (...args: any[]) => boolean; + overEvery(...predicates: Array any>>): (...args: any[]) => boolean; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitWrapper { /** * @see _.overEvery */ - overEvery(...predicates: Array>): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + overEvery(...predicates: Array any>>): LoDashImplicitWrapper<(...args: any[]) => boolean>; } - interface LoDashImplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.overEvery */ - overEvery(...predicates: Array>): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.overEvery - */ - overEvery(...predicates: Array>): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.overEvery - */ - overEvery(...predicates: Array>): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + overEvery(...predicates: Array any>>): LoDashExplicitWrapper<(...args: any[]) => boolean>; } //_.overSome @@ -19667,35 +16316,21 @@ declare namespace _ { * @param predicates The predicates to check. * @return Returns the new function. */ - overSome(...predicates: Array>): (...args: any[]) => boolean; + overSome(...predicates: Array any>>): (...args: any[]) => boolean; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitWrapper { /** * @see _.overSome */ - overSome(...predicates: Array>): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + overSome(...predicates: Array any>>): LoDashImplicitWrapper<(...args: any[]) => boolean>; } - interface LoDashImplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.overSome */ - overSome(...predicates: Array>): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.overSome - */ - overSome(...predicates: Array>): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.overSome - */ - overSome(...predicates: Array>): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + overSome(...predicates: Array any>>): LoDashExplicitWrapper<(...args: any[]) => boolean>; } //_.property @@ -19709,32 +16344,18 @@ declare namespace _ { property(path: Many): (obj: TObj) => TResult; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.property */ - property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; + property(): LoDashImplicitWrapper<(obj: TObj) => TResult>; } - interface LoDashImplicitArrayWrapper { + interface LoDashExplicitWrapper { /** * @see _.property */ - property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; - } - - interface LoDashExplicitWrapper { - /** - * @see _.property - */ - property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.property - */ - property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; + property(): LoDashExplicitWrapper<(obj: TObj) => TResult>; } //_.propertyOf @@ -19749,18 +16370,18 @@ declare namespace _ { propertyOf(object: T): (path: Many) => any; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.propertyOf */ - propertyOf(): LoDashImplicitObjectWrapper<(path: Many) => any>; + propertyOf(): LoDashImplicitWrapper<(path: Many) => any>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitWrapper { /** * @see _.propertyOf */ - propertyOf(): LoDashExplicitObjectWrapper<(path: Many) => any>; + propertyOf(): LoDashExplicitWrapper<(path: Many) => any>; } //_.range @@ -19777,37 +16398,29 @@ declare namespace _ { */ range( start: number, - end: number, - step?: number - ): number[]; - - /** - * @see _.range - */ - range( - end: number, + end?: number, step?: number ): number[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.range */ range( end?: number, step?: number - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.range */ range( end?: number, step?: number - ): LoDashExplicitArrayWrapper; + ): LoDashExplicitWrapper; } //_.rangeRight @@ -19848,37 +16461,29 @@ declare namespace _ { */ rangeRight( start: number, - end: number, - step?: number - ): number[]; - - /** - * @see _.rangeRight - */ - rangeRight( - end: number, + end?: number, step?: number ): number[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.rangeRight */ rangeRight( end?: number, step?: number - ): LoDashImplicitArrayWrapper; + ): LoDashImplicitWrapper; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.rangeRight */ rangeRight( end?: number, step?: number - ): LoDashExplicitArrayWrapper; + ): LoDashExplicitWrapper; } //_.runInContext @@ -19889,10 +16494,10 @@ declare namespace _ { * @param context The context object. * @return Returns a new lodash function. */ - runInContext(context?: Object): typeof _; + runInContext(context?: object): typeof _; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitWrapper { /** * @see _.runInContext */ @@ -19909,18 +16514,18 @@ declare namespace _ { stubArray(): any[]; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.stubArray */ stubArray(): any[]; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.stubArray */ - stubArray(): _.LoDashExplicitArrayWrapper; + stubArray(): LoDashExplicitWrapper; } // _.stubFalse @@ -19933,18 +16538,18 @@ declare namespace _ { stubFalse(): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.stubFalse */ stubFalse(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.stubFalse */ - stubFalse(): _.LoDashExplicitWrapper; + stubFalse(): LoDashExplicitWrapper; } interface LoDashStatic { @@ -19953,21 +16558,21 @@ declare namespace _ { * * @returns Returns the new empty object. */ - stubObject(): Object; + stubObject(): any; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.stubObject */ - stubObject(): Object; + stubObject(): any; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.stubObject */ - stubObject(): _.LoDashExplicitObjectWrapper; + stubObject(): LoDashExplicitWrapper; } interface LoDashStatic { @@ -19979,18 +16584,18 @@ declare namespace _ { stubString(): string; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.stubString */ stubString(): string; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.stubString */ - stubString(): _.LoDashExplicitWrapper; + stubString(): LoDashExplicitWrapper; } interface LoDashStatic { @@ -20002,18 +16607,18 @@ declare namespace _ { stubTrue(): boolean; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.stubTrue */ stubTrue(): boolean; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.stubTrue */ - stubTrue(): _.LoDashExplicitWrapper; + stubTrue(): LoDashExplicitWrapper; } //_.times @@ -20037,7 +16642,7 @@ declare namespace _ { times(n: number): number[]; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.times */ @@ -20051,18 +16656,18 @@ declare namespace _ { times(): number[]; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.times */ times( iteratee: (num: number) => TResult - ): LoDashExplicitArrayWrapper; + ): LoDashExplicitWrapper; /** * @see _.times */ - times(): LoDashExplicitArrayWrapper; + times(): LoDashExplicitWrapper; } //_.toPath @@ -20095,14 +16700,14 @@ declare namespace _ { toPath(value: any): string[]; } - interface LoDashImplicitWrapperBase { + interface LoDashImplicitWrapper { /** * @see _.toPath */ toPath(): LoDashImplicitWrapper; } - interface LoDashExplicitWrapperBase { + interface LoDashExplicitWrapper { /** * @see _.toPath */ @@ -20120,41 +16725,53 @@ declare namespace _ { uniqueId(prefix?: string): string; } - interface LoDashImplicitWrapper { + interface LoDashImplicitWrapper { /** * @see _.uniqueId */ uniqueId(): string; } - interface LoDashExplicitWrapper { + interface LoDashExplicitWrapper { /** * @see _.uniqueId */ uniqueId(): LoDashExplicitWrapper; } + type ArrayIterator = (value: T, index: number, collection: T[]) => TResult; type ListIterator = (value: T, index: number, collection: List) => TResult; - + type ListIteratee = ListIterator | string | [string, any] | PartialDeep; type ListIteratorTypeGuard = (value: T, index: number, collection: List) => value is S; - type DictionaryIterator = (value: T, key: string, collection: Dictionary) => TResult; + // Note: key should be string, not keyof T, because the actual object may contain extra properties that were not specified in the type. + type ObjectIterator = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult; + type ObjectIteratee = ObjectIterator | string | [string, any] | PartialDeep; + type ObjectIteratorTypeGuard = (value: TObject[keyof TObject], key: string, collection: TObject) => value is S; - type DictionaryIteratorTypeGuard = (value: T, key: string, collection: Dictionary) => value is S; + type DictionaryIterator = ObjectIterator, TResult>; + type DictionaryIteratee = ObjectIteratee>; + type DictionaryIteratorTypeGuard = ObjectIteratorTypeGuard, S>; - type NumericDictionaryIterator = (value: T, key: number, collection: Dictionary) => TResult; - - type ObjectIterator = (element: T, key: string, collection: any) => TResult; + type NumericDictionaryIterator = (value: T, key: number, collection: NumericDictionary) => TResult; + type NumericDictionaryIteratee = NumericDictionaryIterator | string | [string, any] | PartialDeep; type StringIterator = (char: string, index: number, string: string) => TResult; type MemoVoidIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => void; + /** @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 MemoVoidArrayIterator = (acc: TResult, curr: T, index: number, arr: T[]) => void; type MemoVoidDictionaryIterator = (acc: TResult, curr: T, key: string, dict: Dictionary) => void; + type ValueIteratee = ((value: T) => any) | string | [string, any] | PartialDeep; + type ValueKeyIteratee = ((value: T, key: string) => any) | string | [string, any] | PartialDeep; + type Comparator = (a: T, b: T) => boolean; + /** Common interface between Arrays and jQuery objects */ type List = ArrayLike; @@ -20174,6 +16791,24 @@ declare namespace _ { cancel(): void; flush(): void; } + + type PartialDeep = { + [P in keyof T]?: PartialDeep; + }; + + // For backwards compatibility + type LoDashImplicitArrayWrapper = LoDashImplicitWrapper; + type LoDashImplicitNillableArrayWrapper = LoDashImplicitWrapper; + type LoDashImplicitObjectWrapper = LoDashImplicitWrapper; + type LoDashImplicitNillableObjectWrapper = LoDashImplicitWrapper; + type LoDashImplicitNumberArrayWrapper = LoDashImplicitWrapper; + type LoDashImplicitStringWrapper = LoDashImplicitWrapper; + type LoDashExplicitArrayWrapper = LoDashExplicitWrapper; + type LoDashExplicitNillableArrayWrapper = LoDashExplicitWrapper; + type LoDashExplicitObjectWrapper = LoDashExplicitWrapper; + type LoDashExplicitNillableObjectWrapper = LoDashExplicitWrapper; + type LoDashExplicitNumberArrayWrapper = LoDashExplicitWrapper; + type LoDashExplicitStringWrapper = LoDashExplicitWrapper; } // Backward compatibility with --target es5 diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 7ebd31f2c7..19399ff23b 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -1,6 +1,4 @@ -declare const $: any, jQuery: any; - -let x = 0 +declare const $: any; interface IFoodOrganic { name: string; @@ -130,7 +128,7 @@ namespace TestWrapper { { let result: _.LoDashImplicitArrayWrapper; - result = _(['']); + result = _(['']); } { @@ -140,12 +138,12 @@ namespace TestWrapper { { let a: TResult[] = []; - _(a) // $ExpectType LoDashImplicitArrayWrapper + _(a); // $ExpectType LoDashImplicitWrapper } { let a: TResult[] | null | undefined = any; - _(a) // $ExpectType LoDashImplicitNillableArrayWrapper + _(a); // $ExpectType LoDashImplicitWrapper } } @@ -227,14 +225,14 @@ namespace TestCompact { { let result: _.LoDashImplicitArrayWrapper; - result = _(array).compact(); + result = _(array).compact(); result = _(list).compact(); } { let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().compact(); + result = _(array).chain().compact(); result = _(list).chain().compact(); } } @@ -300,181 +298,181 @@ namespace TestDifferenceBy { { let result: TResult[]; - result = _.differenceBy(array, array); - result = _.differenceBy(array, list, array); - result = _.differenceBy(array, array, list, array); - result = _.differenceBy(array, list, array, list, array); - result = _.differenceBy(array, array, list, array, list, array); - result = _.differenceBy(array, list, array, list, array, list, 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); - result = _.differenceBy(array, array, iteratee); - result = _.differenceBy(array, list, array, iteratee); - result = _.differenceBy(array, array, list, array, iteratee); - result = _.differenceBy(array, list, array, list, array, iteratee); - result = _.differenceBy(array, array, list, array, list, array, iteratee); - result = _.differenceBy(array, list, array, list, array, list, array, 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); - result = _.differenceBy(array, array, 'a'); - result = _.differenceBy(array, list, array, 'a'); - result = _.differenceBy(array, array, list, array, 'a'); - result = _.differenceBy(array, list, array, list, array, 'a'); - result = _.differenceBy(array, array, list, array, list, array, 'a'); - result = _.differenceBy(array, list, array, list, array, list, array, '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'); - 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, list, array, list, array, list, array, {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}); - result = _.differenceBy(list, list); - result = _.differenceBy(list, array, list); - result = _.differenceBy(list, list, array, list); - result = _.differenceBy(list, array, list, array, list); - result = _.differenceBy(list, list, array, list, array, list); - result = _.differenceBy(list, array, list, array, list, array, 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); - result = _.differenceBy(list, list, iteratee); - result = _.differenceBy(list, array, list, iteratee); - result = _.differenceBy(list, list, array, list, iteratee); - result = _.differenceBy(list, array, list, array, list, iteratee); - result = _.differenceBy(list, list, array, list, array, list, iteratee); - result = _.differenceBy(list, array, list, array, list, array, list, 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); - result = _.differenceBy(list, list, 'a'); - result = _.differenceBy(list, array, list, 'a'); - result = _.differenceBy(list, list, array, list, 'a'); - result = _.differenceBy(list, array, list, array, list, 'a'); - result = _.differenceBy(list, list, array, list, array, list, 'a'); - result = _.differenceBy(list, array, list, array, list, array, list, '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'); - 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, array, list, array, list, array, list, {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}); } { - let result: _.LoDashImplicitArrayWrapper; + let result: _.LoDashImplicitWrapper; - result = _(array).differenceBy(array); - result = _(array).differenceBy(list, array); - result = _(array).differenceBy(array, list, array); - result = _(array).differenceBy(list, array, list, array); - result = _(array).differenceBy(array, list, array, list, array); - result = _(array).differenceBy(list, array, list, array, list, array); + 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); - result = _(array).differenceBy(array, iteratee); - result = _(array).differenceBy(list, array, iteratee); - result = _(array).differenceBy(array, list, array, iteratee); - result = _(array).differenceBy(list, array, list, array, iteratee); - result = _(array).differenceBy(array, list, array, list, array, iteratee); - result = _(array).differenceBy(list, array, list, array, list, array, iteratee); + 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); - result = _(array).differenceBy(array, 'a'); - result = _(array).differenceBy(list, array, 'a'); - result = _(array).differenceBy(array, list, array, 'a'); - result = _(array).differenceBy(list, array, list, array, 'a'); - result = _(array).differenceBy(array, list, array, list, array, 'a'); - result = _(array).differenceBy(list, array, list, array, list, array, 'a'); + 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(list, array, list, array, list, array, {a: 1}); + 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(list); - result = _(list).differenceBy(array, list); - result = _(list).differenceBy(list, array, list); - result = _(list).differenceBy(array, list, array, list); - result = _(list).differenceBy(list, array, list, array, list); - result = _(list).differenceBy(array, list, array, list, array, list); + 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(list, iteratee); - result = _(list).differenceBy(array, list, iteratee); - result = _(list).differenceBy(list, array, list, iteratee); - result = _(list).differenceBy(array, list, array, list, iteratee); - result = _(list).differenceBy(list, array, list, array, list, iteratee); - result = _(list).differenceBy(array, list, array, list, array, list, iteratee); + 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(list, 'a'); - result = _(list).differenceBy(array, list, 'a'); - result = _(list).differenceBy(list, array, list, 'a'); - result = _(list).differenceBy(array, list, array, list, 'a'); - result = _(list).differenceBy(list, array, list, array, list, 'a'); - result = _(list).differenceBy(array, list, array, list, array, list, 'a'); + 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(array, list, array, list, array, list, {a: 1}); + 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: _.LoDashExplicitArrayWrapper; + let result: _.LoDashExplicitWrapper; - result = _(array).chain().differenceBy(array); - result = _(array).chain().differenceBy(list, array); - result = _(array).chain().differenceBy(array, list, array); - result = _(array).chain().differenceBy(list, array, list, array); - result = _(array).chain().differenceBy(array, list, array, list, array); - result = _(array).chain().differenceBy(list, array, list, array, list, array); + 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(array, iteratee); - result = _(array).chain().differenceBy(list, array, iteratee); - result = _(array).chain().differenceBy(array, list, array, iteratee); - result = _(array).chain().differenceBy(list, array, list, array, iteratee); - result = _(array).chain().differenceBy(array, list, array, list, array, iteratee); - result = _(array).chain().differenceBy(list, array, list, array, list, array, iteratee); + 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(array, 'a'); - result = _(array).chain().differenceBy(list, array, 'a'); - result = _(array).chain().differenceBy(array, list, array, 'a'); - result = _(array).chain().differenceBy(list, array, list, array, 'a'); - result = _(array).chain().differenceBy(array, list, array, list, array, 'a'); - result = _(array).chain().differenceBy(list, array, list, array, list, array, 'a'); + 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(list, array, list, array, list, array, {a: 1}); + 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(list); - result = _(list).chain().differenceBy(array, list); - result = _(list).chain().differenceBy(list, array, list); - result = _(list).chain().differenceBy(array, list, array, list); - result = _(list).chain().differenceBy(list, array, list, array, list); - result = _(list).chain().differenceBy(array, list, array, list, array, list); + 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(list, iteratee); - result = _(list).chain().differenceBy(array, list, iteratee); - result = _(list).chain().differenceBy(list, array, list, iteratee); - result = _(list).chain().differenceBy(array, list, array, list, iteratee); - result = _(list).chain().differenceBy(list, array, list, array, list, iteratee); - result = _(list).chain().differenceBy(array, list, array, list, array, list, iteratee); + 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(list, 'a'); - result = _(list).chain().differenceBy(array, list, 'a'); - result = _(list).chain().differenceBy(list, array, list, 'a'); - result = _(list).chain().differenceBy(array, list, array, list, 'a'); - result = _(list).chain().differenceBy(list, array, list, array, list, 'a'); - result = _(list).chain().differenceBy(array, list, array, list, array, list, 'a'); + 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(array, list, array, list, array, list, {a: 1}); + 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}); } } @@ -561,12 +559,12 @@ namespace TestDropRightWhile { result = _.dropRightWhile(array); result = _.dropRightWhile(array, predicateFn); result = _.dropRightWhile(array, ''); - result = _.dropRightWhile<{a: number;}, TResult>(array, {a: 42}); + result = _.dropRightWhile(array, {a: 42}); result = _.dropRightWhile(list); result = _.dropRightWhile(list, predicateFn); result = _.dropRightWhile(list, ''); - result = _.dropRightWhile<{a: number;}, TResult>(list, {a: 42}); + result = _.dropRightWhile(list, {a: 42}); } { @@ -575,12 +573,12 @@ namespace TestDropRightWhile { result = _(array).dropRightWhile(); result = _(array).dropRightWhile(predicateFn); result = _(array).dropRightWhile(''); - result = _(array).dropRightWhile<{a: number;}>({a: 42}); + result = _(array).dropRightWhile({a: 42}); result = _(list).dropRightWhile(); result = _(list).dropRightWhile(predicateFn); result = _(list).dropRightWhile(''); - result = _(list).dropRightWhile<{a: number;}, TResult>({a: 42}); + result = _(list).dropRightWhile({a: 42}); } { @@ -589,12 +587,12 @@ namespace TestDropRightWhile { result = _(array).chain().dropRightWhile(); result = _(array).chain().dropRightWhile(predicateFn); result = _(array).chain().dropRightWhile(''); - result = _(array).chain().dropRightWhile<{a: number;}>({a: 42}); + result = _(array).chain().dropRightWhile({a: 42}); result = _(list).chain().dropRightWhile(); result = _(list).chain().dropRightWhile(predicateFn); result = _(list).chain().dropRightWhile(''); - result = _(list).chain().dropRightWhile<{a: number;}, TResult>({a: 42}); + result = _(list).chain().dropRightWhile({a: 42}); } } @@ -610,12 +608,12 @@ namespace TestDropWhile { result = _.dropWhile(array); result = _.dropWhile(array, predicateFn); result = _.dropWhile(array, ''); - result = _.dropWhile<{a: number;}, TResult>(array, {a: 42}); + result = _.dropWhile(array, {a: 42}); result = _.dropWhile(list); result = _.dropWhile(list, predicateFn); result = _.dropWhile(list, ''); - result = _.dropWhile<{a: number;}, TResult>(list, {a: 42}); + result = _.dropWhile(list, {a: 42}); } { @@ -624,12 +622,12 @@ namespace TestDropWhile { result = _(array).dropWhile(); result = _(array).dropWhile(predicateFn); result = _(array).dropWhile(''); - result = _(array).dropWhile<{a: number;}>({a: 42}); + result = _(array).dropWhile({a: 42}); result = _(list).dropWhile(); result = _(list).dropWhile(predicateFn); result = _(list).dropWhile(''); - result = _(list).dropWhile<{a: number;}, TResult>({a: 42}); + result = _(list).dropWhile({a: 42}); } { @@ -638,66 +636,66 @@ namespace TestDropWhile { result = _(array).chain().dropWhile(); result = _(array).chain().dropWhile(predicateFn); result = _(array).chain().dropWhile(''); - result = _(array).chain().dropWhile<{a: number;}>({a: 42}); + result = _(array).chain().dropWhile({a: 42}); result = _(list).chain().dropWhile(); result = _(list).chain().dropWhile(predicateFn); result = _(list).chain().dropWhile(''); - result = _(list).chain().dropWhile<{a: number;}, TResult>({a: 42}); + result = _(list).chain().dropWhile({a: 42}); } } // _.fill namespace TestFill { - let array: TResult[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; + let array: number[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: number[]; result = _.fill(array, 42); - result = _.fill(array, 42, 0); - result = _.fill(array, 42, 0, 10); + result = _.fill(array, 42, 0); + result = _.fill(array, 42, 0, 10); } { let result: _.List; result = _.fill(list, 42); - result = _.fill(list, 42, 0); - result = _.fill(list, 42, 0, 10); + result = _.fill(list, 42, 0); + result = _.fill(list, 42, 0, 10); } { let result: _.LoDashImplicitArrayWrapper; result = _(array).fill(42); - result = _(array).fill(42, 0); - result = _(array).fill(42, 0, 10); + 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); + 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); + 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); + result = _(list).chain().fill(42, 0); + result = _(list).chain().fill(42, 0, 10); } } @@ -714,21 +712,21 @@ namespace TestFindIndex { result = _.findIndex(array); result = _.findIndex(array, predicateFn); result = _.findIndex(array, ''); - result = _.findIndex<{a: number}, TResult>(array, {a: 42}); + result = _.findIndex(array, {a: 42}); result = _.findIndex(array, predicateFn, fromIndex); result = _.findIndex(list); result = _.findIndex(list, predicateFn); result = _.findIndex(list, ''); - result = _.findIndex<{a: number}, TResult>(list, {a: 42}); + 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 = _(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); @@ -740,11 +738,11 @@ namespace TestFindIndex { { 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 = _(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); @@ -768,21 +766,21 @@ namespace TestFindLastIndex { result = _.findLastIndex(array); result = _.findLastIndex(array, predicateFn); result = _.findLastIndex(array, ''); - result = _.findLastIndex<{a: number}, TResult>(array, {a: 42}); + result = _.findLastIndex(array, {a: 42}); result = _.findLastIndex(array, predicateFn, fromIndex); result = _.findLastIndex(list); result = _.findLastIndex(list, predicateFn); result = _.findLastIndex(list, ''); - result = _.findLastIndex<{a: number}, TResult>(list, {a: 42}); + result = _.findLastIndex(list, {a: 42}); result = _.findLastIndex(list, predicateFn, fromIndex); result = _.findLastIndex([{ b: 5 }], ['b', 5]); - result = _(array).findLastIndex(); - result = _(array).findLastIndex(predicateFn); - result = _(array).findLastIndex(''); - result = _(array).findLastIndex<{a: number}>({a: 42}); - result = _(array).findLastIndex(predicateFn, fromIndex); + result = _(array).findLastIndex(); + result = _(array).findLastIndex(predicateFn); + result = _(array).findLastIndex(''); + result = _(array).findLastIndex<{a: number}>({a: 42}); + result = _(array).findLastIndex(predicateFn, fromIndex); result = _(list).findLastIndex(); result = _(list).findLastIndex(predicateFn); @@ -794,11 +792,11 @@ namespace TestFindLastIndex { { let result: _.LoDashExplicitWrapper; - 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); + 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); result = _(list).chain().findLastIndex(); result = _(list).chain().findLastIndex(predicateFn); @@ -831,16 +829,16 @@ namespace TestFirst { } { - let result: _.LoDashExplicitWrapper; + let result: _.LoDashExplicitWrapper; result = _('abc').chain().first(); } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper; - result = _(array).chain().first<_.LoDashExplicitObjectWrapper>(); - result = _(list).chain().first<_.LoDashExplicitObjectWrapper>(); + result = _(array).chain().first(); + result = _(list).chain().first(); } } @@ -876,11 +874,11 @@ namespace TestFlatten { { let result: _.RecursiveArray; - result = _.flatten([1, [2, [3]]]); - result = _.flatten([1, [2, [3]], [[4]]]); + 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}); + result = _.flatten({0: 1, 1: [2, [3]], length: 2}); + result = _.flatten({0: 1, 1: [2, [3]], 2: [[4]], length: 3}); } { @@ -1080,16 +1078,16 @@ namespace TestHead { } { - let result: _.LoDashExplicitWrapper; + let result: _.LoDashExplicitWrapper; result = _('abc').chain().head(); } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper; - result = _(array).chain().head<_.LoDashExplicitObjectWrapper>(); - result = _(list).chain().head<_.LoDashExplicitObjectWrapper>(); + result = _(array).chain().head(); + result = _(list).chain().head(); } } @@ -1184,8 +1182,8 @@ namespace TestInitial { // _.intersection namespace TestIntersection { - let array: TResult[] | null | undefined = [] as any; - let list: _.List | null | undefined = [] as any; + let array: TResult[] = [] as any; + let list: _.List = [] as any; let arrayParam: TResult[] = [] as any; let listParam: _.List = [] as any; @@ -1281,21 +1279,21 @@ namespace TestLast { } { - let result: _.LoDashExplicitWrapper; + let result: _.LoDashExplicitWrapper; result = _('abc').chain().last(); } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper; - result = _(array).chain().last<_.LoDashExplicitObjectWrapper>(); + result = _(array).chain().last(); } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper; - result = _(list).chain().last<_.LoDashExplicitObjectWrapper>(); + result = _(list).chain().last(); } } @@ -1359,7 +1357,7 @@ namespace TestNth { } { - let result: _.LoDashExplicitWrapper; + let result: _.LoDashExplicitWrapper; result = _(array).chain().nth(); result = _(array).chain().nth(42); @@ -1442,6 +1440,10 @@ namespace TestPullAt { result = _.pullAt(array, 1); result = _.pullAt(array, [2, 3], 1); result = _.pullAt(array, 4, [2, 3], 1); + } + + { + let result: ArrayLike; result = _.pullAt(list); result = _.pullAt(list, 1); @@ -1456,11 +1458,15 @@ namespace TestPullAt { result = _(array).pullAt(1); result = _(array).pullAt([2, 3], 1); result = _(array).pullAt(4, [2, 3], 1); + } - result = _(list).pullAt(); - result = _(list).pullAt(1); - result = _(list).pullAt([2, 3], 1); - result = _(list).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); } { @@ -1470,11 +1476,15 @@ namespace TestPullAt { result = _(array).chain().pullAt(1); result = _(array).chain().pullAt([2, 3], 1); result = _(array).chain().pullAt(4, [2, 3], 1); + } - result = _(list).chain().pullAt(); - result = _(list).chain().pullAt(1); - result = _(list).chain().pullAt([2, 3], 1); - result = _(list).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); } } @@ -1490,40 +1500,40 @@ namespace TestRemove { result = _.remove(array); result = _.remove(array, predicateFn); result = _.remove(array, ''); - result = _.remove<{a: number}, TResult>(array, {a: 42}); + result = _.remove(array, {a: 42}); result = _.remove(list); result = _.remove(list, predicateFn); result = _.remove(list, ''); - result = _.remove<{a: number}, TResult>(list, {a: 42}); + result = _.remove(list, {a: 42}); } { let result: _.LoDashImplicitArrayWrapper; - result = _(array).remove(); - result = _(array).remove(predicateFn); - result = _(array).remove(''); - result = _(array).remove<{a: number}>({a: 42}); + 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: number}, TResult>({a: 42}); + 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: number}>({a: 42}); + 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: number}, TResult>({a: 42}); + result = _(list).chain().remove({a: 42}); } } @@ -1640,47 +1650,38 @@ namespace TestSortedIndexBy { let result: number; result = _.sortedIndexBy('', '', stringIterator); - result = _.sortedIndexBy('', '', stringIterator); result = _.sortedIndexBy(array, value, arrayIterator); result = _.sortedIndexBy(array, value, ''); result = _.sortedIndexBy(array, value, {a: 42}); - result = _.sortedIndexBy(array, value, arrayIterator); - result = _.sortedIndexBy<{a: number}, SampleType>(array, value, {a: 42}); result = _.sortedIndexBy(list, value, listIterator); result = _.sortedIndexBy(list, value, ''); result = _.sortedIndexBy(list, value, {a: 42}); - result = _.sortedIndexBy(list, value, listIterator); - result = _.sortedIndexBy<{a: number}, SampleType>(list, value, {a: 42}); - result = _('').sortedIndexBy('', stringIterator); + result = _('').sortedIndexBy('', stringIterator); - result = _(array).sortedIndexBy(value, arrayIterator); + result = _(array).sortedIndexBy(value, arrayIterator); result = _(array).sortedIndexBy(value, ''); - result = _(array).sortedIndexBy<{a: number}>(value, {a: 42}); + result = _(array).sortedIndexBy(value, {a: 42}); result = _(list).sortedIndexBy(value, listIterator); result = _(list).sortedIndexBy(value, ''); result = _(list).sortedIndexBy(value, {a: 42}); - result = _(list).sortedIndexBy(value, listIterator); - result = _(list).sortedIndexBy<{a: number}, SampleType>(value, {a: 42}); } { let result: _.LoDashExplicitWrapper; - result = _('').chain().sortedIndexBy('', stringIterator); + result = _('').chain().sortedIndexBy('', stringIterator); - result = _(array).chain().sortedIndexBy(value, arrayIterator); + result = _(array).chain().sortedIndexBy(value, arrayIterator); result = _(array).chain().sortedIndexBy(value, ''); - result = _(array).chain().sortedIndexBy<{a: number}>(value, {a: 42}); + 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}); - result = _(list).chain().sortedIndexBy(value, listIterator); - result = _(list).chain().sortedIndexBy<{a: number}, SampleType>(value, {a: 42}); } } @@ -1741,47 +1742,38 @@ namespace TestSortedLastIndexBy { let result: number; result = _.sortedLastIndexBy('', '', stringIterator); - result = _.sortedLastIndexBy('', '', stringIterator); result = _.sortedLastIndexBy(array, value, arrayIterator); result = _.sortedLastIndexBy(array, value, ''); result = _.sortedLastIndexBy(array, value, {a: 42}); - result = _.sortedLastIndexBy(array, value, arrayIterator); - result = _.sortedLastIndexBy<{a: number}, SampleType>(array, value, {a: 42}); result = _.sortedLastIndexBy(list, value, listIterator); result = _.sortedLastIndexBy(list, value, ''); result = _.sortedLastIndexBy(list, value, {a: 42}); - result = _.sortedLastIndexBy(list, value, listIterator); - result = _.sortedLastIndexBy<{a: number}, SampleType>(list, value, {a: 42}); - result = _('').sortedLastIndexBy('', stringIterator); + result = _('').sortedLastIndexBy('', stringIterator); - result = _(array).sortedLastIndexBy(value, arrayIterator); + result = _(array).sortedLastIndexBy(value, arrayIterator); result = _(array).sortedLastIndexBy(value, ''); - result = _(array).sortedLastIndexBy<{a: number}>(value, {a: 42}); + result = _(array).sortedLastIndexBy(value, {a: 42}); result = _(list).sortedLastIndexBy(value, listIterator); result = _(list).sortedLastIndexBy(value, ''); result = _(list).sortedLastIndexBy(value, {a: 42}); - result = _(list).sortedLastIndexBy(value, listIterator); - result = _(list).sortedLastIndexBy<{a: number}, SampleType>(value, {a: 42}); } { let result: _.LoDashExplicitWrapper; - result = _('').chain().sortedLastIndexBy('', stringIterator); + result = _('').chain().sortedLastIndexBy('', stringIterator); - result = _(array).chain().sortedLastIndexBy(value, arrayIterator); + result = _(array).chain().sortedLastIndexBy(value, arrayIterator); result = _(array).chain().sortedLastIndexBy(value, ''); - result = _(array).chain().sortedLastIndexBy<{a: number}>(value, {a: 42}); + 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}); - result = _(list).chain().sortedLastIndexBy(value, listIterator); - result = _(list).chain().sortedLastIndexBy<{a: number}, SampleType>(value, {a: 42}); } } @@ -1896,12 +1888,12 @@ namespace TestTakeRightWhile { result = _.takeRightWhile(array); result = _.takeRightWhile(array, predicateFn); result = _.takeRightWhile(array, ''); - result = _.takeRightWhile<{a: number;}, TResult>(array, {a: 42}); + result = _.takeRightWhile(array, {a: 42}); result = _.takeRightWhile(list); result = _.takeRightWhile(list, predicateFn); result = _.takeRightWhile(list, ''); - result = _.takeRightWhile<{a: number;}, TResult>(list, {a: 42}); + result = _.takeRightWhile(list, {a: 42}); } { @@ -1910,12 +1902,12 @@ namespace TestTakeRightWhile { result = _(array).takeRightWhile(); result = _(array).takeRightWhile(predicateFn); result = _(array).takeRightWhile(''); - result = _(array).takeRightWhile<{a: number;}>({a: 42}); + result = _(array).takeRightWhile({a: 42}); result = _(list).takeRightWhile(); result = _(list).takeRightWhile(predicateFn); result = _(list).takeRightWhile(''); - result = _(list).takeRightWhile<{a: number;}, TResult>({a: 42}); + result = _(list).takeRightWhile({a: 42}); } { @@ -1924,12 +1916,12 @@ namespace TestTakeRightWhile { result = _(array).chain().takeRightWhile(); result = _(array).chain().takeRightWhile(predicateFn); result = _(array).chain().takeRightWhile(''); - result = _(array).chain().takeRightWhile<{a: number;}>({a: 42}); + result = _(array).chain().takeRightWhile({a: 42}); result = _(list).chain().takeRightWhile(); result = _(list).chain().takeRightWhile(predicateFn); result = _(list).chain().takeRightWhile(''); - result = _(list).chain().takeRightWhile<{a: number;}, TResult>({a: 42}); + result = _(list).chain().takeRightWhile({a: 42}); } } @@ -1945,12 +1937,12 @@ namespace TestTakeWhile { result = _.takeWhile(array); result = _.takeWhile(array, predicateFn); result = _.takeWhile(array, ''); - result = _.takeWhile<{a: number;}, TResult>(array, {a: 42}); + result = _.takeWhile(array, {a: 42}); result = _.takeWhile(list); result = _.takeWhile(list, predicateFn); result = _.takeWhile(list, ''); - result = _.takeWhile<{a: number;}, TResult>(list, {a: 42}); + result = _.takeWhile(list, {a: 42}); } { @@ -1959,12 +1951,12 @@ namespace TestTakeWhile { result = _(array).takeWhile(); result = _(array).takeWhile(predicateFn); result = _(array).takeWhile(''); - result = _(array).takeWhile<{a: number;}>({a: 42}); + result = _(array).takeWhile({a: 42}); result = _(list).takeWhile(); result = _(list).takeWhile(predicateFn); result = _(list).takeWhile(''); - result = _(list).takeWhile<{a: number;}, TResult>({a: 42}); + result = _(list).takeWhile({a: 42}); } { @@ -1973,12 +1965,12 @@ namespace TestTakeWhile { result = _(array).chain().takeWhile(); result = _(array).chain().takeWhile(predicateFn); result = _(array).chain().takeWhile(''); - result = _(array).chain().takeWhile<{a: number;}>({a: 42}); + result = _(array).chain().takeWhile({a: 42}); result = _(list).chain().takeWhile(); result = _(list).chain().takeWhile(predicateFn); result = _(list).chain().takeWhile(''); - result = _(list).chain().takeWhile<{a: number;}, TResult>({a: 42}); + result = _(list).chain().takeWhile({a: 42}); } } @@ -2061,10 +2053,10 @@ namespace TestUnionBy { 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, 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); @@ -2085,10 +2077,10 @@ namespace TestUnionBy { 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, 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}); } @@ -2113,10 +2105,10 @@ namespace TestUnionBy { 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(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); @@ -2137,10 +2129,10 @@ namespace TestUnionBy { 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(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}); } @@ -2165,10 +2157,10 @@ namespace TestUnionBy { 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(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); @@ -2189,10 +2181,10 @@ namespace TestUnionBy { 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(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}); } } @@ -2255,7 +2247,6 @@ namespace TestUniqBy { { let result: string[]; - result = _.uniqBy('abc', stringIterator); result = _.uniqBy('abc', stringIterator); } @@ -2263,16 +2254,12 @@ namespace TestUniqBy { let result: SampleObject[]; result = _.uniqBy(array, listIterator); - result = _.uniqBy(array, listIterator); result = _.uniqBy(array, 'a'); result = _.uniqBy(array, {a: 42}); - result = _.uniqBy<{a: number}, SampleObject>(array, {a: 42}); result = _.uniqBy(list, listIterator); - result = _.uniqBy(list, listIterator); result = _.uniqBy(list, 'a'); result = _.uniqBy(list, {a: 42}); - result = _.uniqBy<{a: number}, SampleObject>(list, {a: 42}); } { @@ -2284,15 +2271,13 @@ namespace TestUniqBy { { let result: _.LoDashImplicitArrayWrapper; - result = _(array).uniqBy(listIterator); + result = _(array).uniqBy(listIterator); result = _(array).uniqBy('a'); - result = _(array).uniqBy<{a: number}>({a: 42}); + result = _(array).uniqBy({a: 42}); result = _(list).uniqBy(listIterator); - result = _(list).uniqBy(listIterator); result = _(list).uniqBy('a'); result = _(list).uniqBy({a: 42}); - result = _(list).uniqBy<{a: number}, SampleObject>({a: 42}); } { @@ -2304,15 +2289,13 @@ namespace TestUniqBy { { let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().uniqBy(listIterator); + result = _(array).chain().uniqBy(listIterator); result = _(array).chain().uniqBy('a'); - result = _(array).chain().uniqBy<{a: number}>({a: 42}); + result = _(array).chain().uniqBy({a: 42}); result = _(list).chain().uniqBy(listIterator); - result = _(list).chain().uniqBy(listIterator); result = _(list).chain().uniqBy('a'); result = _(list).chain().uniqBy({a: 42}); - result = _(list).chain().uniqBy<{a: number}, SampleObject>({a: 42}); } } @@ -2370,7 +2353,6 @@ namespace TestSortedUniqBy { { let result: string[]; - result = _.sortedUniqBy('abc', stringIterator); result = _.sortedUniqBy('abc', stringIterator); } @@ -2378,16 +2360,12 @@ namespace TestSortedUniqBy { let result: SampleObject[]; result = _.sortedUniqBy(array, listIterator); - result = _.sortedUniqBy(array, listIterator); result = _.sortedUniqBy(array, 'a'); result = _.sortedUniqBy(array, {a: 42}); - result = _.sortedUniqBy<{a: number}, SampleObject>(array, {a: 42}); result = _.sortedUniqBy(list, listIterator); - result = _.sortedUniqBy(list, listIterator); result = _.sortedUniqBy(list, 'a'); result = _.sortedUniqBy(list, {a: 42}); - result = _.sortedUniqBy<{a: number}, SampleObject>(list, {a: 42}); } { @@ -2399,15 +2377,13 @@ namespace TestSortedUniqBy { { let result: _.LoDashImplicitArrayWrapper; - result = _(array).sortedUniqBy(listIterator); + result = _(array).sortedUniqBy(listIterator); result = _(array).sortedUniqBy('a'); - result = _(array).sortedUniqBy<{a: number}>({a: 42}); + result = _(array).sortedUniqBy({a: 42}); result = _(list).sortedUniqBy(listIterator); - result = _(list).sortedUniqBy(listIterator); result = _(list).sortedUniqBy('a'); result = _(list).sortedUniqBy({a: 42}); - result = _(list).sortedUniqBy<{a: number}, SampleObject>({a: 42}); } { @@ -2419,15 +2395,13 @@ namespace TestSortedUniqBy { { let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().sortedUniqBy(listIterator); + result = _(array).chain().sortedUniqBy(listIterator); result = _(array).chain().sortedUniqBy('a'); - result = _(array).chain().sortedUniqBy<{a: number}>({a: 42}); + result = _(array).chain().sortedUniqBy({a: 42}); result = _(list).chain().sortedUniqBy(listIterator); - result = _(list).chain().sortedUniqBy(listIterator); result = _(list).chain().sortedUniqBy('a'); result = _(list).chain().sortedUniqBy({a: 42}); - result = _(list).chain().sortedUniqBy<{a: number}, SampleObject>({a: 42}); } } @@ -2475,16 +2449,62 @@ namespace TestUnzip { // _.unzipWith { - let testUnzipWithArray: (number[]|_.List)[] | null | undefined = [] as any; + let testUnzipWithArray: Array> | null | undefined = [] as any; let testUnzipWithList: _.List> | null | undefined = [] as any; - let testUnzipWithIterator: {(prev: TResult, curr: number, index?: number, list?: number[]): TResult} = (prev: TResult, curr: number, index?: number, list?: number[]) => ({ a: 1, b: "", c: true }); - let result: TResult[]; - result = _.unzipWith(testUnzipWithArray); - result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator); - result = _.unzipWith(testUnzipWithList); - result = _.unzipWith(testUnzipWithList, testUnzipWithIterator); - result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator).value(); - result = _(testUnzipWithList).unzipWith(testUnzipWithIterator).value(); + + { + _.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 + } + + { + let result: TResult[]; + result = _.unzipWith(testUnzipWithArray, (...group) => { + group; // $ExpectType number[] + return any as TResult; + }); + result = _.unzipWith(testUnzipWithArray, (value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType number + value3; // $ExpectType number + return any as TResult; + }); + result = _.unzipWith(testUnzipWithList, (...group) => { + group; // $ExpectType number[] + return any as TResult; + }); + result = _.unzipWith(testUnzipWithList, (value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType number + value3; // $ExpectType number + return any as TResult; + }); + + result = _(testUnzipWithArray).unzipWith((...group): TResult => { + group; // $ExpectType number[] + return any as TResult; + }).value(); + result = _(testUnzipWithArray).unzipWith((value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType number + value3; // $ExpectType number + return any as TResult; + }).value(); + result = _(testUnzipWithList).unzipWith((...group): TResult => { + group; // $ExpectType number[] + return any as TResult; + }).value(); + result = _(testUnzipWithList).unzipWith((value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType number + value3; // $ExpectType number + return any as TResult; + }).value(); + } } // _.without @@ -2629,8 +2649,8 @@ namespace TestZipObject { { let result: _.Dictionary; - result = _.zipObject<_.Dictionary>(arrayOfKeys); - result = _.zipObject<_.Dictionary>(listOfKeys); + result = _.zipObject(arrayOfKeys); + result = _.zipObject(listOfKeys); } { @@ -2641,13 +2661,13 @@ namespace TestZipObject { result = _.zipObject<_.Dictionary>(listOfKeys, listOfValues); result = _.zipObject<_.Dictionary>(listOfKeys, arrayOfValues); - 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); - result = _.zipObject<_.Dictionary>(arrayOfKeyValuePairs); - result = _.zipObject<_.Dictionary>(listOfKeyValuePairs); + result = _.zipObject(arrayOfKeyValuePairs); + result = _.zipObject(listOfKeyValuePairs); } { @@ -2667,15 +2687,15 @@ namespace TestZipObject { result = _.zipObject(listOfKeys, arrayOfValues); result = _.zipObjectDeep(listOfKeys, arrayOfValues); - result = _.zipObject<_.Dictionary>(arrayOfKeyValuePairs); - result = _.zipObject<_.Dictionary>(listOfKeyValuePairs); + result = _.zipObject(arrayOfKeyValuePairs); + result = _.zipObject(listOfKeyValuePairs); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(arrayOfKeys).zipObject<_.Dictionary>(); - result = _(listOfKeys).zipObject<_.Dictionary>(); + result = _(arrayOfKeys).zipObject(); + result = _(listOfKeys).zipObject(); } { @@ -2686,13 +2706,13 @@ namespace TestZipObject { result = _(listOfKeys).zipObject<_.Dictionary>(listOfValues); result = _(listOfKeys).zipObject<_.Dictionary>(arrayOfValues); - 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); - result = _(listOfKeys).zipObject<_.Dictionary>(arrayOfKeyValuePairs); - result = _(listOfKeys).zipObject<_.Dictionary>(listOfKeyValuePairs); + result = _(listOfKeys).zipObject(arrayOfKeyValuePairs); + result = _(listOfKeys).zipObject(listOfKeyValuePairs); } { @@ -2721,8 +2741,8 @@ namespace TestZipObject { { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(arrayOfKeys).chain().zipObject<_.Dictionary>(); - result = _(listOfKeys).chain().zipObject<_.Dictionary>(); + result = _(arrayOfKeys).chain().zipObject(); + result = _(listOfKeys).chain().zipObject(); } { @@ -2733,13 +2753,13 @@ namespace TestZipObject { result = _(listOfKeys).chain().zipObject<_.Dictionary>(listOfValues); result = _(listOfKeys).chain().zipObject<_.Dictionary>(arrayOfValues); - 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); - result = _(listOfKeys).chain().zipObject<_.Dictionary>(arrayOfKeyValuePairs); - result = _(listOfKeys).chain().zipObject<_.Dictionary>(listOfKeyValuePairs); + result = _(listOfKeys).chain().zipObject(arrayOfKeyValuePairs); + result = _(listOfKeys).chain().zipObject(listOfKeyValuePairs); } { @@ -2767,18 +2787,157 @@ namespace TestZipObject { } // _.zipWith -interface TestZipWithFn { - (a1: number, a2: number): number; +namespace TestZipWith { + type TestZipWithFn = (a1: number, a2: number) => number; + + { + let result: number[][]; + result = _.zipWith([1, 2]); + result = _.zipWith([1, 2], [3, 4], [5, 6]); + result = _([1, 2]).zipWith().value(); + result = _([1, 2]).zipWith([3, 4], [5, 6]).value(); + result = _.chain([1, 2]).zipWith().value(); + result = _.chain([1, 2]).zipWith([3, 4], [5, 6]).value(); + } + { + 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; + }); + + 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(); + } } -let testZipWithFn: TestZipWithFn = (a1, a2) => 1; -result = _.zipWith([1, 2]); -result = _.zipWith([1, 2], testZipWithFn); -result = _.zipWith([1, 2], [1, 2], testZipWithFn); -result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn); -result = _([1, 2]).zipWith().value(); -result = _([1, 2]).zipWith(testZipWithFn).value(); -result = _([1, 2]).zipWith([1, 2], testZipWithFn).value(); -result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn).value(); /********* * Chain * @@ -2868,7 +3027,7 @@ namespace TestTap { { let interceptor = (value: {a: string}) => {}; - let result: _.LoDashImplicitObjectWrapper<{a: string}>; + let result: _.LoDashImplicitWrapper<{a: string}>; _.chain({a: ''}).tap(interceptor); @@ -2895,7 +3054,7 @@ namespace TestTap { { let interceptor = (value: {a: string}) => {}; - let result: _.LoDashExplicitObjectWrapper<{a: string}>; + let result: _.LoDashExplicitWrapper<{a: string}>; _.chain({a: ''}).tap(interceptor); @@ -2948,7 +3107,7 @@ namespace TestThru { let interceptor: Interceptor = (x) => x; let result: _.LoDashImplicitArrayWrapper; - result = _([1, 2, 3]).thru(interceptor); + result = _([1, 2, 3]).thru(interceptor); } { @@ -2983,7 +3142,7 @@ namespace TestThru { let interceptor: Interceptor = (x) => x; let result: _.LoDashExplicitArrayWrapper; - result = _([1, 2, 3]).chain().thru(interceptor); + result = _([1, 2, 3]).chain().thru(interceptor); } } @@ -3037,13 +3196,13 @@ namespace TestConcat { { let result: _.LoDashImplicitArrayWrapper; - result = _(['']).concat(['']); - result = _(['']).concat([''], ['']); - result = _(['']).concat([''], [''], ['']); + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); - result = _(['']).concat(['']); - result = _(['']).concat([''], ['']); - result = _(['']).concat([''], [''], ['']); + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); } { @@ -3073,13 +3232,13 @@ namespace TestConcat { { let result: _.LoDashExplicitArrayWrapper; - result = _(['']).chain().concat(['']); - result = _(['']).chain().concat([''], ['']); - result = _(['']).chain().concat([''], [''], ['']); + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); - result = _(['']).chain().concat(['']); - result = _(['']).chain().concat([''], ['']); - result = _(['']).chain().concat([''], [''], ['']); + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); } { @@ -3123,7 +3282,7 @@ namespace TestPlant { } { - let result: _.LoDashImplicitObjectWrapper<{}>; + let result: _.LoDashImplicitWrapper<{}>; result = _(any).plant<{}>({}); } @@ -3153,7 +3312,7 @@ namespace TestPlant { } { - let result: _.LoDashExplicitObjectWrapper<{}>; + let result: _.LoDashExplicitWrapper<{}>; result = _(any).chain().plant<{}>({}); } } @@ -3197,8 +3356,8 @@ namespace TestToJSON { { let result: string[]; - result = _([]).toJSON(); - result = _([]).chain().toJSON(); + result = _(['']).toJSON(); + result = _(['']).chain().toJSON(); } { @@ -3216,13 +3375,13 @@ namespace TestToString { result = _('').toString(); result = _(42).toString(); result = _(true).toString(); - result = _(['']).toString(); + result = _(['']).toString(); result = _({}).toString(); result = _('').chain().toString(); result = _(42).chain().toString(); result = _(true).chain().toString(); - result = _(['']).chain().toString(); + result = _(['']).chain().toString(); result = _({}).chain().toString(); } @@ -3252,8 +3411,8 @@ namespace TestValue { { let result: string[]; - result = _([]).value(); - result = _([]).chain().value(); + result = _(['']).value(); + result = _(['']).chain().value(); } { @@ -3290,8 +3449,8 @@ namespace TestValueOf { { let result: string[]; - result = _([]).valueOf(); - result = _([]).chain().valueOf(); + result = _(['']).valueOf(); + result = _(['']).chain().valueOf(); } { @@ -3345,7 +3504,7 @@ namespace TestCountBy { let dictionary: _.Dictionary | null | undefined = obj; let numericDictionary: _.NumericDictionary | null | undefined = obj; - let stringIterator: (value: string, index: number, collection: ArrayLike) => any = (value: string, index: number, collection: ArrayLike) => 1; + let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1; let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => any = (value: TResult, key: number, collection: _.NumericDictionary) => 1; @@ -3359,25 +3518,25 @@ namespace TestCountBy { result = _.countBy(array); result = _.countBy(array, listIterator); result = _.countBy(array, ''); - result = _.countBy<{a: number}, TResult>(array, {a: 42}); + result = _.countBy(array, {a: 42}); result = _.countBy(array, {a: 42}); result = _.countBy(list); result = _.countBy(list, listIterator); result = _.countBy(list, ''); - result = _.countBy<{a: number}, TResult>(list, {a: 42}); + result = _.countBy(list, {a: 42}); result = _.countBy(list, {a: 42}); result = _.countBy(dictionary); - result = _.countBy(dictionary, dictionaryIterator); + result = _.countBy(dictionary, dictionaryIterator); result = _.countBy(dictionary, ''); - result = _.countBy<{a: number}, TResult>(dictionary, {a: 42}); + result = _.countBy(dictionary, {a: 42}); result = _.countBy(dictionary, {a: 42}); result = _.countBy(numericDictionary); result = _.countBy(numericDictionary, numericDictionaryIterator); result = _.countBy(numericDictionary, ''); - result = _.countBy<{a: number}, TResult>(numericDictionary, {a: 42}); + result = _.countBy(numericDictionary, {a: 42}); result = _.countBy(numericDictionary, {a: 42}); } @@ -3400,7 +3559,7 @@ namespace TestCountBy { result = _(list).countBy({a: 42}); result = _(dictionary).countBy(); - result = _(dictionary).countBy(dictionaryIterator); + result = _(dictionary).countBy(dictionaryIterator); result = _(dictionary).countBy(''); result = _(dictionary).countBy<{a: number}>({a: 42}); result = _(dictionary).countBy({a: 42}); @@ -3431,7 +3590,7 @@ namespace TestCountBy { result = _(list).chain().countBy({a: 42}); result = _(dictionary).chain().countBy(); - result = _(dictionary).chain().countBy(dictionaryIterator); + result = _(dictionary).chain().countBy(dictionaryIterator); result = _(dictionary).chain().countBy(''); result = _(dictionary).chain().countBy<{a: number}>({a: 42}); result = _(dictionary).chain().countBy({a: 42}); @@ -3526,7 +3685,7 @@ namespace TestEach { { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).each(dictionaryIterator); + result = _(dictionary).each(dictionaryIterator); } { @@ -3550,7 +3709,7 @@ namespace TestEach { { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).chain().each(dictionaryIterator); + result = _(dictionary).chain().each(dictionaryIterator); } } @@ -3636,7 +3795,7 @@ namespace TestEachRight { { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).eachRight(dictionaryIterator); + result = _(dictionary).eachRight(dictionaryIterator); } { @@ -3660,7 +3819,7 @@ namespace TestEachRight { { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).chain().eachRight(dictionaryIterator); + result = _(dictionary).chain().eachRight(dictionaryIterator); } } @@ -3694,7 +3853,7 @@ namespace TestEvery { result = _.every(list, {a: 42}); result = _.every(dictionary); - result = _.every(dictionary, dictionaryIterator); + result = _.every(dictionary, dictionaryIterator); result = _.every(dictionary, 'a'); result = _.every(dictionary, ['a', 42]); result = _.every(dictionary, {a: 42}); @@ -3718,7 +3877,7 @@ namespace TestEvery { result = _(list).every({a: 42}); result = _(dictionary).every(); - result = _(dictionary).every(dictionaryIterator); + result = _(dictionary).every(dictionaryIterator); result = _(dictionary).every('a'); result = _(dictionary).every(['a', 42]); result = _(dictionary).every({a: 42}); @@ -3746,7 +3905,7 @@ namespace TestEvery { result = _(list).chain().every({a: 42}); result = _(dictionary).chain().every(); - result = _(dictionary).chain().every(dictionaryIterator); + result = _(dictionary).chain().every(dictionaryIterator); result = _(dictionary).chain().every('a'); result = _(dictionary).chain().every(['a', 42]); result = _(dictionary).chain().every({a: 42}); @@ -3781,21 +3940,18 @@ namespace TestFilter { result = _.filter(array, listIterator); result = _.filter(array, ''); - result = _.filter(array, /./); result = _.filter(array, {a: 42}); result = _.filter(array, ["a", 42]); result = _.filter(list, listIterator); result = _.filter(list, ''); - result = _.filter(list, /./); result = _.filter(list, {a: 42}); result = _.filter(list, ["a", 42]); - result = _.filter(dictionary, dictionaryIterator); - result = _.filter(dictionary, ''); - result = _.filter(dictionary, /./); - result = _.filter(dictionary, {a: 42}); - result = _.filter(dictionary, ["a", 42]); + result = _.filter(dictionary, dictionaryIterator); + result = _.filter(dictionary, ''); + result = _.filter(dictionary, {a: 42}); + result = _.filter(dictionary, ["a", 42]); } { @@ -3809,21 +3965,18 @@ namespace TestFilter { result = _(array).filter(listIterator); result = _(array).filter(''); - result = _(array).filter(/./); result = _(array).filter({a: 42}); result = _(array).filter(["a", 42]); result = _(list).filter(listIterator); result = _(list).filter(''); - result = _(list).filter(/./); result = _(list).filter({a: 42}); result = _(list).filter(["a", 42]); - result = _(dictionary).filter(dictionaryIterator); - result = _(dictionary).filter(''); - result = _(dictionary).filter(/./); - result = _(dictionary).filter({a: 42}); - result = _(dictionary).filter(["a", 42]); + result = _(dictionary).filter(dictionaryIterator); + result = _(dictionary).filter(''); + result = _(dictionary).filter({a: 42}); + result = _(dictionary).filter(["a", 42]); } { @@ -3837,21 +3990,18 @@ namespace TestFilter { result = _(array).chain().filter(listIterator); result = _(array).chain().filter(''); - 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(/./); 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(/./); - result = _(dictionary).chain().filter({a: 42}); - result = _(dictionary).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]); } { @@ -3861,10 +4011,10 @@ namespace TestFilter { _.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 LoDashImplicitArrayWrapper - _(d2).filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashImplicitArrayWrapper - _(a2).chain().filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitArrayWrapper - _(d2).chain().filter((item: string | number): item is number => typeof item === "number"); // $ExpectType LoDashExplicitArrayWrapper + _(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 } } @@ -3903,13 +4053,13 @@ namespace TestFind { result = _.find(list, ['a', 5], 1); result = _.find(dictionary); - 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); + 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); @@ -3933,15 +4083,15 @@ namespace TestFind { 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 = _(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([any as TResult, null, undefined], (value: TResult | null | undefined): value is TResult | undefined => value !== null); result = _([any as TResult, null, undefined]).find((value: TResult | null | undefined): value is TResult | undefined => value !== null); @@ -3982,13 +4132,13 @@ namespace TestFindLast { result = _.findLast(list, ['a', 5], 1); 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); + 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); @@ -4012,15 +4162,15 @@ namespace TestFindLast { result = _(list).findLast(['a', 5]); result = _(list).findLast(['a', 5], 1); - 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); + 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); result = _.findLast([any as TResult, null, undefined], (value: TResult | null | undefined): value is TResult | undefined => value !== null); result = _([any as TResult, null, undefined]).findLast((value: TResult | null | undefined): value is TResult | undefined => value !== null); @@ -4068,7 +4218,7 @@ namespace TestFlatMap { result = _.flatMap(numArray, listIterator); result = _.flatMap(numArray, listIterator); - result = _.flatMap(objArray, 'a'); + result = _.flatMap(objArray, 'a'); result = _.flatMap(numList); result = _.flatMap(numList); @@ -4076,15 +4226,14 @@ namespace TestFlatMap { result = _.flatMap(numList, listIterator); result = _.flatMap(numList, listIterator); - result = _.flatMap(objList, 'a'); + result = _.flatMap(objList, 'a'); result = _.flatMap(numDictionary); result = _.flatMap(numDictionary); result = _.flatMap(numDictionary, dictionaryIterator); - result = _.flatMap(numDictionary, dictionaryIterator); - result = _.flatMap(objDictionary, 'a'); + result = _.flatMap(objDictionary, 'a'); result = _.flatMap(numNumericDictionary); result = _.flatMap(numNumericDictionary); @@ -4092,7 +4241,7 @@ namespace TestFlatMap { result = _.flatMap(numNumericDictionary, numericDictionaryIterator); result = _.flatMap(numNumericDictionary, numericDictionaryIterator); - result = _.flatMap<_.NumericDictionary<{a: number}|{a: number}[]>, number>(objNumericDictionary, 'a'); + result = _.flatMap(objNumericDictionary, 'a'); } { @@ -4115,27 +4264,26 @@ namespace TestFlatMap { let result: _.LoDashImplicitArrayWrapper; result = _('abc').flatMap(); - result = _('abc').flatMap(stringIterator); } { let result: _.LoDashImplicitArrayWrapper; result = _(numArray).flatMap(); - result = _(numArray).flatMap(listIterator); - result = _(objArray).flatMap('a'); + result = _(numArray).flatMap(listIterator); + result = _(objArray).flatMap('a'); result = _(numList).flatMap(); result = _(numList).flatMap(listIterator); - result = _(objList).flatMap('a'); + result = _(objList).flatMap('a'); result = _(numDictionary).flatMap(); - result = _(numDictionary).flatMap(dictionaryIterator); - result = _(objDictionary).flatMap('a'); + result = _(numDictionary).flatMap(dictionaryIterator); + result = _(objDictionary).flatMap('a'); result = _(numNumericDictionary).flatMap(); result = _(numNumericDictionary).flatMap(numericDictionaryIterator); - result = _(objNumericDictionary).flatMap('a'); + result = _(objNumericDictionary).flatMap('a'); } { @@ -4158,27 +4306,26 @@ namespace TestFlatMap { let result: _.LoDashExplicitArrayWrapper; result = _('abc').chain().flatMap(); - result = _('abc').chain().flatMap(stringIterator); } { let result: _.LoDashExplicitArrayWrapper; result = _(numArray).chain().flatMap(); - result = _(numArray).chain().flatMap(listIterator); - result = _(objArray).chain().flatMap('a'); + 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 = _(objList).chain().flatMap('a'); result = _(numDictionary).chain().flatMap(); - result = _(numDictionary).chain().flatMap(dictionaryIterator); - result = _(objDictionary).chain().flatMap('a'); + result = _(numDictionary).chain().flatMap(dictionaryIterator); + result = _(objDictionary).chain().flatMap('a'); result = _(numNumericDictionary).chain().flatMap(); result = _(numNumericDictionary).chain().flatMap(numericDictionaryIterator); - result = _(objNumericDictionary).chain().flatMap('a'); + result = _(objNumericDictionary).chain().flatMap('a'); } { @@ -4232,25 +4379,25 @@ namespace TestFlatMapDeep { { let result: number[]; - result = _.flatMapDeep(numArray); + result = _.flatMapDeep(numArray); result = _.flatMapDeep(numArray, listIterator); result = _.flatMapDeep(objArray, 'a'); - result = _.flatMapDeep(numList); + result = _.flatMapDeep(numList); result = _.flatMapDeep(numList, listIterator); result = _.flatMapDeep(objList, 'a'); - result = _.flatMapDeep(numDictionary); + result = _.flatMapDeep(numDictionary); result = _.flatMapDeep(numDictionary, dictionaryIterator); result = _.flatMapDeep(objDictionary, 'a'); - result = _.flatMapDeep(numNumericDictionary); + result = _.flatMapDeep(numNumericDictionary); result = _.flatMapDeep(numNumericDictionary, numericDictionaryIterator); @@ -4283,19 +4430,19 @@ namespace TestFlatMapDeep { { let result: _.LoDashImplicitArrayWrapper; - result = _(numArray).flatMapDeep(); + result = _(numArray).flatMapDeep(); result = _(numArray).flatMapDeep(listIterator); result = _(objArray).flatMapDeep('a'); - result = _(numList).flatMapDeep(); + result = _(numList).flatMapDeep(); result = _(numList).flatMapDeep(listIterator); result = _(objList).flatMapDeep('a'); - result = _(numDictionary).flatMapDeep(); + result = _(numDictionary).flatMapDeep(); result = _(numDictionary).flatMapDeep(dictionaryIterator); result = _(objDictionary).flatMapDeep('a'); - result = _(numNumericDictionary).flatMapDeep(); + result = _(numNumericDictionary).flatMapDeep(); result = _(numNumericDictionary).flatMapDeep(numericDictionaryIterator); result = _(objNumericDictionary).flatMapDeep('a'); } @@ -4326,19 +4473,19 @@ namespace TestFlatMapDeep { { let result: _.LoDashExplicitArrayWrapper; - result = _(numArray).chain().flatMapDeep(); + result = _(numArray).chain().flatMapDeep(); result = _(numArray).chain().flatMapDeep(listIterator); result = _(objArray).chain().flatMapDeep('a'); - result = _(numList).chain().flatMapDeep(); + result = _(numList).chain().flatMapDeep(); result = _(numList).chain().flatMapDeep(listIterator); result = _(objList).chain().flatMapDeep('a'); - result = _(numDictionary).chain().flatMapDeep(); + result = _(numDictionary).chain().flatMapDeep(); result = _(numDictionary).chain().flatMapDeep(dictionaryIterator); result = _(objDictionary).chain().flatMapDeep('a'); - result = _(numNumericDictionary).chain().flatMapDeep(); + result = _(numNumericDictionary).chain().flatMapDeep(); result = _(numNumericDictionary).chain().flatMapDeep(numericDictionaryIterator); result = _(objNumericDictionary).chain().flatMapDeep('a'); } @@ -4394,25 +4541,25 @@ namespace TestFlatMapDepth { { let result: number[]; - result = _.flatMapDepth(numArray); + result = _.flatMapDepth(numArray); result = _.flatMapDepth(numArray, listIterator, 1); result = _.flatMapDepth(objArray, 'a'); - result = _.flatMapDepth(numList); + result = _.flatMapDepth(numList); result = _.flatMapDepth(numList, listIterator, 1); result = _.flatMapDepth(objList, 'a', 1); - result = _.flatMapDepth(numDictionary); + result = _.flatMapDepth(numDictionary); result = _.flatMapDepth(numDictionary, dictionaryIterator, 1); result = _.flatMapDepth(objDictionary, 'a', 1); - result = _.flatMapDepth(numNumericDictionary); + result = _.flatMapDepth(numNumericDictionary); result = _.flatMapDepth(numNumericDictionary, numericDictionaryIterator, 1); @@ -4445,19 +4592,19 @@ namespace TestFlatMapDepth { { let result: _.LoDashImplicitArrayWrapper; - result = _(numArray).flatMapDepth(); + result = _(numArray).flatMapDepth(); result = _(numArray).flatMapDepth(listIterator, 1); result = _(objArray).flatMapDepth('a', 1); - result = _(numList).flatMapDepth(); + result = _(numList).flatMapDepth(); result = _(numList).flatMapDepth(listIterator, 1); result = _(objList).flatMapDepth('a', 1); - result = _(numDictionary).flatMapDepth(); + result = _(numDictionary).flatMapDepth(); result = _(numDictionary).flatMapDepth(dictionaryIterator, 1); result = _(objDictionary).flatMapDepth('a', 1); - result = _(numNumericDictionary).flatMapDepth(); + result = _(numNumericDictionary).flatMapDepth(); result = _(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 1); result = _(objNumericDictionary).flatMapDepth('a', 1); } @@ -4488,19 +4635,19 @@ namespace TestFlatMapDepth { { let result: _.LoDashExplicitArrayWrapper; - result = _(numArray).chain().flatMapDepth(); + result = _(numArray).chain().flatMapDepth(); result = _(numArray).chain().flatMapDepth(listIterator, 1); result = _(objArray).chain().flatMapDepth('a', 1); - result = _(numList).chain().flatMapDepth(); + result = _(numList).chain().flatMapDepth(); result = _(numList).chain().flatMapDepth(listIterator, 1); result = _(objList).chain().flatMapDepth('a', 1); - result = _(numDictionary).chain().flatMapDepth(); + result = _(numDictionary).chain().flatMapDepth(); result = _(numDictionary).chain().flatMapDepth(dictionaryIterator, 1); result = _(objDictionary).chain().flatMapDepth('a', 1); - result = _(numNumericDictionary).chain().flatMapDepth(); + result = _(numNumericDictionary).chain().flatMapDepth(); result = _(numNumericDictionary).chain().flatMapDepth(numericDictionaryIterator, 1); result = _(objNumericDictionary).chain().flatMapDepth('a', 1); } @@ -4564,8 +4711,7 @@ namespace TestForEach { result = _.forEach(array, (value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - // Note: ideally we'd like collection TResult[], but it seems the best we can get is List. - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4579,8 +4725,7 @@ namespace TestForEach { result = _.forEach(nilArray, (value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - // Note: ideally we'd like collection TResult[], but it seems the best we can get is List. - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4648,7 +4793,7 @@ namespace TestForEach { result = _(array).forEach((value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4658,7 +4803,7 @@ namespace TestForEach { result = _(nilArray).forEach((value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4677,13 +4822,13 @@ namespace TestForEach { { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).forEach(dictionaryIterator); + result = _(dictionary).forEach(dictionaryIterator); } { let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).forEach(dictionaryIterator); + result = _(nilDictionary).forEach(dictionaryIterator); } { @@ -4702,7 +4847,7 @@ namespace TestForEach { result = _(array).chain().forEach((value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4712,7 +4857,7 @@ namespace TestForEach { result = _(nilArray).chain().forEach((value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4731,13 +4876,13 @@ namespace TestForEach { { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).chain().forEach(dictionaryIterator); + result = _(dictionary).chain().forEach(dictionaryIterator); } { let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).chain().forEach(dictionaryIterator); + result = _(nilDictionary).chain().forEach(dictionaryIterator); } } @@ -4779,7 +4924,7 @@ namespace TestForEachRight { result = _.forEachRight(array, (value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4789,7 +4934,7 @@ namespace TestForEachRight { result = _.forEachRight(nilArray, (value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4870,13 +5015,13 @@ namespace TestForEachRight { { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).forEachRight(dictionaryIterator); + result = _(dictionary).forEachRight(dictionaryIterator); } { let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).forEachRight(dictionaryIterator); + result = _(nilDictionary).forEachRight(dictionaryIterator); } { @@ -4895,7 +5040,7 @@ namespace TestForEachRight { result = _(array).chain().forEachRight((value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4905,7 +5050,7 @@ namespace TestForEachRight { result = _(nilArray).chain().forEachRight((value, index, collection) => { value; // $ExpectType TResult index; // $ExpectType number - collection; // $ExpectType ArrayLike + collection; // $ExpectType TResult[] }); } @@ -4924,13 +5069,13 @@ namespace TestForEachRight { { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).chain().forEachRight(dictionaryIterator); + result = _(dictionary).chain().forEachRight(dictionaryIterator); } { let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).chain().forEachRight(dictionaryIterator); + result = _(nilDictionary).chain().forEachRight(dictionaryIterator); } } @@ -4952,7 +5097,6 @@ namespace TestGroupBy { result = _.groupBy(''); result = _.groupBy('', stringIterator); - result = _.groupBy('', stringIterator); } { @@ -4963,97 +5107,67 @@ namespace TestGroupBy { result = _.groupBy(array, ''); result = _.groupBy(array, {a: 42}); - result = _.groupBy(array, listIterator); - result = _.groupBy(array, ''); - result = _.groupBy<{a: number}, SampleType>(array, {a: 42}); - result = _.groupBy(list); result = _.groupBy(list, listIterator); result = _.groupBy(list, ''); result = _.groupBy(list, {a: 42}); - result = _.groupBy(list, listIterator); - result = _.groupBy(list, ''); - result = _.groupBy<{a: number}, SampleType>(list, {a: 42}); - - result = _.groupBy(dictionary); - result = _.groupBy(dictionary, dictionaryIterator); - result = _.groupBy(dictionary, ''); - result = _.groupBy(dictionary, {a: 42}); - - result = _.groupBy(dictionary, dictionaryIterator); - result = _.groupBy(dictionary, ''); - result = _.groupBy<{a: number}, SampleType>(dictionary, {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); + result = _('').groupBy((char: string, index: number, string: ArrayLike) => 0); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; result = _(array).groupBy(); - result = _(array).groupBy(listIterator); + result = _(array).groupBy(listIterator); result = _(array).groupBy(''); - result = _(array).groupBy(''); - result = _(array).groupBy<{a: number}>({a: 42}); + result = _(array).groupBy({a: 42}); result = _(list).groupBy(); result = _(list).groupBy(listIterator); result = _(list).groupBy(''); result = _(list).groupBy({a: 42}); - result = _(list).groupBy(listIterator); - result = _(list).groupBy(''); - result = _(list).groupBy<{a: number}, SampleType>({a: 42}); - result = _(dictionary).groupBy(); - result = _(dictionary).groupBy(dictionaryIterator); + result = _(dictionary).groupBy(dictionaryIterator); result = _(dictionary).groupBy(''); result = _(dictionary).groupBy({a: 42}); - - result = _(dictionary).groupBy(dictionaryIterator); - result = _(dictionary).groupBy(''); - result = _(dictionary).groupBy<{a: number}, SampleType>({a: 42}); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; result = _('').chain().groupBy(); - result = _('').chain().groupBy((char: string, index: number, string: ArrayLike) => 0); + 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(listIterator); result = _(array).chain().groupBy(''); - result = _(array).chain().groupBy(''); - result = _(array).chain().groupBy<{a: number}>({a: 42}); + 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 = _(list).chain().groupBy(listIterator); - result = _(list).chain().groupBy(''); - result = _(list).chain().groupBy<{a: number}, SampleType>({a: 42}); - result = _(dictionary).chain().groupBy(); - result = _(dictionary).chain().groupBy(dictionaryIterator); + result = _(dictionary).chain().groupBy(dictionaryIterator); result = _(dictionary).chain().groupBy(''); result = _(dictionary).chain().groupBy({a: 42}); - - result = _(dictionary).chain().groupBy(dictionaryIterator); - result = _(dictionary).chain().groupBy(''); - result = _(dictionary).chain().groupBy<{a: number}, SampleType>({a: 42}); } } @@ -5132,26 +5246,22 @@ namespace TestKeyBy { result = _.keyBy(array); result = _.keyBy(array, listIterator); result = _.keyBy(array, 'a'); - result = _.keyBy<{a: number}, SampleObject>(array, {a: 42}); result = _.keyBy(array, {a: 42}); result = _.keyBy(list); result = _.keyBy(list, listIterator); result = _.keyBy(list, 'a'); - result = _.keyBy<{a: number}, SampleObject>(list, {a: 42}); result = _.keyBy(list, {a: 42}); result = _.keyBy(numericDictionary); result = _.keyBy(numericDictionary, numericDictionaryIterator); result = _.keyBy(numericDictionary, 'a'); - result = _.keyBy<{a: number}, SampleObject>(numericDictionary, {a: 42}); result = _.keyBy(numericDictionary, {a: 42}); - result = _.keyBy(dictionary); - result = _.keyBy(dictionary, dictionaryIterator); - result = _.keyBy(dictionary, 'a'); - result = _.keyBy<{a: number}, SampleObject>(dictionary, {a: 42}); - result = _.keyBy(dictionary, {a: 42}); + result = _.keyBy(dictionary); + result = _.keyBy(dictionary, dictionaryIterator); + result = _.keyBy(dictionary, 'a'); + result = _.keyBy(dictionary, {a: 42}); } { @@ -5167,25 +5277,22 @@ namespace TestKeyBy { result = _(array).keyBy(); result = _(array).keyBy(listIterator); result = _(array).keyBy('a'); - result = _(array).keyBy<{a: number}>({a: 42}); + result = _(array).keyBy({a: 42}); result = _(list).keyBy(); result = _(list).keyBy(listIterator); result = _(list).keyBy('a'); - result = _(list).keyBy<{a: number}, SampleObject>({a: 42}); result = _(list).keyBy({a: 42}); result = _(numericDictionary).keyBy(); result = _(numericDictionary).keyBy(numericDictionaryIterator); result = _(numericDictionary).keyBy('a'); - result = _(numericDictionary).keyBy<{a: number}, SampleObject>({a: 42}); result = _(numericDictionary).keyBy({a: 42}); - result = _(dictionary).keyBy(); - result = _(dictionary).keyBy(dictionaryIterator); - result = _(dictionary).keyBy('a'); - result = _(dictionary).keyBy<{a: number}, SampleObject>({a: 42}); - result = _(dictionary).keyBy({a: 42}); + result = _(dictionary).keyBy(); + result = _(dictionary).keyBy(dictionaryIterator); + result = _(dictionary).keyBy('a'); + result = _(dictionary).keyBy({a: 42}); } { @@ -5201,25 +5308,22 @@ namespace TestKeyBy { result = _(array).chain().keyBy(); result = _(array).chain().keyBy(listIterator); result = _(array).chain().keyBy('a'); - result = _(array).chain().keyBy<{a: number}>({a: 42}); + 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: number}, SampleObject>({a: 42}); 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: number}, SampleObject>({a: 42}); 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: number}, SampleObject>({a: 42}); - result = _(dictionary).chain().keyBy({a: 42}); + result = _(dictionary).chain().keyBy(); + result = _(dictionary).chain().keyBy(dictionaryIterator); + result = _(dictionary).chain().keyBy('a'); + result = _(dictionary).chain().keyBy({a: 42}); } } @@ -5240,68 +5344,68 @@ namespace TestInvoke { let result: string; - result = _.invoke(boolArray, "[1]"); - result = _.invoke(boolArray, "[1]", 2); - result = _.invoke(boolArray, [1, "toString"]); - result = _.invoke(boolArray, [1, "toString"], 2); + result = _.invoke(boolArray, "[1]"); + result = _.invoke(boolArray, "[1]", 2); + result = _.invoke(boolArray, [1, "toString"]); + result = _.invoke(boolArray, [1, "toString"], 2); - result = _.invoke(boolArray, "[1]"); - result = _.invoke(boolArray, "[1]", 2); - result = _.invoke(boolArray, [1, "toString"]); - result = _.invoke(boolArray, [1, "toString"], 2); + result = _.invoke(boolArray, "[1]"); + result = _.invoke(boolArray, "[1]", 2); + result = _.invoke(boolArray, [1, "toString"]); + result = _.invoke(boolArray, [1, "toString"], 2); - result = _.invoke(numDict, "a.toString"); - result = _.invoke(numDict, "a.toString", 2); - result = _.invoke(numDict, ["a", "toString"]); - result = _.invoke(numDict, ["a", "toString"], 2); + result = _.invoke(numDict, "a.toString"); + result = _.invoke(numDict, "a.toString", 2); + result = _.invoke(numDict, ["a", "toString"]); + result = _.invoke(numDict, ["a", "toString"], 2); - result = _.invoke(numDict, "a.toString"); - result = _.invoke(numDict, "a.toString", 2); - result = _.invoke(numDict, ["a", "toString"]); - result = _.invoke(numDict, ["a", "toString"], 2); + result = _.invoke(numDict, "a.toString"); + result = _.invoke(numDict, "a.toString", 2); + result = _.invoke(numDict, ["a", "toString"]); + result = _.invoke(numDict, ["a", "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 = _.invoke(nestedDict, ["a", 0, "toString"]); + result = _.invoke(nestedDict, ["a", 0, "toString"], 2); - result = _.invoke, string>(nestedDict, ["a[0].toString"]); - result = _.invoke, string>(nestedDict, ["a[0].toString"], 2); - result = _.invoke, string>(nestedDict, ["a", 0, "toString"]); - result = _.invoke, string>(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 = _(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 = _(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); + 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<_.LoDashExplicitWrapper>("[1]"); - result = _(boolArray).chain().invoke<_.LoDashExplicitWrapper>("[1]", 2); - result = _(boolArray).chain().invoke<_.LoDashExplicitWrapper>([1, "toString"]); - result = _(boolArray).chain().invoke<_.LoDashExplicitWrapper>([1, "toString"], 2); + 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<_.LoDashExplicitWrapper>("a.toString"); - result = _(numDict).chain().invoke<_.LoDashExplicitWrapper>("a.toString", 2); - result = _(numDict).chain().invoke<_.LoDashExplicitWrapper>(["a", "toString"]); - result = _(numDict).chain().invoke<_.LoDashExplicitWrapper>(["a", "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<_.LoDashExplicitWrapper>("a[0].toString"); - result = _(nestedDict).chain().invoke<_.LoDashExplicitWrapper>("a[0].toString", 2); - result = _(nestedDict).chain().invoke<_.LoDashExplicitWrapper>(["a", 0, "toString"]); - result = _(nestedDict).chain().invoke<_.LoDashExplicitWrapper>(["a", 0, "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); } } @@ -5317,17 +5421,17 @@ namespace TestInvokeMap { let numDict: _.Dictionary | null | undefined = obj as any; 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(); + 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(); - 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 = _.invokeMap(numArray, Number.prototype.toString); result = _.invokeMap(numArray, Number.prototype.toString, 2); result = _(numArray).invokeMap(Number.prototype.toString).value(); @@ -5335,17 +5439,17 @@ namespace TestInvokeMap { result = _(numArray).chain().invokeMap(Number.prototype.toString).value(); result = _(numArray).chain().invokeMap(Number.prototype.toString, 2).value(); - 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(); + 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(); - 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 = _.invokeMap(numDict, Number.prototype.toString); result = _.invokeMap(numDict, Number.prototype.toString, 2); result = _(numDict).invokeMap(Number.prototype.toString).value(); @@ -5413,7 +5517,7 @@ namespace TestMap { { let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().map({}); + result = _(array).chain().map({}); result = _(list).chain().map({}); result = _(dictionary).chain().map({}); } @@ -5438,33 +5542,148 @@ namespace TestMap { } // _.partition -result = _.partition('abcd', (n) => n < 'c'); -result = _.partition(['a', 'b', 'c', 'd'], (n) => n < 'c'); -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 < 3); -result = <{a: number}[][]>_.partition<{a: number}, {a: number}>([{a: 1}, {a: 2}], {a: 2}); -result = <{a: number}[][]>_.partition<{a: number}, {a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, {a: 2}); -result = <{a: number}[][]>_.partition<{a: number}, {a: number}>({0: {a: 1}, 1: {a: 2}}, {a: 2}); -result = <{a: number}[][]>_.partition<{a: number}>([{a: 1}, {a: 2}], 'a'); -result = <{a: number}[][]>_.partition<{a: number}>([{a: 1}, {a: 2}], 'a', 2); -result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, 'a'); -result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, 'a', 2); -result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}}, 'a'); -result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}}, 'a', 2); -result = <{a: number}[][]>_.partition<{a: number}>(null, 'a'); -result = _('abcd').partition((n) => n < 'c').value(); -result = _(['a', 'b', 'c', 'd']).partition((n) => n < 'c').value(); -result = _([1, 2, 3, 4]).partition((n) => n < 3).value(); -result = _({0: 1, 1: 2, 2: 3, 3: 4, length: 4}).partition((n) => n < 3).value(); -result = _({a: 1, b: 2, c: 3, d: 4}).partition((n) => n < 3).value(); -result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition<{a: number}>({a: 2}).value(); -result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}, length: 2}).partition<{a: number}, {a: number}>({a: 2}).value(); -result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}, {a: number}>({a: 2}).value(); -result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition('a').value(); -result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition('a', 2).value(); -result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a').value(); -result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a', 2).value(); +namespace TestPartition { + { + let result: any[][]; + + result = _.partition(any, (n) => { + n; // $ExpectType any + return n < 'c'; + }); + } + + { + let result: string[][]; + + result = _.partition('abcd', (n) => { + n; // $ExpectType string + return n < 'c'; + }); + result = _.partition(['a', 'b', 'c', 'd'], (n) => { + n; // $ExpectType string + return n < 'c'; + }); + } + + { + 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 = _(any).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(any).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]); + } +} // TODO // _.map with iteratee shorthand @@ -5549,8 +5768,8 @@ namespace TestReduce { return r; }, {} as ABC); // tslint:disable-line no-object-literal-type-assertion - result = _([1, 2, 3]).reduce((sum: number, num: number) => sum + num); - result = _({ 'a': 1, 'b': 2, 'c': 3 }).reduce((r: ABC, num: number, key: string) => { + result = _([1, 2, 3]).reduce((sum: number, num: number) => sum + num); + result = _({ 'a': 1, 'b': 2, 'c': 3 }).reduce((r: ABC, num: number, key: string) => { r[key] = num * 3; return r; }, { a: 1, b: 2, c: 3 }); @@ -5579,15 +5798,15 @@ namespace TestReject { result = _.reject(array, listIterator); result = _.reject(array, ''); - result = _.reject<{a: number}, TResult>(array, {a: 42}); + result = _.reject(array, {a: 42}); result = _.reject(list, listIterator); result = _.reject(list, ''); - result = _.reject<{a: number}, TResult>(list, {a: 42}); + result = _.reject(list, {a: 42}); - result = _.reject(dictionary, dictionaryIterator); - result = _.reject(dictionary, ''); - result = _.reject<{a: number}, TResult>(dictionary, {a: 42}); + result = _.reject(dictionary, dictionaryIterator); + result = _.reject(dictionary, ''); + result = _.reject(dictionary, {a: 42}); } { @@ -5601,15 +5820,15 @@ namespace TestReject { result = _(array).reject(listIterator); result = _(array).reject(''); - result = _(array).reject<{a: number}>({a: 42}); + result = _(array).reject({a: 42}); result = _(list).reject(listIterator); result = _(list).reject(''); - result = _(list).reject<{a: number}, TResult>({a: 42}); + result = _(list).reject({a: 42}); - result = _(dictionary).reject(dictionaryIterator); - result = _(dictionary).reject(''); - result = _(dictionary).reject<{a: number}, TResult>({a: 42}); + result = _(dictionary).reject(dictionaryIterator); + result = _(dictionary).reject(''); + result = _(dictionary).reject({a: 42}); } { @@ -5623,15 +5842,15 @@ namespace TestReject { result = _(array).chain().reject(listIterator); result = _(array).chain().reject(''); - result = _(array).chain().reject<{a: number}>({a: 42}); + result = _(array).chain().reject({a: 42}); result = _(list).chain().reject(listIterator); result = _(list).chain().reject(''); - result = _(list).chain().reject<{a: number}, TResult>({a: 42}); + result = _(list).chain().reject({a: 42}); - result = _(dictionary).chain().reject(dictionaryIterator); - result = _(dictionary).chain().reject(''); - result = _(dictionary).chain().reject<{a: number}, TResult>({a: 42}); + result = _(dictionary).chain().reject(dictionaryIterator); + result = _(dictionary).chain().reject(''); + result = _(dictionary).chain().reject({a: 42}); } } @@ -5663,14 +5882,14 @@ namespace TestSample { } { - let result: _.LoDashExplicitWrapper; + let result: _.LoDashExplicitWrapper; result = _('abc').chain().sample(); - result = _(array).chain().sample<_.LoDashExplicitWrapper>(); - result = _(list).chain().sample<_.LoDashExplicitWrapper>(); - result = _(dictionary).chain().sample<_.LoDashExplicitWrapper>(); - result = _(numericDictionary).chain().sample<_.LoDashExplicitWrapper>(); - result = _({a: 'foo'}).chain().sample<_.LoDashExplicitWrapper>(); + result = _(array).chain().sample(); + result = _(list).chain().sample(); + result = _(dictionary).chain().sample(); + result = _(numericDictionary).chain().sample(); + result = _({a: 'foo'}).chain().sample(); } } @@ -5695,8 +5914,8 @@ namespace TestSampleSize { result = _.sampleSize(dictionary, 42); result = _.sampleSize(numericDictionary); result = _.sampleSize(numericDictionary, 42); - result = _.sampleSize<{a: string}, string>({a: 'foo'}); - result = _.sampleSize<{a: string}, string>({a: 'foo'}, 42); + result = _.sampleSize({a: 'foo'}); + result = _.sampleSize({a: 'foo'}, 42); result = _.sampleSize({a: 'foo'}); result = _.sampleSize({a: 'foo'}, 42); } @@ -5754,7 +5973,7 @@ namespace TestShuffle { result = _.shuffle(array); result = _.shuffle(list); - result = _.shuffle(dictionary); + result = _.shuffle(dictionary); } { @@ -5768,7 +5987,7 @@ namespace TestShuffle { result = _(array).shuffle(); result = _(list).shuffle(); - result = _(dictionary).shuffle(); + result = _(dictionary).shuffle(); } { @@ -5782,7 +6001,7 @@ namespace TestShuffle { result = _(array).chain().shuffle(); result = _(list).chain().shuffle(); - result = _(dictionary).chain().shuffle(); + result = _(dictionary).chain().shuffle(); } } @@ -5798,9 +6017,9 @@ namespace TestSize { { let result: number; - result = _.size(array); - result = _.size(list); - result = _.size(dictionary); + result = _.size(array); + result = _.size(list); + result = _.size(dictionary); result = _.size(''); result = _(array).size(); @@ -5852,10 +6071,10 @@ namespace TestSome { result = _.some(dictionary); result = _.some(numericDictionary, numericDictionaryIterator); - result = _.some(dictionary, (value, key, collection) => { - value.a--; - key.substr(0); - value = collection[key]; + result = _.some(dictionary, (value, key, collection) => { + value; // $ExpectType SampleObject + key; // $ExpectType string + collection; // $ExpectType Dictionary return true; }); result = _.some(dictionary, 'a'); @@ -5887,7 +6106,7 @@ namespace TestSome { result = _(list).some({a: 42}); result = _(dictionary).some(); - result = _(dictionary).some(dictionaryIterator); + result = _(dictionary).some(dictionaryIterator); result = _(dictionary).some('a'); result = _(dictionary).some(['a', 42]); result = _(dictionary).some({a: 42}); @@ -5921,7 +6140,7 @@ namespace TestSome { result = _(list).chain().some({a: 42}); result = _(dictionary).chain().some(); - result = _(dictionary).chain().some(dictionaryIterator); + result = _(dictionary).chain().some(dictionaryIterator); result = _(dictionary).chain().some('a'); result = _(dictionary).chain().some(['a', 42]); result = _(dictionary).chain().some({a: 42}); @@ -5953,58 +6172,58 @@ namespace TestSortBy { { let result: TResult[]; - result = _.sortBy(array); - result = _.sortBy(array, listIterator); - result = _.sortBy(array, ''); - result = _.sortBy<{a: number}, TResult>(array, {a: 42}); + result = _.sortBy(array); + result = _.sortBy(array, listIterator); + result = _.sortBy(array, ''); + result = _.sortBy(array, {a: 42}); - result = _.sortBy(list); - result = _.sortBy(list, listIterator); - result = _.sortBy(list, ''); - result = _.sortBy<{a: number}, TResult>(list, {a: 42}); + result = _.sortBy(list); + result = _.sortBy(list, listIterator); + result = _.sortBy(list, ''); + result = _.sortBy(list, {a: 42}); - result = _.sortBy(dictionary); - result = _.sortBy(dictionary, dictionaryIterator); - result = _.sortBy(dictionary, ''); - result = _.sortBy<{a: number}, TResult>(dictionary, {a: 42}); + 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(listIterator); result = _(array).sortBy(''); - result = _(array).sortBy<{a: number}>({a: 42}); + result = _(array).sortBy({a: 42}); - result = _(list).sortBy(); - result = _(list).sortBy(listIterator); - result = _(list).sortBy(''); - result = _(list).sortBy<{a: number}, TResult>({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: number}, TResult>({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(listIterator); result = _(array).chain().sortBy(''); - result = _(array).chain().sortBy<{a: number}>({a: 42}); + result = _(array).chain().sortBy({a: 42}); - result = _(list).chain().sortBy(); - result = _(list).chain().sortBy(listIterator); - result = _(list).chain().sortBy(''); - result = _(list).chain().sortBy<{a: number}, TResult>({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: number}, TResult>({a: 42}); + result = _(dictionary).chain().sortBy(); + result = _(dictionary).chain().sortBy(dictionaryIterator); + result = _(dictionary).chain().sortBy(''); + result = _(dictionary).chain().sortBy({a: 42}); } } @@ -6037,23 +6256,23 @@ namespace TestorderBy { let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[] = (value) => 1; let result: SampleObject[]; - result = _.orderBy<{a: number}, SampleObject>(array, iteratees); - result = _.orderBy<{a: number}, SampleObject>(array, iteratees, orders); + result = _.orderBy(array, iteratees); + result = _.orderBy(array, iteratees, orders); result = _.orderBy(array, iteratees); result = _.orderBy(array, iteratees, orders); - result = _.orderBy<{a: number}, SampleObject>(list, iteratees); - result = _.orderBy<{a: number}, SampleObject>(list, iteratees, orders); + result = _.orderBy(list, iteratees); + result = _.orderBy(list, iteratees, orders); result = _.orderBy(list, iteratees); result = _.orderBy(list, iteratees, orders); - result = _.orderBy<{a: number}, SampleObject>(numericDictionary, iteratees); - result = _.orderBy<{a: number}, SampleObject>(numericDictionary, iteratees, orders); + result = _.orderBy(numericDictionary, iteratees); + result = _.orderBy(numericDictionary, iteratees, orders); result = _.orderBy(numericDictionary, iteratees); result = _.orderBy(numericDictionary, iteratees, orders); - result = _.orderBy<{a: number}, SampleObject>(dictionary, iteratees); - result = _.orderBy<{a: number}, SampleObject>(dictionary, iteratees, orders); + result = _.orderBy(dictionary, iteratees); + result = _.orderBy(dictionary, iteratees, orders); result = _.orderBy(dictionary, iteratees); result = _.orderBy(dictionary, iteratees, orders); } @@ -6062,21 +6281,21 @@ namespace TestorderBy { let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[] = (value) => ""; let result: _.LoDashImplicitArrayWrapper; - result = _(array).orderBy<{a: number}>(iteratees); - result = _(array).orderBy<{a: number}>(iteratees, orders); + result = _(array).orderBy(iteratees); + result = _(array).orderBy(iteratees, orders); - result = _(list).orderBy<{a: number}, SampleObject>(iteratees); - result = _(list).orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(list).orderBy(iteratees); + result = _(list).orderBy(iteratees, orders); result = _(list).orderBy(iteratees); result = _(list).orderBy(iteratees, orders); - result = _(numericDictionary).orderBy<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).orderBy(iteratees); + result = _(numericDictionary).orderBy(iteratees, orders); result = _(numericDictionary).orderBy(iteratees); result = _(numericDictionary).orderBy(iteratees, orders); - result = _(dictionary).orderBy<{a: number}, SampleObject>(iteratees); - result = _(dictionary).orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).orderBy(iteratees); + result = _(dictionary).orderBy(iteratees, orders); result = _(dictionary).orderBy(iteratees); result = _(dictionary).orderBy(iteratees, orders); } @@ -6085,21 +6304,21 @@ namespace TestorderBy { let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[] = (value) => ""; let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().orderBy<{a: number}>(iteratees); - result = _(array).chain().orderBy<{a: number}>(iteratees, orders); + result = _(array).chain().orderBy(iteratees); + result = _(array).chain().orderBy(iteratees, orders); - result = _(list).chain().orderBy<{a: number}, SampleObject>(iteratees); - result = _(list).chain().orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(list).chain().orderBy(iteratees); + result = _(list).chain().orderBy(iteratees, orders); result = _(list).chain().orderBy(iteratees); result = _(list).chain().orderBy(iteratees, orders); - result = _(numericDictionary).chain().orderBy<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).chain().orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).chain().orderBy(iteratees); + result = _(numericDictionary).chain().orderBy(iteratees, orders); result = _(numericDictionary).chain().orderBy(iteratees); result = _(numericDictionary).chain().orderBy(iteratees, orders); - result = _(dictionary).chain().orderBy<{a: number}, SampleObject>(iteratees); - result = _(dictionary).chain().orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).chain().orderBy(iteratees); + result = _(dictionary).chain().orderBy(iteratees, orders); result = _(dictionary).chain().orderBy(iteratees); result = _(dictionary).chain().orderBy(iteratees, orders); } @@ -6167,24 +6386,24 @@ namespace TestAry { { let result: SampleFunc; - result = _.ary(func); - result = _.ary(func, 2); - result = _.ary(func); - result = _.ary(func, 2); + result = _.ary(func); + result = _.ary(func, 2); + result = _.ary(func); + result = _.ary(func, 2); } { let result: _.LoDashImplicitObjectWrapper; - result = _(func).ary(); - result = _(func).ary(2); + result = _(func).ary(); + result = _(func).ary(2); } { let result: _.LoDashExplicitObjectWrapper; - result = _(func).chain().ary(); - result = _(func).chain().ary(2); + result = _(func).chain().ary(); + result = _(func).chain().ary(2); } } @@ -6226,8 +6445,8 @@ namespace TestBind { let result: SampleResult; - result = _.bind(func, any); - result = _.bind(func, any); + result = _.bind(func, any); + result = _.bind(func, any); } { @@ -6235,8 +6454,8 @@ namespace TestBind { let result: SampleResult; - result = _.bind(func, any, 42); - result = _.bind(func, any, 42); + result = _.bind(func, any, 42); + result = _.bind(func, any, 42); } { @@ -6244,8 +6463,8 @@ namespace TestBind { let result: SampleResult; - result = _.bind(func, any, 42, ''); - result = _.bind(func, any, 42, ''); + result = _.bind(func, any, 42, ''); + result = _.bind(func, any, 42, ''); } { @@ -6253,7 +6472,7 @@ namespace TestBind { let result: _.LoDashImplicitObjectWrapper; - result = _(func).bind(any); + result = _(func).bind(any); } { @@ -6261,7 +6480,7 @@ namespace TestBind { let result: _.LoDashImplicitObjectWrapper; - result = _(func).bind(any, 42); + result = _(func).bind(any, 42); } { @@ -6269,7 +6488,7 @@ namespace TestBind { let result: _.LoDashImplicitObjectWrapper; - result = _(func).bind(any, 42, ''); + result = _(func).bind(any, 42, ''); } { @@ -6277,23 +6496,23 @@ namespace TestBind { let result: _.LoDashExplicitObjectWrapper; - result = _(func).chain().bind(any); + result = _(func).chain().bind(any); } { type SampleResult = (b: string) => boolean; - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper; - result = _(func).chain().bind(any, 42); + result = _(func).chain().bind(any, 42); } { type SampleResult = () => boolean; - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper; - result = _(func).chain().bind(any, 42, ''); + result = _(func).chain().bind(any, 42, ''); } } @@ -6346,8 +6565,7 @@ namespace TestBindKey { let result: SampleResult; - result = _.bindKey(object, 'foo'); - result = _.bindKey(object, 'foo'); + result = _.bindKey(object, 'foo'); } { @@ -6355,8 +6573,7 @@ namespace TestBindKey { let result: SampleResult; - result = _.bindKey(object, 'foo', 42); - result = _.bindKey(object, 'foo', 42); + result = _.bindKey(object, 'foo', 42); } { @@ -6364,8 +6581,7 @@ namespace TestBindKey { let result: SampleResult; - result = _.bindKey(object, 'foo', 42, ''); - result = _.bindKey(object, 'foo', 42, ''); + result = _.bindKey(object, 'foo', 42, ''); } { @@ -6373,7 +6589,7 @@ namespace TestBindKey { let result: _.LoDashImplicitObjectWrapper; - result = _(object).bindKey('foo'); + result = _(object).bindKey('foo'); } { @@ -6381,7 +6597,7 @@ namespace TestBindKey { let result: _.LoDashImplicitObjectWrapper; - result = _(object).bindKey('foo', 42); + result = _(object).bindKey('foo', 42); } { @@ -6389,7 +6605,7 @@ namespace TestBindKey { let result: _.LoDashImplicitObjectWrapper; - result = _(object).bindKey('foo', 42, ''); + result = _(object).bindKey('foo', 42, ''); } { @@ -6397,7 +6613,7 @@ namespace TestBindKey { let result: _.LoDashExplicitObjectWrapper; - result = _(object).chain().bindKey('foo'); + result = _(object).chain().bindKey('foo'); } { @@ -6405,7 +6621,7 @@ namespace TestBindKey { let result: _.LoDashExplicitObjectWrapper; - result = _(object).chain().bindKey('foo', 42); + result = _(object).chain().bindKey('foo', 42); } { @@ -6413,16 +6629,10 @@ namespace TestBindKey { let result: _.LoDashExplicitObjectWrapper; - result = _(object).chain().bindKey('foo', 42, ''); + result = _(object).chain().bindKey('foo', 42, ''); } } -const createCallbackObj: { [index: string]: string; } = { name: 'Joe' }; -result = <() => any>_.createCallback('name'); -result = <() => boolean>_.createCallback(createCallbackObj); -result = <_.LoDashImplicitObjectWrapper<() => any>>_('name').createCallback(); -result = <_.LoDashImplicitObjectWrapper<() => boolean>>_(createCallbackObj).createCallback(); - // _.curry const testCurryFn = (a: number, b: number, c: number) => [a, b, c]; let curryResult0: number[] @@ -6527,10 +6737,10 @@ namespace TestDefer { { let result: number; - result = _.defer(func); - result = _.defer(func, any); - result = _.defer(func, any, any); - result = _.defer(func, any, any, any); + result = _.defer(func); + result = _.defer(func, any); + result = _.defer(func, any, any); + result = _.defer(func, any, any, any); } { @@ -6561,9 +6771,9 @@ namespace TestDelay { { let result: number; - result = _.delay(func, 1); - result = _.delay(func, 1, 2); - result = _.delay(func, 1, 2, ''); + result = _.delay(func, 1); + result = _.delay(func, 1, 2); + result = _.delay(func, 1, 2, ''); } { @@ -6628,34 +6838,34 @@ namespace TestFlow { 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<(m: number, n: number) => number>([Fn2, Fn1, Fn3, Fn4]); + result = _.flow([Fn2, Fn1, Fn3, Fn4]); } { let result: (m: number, n: number) => number; - result = _.flow<(m: number, n: number) => number>(Fn1, Fn2); - result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); - result = _.flow<(m: number, n: number) => number>([Fn1, Fn1, Fn1, Fn2]); + result = _.flow(Fn1, Fn2); + result = _.flow(Fn1, Fn1, Fn2); + result = _.flow(Fn1, Fn1, Fn1, Fn2); + result = _.flow([Fn1, Fn1, Fn1, Fn2]); } { let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; - result = _(Fn1).flow<(m: number, n: number) => number>(Fn2); - result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _(Fn1).flow<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); + result = _(Fn1).flow(Fn2); + result = _(Fn1).flow(Fn1, Fn2); + result = _(Fn1).flow(Fn1, Fn1, Fn2); + result = _(Fn1).flow([Fn1, Fn1, Fn2]); } { let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; - result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn2); - result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _(Fn1).chain().flow<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); + result = _(Fn1).chain().flow(Fn2); + result = _(Fn1).chain().flow(Fn1, Fn2); + result = _(Fn1).chain().flow(Fn1, Fn1, Fn2); + result = _(Fn1).chain().flow([Fn1, Fn1, Fn2]); } } @@ -6667,28 +6877,28 @@ namespace TestFlowRight { { let result: (m: number, n: number) => number; - result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn2); - result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); - result = _.flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn1, Fn2]); + result = _.flowRight(Fn1, Fn2); + result = _.flowRight(Fn1, Fn1, Fn2); + result = _.flowRight(Fn1, Fn1, Fn1, Fn2); + result = _.flowRight([Fn1, Fn1, Fn1, Fn2]); } { let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; - result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn2); - result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _(Fn1).flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); + result = _(Fn1).flowRight(Fn2); + result = _(Fn1).flowRight(Fn1, Fn2); + result = _(Fn1).flowRight(Fn1, Fn1, Fn2); + result = _(Fn1).flowRight([Fn1, Fn1, Fn2]); } { let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; - result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn2); - result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _(Fn1).chain().flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); + 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]); } } @@ -6763,43 +6973,43 @@ namespace TestOverArgs { { let result: (a: string) => boolean; - result = _.overArgs boolean>(func1, transform1); - result = _.overArgs boolean>(func1, [transform1]); + result = _.overArgs(func1, transform1); + result = _.overArgs(func1, [transform1]); } { let result: (a: string, b: number) => boolean; - result = _.overArgs boolean>(func2, transform1, transform2); - result = _.overArgs boolean>(func2, [transform1, transform2]); + result = _.overArgs(func2, transform1, transform2); + result = _.overArgs(func2, [transform1, transform2]); } { let result: _.LoDashImplicitObjectWrapper<(a: string) => boolean>; - result = _(func1).overArgs<(a: string) => boolean>(transform1); - result = _(func1).overArgs<(a: string) => boolean>([transform1]); + result = _(func1).overArgs(transform1); + result = _(func1).overArgs([transform1]); } { let result: _.LoDashImplicitObjectWrapper<(a: string, b: number) => boolean>; - result = _(func2).overArgs<(a: string, b: number) => boolean>(transform1, transform2); - result = _(func2).overArgs<(a: string, b: number) => boolean>([transform1, transform2]); + result = _(func2).overArgs(transform1, transform2); + result = _(func2).overArgs([transform1, transform2]); } { let result: _.LoDashExplicitObjectWrapper<(a: string) => boolean>; - result = _(func1).chain().overArgs<(a: string) => boolean>(transform1); - result = _(func1).chain().overArgs<(a: string) => boolean>([transform1]); + result = _(func1).chain().overArgs(transform1); + result = _(func1).chain().overArgs([transform1]); } { let result: _.LoDashExplicitObjectWrapper<(a: string, b: number) => boolean>; - result = _(func2).chain().overArgs<(a: string, b: number) => boolean>(transform1, transform2); - result = _(func2).chain().overArgs<(a: string, b: number) => boolean>([transform1, transform2]); + result = _(func2).chain().overArgs(transform1, transform2); + result = _(func2).chain().overArgs([transform1, transform2]); } } @@ -6819,21 +7029,18 @@ namespace TestNegate { let result: ResultFn; result = _.negate(predicate); - result = _.negate(predicate); } { let result: _.LoDashImplicitObjectWrapper; result = _(predicate).negate(); - result = _(predicate).negate(); } { let result: _.LoDashExplicitObjectWrapper; result = _(predicate).chain().negate(); - result = _(predicate).chain().negate(); } } @@ -6882,10 +7089,10 @@ const testReargFn = (a: string, b: string, c: string) => [a, b, c]; interface TestReargResultFn { (b: string, c: string, a: string): string[]; } -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'); +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'); // _.rest namespace TestRest { @@ -6897,25 +7104,22 @@ namespace TestRest { { let result: ResultFunc; - result = _.rest(func); - result = _.rest(func, 1); - - result = _.rest(func); - result = _.rest(func, 1); + result = _.rest(func); + result = _.rest(func, 1); } { let result: _.LoDashImplicitObjectWrapper; - result = _(func).rest(); - result = _(func).rest(1); + result = _(func).rest(); + result = _(func).rest(1); } { let result: _.LoDashExplicitObjectWrapper; - result = _(func).chain().rest(); - result = _(func).chain().rest(1); + result = _(func).chain().rest(); + result = _(func).chain().rest(1); } } @@ -6929,20 +7133,19 @@ namespace TestSpread { { let result: SampleResult; - result = _.spread(func); - result = _.spread(func); + result = _.spread(func); } { let result: _.LoDashImplicitObjectWrapper; - result = _(func).spread(); + result = _(func).spread(); } { let result: _.LoDashExplicitObjectWrapper; - result = _(func).chain().spread(); + result = _(func).chain().spread(); } } @@ -7030,9 +7233,7 @@ namespace TestWrap { let wrapper: SampleWrapper = (a, b, c) => true; let result: SampleResult; - result = _.wrap(value, wrapper); - result = _.wrap(value, wrapper); - result = _.wrap(value, wrapper); + result = _.wrap(value, wrapper); } { @@ -7042,8 +7243,7 @@ namespace TestWrap { let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashImplicitObjectWrapper; - result = _(value).wrap(wrapper); - result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); } { @@ -7053,8 +7253,7 @@ namespace TestWrap { let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashImplicitObjectWrapper; - result = _(value).wrap(wrapper); - result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); } { @@ -7064,8 +7263,7 @@ namespace TestWrap { let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashImplicitObjectWrapper; - result = _(value).wrap(wrapper); - result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); } { @@ -7075,8 +7273,7 @@ namespace TestWrap { let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashExplicitObjectWrapper; - result = _(value).chain().wrap(wrapper); - result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); } { @@ -7086,8 +7283,7 @@ namespace TestWrap { let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashExplicitObjectWrapper; - result = _(value).chain().wrap(wrapper); - result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); } { @@ -7097,8 +7293,7 @@ namespace TestWrap { let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashExplicitObjectWrapper; - result = _(value).chain().wrap(wrapper); - result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); } } @@ -7160,7 +7355,7 @@ namespace TestClone { let result: string[]; result = _.clone(['']); - result = _(['']).clone(); + result = _(['']).clone(); } { @@ -7202,7 +7397,7 @@ namespace TestCloneDeep { let result: string[]; result = _.cloneDeep(['']); - result = _(['']).cloneDeep(); + result = _(['']).cloneDeep(); } { @@ -7235,48 +7430,45 @@ namespace TestCloneDeepWith { let customizer: CloneDeepWithCustomizer = (x) => ""; let reslut: string; - result = _.cloneDeepWith(42, customizer); - result = _.cloneDeepWith(42, customizer); - result = _(42).cloneDeepWith(customizer); + result = _.cloneDeepWith(42, customizer); + result = _(42).cloneDeepWith(customizer); } { let customizer: CloneDeepWithCustomizer = (x) => ""; let result: _.LoDashExplicitWrapper; - result = _(42).chain().cloneDeepWith(customizer); + result = _(42).chain().cloneDeepWith(customizer); } { let customizer: CloneDeepWithCustomizer = (x) => []; let reslut: string[]; - result = _.cloneDeepWith([42], customizer); - result = _.cloneDeepWith([42], customizer); - result = _([42]).cloneDeepWith(customizer); + result = _.cloneDeepWith([42], customizer); + result = _([42]).cloneDeepWith(customizer); } { let customizer: CloneDeepWithCustomizer = (x) => []; let result: _.LoDashExplicitArrayWrapper; - result = _([42]).chain().cloneDeepWith(customizer); + 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: string;};}>({a: {b: 42}}, customizer); - result = _.cloneDeepWith<{a: {b: number;};}, {a: {b: string;};}>({a: {b: 42}}, customizer); - result = _({a: {b: 42}}).cloneDeepWith<{a: {b: string;};}>(customizer); + 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<{a: {b: string;};}>(customizer); + result = _({a: {b: 42}}).chain().cloneDeepWith(customizer); } } @@ -7290,7 +7482,7 @@ namespace TestCloneWith { let customizer: CloneWithCustomizer = (x) => ""; let reslut: string; - result = _.cloneWith(42, customizer); + result = _.cloneWith(42, customizer); result = _.cloneWith(42, customizer); result = _(42).cloneWith(customizer); } @@ -7306,7 +7498,7 @@ namespace TestCloneWith { let customizer: CloneWithCustomizer = (x) => []; let reslut: string[]; - result = _.cloneWith([42], customizer); + result = _.cloneWith([42], customizer); result = _.cloneWith([42], customizer); result = _([42]).cloneWith(customizer); } @@ -7315,14 +7507,14 @@ namespace TestCloneWith { let customizer: CloneWithCustomizer = (x) => []; let result: _.LoDashExplicitArrayWrapper; - result = _([42]).chain().cloneWith(customizer); + 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: string;};}>({a: {b: 42}}, customizer); + 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); } @@ -7503,14 +7695,13 @@ namespace TestIsArrayBuffer { namespace TestIsArrayLike { { let value: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] - | number | Function | { length: string } | { a: string } + | number | { length: string } | { a: string } | null | undefined = any; if (_.isArrayLike(value)) { let result: string | string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; - } - else { - let result: number | Function | { length: string } | { a: string; } = value; + } else { + let result: number | { length: string } | { a: string; } | null | undefined = value; } } @@ -7530,8 +7721,7 @@ namespace TestIsArrayLike { if (_.isArrayLike(value)) { value; // $ExpectType never - } - else { + } else { value; // $ExpectType Function } } @@ -7580,14 +7770,13 @@ namespace TestIsArrayLike { namespace TestIsArrayLikeObject { { let value: string[] | { [index: number]: boolean, length: number } | [number, boolean] - | number | string | Function | { length: string } | { a: string } + | number | string | { length: string } | { a: string } | null | undefined = any; if (_.isArrayLikeObject(value)) { let result: string[] | { [index: number]: boolean, length: number } | [number, boolean] = value; - } - else { - let result: string | number | Function | { length: string; } | { a: string; } = value; + } else { + let result: string | number | { length: string; } | { a: string; } | null | undefined = value; } } @@ -7607,8 +7796,7 @@ namespace TestIsArrayLikeObject { if (_.isArrayLikeObject(value)) { value; // $ExpectType never - } - else { + } else { value; // $ExpectType string | Function } } @@ -7963,7 +8151,7 @@ namespace TestIsMap { { let value: number|Map = 0; - if (_.isMap(value)) { + if (_.isMap(value)) { let result: Map = value; } else { @@ -8253,7 +8441,7 @@ namespace TestIsSet { { let value: number|Set = 0; - if (_.isSet(value)) { + if (_.isSet(value)) { let result: Set = value; } else { @@ -8375,7 +8563,7 @@ namespace TestIsWeakMap { let value: number|WeakMap = 0; - if (_.isWeakMap(value)) { + if (_.isWeakMap(value)) { let result: WeakMap = value; } else { @@ -8531,23 +8719,23 @@ namespace TestToArray { namespace TestToPlainObject { { let result: TResult; - result = _.toPlainObject(); - result = _.toPlainObject(true); - result = _.toPlainObject(1); - result = _.toPlainObject('a'); - result = _.toPlainObject([]); - result = _.toPlainObject({}); + result = _.toPlainObject(); + result = _.toPlainObject(true); + result = _.toPlainObject(1); + result = _.toPlainObject('a'); + result = _.toPlainObject([]); + result = _.toPlainObject({}); } { let result: _.LoDashImplicitObjectWrapper; - result = _(true).toPlainObject(); - result = _(1).toPlainObject(); - result = _('a').toPlainObject(); - result = _([1]).toPlainObject(); - result = _([]).toPlainObject(); - result = _({}).toPlainObject(); + result = _(true).toPlainObject(); + result = _(1).toPlainObject(); + result = _('a').toPlainObject(); + result = _([1]).toPlainObject(); + result = _(['']).toPlainObject(); + result = _({}).toPlainObject(); } } @@ -8563,13 +8751,13 @@ namespace TestToFinite { } { - let result: _.LoDashImplicitWrapper; + let result: number; result = _(true).toFinite(); result = _(1).toFinite(); result = _('3.2').toFinite(); result = _([1]).toFinite(); - result = _([]).toFinite(); + result = _([]).toFinite(); result = _({}).toFinite(); } } @@ -8586,13 +8774,13 @@ namespace TestToInteger { } { - let result: _.LoDashImplicitWrapper; + let result: number; result = _(true).toInteger(); result = _(1).toInteger(); result = _('a').toInteger(); result = _([1]).toInteger(); - result = _([]).toInteger(); + result = _(['']).toInteger(); result = _({}).toInteger(); } } @@ -8609,13 +8797,13 @@ namespace TestToLength { } { - let result: _.LoDashImplicitWrapper; + let result: number; result = _(true).toLength(); result = _(1).toLength(); result = _('a').toLength(); result = _([1]).toLength(); - result = _([]).toLength(); + result = _(['']).toLength(); result = _({}).toLength(); } } @@ -8632,13 +8820,13 @@ namespace TestToNumber { } { - let result: _.LoDashImplicitWrapper; + let result: number; result = _(true).toNumber(); result = _(1).toNumber(); result = _('a').toNumber(); result = _([1]).toNumber(); - result = _([]).toNumber(); + result = _(['']).toNumber(); result = _({}).toNumber(); } } @@ -8655,13 +8843,13 @@ namespace TestToSafeInteger { } { - let result: _.LoDashImplicitWrapper; + let result: number; result = _(true).toSafeInteger(); result = _(1).toSafeInteger(); result = _('a').toSafeInteger(); result = _([1]).toSafeInteger(); - result = _([]).toSafeInteger(); + result = _(['']).toSafeInteger(); result = _({}).toSafeInteger(); } } @@ -8764,42 +8952,33 @@ namespace TestMax { namespace TestMaxBy { let array: number[] = []; let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array2: TResult[] = []; + let list2: _.List = []; let listIterator = (value: number, index: number, collection: _.List) => 0; - let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; let result: number | undefined; + let result2: TResult | undefined; result = _.maxBy(array); result = _.maxBy(array, listIterator); result = _.maxBy(array, ''); - result = _.maxBy<{a: number}, number>(array, {a: 42}); + result2 = _.maxBy(array2, {a: 42}); result = _.maxBy(list); result = _.maxBy(list, listIterator); result = _.maxBy(list, ''); - result = _.maxBy<{a: number}, number>(list, {a: 42}); - - result = _.maxBy(dictionary); - result = _.maxBy(dictionary, dictionaryIterator); - result = _.maxBy(dictionary, ''); - result = _.maxBy<{a: number}, number>(dictionary, {a: 42}); + result2 = _.maxBy(list2, {a: 42}); result = _(array).maxBy(); result = _(array).maxBy(listIterator); result = _(array).maxBy(''); - result = _(array).maxBy<{a: number}>({a: 42}); + result2 = _(array2).maxBy({a: 42}); result = _(list).maxBy(); result = _(list).maxBy(listIterator); result = _(list).maxBy(''); - result = _(list).maxBy<{a: number}, number>({a: 42}); - - result = _(dictionary).maxBy(); - result = _(dictionary).maxBy(dictionaryIterator); - result = _(dictionary).maxBy(''); - result = _(dictionary).maxBy<{a: number}, number>({a: 42}); + result2 = _(list2).maxBy({a: 42}); } // _.mean @@ -8809,7 +8988,6 @@ namespace TestMean { let result: number; result = _.mean(array); - result = _.mean(array); result = _(array).mean(); } @@ -8844,42 +9022,33 @@ namespace TestMin { namespace TestMinBy { let array: number[] = []; let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array2: TResult[] = []; + let list2: _.List = []; let listIterator = (value: number, index: number, collection: _.List) => 0; - let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; let result: number | undefined; + let result2: TResult | undefined; result = _.minBy(array); result = _.minBy(array, listIterator); result = _.minBy(array, ''); - result = _.minBy<{a: number}, number>(array, {a: 42}); + result2 = _.minBy(array2, {a: 42}); result = _.minBy(list); result = _.minBy(list, listIterator); result = _.minBy(list, ''); - result = _.minBy<{a: number}, number>(list, {a: 42}); - - result = _.minBy(dictionary); - result = _.minBy(dictionary, dictionaryIterator); - result = _.minBy(dictionary, ''); - result = _.minBy<{a: number}, number>(dictionary, {a: 42}); + result2 = _.minBy(list2, {a: 42}); result = _(array).minBy(); result = _(array).minBy(listIterator); result = _(array).minBy(''); - result = _(array).minBy<{a: number}>({a: 42}); + result2 = _(array2).minBy({a: 42}); result = _(list).minBy(); result = _(list).minBy(listIterator); result = _(list).minBy(''); - result = _(list).minBy<{a: number}, number>({a: 42}); - - result = _(dictionary).minBy(); - result = _(dictionary).minBy(dictionaryIterator); - result = _(dictionary).minBy(''); - result = _(dictionary).minBy<{a: number}, number>({a: 42}); + result2 = _(list2).minBy({a: 42}); } // _.multiply @@ -8933,10 +9102,8 @@ namespace TestSum { let result: number; result = _.sum(array); - result = _.sum(array); result = _.sum(list); - result = _.sum(list); result = _(array).sum(); @@ -8964,7 +9131,7 @@ namespace TestSumBy { let list: _.List | null | undefined = [] as any; let objectList: _.List<{ 'age': number }> | null | undefined = [] as any; - let listIterator = (value: number, index: number, collection: _.List) => 0; + let listIterator = (value: number) => 0; { let result: number; @@ -8972,17 +9139,15 @@ namespace TestSumBy { result = _.sumBy(array); result = _.sumBy(array, listIterator); result = _.sumBy(objectArray, 'age'); - result = _.sumBy(objectArray, { 'age': 30 }); result = _.sumBy(list); result = _.sumBy(list, listIterator); result = _.sumBy(objectList, 'age'); - result = _.sumBy(objectList, { 'age': 30 }); result = _(array).sumBy(listIterator); result = _(objectArray).sumBy('age'); - result = _(list).sumBy((value: _.List | null | undefined, index: number, collection: _.List<_.List | null | undefined>) => 0); + result = _(list).sumBy(listIterator); result = _(objectList).sumBy('age'); } @@ -8992,7 +9157,7 @@ namespace TestSumBy { result = _(array).chain().sumBy(listIterator); result = _(objectArray).chain().sumBy('age'); - result = _(list).chain().sumBy((value: _.List | null | undefined, index: number, collection: _.List<_.List | null | undefined>) => 0); + result = _(list).chain().sumBy(listIterator); result = _(objectList).chain().sumBy('age'); } } @@ -9138,7 +9303,7 @@ namespace TestAssign { { let result: { a: number, b: number, c: number, d: number, e: number }; - result = _.assign<{ a: number, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5); + result = _.assign(obj, s1, s2, s3, s4, s5); } { @@ -9174,7 +9339,7 @@ namespace TestAssign { { let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).assign<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5); + result = _(obj).assign(s1, s2, s3, s4, s5); } { @@ -9210,7 +9375,7 @@ namespace TestAssign { { let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).chain().assign<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5); + result = _(obj).chain().assign(s1, s2, s3, s4, s5); } } @@ -9322,7 +9487,7 @@ namespace TestAssignWith { { let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).chain().assignWith<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5, customizer); + result = _(obj).chain().assignWith(s1, s2, s3, s4, s5, customizer); } } @@ -9449,7 +9614,7 @@ namespace TestAssignIn { { let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).chain().assignIn<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5); + result = _(obj).chain().assignIn(s1, s2, s3, s4, s5); } } @@ -9561,7 +9726,7 @@ namespace TestAssignInWith { { let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).chain().assignInWith<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5, customizer); + result = _(obj).chain().assignInWith(s1, s2, s3, s4, s5, customizer); } } @@ -9644,7 +9809,7 @@ namespace TestDefaults { { let result: { a: string, b: number, c: number, d: number, e: number }; - result = _.defaults<{ a: string, b: number, c: number, d: number, e: number }>(obj, s1, s2, s3, s4, s5); + result = _.defaults(obj, s1, s2, s3, s4, s5); } { @@ -9680,7 +9845,7 @@ namespace TestDefaults { { let result: _.LoDashImplicitObjectWrapper<{ a: string, b: number, c: number, d: number, e: number }>; - result = _(obj).defaults<{ a: string, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5); + result = _(obj).defaults(s1, s2, s3, s4, s5); } { @@ -9716,7 +9881,7 @@ namespace TestDefaults { { let result: _.LoDashExplicitObjectWrapper<{ a: string, b: number, c: number, d: number, e: number }>; - result = _(obj).chain().defaults<{ a: string, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5); + result = _(obj).chain().defaults(s1, s2, s3, s4, s5); } } @@ -9730,45 +9895,27 @@ interface DefaultsDeepResult { const TestDefaultsDeepObject = { 'user': { 'name': 'barney' } }; const TestDefaultsDeepSource = { 'user': { 'name': 'fred', 'age': 36 } }; result = _.defaultsDeep(TestDefaultsDeepObject, TestDefaultsDeepSource); -result = _(TestDefaultsDeepObject).defaultsDeep(TestDefaultsDeepSource).value(); +result = _(TestDefaultsDeepObject).defaultsDeep(TestDefaultsDeepSource).value(); // _.entries namespace TestEntries { let object: _.Dictionary = {}; - { - let result: [string, any][]; - - result = _.entries<_.Dictionary>(object); - } - { let result: [string, string][]; - result = _.entries<_.Dictionary, string>(object); + result = _.entries(object); } { let result: _.LoDashImplicitArrayWrapper<[string, string]>; - result = _(object).entries(); - } - - { - let result: _.LoDashImplicitArrayWrapper<[string, any]>; - result = _(object).entries(); } { let result: _.LoDashExplicitArrayWrapper<[string, string]>; - result = _(object).chain().entries(); - } - - { - let result: _.LoDashExplicitArrayWrapper<[string, any]>; - result = _(object).chain().entries(); } } @@ -9777,27 +9924,15 @@ namespace TestEntries { namespace TestEntriesIn { let object: _.Dictionary = {}; - { - let result: [string, any][]; - - result = _.entriesIn<_.Dictionary>(object); - } - { let result: [string, string][]; - result = _.entriesIn<_.Dictionary, string>(object); + result = _.entriesIn(object); } { let result: _.LoDashImplicitArrayWrapper<[string, string]>; - result = _(object).entriesIn(); - } - - { - let result: _.LoDashImplicitArrayWrapper<[string, any]>; - result = _(object).entriesIn(); } @@ -9901,7 +10036,7 @@ namespace TestExtend { { let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).extend<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5); + result = _(obj).extend(s1, s2, s3, s4, s5); } { @@ -9937,7 +10072,7 @@ namespace TestExtend { { let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).chain().extend<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5); + result = _(obj).chain().extend(s1, s2, s3, s4, s5); } } @@ -10028,7 +10163,7 @@ namespace TestExtendWith { { let result: _.LoDashImplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).extendWith<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5, customizer); + result = _(obj).extendWith(s1, s2, s3, s4, s5, customizer); } { @@ -10064,7 +10199,7 @@ namespace TestExtendWith { { let result: _.LoDashExplicitObjectWrapper<{ a: number, b: number, c: number, d: number, e: number }>; - result = _(obj).chain().extendWith<{ a: number, b: number, c: number, d: number, e: number }>(s1, s2, s3, s4, s5, customizer); + result = _(obj).chain().extendWith(s1, s2, s3, s4, s5, customizer); } } @@ -10081,7 +10216,7 @@ namespace TestFindKey { result = _.findKey<{a: string;}>({a: ''}, ''); - result = _.findKey<{a: number;}, {a: string;}>({a: ''}, {a: 42}); + result = _.findKey({a: { b: 5 }}, {b: 42}); result = _.findKey({a: { b: 5 }}, ['b', 5]); @@ -10091,16 +10226,16 @@ namespace TestFindKey { result = _<{a: string;}>({a: ''}).findKey(''); - result = _<{a: string;}>({a: ''}).findKey<{a: number;}>({a: 42}); + 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 = _.findKey({a: ''}, predicateFn); - result = _<{a: string;}>({a: ''}).findKey(predicateFn); + result = _({a: ''}).findKey(predicateFn); } { @@ -10113,14 +10248,14 @@ namespace TestFindKey { result = _<{a: string;}>({a: ''}).chain().findKey(''); - result = _<{a: string;}>({a: ''}).chain().findKey<{a: number;}>({a: 42}); + result = _({a: { b: 5 }}).chain().findKey({b: 42}); } { let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; let result: _.LoDashExplicitWrapper; - result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); + result = _({a: ''}).chain().findKey(predicateFn); } } @@ -10136,7 +10271,7 @@ namespace TestFindLastKey { result = _.findLastKey<{a: string;}>({a: ''}, ''); - result = _.findLastKey<{a: number;}, {a: string;}>({a: ''}, {a: 42}); + result = _.findLastKey({a: { b: 5 }}, {b: 42}); result = _.findLastKey({a: { b: 5 }}, ['b', 5]); @@ -10146,16 +10281,16 @@ namespace TestFindLastKey { result = _<{a: string;}>({a: ''}).findLastKey(''); - result = _<{a: string;}>({a: ''}).findLastKey<{a: number;}>({a: 42}); + 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 = _.findLastKey({a: ''}, predicateFn); - result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); + result = _({a: ''}).findLastKey(predicateFn); } { @@ -10168,14 +10303,14 @@ namespace TestFindLastKey { result = _<{a: string;}>({a: ''}).chain().findLastKey(''); - result = _<{a: string;}>({a: ''}).chain().findLastKey<{a: number;}>({a: 42}); + result = _({a: { b: 5 }}).chain().findLastKey({b: 42}); } { let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; let result: _.LoDashExplicitWrapper; - result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _({a: ''}).chain().findLastKey(predicateFn); } } @@ -10194,15 +10329,15 @@ namespace TestForIn { { let result: _.Dictionary; - result = _.forIn(dictionary); - result = _.forIn(dictionary, dictionaryIterator); + result = _.forIn(dictionary); + result = _.forIn(dictionary, dictionaryIterator); } { let result: _.Dictionary | null | undefined; - result = _.forIn(nilDictionary); - result = _.forIn(nilDictionary, dictionaryIterator); + result = _.forIn(nilDictionary); + result = _.forIn(nilDictionary, dictionaryIterator); } { @@ -10222,29 +10357,29 @@ namespace TestForIn { { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).forIn(); - result = _(dictionary).forIn(dictionaryIterator); + result = _(dictionary).forIn(); + result = _(dictionary).forIn(dictionaryIterator); } { let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).forIn(); - result = _(nilDictionary).forIn(dictionaryIterator); + result = _(nilDictionary).forIn(); + result = _(nilDictionary).forIn(dictionaryIterator); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).chain().forIn(); - result = _(dictionary).chain().forIn(dictionaryIterator); + result = _(dictionary).chain().forIn(); + result = _(dictionary).chain().forIn(dictionaryIterator); } { let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).chain().forIn(); - result = _(nilDictionary).chain().forIn(dictionaryIterator); + result = _(nilDictionary).chain().forIn(); + result = _(nilDictionary).chain().forIn(dictionaryIterator); } } @@ -10263,15 +10398,15 @@ namespace TestForInRight { { let result: _.Dictionary; - result = _.forInRight(dictionary); - result = _.forInRight(dictionary, dictionaryIterator); + result = _.forInRight(dictionary); + result = _.forInRight(dictionary, dictionaryIterator); } { let result: _.Dictionary | null | undefined; - result = _.forInRight(nilDictionary); - result = _.forInRight(nilDictionary, dictionaryIterator); + result = _.forInRight(nilDictionary); + result = _.forInRight(nilDictionary, dictionaryIterator); } { @@ -10291,29 +10426,29 @@ namespace TestForInRight { { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).forInRight(); - result = _(dictionary).forInRight(dictionaryIterator); + result = _(dictionary).forInRight(); + result = _(dictionary).forInRight(dictionaryIterator); } { let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).forInRight(); - result = _(nilDictionary).forInRight(dictionaryIterator); + result = _(nilDictionary).forInRight(); + result = _(nilDictionary).forInRight(dictionaryIterator); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).chain().forInRight(); - result = _(dictionary).chain().forInRight(dictionaryIterator); + result = _(dictionary).chain().forInRight(); + result = _(dictionary).chain().forInRight(dictionaryIterator); } { let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).chain().forInRight(); - result = _(nilDictionary).chain().forInRight(dictionaryIterator); + result = _(nilDictionary).chain().forInRight(); + result = _(nilDictionary).chain().forInRight(dictionaryIterator); } } @@ -10332,15 +10467,15 @@ namespace TestForOwn { { let result: _.Dictionary; - result = _.forOwn(dictionary); - result = _.forOwn(dictionary, dictionaryIterator); + result = _.forOwn(dictionary); + result = _.forOwn(dictionary, dictionaryIterator); } { let result: _.Dictionary | null | undefined; - result = _.forOwn(nilDictionary); - result = _.forOwn(nilDictionary, dictionaryIterator); + result = _.forOwn(nilDictionary); + result = _.forOwn(nilDictionary, dictionaryIterator); } { @@ -10360,29 +10495,29 @@ namespace TestForOwn { { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).forOwn(); - result = _(dictionary).forOwn(dictionaryIterator); + result = _(dictionary).forOwn(); + result = _(dictionary).forOwn(dictionaryIterator); } { let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).forOwn(); - result = _(nilDictionary).forOwn(dictionaryIterator); + result = _(nilDictionary).forOwn(); + result = _(nilDictionary).forOwn(dictionaryIterator); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).chain().forOwn(); - result = _(dictionary).chain().forOwn(dictionaryIterator); + result = _(dictionary).chain().forOwn(); + result = _(dictionary).chain().forOwn(dictionaryIterator); } { let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).chain().forOwn(); - result = _(nilDictionary).chain().forOwn(dictionaryIterator); + result = _(nilDictionary).chain().forOwn(); + result = _(nilDictionary).chain().forOwn(dictionaryIterator); } } @@ -10401,15 +10536,15 @@ namespace TestForOwnRight { { let result: _.Dictionary; - result = _.forOwnRight(dictionary); - result = _.forOwnRight(dictionary, dictionaryIterator); + result = _.forOwnRight(dictionary); + result = _.forOwnRight(dictionary, dictionaryIterator); } { let result: _.Dictionary | null | undefined; - result = _.forOwnRight(nilDictionary); - result = _.forOwnRight(nilDictionary, dictionaryIterator); + result = _.forOwnRight(nilDictionary); + result = _.forOwnRight(nilDictionary, dictionaryIterator); } { @@ -10429,29 +10564,29 @@ namespace TestForOwnRight { { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).forOwnRight(); - result = _(dictionary).forOwnRight(dictionaryIterator); + result = _(dictionary).forOwnRight(); + result = _(dictionary).forOwnRight(dictionaryIterator); } { let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).forOwnRight(); - result = _(nilDictionary).forOwnRight(dictionaryIterator); + result = _(nilDictionary).forOwnRight(); + result = _(nilDictionary).forOwnRight(dictionaryIterator); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(dictionary).chain().forOwnRight(); - result = _(dictionary).chain().forOwnRight(dictionaryIterator); + result = _(dictionary).chain().forOwnRight(); + result = _(dictionary).chain().forOwnRight(dictionaryIterator); } { let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; - result = _(nilDictionary).chain().forOwnRight(); - result = _(nilDictionary).chain().forOwnRight(dictionaryIterator); + result = _(nilDictionary).chain().forOwnRight(); + result = _(nilDictionary).chain().forOwnRight(dictionaryIterator); } } @@ -10464,7 +10599,7 @@ namespace TestFunctions { { let result: string[]; - result = _.functions(object); + result = _.functions(object); } { @@ -10510,15 +10645,15 @@ namespace TestGet { { let result: string; - 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 = _.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', '_'); @@ -10529,15 +10664,15 @@ namespace TestGet { { 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 = _.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); @@ -10548,15 +10683,15 @@ namespace TestGet { { let result: boolean; - result = _.get<{a: boolean}, boolean>({a: true}, 'a'); - result = _.get<{a: boolean}, boolean>({a: true}, 'a', false); - result = _.get<{a: boolean}, boolean>({a: true}, ['a']); - result = _.get<{a: boolean}, boolean>({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 = _.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); @@ -10567,28 +10702,28 @@ namespace TestGet { { let result: _.LoDashExplicitWrapper; - result = _('abc').chain().get<_.LoDashExplicitWrapper>('0'); - result = _('abc').chain().get<_.LoDashExplicitWrapper>('0', '_'); - result = _('abc').chain().get<_.LoDashExplicitWrapper>(['0']); - result = _('abc').chain().get<_.LoDashExplicitWrapper>(['0'], '_'); + 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<_.LoDashExplicitWrapper>('0'); - result = _([42]).chain().get<_.LoDashExplicitWrapper>('0', -1); - result = _([42]).chain().get<_.LoDashExplicitWrapper>(['0']); - result = _([42]).chain().get<_.LoDashExplicitWrapper>(['0'], -1); + 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<_.LoDashExplicitWrapper>('a'); - result = _({a: true}).chain().get<_.LoDashExplicitWrapper>('a', false); - result = _({a: true}).chain().get<_.LoDashExplicitWrapper>(['a']); - result = _({a: true}).chain().get<_.LoDashExplicitWrapper>(['a'], false); + 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); } } @@ -10655,27 +10790,21 @@ namespace TestHasIn { // _.invert namespace TestInvert { { - let result: TResult; + let result: _.Dictionary; - result = _.invert({}); - result = _.invert({}, true); - - result = _.invert({}); - result = _.invert({}, true); + result = _.invert({}); } { - let result: _.LoDashImplicitObjectWrapper; + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _({}).invert(); - result = _({}).invert(true); + result = _({}).invert(); } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _({}).chain().invert(); - result = _({}).chain().invert(true); + result = _({}).chain().invert(); } } @@ -10832,58 +10961,58 @@ namespace TestMapKeys { { let result: _.Dictionary; - result = _.mapKeys(array); - result = _.mapKeys(array, listIterator); - result = _.mapKeys(array, ''); - result = _.mapKeys(array, {}); + result = _.mapKeys(array); + result = _.mapKeys(array, listIterator); + result = _.mapKeys(array, ''); + result = _.mapKeys(array, {}); - result = _.mapKeys(list); - result = _.mapKeys(list, listIterator); - result = _.mapKeys(list, ''); - result = _.mapKeys(list, {}); + result = _.mapKeys(list); + result = _.mapKeys(list, listIterator); + result = _.mapKeys(list, ''); + result = _.mapKeys(list, {}); - result = _.mapKeys(dictionary); - result = _.mapKeys(dictionary, dictionaryIterator); - result = _.mapKeys(dictionary, ''); - result = _.mapKeys(dictionary, {}); + result = _.mapKeys(dictionary); + result = _.mapKeys(dictionary, dictionaryIterator); + result = _.mapKeys(dictionary, ''); + result = _.mapKeys(dictionary, {}); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(array).mapKeys(); - result = _(array).mapKeys(listIterator); + result = _(array).mapKeys(); + result = _(array).mapKeys(listIterator); result = _(array).mapKeys(''); - result = _(array).mapKeys<{}>({}); + result = _(array).mapKeys({}); - result = _(list).mapKeys(); - result = _(list).mapKeys(listIterator); - result = _(list).mapKeys(''); - result = _(list).mapKeys({}); + result = _(list).mapKeys(); + result = _(list).mapKeys(listIterator); + result = _(list).mapKeys(''); + result = _(list).mapKeys({}); - result = _(dictionary).mapKeys(); - result = _(dictionary).mapKeys(dictionaryIterator); - result = _(dictionary).mapKeys(''); - result = _(dictionary).mapKeys({}); + result = _(dictionary).mapKeys(); + result = _(dictionary).mapKeys(dictionaryIterator); + result = _(dictionary).mapKeys(''); + result = _(dictionary).mapKeys({}); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(array).chain().mapKeys(); - result = _(array).chain().mapKeys(listIterator); + result = _(array).chain().mapKeys(); + result = _(array).chain().mapKeys(listIterator); result = _(array).chain().mapKeys(''); - result = _(array).chain().mapKeys<{}>({}); + result = _(array).chain().mapKeys({}); - result = _(list).chain().mapKeys(); - result = _(list).chain().mapKeys(listIterator); - result = _(list).chain().mapKeys(''); - result = _(list).chain().mapKeys({}); + result = _(list).chain().mapKeys(); + result = _(list).chain().mapKeys(listIterator); + result = _(list).chain().mapKeys(''); + result = _(list).chain().mapKeys({}); - result = _(dictionary).chain().mapKeys(); - result = _(dictionary).chain().mapKeys(dictionaryIterator); - result = _(dictionary).chain().mapKeys(''); - result = _(dictionary).chain().mapKeys({}); + result = _(dictionary).chain().mapKeys(); + result = _(dictionary).chain().mapKeys(dictionaryIterator); + result = _(dictionary).chain().mapKeys(''); + result = _(dictionary).chain().mapKeys({}); } } @@ -10909,7 +11038,7 @@ namespace TestMerge { result = _.merge(initialValue, {}, {}, {}, mergingValue); // Once we get to the varargs version, you have to specify the result explicitly - result = _.merge(initialValue, {}, {}, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue); type ComplicatedExpectedType = { a: number, b: string, c: {}, d: number[], e: boolean }; @@ -10939,7 +11068,7 @@ namespace TestMerge { result = _(initialValue).merge({}, {}, {}, mergingValue).value(); // Once we get to the varargs version, you have to specify the result explicitly - result = _(initialValue).merge({}, {}, {}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, {}, {}, mergingValue).value(); // Test complex multiple combinations with chaining @@ -10997,34 +11126,32 @@ namespace TestMergeWith { result = _.mergeWith(initialValue, {}, {}, {}, mergingValue, customizer); // Once we get to the varargs version, you have to specify the result explicitl - result = _.mergeWith(initialValue, {}, {}, {}, {}, mergingValue, customizer); + 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(); - - // Once we get to the varargs version, you have to specify the result explicitly - result = _(initialValue).mergeWith({}, {}, {}, {}, mergingValue, customizer).value(); + result = _(initialValue).mergeWith({}, {}, {}, {}, mergingValue, customizer).value(); } // _.omit namespace TestOmit { - let obj: {} | null | undefined = any; + let obj: TResult | null | undefined = any; let predicate: (element: any, key: string, collection: any) => boolean; { - let result: TResult; + let result: Partial; - result = _.omit(obj, 'a'); - result = _.omit(obj, 0, 'a'); - result = _.omit(obj, true, 0, 'a'); - result = _.omit(obj, ['b', 1, false], true, 0, 'a'); + result = _.omit(obj, 'a'); + result = _.omit(obj, 0, 'a'); + result = _.omit(obj, true, 0, 'a'); + result = _.omit(obj, ['b', 1, false], true, 0, 'a'); } { - let result: _.LoDashImplicitObjectWrapper; + let result: _.LoDashImplicitWrapper>; result = _(obj).omit('a'); result = _(obj).omit(0, 'a'); @@ -11033,7 +11160,7 @@ namespace TestOmit { } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper>; result = _(obj).chain().omit('a'); result = _(obj).chain().omit(0, 'a'); @@ -11044,23 +11171,23 @@ namespace TestOmit { // _.omitBy namespace TestOmitBy { - let obj: {} | null | undefined = any; - let predicate = (element: any, key: string, collection: any) => true; + let obj: TResult | null | undefined = any; + let predicate = (element: any, key: string) => true; { - let result: TResult; + let result: Partial; - result = _.omitBy(obj, predicate); + result = _.omitBy(obj, predicate); } { - let result: _.LoDashImplicitObjectWrapper; + let result: _.LoDashImplicitWrapper>; result = _(obj).omitBy(predicate); } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper>; result = _(obj).chain().omitBy(predicate); } @@ -11068,19 +11195,19 @@ namespace TestOmitBy { // _.pick namespace TestPick { - let obj: {} | null | undefined = any; + let obj: TResult | null | undefined = any; { - let result: TResult; + let result: Partial; - result = _.pick(obj, 'a'); - result = _.pick(obj, 0, 'a'); - result = _.pick(obj, true, 0, 'a'); - result = _.pick(obj, ['b', 1, false], true, 0, 'a'); + result = _.pick(obj, 'a'); + result = _.pick(obj, 0, 'a'); + result = _.pick(obj, true, 0, 'a'); + result = _.pick(obj, ['b', 1, false], true, 0, 'a'); } { - let result: _.LoDashImplicitObjectWrapper; + let result: _.LoDashImplicitWrapper>; result = _(obj).pick('a'); result = _(obj).pick(0, 'a'); @@ -11089,7 +11216,7 @@ namespace TestPick { } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper>; result = _(obj).chain().pick('a'); result = _(obj).chain().pick(0, 'a'); @@ -11100,23 +11227,23 @@ namespace TestPick { // _.pickBy namespace TestPickBy { - let obj: {} | null | undefined = any; - let predicate = (element: any, key: string, collection: any) => true; + let obj: TResult | null | undefined = any; + let predicate = (element: any, key: string) => true; { - let result: TResult; + let result: Partial; - result = _.pickBy(obj, predicate); + result = _.pickBy(obj, predicate); } { - let result: _.LoDashImplicitObjectWrapper; + let result: _.LoDashImplicitWrapper>; result = _(obj).pickBy(predicate); } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashExplicitWrapper>; result = _(obj).chain().pickBy(predicate); } @@ -11127,13 +11254,6 @@ namespace TestResult { { let result: string; - 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 = _.result('abc', '0'); result = _.result('abc', '0', '_'); result = _.result('abc', '0', () => '_'); @@ -11152,13 +11272,6 @@ namespace TestResult { { 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 = _.result([42], '0'); result = _.result([42], '0', -1); result = _.result([42], '0', () => -1); @@ -11177,13 +11290,6 @@ namespace TestResult { { let result: boolean; - result = _.result<{a: boolean}, boolean>({a: true}, 'a'); - result = _.result<{a: boolean}, boolean>({a: true}, 'a', false); - result = _.result<{a: boolean}, boolean>({a: true}, 'a', () => false); - result = _.result<{a: boolean}, boolean>({a: true}, ['a']); - result = _.result<{a: boolean}, boolean>({a: true}, ['a'], false); - result = _.result<{a: boolean}, boolean>({a: true}, ['a'], () => false); - result = _.result({a: true}, 'a'); result = _.result({a: true}, 'a', false); result = _.result({a: true}, 'a', () => false); @@ -11202,34 +11308,34 @@ namespace TestResult { { let result: _.LoDashExplicitWrapper; - result = _('abc').chain().result<_.LoDashExplicitWrapper>('0'); - result = _('abc').chain().result<_.LoDashExplicitWrapper>('0', '_'); - result = _('abc').chain().result<_.LoDashExplicitWrapper>('0', '_'); - result = _('abc').chain().result<_.LoDashExplicitWrapper>(['0']); - result = _('abc').chain().result<_.LoDashExplicitWrapper>(['0'], () => '_'); - result = _('abc').chain().result<_.LoDashExplicitWrapper>(['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'], () => '_'); + result = _('abc').chain().result(['0'], () => '_'); } { let result: _.LoDashExplicitWrapper; - result = _([42]).chain().result<_.LoDashExplicitWrapper>('0'); - result = _([42]).chain().result<_.LoDashExplicitWrapper>('0', -1); - result = _([42]).chain().result<_.LoDashExplicitWrapper>('0', () => -1); - result = _([42]).chain().result<_.LoDashExplicitWrapper>(['0']); - result = _([42]).chain().result<_.LoDashExplicitWrapper>(['0'], -1); - result = _([42]).chain().result<_.LoDashExplicitWrapper>(['0'], () => -1); + 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<_.LoDashExplicitWrapper>('a'); - result = _({a: true}).chain().result<_.LoDashExplicitWrapper>('a', false); - result = _({a: true}).chain().result<_.LoDashExplicitWrapper>('a', () => false); - result = _({a: true}).chain().result<_.LoDashExplicitWrapper>(['a']); - result = _({a: true}).chain().result<_.LoDashExplicitWrapper>(['a'], false); - result = _({a: true}).chain().result<_.LoDashExplicitWrapper>(['a'], () => false); + 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); } } @@ -11246,12 +11352,6 @@ namespace TestSet { result = _.set(object, 'a.b[1]', value); result = _.set(object, ['a', 'b', 1], value); - - result = _.set(object, 'a.b[1]', value); - result = _.set(object, ['a', 'b', 1], value); - - result = _.set(object, 'a.b[1]', value); - result = _.set(object, ['a', 'b', 1], value); } { @@ -11259,9 +11359,6 @@ namespace TestSet { result = _(object).set('a.b[1]', value); result = _(object).set(['a', 'b', 1], value); - - result = _(object).set('a.b[1]', value); - result = _(object).set(['a', 'b', 1], value); } { @@ -11269,20 +11366,16 @@ namespace TestSet { result = _(object).chain().set('a.b[1]', value); result = _(object).chain().set(['a', 'b', 1], value); - - result = _(object).chain().set('a.b[1]', value); - result = _(object).chain().set(['a', 'b', 1], value); } } // _.setWith namespace TestSetWith { - type SampleObject = {a: {}}; type SampleResult = {a: {b: number[]}}; - let object: SampleObject = { a: {} }; + let object: SampleResult = { a: { b: [] } }; let value = 0; - let customizer = (value: any, key: string, object: SampleObject) => 0; + let customizer = (value: any, key: string, object: SampleResult) => 0; { let result: SampleResult; @@ -11291,16 +11384,6 @@ namespace TestSetWith { result = _.setWith(object, 'a.b[1]', value, customizer); 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); - 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); - result = _.setWith(object, ['a', 'b', 1], value); - result = _.setWith(object, ['a', 'b', 1], value, customizer); } { @@ -11310,11 +11393,6 @@ namespace TestSetWith { result = _(object).setWith('a.b[1]', value, customizer); 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); - result = _(object).setWith(['a', 'b', 1], value); - result = _(object).setWith(['a', 'b', 1], value, customizer); } { @@ -11324,11 +11402,6 @@ namespace TestSetWith { 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); - - 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); } } @@ -11336,39 +11409,21 @@ namespace TestSetWith { namespace TestToPairs { let object: _.Dictionary = {}; - { - let result: [string, any][]; - - result = _.toPairs<_.Dictionary>(object); - } - { let result: [string, string][]; - result = _.toPairs<_.Dictionary, string>(object); + result = _.toPairs(object); } { let result: _.LoDashImplicitArrayWrapper<[string, string]>; - result = _(object).toPairs(); - } - - { - let result: _.LoDashImplicitArrayWrapper<[string, any]>; - result = _(object).toPairs(); } { let result: _.LoDashExplicitArrayWrapper<[string, string]>; - result = _(object).chain().toPairs(); - } - - { - let result: _.LoDashExplicitArrayWrapper<[string, any]>; - result = _(object).chain().toPairs(); } } @@ -11377,27 +11432,15 @@ namespace TestToPairs { namespace TestToPairsIn { let object: _.Dictionary = {}; - { - let result: [string, any][]; - - result = _.toPairsIn<_.Dictionary>(object); - } - { let result: [string, string][]; - result = _.toPairsIn<_.Dictionary, string>(object); + result = _.toPairsIn(object); } { let result: _.LoDashImplicitArrayWrapper<[string, string]>; - result = _(object).toPairsIn(); - } - - { - let result: _.LoDashImplicitArrayWrapper<[string, any]>; - result = _(object).toPairsIn(); } @@ -11424,13 +11467,13 @@ namespace TestTransform { let accumulator: TResult[] = []; let result: TResult[]; - result = _.transform(array); + 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(); + result = _(array).transform().value(); + result = _(array).transform(iterator).value(); + result = _(array).transform(iterator, accumulator).value(); } { @@ -11438,11 +11481,9 @@ namespace TestTransform { let accumulator: _.Dictionary = {}; let result: _.Dictionary; - result = _.transform(array, iterator); result = _.transform(array, iterator, accumulator); - result = _(array).transform(iterator).value(); - result = _(array).transform(iterator, accumulator).value(); + result = _(array).transform(iterator, accumulator).value(); } { @@ -11450,11 +11491,11 @@ namespace TestTransform { let accumulator: _.Dictionary = {}; let result: _.Dictionary; - result = _.transform(dictionary); + result = _.transform(dictionary); result = _.transform(dictionary, iterator); result = _.transform(dictionary, iterator, accumulator); - result = _(dictionary).transform().value(); + result = _(dictionary).transform().value(); result = _(dictionary).transform(iterator).value(); result = _(dictionary).transform(iterator, accumulator).value(); } @@ -11464,10 +11505,8 @@ namespace TestTransform { let accumulator: TResult[] = []; let result: TResult[]; - result = _.transform(dictionary, iterator); result = _.transform(dictionary, iterator, accumulator); - result = _(dictionary).transform(iterator).value(); result = _(dictionary).transform(iterator, accumulator).value(); } } @@ -11481,8 +11520,8 @@ namespace TestUnset { { let result: boolean; - _.unset(object, 'a.b'); - _.unset(object, ['a', 'b']); + result = _.unset(object, 'a.b'); + result = _.unset(object, ['a', 'b']); } { @@ -11502,57 +11541,40 @@ namespace TestUnset { // _.update namespace TestUpdate { - type SampleObject = {a: {}}; type SampleResult = {a: {b: number[]}}; - let object: SampleObject = { a: {} }; + 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); - - result = _.update<(value: any) => number, SampleResult>(object, 'a.b[1]', updater); - result = _.update<(value: any) => number, SampleResult>(object, ['a', 'b', 1], updater); - - result = _.update(object, 'a.b[1]', updater); - result = _.update(object, ['a', 'b', 1], updater); - - result = _.update number, SampleResult>(object, 'a.b[1]', updater); - result = _.update number, SampleResult>(object, ['a', 'b', 1], updater); + 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); - - result = _(object).update<(value: any) => number, SampleResult>('a.b[1]', updater); - result = _(object).update<(value: any) => number, SampleResult>(['a', 'b', 1], updater); + 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); - - result = _(object).chain().update<(value: any) => number, SampleResult>('a.b[1]', updater); - result = _(object).chain().update<(value: any) => number, SampleResult>(['a', 'b', 1], updater); + result = _(object).chain().update('a.b[1]', updater); + result = _(object).chain().update(['a', 'b', 1], updater); } } // _.updateWith namespace TestUpdateWith { - type SampleObject = {a: {}}; type SampleResult = {a: {b: number[]}}; - let object: SampleObject = { a: {} }; + let object: SampleResult = { a: { b: [] } }; let updater = (value: any) => 0; - let customizer = (value: any, key: string, object: SampleObject) => 0; + let customizer = (value: any, key: string, object: SampleResult) => 0; { let result: SampleResult; @@ -11594,7 +11616,6 @@ namespace TestValues { { let result: any[]; - result = _.values(); result = _.values(123); result = _.values(true); result = _.values(null); @@ -12026,11 +12047,9 @@ namespace TestReplace { result = _.replace('Hi Fred', /fred/i, 'Barney'); result = _.replace('Hi Fred', /fred/i, replacer); - result = _.replace('Fred'); result = _.replace('Fred', 'Barney'); result = _.replace('Fred', replacer); - result = _.replace(/fred/i); result = _.replace(/fred/i, 'Barney'); result = _.replace(/fred/i, replacer); @@ -12040,11 +12059,9 @@ namespace TestReplace { result = _('Hi Fred').replace(/fred/i, 'Barney'); result = _('Hi Fred').replace(/fred/i, replacer); - result = _('Fred').replace(); result = _('Fred').replace('Barney'); result = _('Fred').replace(replacer); - result = _(/fred/i).replace(); result = _(/fred/i).replace('Barney'); result = _(/fred/i).replace(replacer); } @@ -12058,11 +12075,9 @@ namespace TestReplace { result = _('Hi Fred').chain().replace(/fred/i, 'Barney'); result = _('Hi Fred').chain().replace(/fred/i, replacer); - result = _('Fred').chain().replace(); result = _('Fred').chain().replace('Barney'); result = _('Fred').chain().replace(replacer); - result = _(/fred/i).chain().replace(); result = _(/fred/i).chain().replace('Barney'); result = _(/fred/i).chain().replace(replacer); } @@ -12438,52 +12453,52 @@ namespace TestConstant { { let result: _.LoDashImplicitObjectWrapper<() => number>; - result = _(42).constant(); + result = _(42).constant(); } { let result: _.LoDashImplicitObjectWrapper<() => string>; - result = _('a').constant(); + result = _('a').constant(); } { let result: _.LoDashImplicitObjectWrapper<() => boolean>; - result = _(true).constant(); + result = _(true).constant(); } { let result: _.LoDashImplicitObjectWrapper<() => string[]>; - result = _(['a']).constant(); + result = _(['a']).constant(); } { let result: _.LoDashImplicitObjectWrapper<() => {a: string}>; - result = _({a: 'a'}).constant<{a: string}>(); + result = _({a: 'a'}).constant(); } { let result: _.LoDashExplicitObjectWrapper<() => number>; - result = _(42).chain().constant(); + result = _(42).chain().constant(); } { let result: _.LoDashExplicitObjectWrapper<() => string>; - result = _('a').chain().constant(); + result = _('a').chain().constant(); } { let result: _.LoDashExplicitObjectWrapper<() => boolean>; - result = _(true).chain().constant(); + result = _(true).chain().constant(); } { let result: _.LoDashExplicitObjectWrapper<() => string[]>; - result = _(['a']).chain().constant(); + result = _(['a']).chain().constant(); } { let result: _.LoDashExplicitObjectWrapper<() => {a: string}>; - result = _({a: 'a'}).chain().constant<{a: string}>(); + result = _({a: 'a'}).chain().constant(); } } @@ -12526,7 +12541,7 @@ namespace TestDefaultTo { } { - let result: _.LoDashImplicitObjectWrapper; + let result: number; result = _(42).defaultTo(42); result = _(undefined).defaultTo(42); result = _(null).defaultTo(42); @@ -12534,34 +12549,30 @@ namespace TestDefaultTo { } { - let result: _.LoDashImplicitObjectWrapper; + let result: string; result = _('a').defaultTo('default'); result = _(null).defaultTo('default'); - result = _(NaN).defaultTo('default'); } { - let result: _.LoDashImplicitObjectWrapper; + let result: boolean; result = _(true).defaultTo(true); result = _(undefined).defaultTo(true); result = _(null).defaultTo(true); - result = _(NaN).defaultTo(true); } { - let result: _.LoDashImplicitObjectWrapper; + let result: string[]; result = _(['a']).defaultTo(['default']); result = _(undefined).defaultTo(['default']); result = _(null).defaultTo(['default']); - result = _(NaN).defaultTo(['default']); } { - let result: _.LoDashImplicitObjectWrapper<{ a: string }>; + let result: { a: string }; result = _({ a: 'a' }).defaultTo({a : 'a'}); result = _(undefined).defaultTo({a : 'a'}); result = _(null).defaultTo({a : 'a'}); - result = _(NaN).defaultTo({a : 'a'}); } { @@ -12577,7 +12588,6 @@ namespace TestDefaultTo { result = _('a').chain().defaultTo('default'); result = _(undefined).chain().defaultTo('default'); result = _(null).chain().defaultTo('default'); - result = _(NaN).chain().defaultTo('default'); } { @@ -12585,7 +12595,6 @@ namespace TestDefaultTo { result = _(true).chain().defaultTo(true); result = _(undefined).chain().defaultTo(true); result = _(null).chain().defaultTo(true); - result = _(NaN).chain().defaultTo(true); } { @@ -12593,7 +12602,6 @@ namespace TestDefaultTo { result = _(['a']).chain().defaultTo(['default']); result = _(undefined).chain().defaultTo(['default']); result = _(null).chain().defaultTo(['default']); - result = _(NaN).chain().defaultTo(['default']); } { @@ -12601,7 +12609,6 @@ namespace TestDefaultTo { result = _({ a: 'a' }).chain().defaultTo({a : 'a'}); result = _(undefined).chain().defaultTo({a : 'a'}); result = _(null).chain().defaultTo({a : 'a'}); - result = _(NaN).chain().defaultTo({a : 'a'}); } } @@ -12664,7 +12671,7 @@ namespace TestIteratee { { let result: (object: any) => TResult; - result = _.iteratee(''); + result = _.iteratee(''); } { @@ -12676,13 +12683,14 @@ namespace TestIteratee { { let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; - result = _(Function).iteratee(); + let func: (...args: any[]) => TResult = any; + result = _(func).iteratee(); } { let result: _.LoDashImplicitObjectWrapper<(object: any) => TResult>; - result = _('').iteratee(); + result = _('').iteratee(); } { @@ -12694,13 +12702,14 @@ namespace TestIteratee { { let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; - result = _(Function).chain().iteratee(); + let func: (...args: any[]) => TResult = any; + result = _(func).chain().iteratee(); } { let result: _.LoDashExplicitObjectWrapper<(object: any) => TResult>; - result = _('').chain().iteratee(); + result = _('').chain().iteratee(); } { @@ -12782,83 +12791,83 @@ namespace TestMethod { { let result: (object: any) => {a: string}; - result = _.method<{a: string}>('a.0'); - result = _.method<{a: string}>('a.0', any, any); - result = _.method<{a: string}>('a.0', any, any, any); + result = _.method('a.0'); + result = _.method('a.0', any, any); + result = _.method('a.0', any, any, any); - result = _.method<{a: string}>(['a', 0]); - result = _.method<{a: string}>(['a', 0], any); - result = _.method<{a: string}>(['a', 0], any, any); - result = _.method<{a: string}>(['a', 0], any, any, any); + result = _.method(['a', 0]); + result = _.method(['a', 0], any); + result = _.method(['a', 0], any, any); + result = _.method(['a', 0], any, any, any); } { let result: (object: {a: string}) => {b: string}; - result = _.method<{a: string}, {b: string}>('a.0'); - result = _.method<{a: string}, {b: string}>('a.0', any, any); - result = _.method<{a: string}, {b: string}>('a.0', any, any, any); + result = _.method('a.0'); + result = _.method('a.0', any, any); + result = _.method('a.0', any, any, any); - result = _.method<{a: string}, {b: string}>(['a', 0]); - result = _.method<{a: string}, {b: string}>(['a', 0], any); - result = _.method<{a: string}, {b: string}>(['a', 0], any, any); - result = _.method<{a: string}, {b: string}>(['a', 0], any, any, any); + result = _.method(['a', 0]); + result = _.method(['a', 0], any); + result = _.method(['a', 0], any, any); + result = _.method(['a', 0], any, any, any); } { let result: _.LoDashImplicitObjectWrapper<(object: any) => {a: string}>; - result = _('a.0').method<{a: string}>(); - result = _('a.0').method<{a: string}>(any); - result = _('a.0').method<{a: string}>(any, any); - result = _('a.0').method<{a: string}>(any, any, any); + result = _('a.0').method(); + result = _('a.0').method(any); + result = _('a.0').method(any, any); + result = _('a.0').method(any, any, any); - result = _(['a', 0]).method<{a: string}>(); - result = _(['a', 0]).method<{a: string}>(any); - result = _(['a', 0]).method<{a: string}>(any, any); - result = _(['a', 0]).method<{a: string}>(any, any, any); + result = _(['a', 0]).method(); + result = _(['a', 0]).method(any); + result = _(['a', 0]).method(any, any); + result = _(['a', 0]).method(any, any, any); } { let result: _.LoDashImplicitObjectWrapper<(object: {a: string}) => {b: string}>; - result = _('a.0').method<{a: string}, {b: string}>(); - result = _('a.0').method<{a: string}, {b: string}>(any); - result = _('a.0').method<{a: string}, {b: string}>(any, any); - result = _('a.0').method<{a: string}, {b: string}>(any, any, any); + result = _('a.0').method(); + result = _('a.0').method(any); + result = _('a.0').method(any, any); + result = _('a.0').method(any, any, any); - result = _(['a', 0]).method<{a: string}, {b: string}>(); - result = _(['a', 0]).method<{a: string}, {b: string}>(any); - result = _(['a', 0]).method<{a: string}, {b: string}>(any, any); - result = _(['a', 0]).method<{a: string}, {b: string}>(any, any, any); + result = _(['a', 0]).method(); + result = _(['a', 0]).method(any); + result = _(['a', 0]).method(any, any); + result = _(['a', 0]).method(any, any, any); } { let result: _.LoDashExplicitObjectWrapper<(object: any) => {a: string}>; - result = _('a.0').chain().method<{a: string}>(); - result = _('a.0').chain().method<{a: string}>(any); - result = _('a.0').chain().method<{a: string}>(any, any); - result = _('a.0').chain().method<{a: string}>(any, any, any); + result = _('a.0').chain().method(); + result = _('a.0').chain().method(any); + result = _('a.0').chain().method(any, any); + result = _('a.0').chain().method(any, any, any); - result = _(['a', 0]).chain().method<{a: string}>(); - result = _(['a', 0]).chain().method<{a: string}>(any); - result = _(['a', 0]).chain().method<{a: string}>(any, any); - result = _(['a', 0]).chain().method<{a: string}>(any, any, any); + result = _(['a', 0]).chain().method(); + result = _(['a', 0]).chain().method(any); + result = _(['a', 0]).chain().method(any, any); + result = _(['a', 0]).chain().method(any, any, any); } { let result: _.LoDashExplicitObjectWrapper<(object: {a: string}) => {b: string}>; - result = _('a.0').chain().method<{a: string}, {b: string}>(); - result = _('a.0').chain().method<{a: string}, {b: string}>(any); - result = _('a.0').chain().method<{a: string}, {b: string}>(any, any); - result = _('a.0').chain().method<{a: string}, {b: string}>(any, any, any); + result = _('a.0').chain().method(); + result = _('a.0').chain().method(any); + result = _('a.0').chain().method(any, any); + result = _('a.0').chain().method(any, any, any); - result = _(['a', 0]).chain().method<{a: string}, {b: string}>(); - result = _(['a', 0]).chain().method<{a: string}, {b: string}>(any); - result = _(['a', 0]).chain().method<{a: string}, {b: string}>(any, any); - result = _(['a', 0]).chain().method<{a: string}, {b: string}>(any, any, any); + result = _(['a', 0]).chain().method(); + result = _(['a', 0]).chain().method(any); + result = _(['a', 0]).chain().method(any, any); + result = _(['a', 0]).chain().method(any, any, any); } } @@ -12872,66 +12881,77 @@ namespace TestMethodOf { { let result: ResultFn; - result = _.methodOf(object); - result = _.methodOf(object, any); - result = _.methodOf(object, any, any); - result = _.methodOf(object, any, any, any); - - result = _.methodOf(object); - result = _.methodOf(object, any); - result = _.methodOf(object, any, any); - result = _.methodOf(object, any, any, any); + result = _.methodOf(object); + result = _.methodOf(object, any); + result = _.methodOf(object, any, any); + result = _.methodOf(object, any, any, any); } { let result: _.LoDashImplicitObjectWrapper; - result = _(object).methodOf(); - result = _(object).methodOf(any); - result = _(object).methodOf(any, any); - result = _(object).methodOf(any, any, any); + result = _(object).methodOf(); + result = _(object).methodOf(any); + result = _(object).methodOf(any, any); + result = _(object).methodOf(any, any, any); } { let result: _.LoDashExplicitObjectWrapper; - result = _(object).chain().methodOf(); - result = _(object).chain().methodOf(any); - result = _(object).chain().methodOf(any, any); - result = _(object).chain().methodOf(any, any, any); + result = _(object).chain().methodOf(); + result = _(object).chain().methodOf(any); + result = _(object).chain().methodOf(any, any); + result = _(object).chain().methodOf(any, any, any); } } // _.mixin namespace TestMixin { - let source: _.Dictionary = {}; + let source: _.Dictionary<(...args: any[]) => any> = {}; + let dest: TResult = any; let options: {chain?: boolean} = {}; + { + let result: _.LoDashStatic; + + result = _.mixin(source); + result = _.mixin(source, options); + } + { let result: TResult; - result = _.mixin({}, source); - result = _.mixin({}, source, options); - result = _.mixin(source); - result = _.mixin(source, options); + result = _.mixin(dest, source); + result = _.mixin(dest, source, options); } { - let result: _.LoDashImplicitObjectWrapper; + let result: _.LoDashImplicitWrapper<_.LoDashStatic>; - result = _({}).mixin(source); - result = _({}).mixin(source, options); - result = _(source).mixin(); - result = _(source).mixin(options); + result = _(source).mixin(); + result = _(source).mixin(options); } { - let result: _.LoDashExplicitObjectWrapper; + let result: _.LoDashImplicitWrapper; - result = _({}).chain().mixin(source); - result = _({}).chain().mixin(source, options); - result = _(source).chain().mixin(); - result = _(source).chain().mixin(options); + 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); } } @@ -12967,7 +12987,7 @@ namespace TestNoop { result = _('a').noop(true, 'a', 1); result = _([1]).noop(true, 'a', 1); - result = _([]).noop(true, 'a', 1); + result = _(['']).noop(true, 'a', 1); result = _({}).noop(true, 'a', 1); result = _(any).noop(true, 'a', 1); } @@ -12977,7 +12997,7 @@ namespace TestNoop { 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 = _({}).chain().noop(true, 'a', 1); result = _(any).chain().noop(true, 'a', 1); } @@ -12989,20 +13009,20 @@ namespace TestNthArg { { let result: SampleFunc; - result = _.nthArg(); - result = _.nthArg(1); + result = _.nthArg(); + result = _.nthArg(1); } { let result: _.LoDashImplicitObjectWrapper; - result = _(1).nthArg(); + result = _(1).nthArg(); } { let result: _.LoDashExplicitObjectWrapper; - result = _(1).chain().nthArg(); + result = _(1).chain().nthArg(); } } @@ -13232,7 +13252,7 @@ namespace TestRangeRight { result = _('a').chain().stubArray(); result = _([1]).chain().stubArray(); - result = _([]).chain().stubArray(); + result = _(['']).chain().stubArray(); result = _({}).chain().stubArray(); result = _(any).chain().stubArray(); } @@ -13252,7 +13272,7 @@ namespace TestRangeRight { result = _('a').chain().stubFalse(); result = _([1]).chain().stubFalse(); - result = _([]).chain().stubFalse(); + result = _(['']).chain().stubFalse(); result = _({}).chain().stubFalse(); result = _(any).chain().stubFalse(); } @@ -13272,7 +13292,7 @@ namespace TestRangeRight { result = _('a').chain().stubObject(); result = _([1]).chain().stubObject(); - result = _([]).chain().stubObject(); + result = _(['']).chain().stubObject(); result = _({}).chain().stubObject(); result = _(any).chain().stubObject(); } @@ -13292,7 +13312,7 @@ namespace TestRangeRight { result = _('a').chain().stubString(); result = _([1]).chain().stubString(); - result = _([]).chain().stubString(); + result = _(['']).chain().stubString(); result = _({}).chain().stubString(); result = _(any).chain().stubString(); } @@ -13312,7 +13332,7 @@ namespace TestRangeRight { result = _('a').chain().stubTrue(); result = _([1]).chain().stubTrue(); - result = _([]).chain().stubTrue(); + result = _(['']).chain().stubTrue(); result = _({}).chain().stubTrue(); result = _(any).chain().stubTrue(); } @@ -13367,7 +13387,7 @@ namespace TestToPath { result = _(1).toPath(); result = _('a').toPath(); result = _([1]).toPath(); - result = _(["a"]).toPath(); + result = _(["a"]).toPath(); result = _({}).toPath(); } } diff --git a/types/lodash/tslint.json b/types/lodash/tslint.json index 02254dbc60..44e681fc18 100644 --- a/types/lodash/tslint.json +++ b/types/lodash/tslint.json @@ -2,35 +2,28 @@ "extends": "dtslint/dt.json", "rules": { // All are TODOs - "adjacent-overload-signatures": false, - "align": false, "array-type": false, "ban-types": false, "callable-types": false, - "comment-format": false, - "eofline": false, + "comment-format": [false], "interface-name": false, "interface-over-type-literal": false, "jsdoc-format": false, - "max-line-length": false, + "max-line-length": [false], "no-any-union": false, "no-empty-interface": false, - "no-namespace": false, "no-mergeable-namespace": false, + "no-namespace": false, "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, "no-unnecessary-type-assertion": false, "no-void-expression": false, - "no-trailing-whitespace": false, "object-literal-key-quotes": false, "one-line": false, - "one-variable-per-declaration": false, "prefer-const": false, "semicolon": false, "space-within-parens": false, - "triple-equals": false, - "typedef-whitespace": false, + "typedef-whitespace": [false], "unified-signatures": false, - "whitespace": false + "whitespace": [false] } } From 1d3179901c97f1f5a18c717d986ade3881dd7b13 Mon Sep 17 00:00:00 2001 From: Rob Sterner Date: Thu, 19 Oct 2017 11:27:29 -0400 Subject: [PATCH 048/314] per the docs/comments the order can be null (#20721) --- types/c3/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index 00d1cf1840..eb727233a0 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -366,7 +366,7 @@ declare namespace c3 { * and it will recieve the data as argument. * Available Values: desc, asc, function (data1, data2) { ... }, null */ - order?: string | ((...data: string[]) => void); + order?: string | ((...data: string[]) => void) | null; /** * Define regions for each data. * The values must be an array for each data and it should include an object that has start, end, style. If start is not set, the start will be the first data point. If end is not set, the From f9aa971b2735046772a12d8b7ad4f6d04932bba6 Mon Sep 17 00:00:00 2001 From: Viktor Isaev Date: Thu, 19 Oct 2017 18:31:05 +0300 Subject: [PATCH 049/314] Added typings for "heapdump". (#20716) * Added typings for "require-dir". * Fixed dtslint errors. * Fixed By field. * Added typings for "restify-cookies". * Added "cookies" field to Request interface. * Added typings for "heapdump". --- types/heapdump/heapdump-tests.ts | 9 +++++++++ types/heapdump/index.d.ts | 6 ++++++ types/heapdump/tsconfig.json | 25 +++++++++++++++++++++++++ types/heapdump/tslint.json | 1 + 4 files changed, 41 insertions(+) create mode 100644 types/heapdump/heapdump-tests.ts create mode 100644 types/heapdump/index.d.ts create mode 100644 types/heapdump/tsconfig.json create mode 100644 types/heapdump/tslint.json diff --git a/types/heapdump/heapdump-tests.ts b/types/heapdump/heapdump-tests.ts new file mode 100644 index 0000000000..49019f83fc --- /dev/null +++ b/types/heapdump/heapdump-tests.ts @@ -0,0 +1,9 @@ +import * as heapdump from 'heapdump'; + +heapdump.writeSnapshot('/tmp/myDump', (err) => { + if (err) { + console.log('Failed to dump heap: ' + err); + } else { + console.log('Successfully dumped heap!'); + } +}); diff --git a/types/heapdump/index.d.ts b/types/heapdump/index.d.ts new file mode 100644 index 0000000000..d4e0477a32 --- /dev/null +++ b/types/heapdump/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for heapdump 0.3 +// Project: https://github.com/bnoordhuis/node-heapdump +// Definitions by: weekens +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function writeSnapshot(dumpFileName: string, callback: (err?: Error) => void): void; diff --git a/types/heapdump/tsconfig.json b/types/heapdump/tsconfig.json new file mode 100644 index 0000000000..a15a306b41 --- /dev/null +++ b/types/heapdump/tsconfig.json @@ -0,0 +1,25 @@ +{ + "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", + "heapdump-tests.ts" + ] +} diff --git a/types/heapdump/tslint.json b/types/heapdump/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/heapdump/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5b3c2c61117a6d713af90d8b1efe8492749c97e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emre=20Do=C4=9Fan?= Date: Thu, 19 Oct 2017 18:35:06 +0300 Subject: [PATCH 050/314] Optional parameters for constructor has been changed according to package's description (#20712) --- types/neo4j/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/neo4j/index.d.ts b/types/neo4j/index.d.ts index f0923557ca..dc9567f725 100644 --- a/types/neo4j/index.d.ts +++ b/types/neo4j/index.d.ts @@ -57,7 +57,7 @@ export interface GraphDatabaseOptions { * HTTP agent. * @type {any} */ - agent: any; + agent?: any; /** * Authentication information. @@ -69,13 +69,13 @@ export interface GraphDatabaseOptions { * HTTP headers. * @type {Object} */ - headers: {}; + headers?: {}; /** * Proxy address. * @type {string} */ - proxy: string; + proxy?: string; /** * URL connection. From 12eb86bd1bbc28f5d49965adb63bfc25fd8e4558 Mon Sep 17 00:00:00 2001 From: Ika Date: Thu, 19 Oct 2017 23:36:58 +0800 Subject: [PATCH 051/314] feat(prettier): update to v1.7.x (#20708) --- types/prettier/index.d.ts | 26 +++++++++++++++++++++----- types/prettier/prettier-tests.ts | 3 +++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/types/prettier/index.d.ts b/types/prettier/index.d.ts index 1ed2568a1e..6ea1fcbbf9 100644 --- a/types/prettier/index.d.ts +++ b/types/prettier/index.d.ts @@ -9,7 +9,16 @@ import { File } from 'babel-types'; export type AST = File; export type BuiltInParser = (text: string, options?: any) => AST; -export type BuiltInParserName = 'babylon' | 'flow' | 'typescript' | 'postcss' | 'json' | 'graphql'; +export type BuiltInParserName = + | 'babylon' + | 'flow' + | 'typescript' + | 'postcss' // deprecated + | 'css' + | 'less' + | 'scss' + | 'json' + | 'graphql'; export type CustomParser = (text: string, parsers: Record, options: Options) => AST; @@ -107,11 +116,18 @@ export interface ResolveConfigOptions { * If set to `false`, all caching will be bypassed. */ useCache?: boolean; + /** + * Pass directly the path of the config file if you don't wish to search for it. + */ + config?: string; } /** - * `resolveConfig` can be used to resolve configuration for a given source file. - * The function optionally accepts an input file path as an argument, which defaults to the current working directory. + * `resolveConfig` can be used to resolve configuration for a given source file, + * passing its path as the first argument. The config search will start at the + * file path and continue to search up the directory. + * (You can use `process.cwd()` to start searching from the current directory). + * * A promise is returned which will resolve to: * * - An options object, providing a [config file](https://github.com/prettier/prettier#configuration-file) was found. @@ -119,9 +135,9 @@ export interface ResolveConfigOptions { * * The promise will be rejected if there was an error parsing the configuration file. */ -export function resolveConfig(filePath?: string, options?: ResolveConfigOptions): Promise; +export function resolveConfig(filePath: string, options?: ResolveConfigOptions): Promise; export namespace resolveConfig { - function sync(filePath?: string, options?: ResolveConfigOptions): null | Options; + function sync(filePath: string, options?: ResolveConfigOptions): null | Options; } /** diff --git a/types/prettier/prettier-tests.ts b/types/prettier/prettier-tests.ts index 8d95196101..9d78453bae 100644 --- a/types/prettier/prettier-tests.ts +++ b/types/prettier/prettier-tests.ts @@ -24,6 +24,9 @@ prettier.resolveConfig('path/to/somewhere').then(options => { } }); +// $ExpectError +prettier.resolveConfig(); + const options = prettier.resolveConfig.sync('path/to/somewhere'); if (options !== null) { const formatted = prettier.format('hello world', options); From fb6179c085bcf89d530555bda1828c79a025627a Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 20 Oct 2017 00:39:42 +0900 Subject: [PATCH 052/314] [hexo-fs] cleanup unnecessary type annotation (#20702) --- types/hexo-fs/hexo-fs-tests.ts | 147 ++++++++++++++++----------------- types/hexo-fs/index.d.ts | 1 + 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/types/hexo-fs/hexo-fs-tests.ts b/types/hexo-fs/hexo-fs-tests.ts index 71e6d99e1b..d53a790ac1 100644 --- a/types/hexo-fs/hexo-fs-tests.ts +++ b/types/hexo-fs/hexo-fs-tests.ts @@ -1,11 +1,10 @@ import fs = require('hexo-fs'); -import path = require('path'); -import mocha = require('mocha'); +import { join, dirname } from 'path'; +import 'mocha'; import chai = require('chai'); import Promise = require('bluebird'); const should = chai.should(); -const { join } = path; function createDummyFolder(path: string) { return Promise.all([ @@ -31,18 +30,18 @@ const tmpDir = join(__dirname, 'fs_tmp'); before(() => fs.mkdirs(tmpDir)); -after((done) => { +after(done => { fs.rmdir(tmpDir); done(); }); it('exists()', () => { - return fs.exists(tmpDir).then((exist) => { + return fs.exists(tmpDir).then(exist => { exist.should.be.true; }); }); -it('exists() - callback', (callback) => { +it('exists() - callback', callback => { fs.exists(tmpDir, (exist) => { exist.should.be.true; callback(); @@ -54,19 +53,19 @@ it('mkdirs()', () => { return fs.mkdirs(target).then(() => { return fs.exists(target); - }).then((exist) => { + }).then(exist => { exist.should.be.true; return fs.rmdir(join(tmpDir, 'a')); }); }); -it('mkdirs() - callback', (callback) => { +it('mkdirs() - callback', callback => { const target = join(tmpDir, 'a', 'b', 'c'); - fs.mkdirs(target, (err) => { + fs.mkdirs(target, err => { should.not.exist(err); - fs.exists(target, (exist) => { + fs.exists(target, exist => { exist.should.be.true; fs.rmdir(join(tmpDir, 'a'), callback); }); @@ -78,7 +77,7 @@ it('mkdirsSync()', () => { fs.mkdirsSync(target); - return fs.exists(target).then((exist) => { + return fs.exists(target).then(exist => { exist.should.be.true; return fs.rmdir(join(tmpDir, 'a')); }); @@ -90,17 +89,17 @@ it('writeFile()', () => { return fs.writeFile(target, body).then(() => { return fs.readFile(target); - }).then((content) => { + }).then(content => { content.should.eql(body); return fs.rmdir(join(tmpDir, 'a')); }); }); -it('writeFile() - callback', (callback) => { +it('writeFile() - callback', callback => { const target = join(tmpDir, 'a', 'b', 'test.txt'); const body = 'foo'; - fs.writeFile(target, body, (err) => { + fs.writeFile(target, body, err => { should.not.exist(err); fs.readFile(target, (_, content) => { @@ -116,7 +115,7 @@ it('writeFileSync()', () => { fs.writeFileSync(target, body); - return fs.readFile(target).then((content) => { + return fs.readFile(target).then(content => { content.should.eql(body); return fs.rmdir(join(tmpDir, 'a')); }); @@ -131,19 +130,19 @@ it('appendFile()', () => { return fs.appendFile(target, body2); }).then(() => { return fs.readFile(target); - }).then((content) => { + }).then(content => { content.should.eql(body + body2); return fs.rmdir(join(tmpDir, 'a')); }); }); -it('appendFile() - callback', (callback) => { +it('appendFile() - callback', callback => { const target = join(tmpDir, 'a', 'b', 'test.txt'); const body = 'foo'; const body2 = 'bar'; fs.writeFile(target, body, () => { - fs.appendFile(target, body2, (err) => { + fs.appendFile(target, body2, err => { should.not.exist(err); fs.readFile(target, (_, content) => { @@ -162,7 +161,7 @@ it('appendFileSync()', () => { return fs.writeFile(target, body).then(() => { fs.appendFileSync(target, body2); return fs.readFile(target); - }).then((content) => { + }).then(content => { content.should.eql(body + body2); return fs.rmdir(join(tmpDir, 'a')); }); @@ -177,7 +176,7 @@ it('copyFile()', () => { return fs.copyFile(src, dest); }).then(() => { return fs.readFile(dest); - }).then((content) => { + }).then(content => { content.should.eql(body); return Promise.all([ @@ -187,15 +186,15 @@ it('copyFile()', () => { }); }); -it('copyFile() - callback', (callback) => { +it('copyFile() - callback', callback => { const src = join(tmpDir, 'test.txt'); const dest = join(tmpDir, 'a', 'b', 'test.txt'); const body = 'foo'; - fs.writeFile(src, body, (err) => { + fs.writeFile(src, body, err => { if (err) return callback(err); - fs.copyFile(src, dest, (err) => { + fs.copyFile(src, dest, err => { if (err) return callback(err); fs.readFile(dest, (err, content) => { @@ -217,7 +216,7 @@ it('copyDir()', () => { return createDummyFolder(src).then(() => { return fs.copyDir(src, dest); - }).then((files) => { + }).then(files => { files.should.have.members([ 'e.txt', 'f.js', @@ -231,7 +230,7 @@ it('copyDir()', () => { fs.readFile(join(dest, 'folder', 'h.txt')), fs.readFile(join(dest, 'folder', 'i.js')) ]); - }).then((result) => { + }).then(result => { result.should.eql(['e', 'f', 'h', 'i']); }).then(() => { return Promise.all([ @@ -241,7 +240,7 @@ it('copyDir()', () => { }); }); -it('copyDir() - callback', (callback) => { +it('copyDir() - callback', callback => { const src = join(tmpDir, 'a'); const dest = join(tmpDir, 'b'); @@ -260,7 +259,7 @@ it('copyDir() - callback', (callback) => { fs.readFile(join(dest, 'f.js')), fs.readFile(join(dest, 'folder', 'h.txt')), fs.readFile(join(dest, 'folder', 'i.js')) - ]).then((result) => { + ]).then(result => { result.should.eql(['e', 'f', 'h', 'i']); }).then(() => { return Promise.all([ @@ -278,7 +277,7 @@ it('copyDir() - ignoreHidden off', () => { return createDummyFolder(src).then(() => { return fs.copyDir(src, dest, { ignoreHidden: false }); - }).then((files) => { + }).then(files => { files.should.have.members([ join('.hidden', 'a.txt'), join('.hidden', 'b.js'), @@ -302,7 +301,7 @@ it('copyDir() - ignoreHidden off', () => { fs.readFile(join(dest, 'folder', 'i.js')), fs.readFile(join(dest, 'folder', '.j')) ]); - }).then((result) => { + }).then(result => { result.should.eql(['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j']); }).then(() => { return Promise.all([ @@ -318,14 +317,14 @@ it('copyDir() - ignorePattern', () => { return createDummyFolder(src).then(() => { return fs.copyDir(src, dest, { ignorePattern: /\.js/ }); - }).then((files) => { + }).then(files => { files.should.have.members(['e.txt', join('folder', 'h.txt')]); return Promise.all([ fs.readFile(join(dest, 'e.txt')), fs.readFile(join(dest, 'folder', 'h.txt')) ]); - }).then((result) => { + }).then(result => { result.should.eql(['e', 'h']); }).then(() => { return Promise.all([ @@ -340,7 +339,7 @@ it('listDir()', () => { return createDummyFolder(target).then(() => { return fs.listDir(target); - }).then((files) => { + }).then(files => { files.should.have.members([ 'e.txt', 'f.js', @@ -352,7 +351,7 @@ it('listDir()', () => { }); }); -it('listDir() - callback', (callback) => { +it('listDir() - callback', callback => { const target = join(tmpDir, 'test'); createDummyFolder(target).then(() => { @@ -376,7 +375,7 @@ it('listDir() - ignoreHidden off', () => { return createDummyFolder(target).then(() => { return fs.listDir(target, { ignoreHidden: false }); - }).then((files) => { + }).then(files => { files.should.have.members([ join('.hidden', 'a.txt'), join('.hidden', 'b.js'), @@ -398,7 +397,7 @@ it('listDir() - ignorePattern', () => { return createDummyFolder(target).then(() => { return fs.listDir(target, { ignorePattern: /\.js/ }); - }).then((files) => { + }).then(files => { files.should.have.members(['e.txt', join('folder', 'h.txt')]); return fs.rmdir(target); }); @@ -457,17 +456,17 @@ it('readFile()', () => { return fs.writeFile(target, body).then(() => { return fs.readFile(target); - }).then((content) => { + }).then(content => { content.should.eql(body); return fs.unlink(target); }); }); -it('readFile() - callback', (callback) => { +it('readFile() - callback', callback => { const target = join(tmpDir, 'test.txt'); const body = 'test'; - fs.writeFile(target, body, (err) => { + fs.writeFile(target, body, err => { if (err) return callback(err); fs.readFile(target, (err, content) => { @@ -486,7 +485,7 @@ it('readFile() - escape BOM', () => { return fs.writeFile(target, body).then(() => { return fs.readFile(target); - }).then((content) => { + }).then(content => { content.should.eql('foo'); return fs.unlink(target); }); @@ -498,7 +497,7 @@ it('readFile() - escape Windows line ending', () => { return fs.writeFile(target, body).then(() => { return fs.readFile(target); - }).then((content) => { + }).then(content => { content.should.eql('foo\nbar'); return fs.unlink(target); }); @@ -539,12 +538,12 @@ it('unlink()', () => { return fs.writeFile(target, '').then(() => { return fs.exists(target); - }).then((exist) => { + }).then(exist => { exist.should.eql(true); return fs.unlink(target); }).then(() => { return fs.exists(target); - }).then((exist) => { + }).then(exist => { exist.should.eql(false); }); }); @@ -554,7 +553,7 @@ it('emptyDir()', () => { return createDummyFolder(target).then(() => { return fs.emptyDir(target); - }).then>((files) => { + }).then(files => { files.should.have.members([ 'e.txt', 'f.js', @@ -574,7 +573,7 @@ it('emptyDir()', () => { [join(target, 'folder', '.j'), true] ]; }).map((data: [string, boolean]) => { - return fs.exists(data[0]).then((exist) => { + return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); }).then(() => { @@ -582,7 +581,7 @@ it('emptyDir()', () => { }); }); -it('emptyDir() - callback', (callback) => { +it('emptyDir() - callback', callback => { const target = join(tmpDir, 'test'); createDummyFolder(target).then(() => { @@ -596,7 +595,7 @@ it('emptyDir() - callback', (callback) => { join('folder', 'i.js') ]); - Promise.map<[string, boolean], void>([ + Promise.map([ [join(target, '.hidden', 'a.txt'), true], [join(target, '.hidden', 'b.js'), true], [join(target, '.hidden', 'c', 'd'), true], @@ -606,8 +605,8 @@ it('emptyDir() - callback', (callback) => { [join(target, 'folder', 'h.txt'), false], [join(target, 'folder', 'i.js'), false], [join(target, 'folder', '.j'), true] - ], (data: [string, boolean]) => { - return fs.exists(data[0]).then((exist) => { + ] as Array<[string, boolean]>, data => { + return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); }).then(() => { @@ -622,7 +621,7 @@ it('emptyDir() - ignoreHidden off', () => { return createDummyFolder(target).then(() => { return fs.emptyDir(target, { ignoreHidden: false }); - }).then>((files) => { + }).then(files => { files.should.have.members([ join('.hidden', 'a.txt'), join('.hidden', 'b.js'), @@ -647,7 +646,7 @@ it('emptyDir() - ignoreHidden off', () => { [join(target, 'folder', '.j'), false] ]; }).map((data: [string, boolean]) => { - return fs.exists(data[0]).then((exist) => { + return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); }).then(() => { @@ -660,7 +659,7 @@ it('emptyDir() - ignorePattern', () => { return createDummyFolder(target).then(() => { return fs.emptyDir(target, { ignorePattern: /\.js/ }); - }).then>((files) => { + }).then(files => { files.should.have.members(['e.txt', join('folder', 'h.txt')]); return [ @@ -675,7 +674,7 @@ it('emptyDir() - ignorePattern', () => { [join(target, 'folder', '.j'), true] ]; }).map((data: [string, boolean]) => { - return fs.exists(data[0]).then((exist) => { + return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); }).then(() => { @@ -688,7 +687,7 @@ it('emptyDir() - exclude', () => { return createDummyFolder(target).then(() => { return fs.emptyDir(target, { exclude: ['e.txt', join('folder', 'i.js')] }); - }).then>((files) => { + }).then(files => { files.should.have.members(['f.js', join('folder', 'h.txt')]); return [ @@ -703,7 +702,7 @@ it('emptyDir() - exclude', () => { [join(target, 'folder', '.j'), true] ]; }).map((data: [string, boolean]) => { - return fs.exists(data[0]).then((exist) => { + return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); }).then(() => { @@ -714,7 +713,7 @@ it('emptyDir() - exclude', () => { it('emptyDirSync()', () => { const target = join(tmpDir, 'test'); - return createDummyFolder(target).then>(() => { + return createDummyFolder(target).then(() => { const files = fs.emptyDirSync(target); files.should.have.members([ 'e.txt', @@ -735,7 +734,7 @@ it('emptyDirSync()', () => { [join(target, 'folder', '.j'), true] ]; }).map((data: [string, boolean]) => { - return fs.exists(data[0]).then((exist) => { + return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); }).then(() => { @@ -746,7 +745,7 @@ it('emptyDirSync()', () => { it('emptyDirSync() - ignoreHidden off', () => { const target = join(tmpDir, 'test'); - return createDummyFolder(target).then>(() => { + return createDummyFolder(target).then(() => { const files = fs.emptyDirSync(target, { ignoreHidden: false }); files.should.have.members([ join('.hidden', 'a.txt'), @@ -772,7 +771,7 @@ it('emptyDirSync() - ignoreHidden off', () => { [join(target, 'folder', '.j'), false] ]; }).map((data: [string, boolean]) => { - return fs.exists(data[0]).then((exist) => { + return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); }).then(() => { @@ -783,7 +782,7 @@ it('emptyDirSync() - ignoreHidden off', () => { it('emptyDirSync() - ignorePattern', () => { const target = join(tmpDir, 'test'); - return createDummyFolder(target).then>(() => { + return createDummyFolder(target).then(() => { const files = fs.emptyDirSync(target, { ignorePattern: /\.js/ }); files.should.have.members(['e.txt', join('folder', 'h.txt')]); @@ -799,7 +798,7 @@ it('emptyDirSync() - ignorePattern', () => { [join(target, 'folder', '.j'), true] ]; }).map((data: [string, boolean]) => { - return fs.exists(data[0]).then((exist) => { + return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); }).then(() => { @@ -810,7 +809,7 @@ it('emptyDirSync() - ignorePattern', () => { it('emptyDirSync() - exclude', () => { const target = join(tmpDir, 'test'); - return createDummyFolder(target).then>(() => { + return createDummyFolder(target).then(() => { const files = fs.emptyDirSync(target, { exclude: ['e.txt', join('folder', 'i.js')] }); files.should.have.members(['f.js', join('folder', 'h.txt')]); @@ -826,7 +825,7 @@ it('emptyDirSync() - exclude', () => { [join(target, 'folder', '.j'), true] ]; }).map((data: [string, boolean]) => { - return fs.exists(data[0]).then((exist) => { + return fs.exists(data[0]).then(exist => { exist.should.eql(data[1]); }); }).then(() => { @@ -841,19 +840,19 @@ it('rmdir()', () => { return fs.rmdir(target); }).then(() => { return fs.exists(target); - }).then((exist) => { + }).then(exist => { exist.should.be.false; }); }); -it('rmdir() - callback', (callback) => { +it('rmdir() - callback', callback => { const target = join(tmpDir, 'test'); createDummyFolder(target).then(() => { - fs.rmdir(target, (err) => { + fs.rmdir(target, err => { should.not.exist(err); - fs.exists(target, (exist) => { + fs.exists(target, exist => { exist.should.be.false; callback(); }); @@ -867,7 +866,7 @@ it('rmdirSync()', () => { return createDummyFolder(target).then(() => { fs.rmdirSync(target); return fs.exists(target); - }).then((exist) => { + }).then(exist => { exist.should.be.false; }); }); @@ -877,7 +876,7 @@ import { FSWatcher } from 'chokidar'; it('watch()', () => { let watcher: FSWatcher; - return fs.watch(tmpDir).then((watcher_) => { + return fs.watch(tmpDir).then(watcher_ => { watcher = watcher_; return new Promise((resolve, reject) => { @@ -905,7 +904,7 @@ it('ensurePath() - file exists', () => { fs.writeFile(join(target, 'bar.txt'), '') ]).then(() => { return fs.ensurePath(join(target, 'foo.txt')); - }).then((path) => { + }).then(path => { path.should.eql(join(target, 'foo-2.txt')); return fs.rmdir(target); }); @@ -914,12 +913,12 @@ it('ensurePath() - file exists', () => { it('ensurePath() - file not exist', () => { const target = join(tmpDir, 'foo.txt'); - return fs.ensurePath(target).then((path) => { + return fs.ensurePath(target).then(path => { path.should.eql(target); }); }); -it('ensurePath() - callback', (callback) => { +it('ensurePath() - callback', callback => { const target = join(tmpDir, 'test'); Promise.all([ @@ -962,7 +961,7 @@ it('ensurePathSync() - file not exist', () => { it('ensureWriteStream()', () => { const target = join(tmpDir, 'foo', 'bar.txt'); - return fs.ensureWriteStream(target).then((stream) => { + return fs.ensureWriteStream(target).then(stream => { stream.path.should.eql(target); stream.on('finish', () => { return fs.unlink(target); @@ -970,7 +969,7 @@ it('ensureWriteStream()', () => { }); }); -it('ensureWriteStream() - callback', (callback) => { +it('ensureWriteStream() - callback', callback => { const target = join(tmpDir, 'foo', 'bar.txt'); fs.ensureWriteStream(target, (err, stream) => { @@ -986,6 +985,6 @@ it('ensureWriteStreamSync()', () => { stream.path.should.eql(target); stream.on('finish', () => { - return fs.rmdir(path.dirname(target)); + return fs.rmdir(dirname(target)); }); }); diff --git a/types/hexo-fs/index.d.ts b/types/hexo-fs/index.d.ts index 237071d7c6..b1b9ef0405 100644 --- a/types/hexo-fs/index.d.ts +++ b/types/hexo-fs/index.d.ts @@ -2,6 +2,7 @@ // Project: http://hexo.io/ // Definitions by: segayuu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import Promise = require('bluebird'); import { From 498e2c46417703cf11f930cc235708b13a5904dd Mon Sep 17 00:00:00 2001 From: renjfk Date: Thu, 19 Oct 2017 18:40:40 +0300 Subject: [PATCH 053/314] add definitions for mark.js (#20700) --- types/mark.js/index.d.ts | 61 ++++++++++++++++++++++++++++++++++ types/mark.js/mark.js-tests.ts | 4 +++ types/mark.js/tsconfig.json | 24 +++++++++++++ types/mark.js/tslint.json | 1 + 4 files changed, 90 insertions(+) create mode 100644 types/mark.js/index.d.ts create mode 100644 types/mark.js/mark.js-tests.ts create mode 100644 types/mark.js/tsconfig.json create mode 100644 types/mark.js/tslint.json diff --git a/types/mark.js/index.d.ts b/types/mark.js/index.d.ts new file mode 100644 index 0000000000..2215c4e65c --- /dev/null +++ b/types/mark.js/index.d.ts @@ -0,0 +1,61 @@ +// Type definitions for mark.js 8.11 +// Project: https://markjs.io/ +// Definitions by: Soner Köksal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +type MarkAccuracy = "partially" | "complementary" | "exactly"; + +interface MarkOptions { + element?: string; + className?: string; + exclude?: string[]; + separateWordSearch?: boolean; + accuracy?: MarkAccuracy | { value: MarkAccuracy }; + diacritics?: boolean; + synonyms?: { [index: string]: string }; + iframes?: boolean; + iframesTimeout?: number; + acrossElements?: boolean; + caseSensitive?: boolean; + ignoreJoiners?: boolean; + wildcards?: "disabled" | "enabled" | "withSpaces"; + + each?(element: Element): void; + + filter?(textNode: Element, term: string, marksSoFar: number, marksTotal: number): boolean; + + noMatch?(term: string): void; + + done?(marksTotal: number): void; + + debug?: boolean; + log?: object; +} + +interface UnmarkOptions { + element?: string; + className?: string; + exclude?: string[]; + iframes?: boolean; + iframesTimeout?: number; + + done?(marksTotal: number): void; + + debug?: boolean; + log?: object; +} + +interface JQuery { + mark(term: string, options?: MarkOptions): void; + + unmark(options?: UnmarkOptions): void; +} + +interface JQueryStatic { + mark(term: string, options?: MarkOptions): void; + + unmark(options?: UnmarkOptions): void; +} diff --git a/types/mark.js/mark.js-tests.ts b/types/mark.js/mark.js-tests.ts new file mode 100644 index 0000000000..136098d39d --- /dev/null +++ b/types/mark.js/mark.js-tests.ts @@ -0,0 +1,4 @@ +$("div.context").mark("text", { + element: "span", + className: "highlight" +}); diff --git a/types/mark.js/tsconfig.json b/types/mark.js/tsconfig.json new file mode 100644 index 0000000000..381f150954 --- /dev/null +++ b/types/mark.js/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", + "mark.js-tests.ts" + ] +} diff --git a/types/mark.js/tslint.json b/types/mark.js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mark.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6688ade3ea728ae56e15288f14f2f3a43cbc6708 Mon Sep 17 00:00:00 2001 From: renjfk Date: Thu, 19 Oct 2017 18:42:05 +0300 Subject: [PATCH 054/314] added definitions for selectables 1.4 (#20699) * added definitions for selectables 1.4 * options are now optional * constructor is now optional --- types/selectables/index.d.ts | 35 ++++++++++++++++++++++++++ types/selectables/selectables-tests.ts | 15 +++++++++++ types/selectables/tsconfig.json | 24 ++++++++++++++++++ types/selectables/tslint.json | 1 + 4 files changed, 75 insertions(+) create mode 100644 types/selectables/index.d.ts create mode 100644 types/selectables/selectables-tests.ts create mode 100644 types/selectables/tsconfig.json create mode 100644 types/selectables/tslint.json diff --git a/types/selectables/index.d.ts b/types/selectables/index.d.ts new file mode 100644 index 0000000000..3834428240 --- /dev/null +++ b/types/selectables/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for selectables 1.4 +// Project: https://github.com/p34eu/Selectables#readme +// Definitions by: Soner Köksal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = Selectables; + +declare class Selectables { + options: Selectables.Options; + + constructor(options?: Selectables.Options); + + enable(): void; + + disable(): void; +} + +declare namespace Selectables { + interface Options { + zone?: string; + elements?: string; + selectedClass?: string; + key?: string | boolean; + moreUsing?: string; + enabled?: boolean; + + start?(e: Event): void; + + stop?(e: Event): void; + + onSelect?(el: Element): void; + + onDeselect?(el: Element): void; + } +} diff --git a/types/selectables/selectables-tests.ts b/types/selectables/selectables-tests.ts new file mode 100644 index 0000000000..595f2ca738 --- /dev/null +++ b/types/selectables/selectables-tests.ts @@ -0,0 +1,15 @@ +import * as Selectables from "selectables"; + +const dr = new Selectables({ + zone: '#div', + elements: 'li' +}); + +// later +dr.disable(); + +// enable again +dr.enable(); + +// set options +dr.options.key = 'altKey'; diff --git a/types/selectables/tsconfig.json b/types/selectables/tsconfig.json new file mode 100644 index 0000000000..e34d4a6078 --- /dev/null +++ b/types/selectables/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", + "selectables-tests.ts" + ] +} diff --git a/types/selectables/tslint.json b/types/selectables/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/selectables/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ba5c25b8c7aa5acd0a062c832f53857cf8958663 Mon Sep 17 00:00:00 2001 From: Junyoung Clare Jang Date: Thu, 19 Oct 2017 11:42:41 -0400 Subject: [PATCH 055/314] Fix ModifyOptions (#20698) --- types/openlayers/index.d.ts | 2 ++ types/openlayers/openlayers-tests.ts | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index 539db01b4d..441214cce6 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -12617,6 +12617,7 @@ declare module olx { /** * @typedef {{condition: (ol.EventsConditionType|undefined), * deleteCondition: (ol.EventsConditionType|undefined), + * insertVertexCondition: (ol.EventsConditionType|undefined), * pixelTolerance: (number|undefined), * style: (ol.style.Style|Array.|ol.StyleFunction|undefined), * features: ol.Collection., @@ -12626,6 +12627,7 @@ declare module olx { interface ModifyOptions { condition?: ol.EventsConditionType; deleteCondition?: ol.EventsConditionType; + insertVertexCondition?: ol.EventsConditionType; pixelTolerance?: number; style?: (ol.style.Style | ol.style.Style[] | ol.StyleFunction); features: ol.Collection; diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index 29d763344a..50281ff0fe 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -703,7 +703,8 @@ jsonValue = geojsonFormat.writeGeometryObject(geometry, writeOptions); // ol.interactions // let modify: ol.interaction.Modify = new ol.interaction.Modify({ - features: new ol.Collection(featureArray) + insertVertexCondition: ol.events.condition.never, + features: new ol.Collection(featureArray), }); let draw: ol.interaction.Draw = new ol.interaction.Draw({ @@ -811,4 +812,4 @@ numberValue = ol.Sphere.getArea(geometry, { numberValue = ol.Sphere.getLength(geometry, { projection: projection, radius: numberValue, -}); \ No newline at end of file +}); From 2c1dc4970e23bfcff04851e4b9e241832b18c680 Mon Sep 17 00:00:00 2001 From: Pratheek Adidela Date: Thu, 19 Oct 2017 22:46:17 +0530 Subject: [PATCH 056/314] Added types for node-horseman (#20030) * Added declarations for 'node-horseman'. * Linting is successful. * Made required changes for pushing to @types. --- types/node-horseman/index.d.ts | 241 +++++++++++++++++++++ types/node-horseman/node-horseman-tests.ts | 11 + types/node-horseman/tsconfig.json | 24 ++ types/node-horseman/tslint.json | 1 + 4 files changed, 277 insertions(+) create mode 100644 types/node-horseman/index.d.ts create mode 100644 types/node-horseman/node-horseman-tests.ts create mode 100644 types/node-horseman/tsconfig.json create mode 100644 types/node-horseman/tslint.json diff --git a/types/node-horseman/index.d.ts b/types/node-horseman/index.d.ts new file mode 100644 index 0000000000..46ca810233 --- /dev/null +++ b/types/node-horseman/index.d.ts @@ -0,0 +1,241 @@ +// Type definitions for node-horseman 3.3 +// Project: https://github.com/johntitus/node-horseman#readme +// Definitions by: Pratheek Adidela +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export = horseman; + +declare class horseman { + constructor(options: any); + /** Handle page events inside PhantomJS. Phantom receives callback return value with .at but not with .on */ + at(eventType: string, callback: () => void): this; + + /** Get the value of an attribute for a selector. */ + attribute(selector: string, attr: string): string; + + /** Use basic HTTP authentication when opening a page. */ + authentication(username: string, password: string): this; + + /** Go back a page. */ + back(): this; + + /** Get the bounding rectangle of a selector. */ + boundingRectangle(selector: string): ClientRect; + + /** Clear an input field. */ + clear(selector: string): any; + + /** Click on a selector and fire a 'click event'. */ + click(selector: string): this; + + /** Close the instance and perform cleanup. */ + close(): this; + + /** Close a tab and release its resources. */ + closeTab(tabNumber: string): this; + + /** Set the cookies for Phantom. */ + cookies(args: object | object[] | string): this; + /** Get the cookies from Phantom. */ + cookies(): string; + + /** Count the number of occurances of 'selector' on the page. */ + count(selector: string): number; + + /** Save a cropped screenshot to disk. */ + crop(area: string | object, path: string): this; + + /** Take a base64 encoded cropped screenshot. */ + cropBase64(area: string, type: string | 'PNG'): any; + + /** Get the value of an css property of a selector. */ + cssProperty(selector: string, prop: string): string; + + /** Execute a function without breaking the api chain. */ + do(fn: () => void): this; + + /** Download a URL. */ + download(url: string, path: string, binary: boolean, method: string, data: string): this; + + /** Run a javascript function on the current page and optionally return the results. */ + evaluate(fn: () => void, args?: any[]): this; + + /** Determine if the selector exists, at least once, on the page. */ + exists(selector: string): boolean; + + /** Go forward a page. */ + forward(): this; + + /** Get the count of frames inside the current frame. */ + frameCount(): number; + + /** Get the name of the current frame. */ + frameName(): string; + + /** Get the names of the frames inside the current frame. */ + frameNames(): string; + + /** Set headers sent to the remote server during an 'open'. */ + headers(headers: object[]): this; + + /** Get the height of an element. */ + height(selector: string): number; + + /** Get the HTML for the page, or optionally for a selector. */ + html(selector?: string, file?: string): Promise; + + /** Includes javascript script from a url on the page. */ + includeJs(url: string): this; + + /** Injects javascript from a file into the page. */ + injectJs(file: string): this; + + /** Fire a key event. */ + keyboardEvent(type?: string, key?: string, modifier?: number): this; + + /** Log the output from either a previous chain method, or a string the user passed in. */ + log(output?: string): this; + + /** Run javascript on the page. */ + manipulate(fn: () => void, args?: any[]): this; + + /** Fire a mouse event. */ + mouseEvent(type?: string, x?: number, y?: number, button?: string): this; + + /** Handles page events. * eventType can be one of: + * initialized - callback() + * loadStarted - callback() + * loadFinished - callback(status) + * tabCreated - callback(tabNum, tab) + * tabClosed - callback(tabNum, tab) + * urlChanged - callback(targetUrl) + * navigationRequested - callback(url, type, willNavigate, main) + * resourceRequested - callback(requestData, networkRequest) + * resourceReceived - callback(response) + * pageCreated - callback(newPage) + * consoleMessage(msg, lineNum, sourceId) + * alert - callback(msg) + * confirm - callback(msg) + * prompt - callback(msg, defaultVal) + * filePicker - callback(oldFile) + * error - callback(msg, trace); + * timeout - callback(type) + */ + on(event: string | "timeout" | "tabCreated" | "tabClosed"| "resourceTimeout"| "urlChanged"| "resourceReceived"| "pageCreated"| "loadFinished", func: (...args: any[]) => void): this; + + /** Open a url in Phantom. */ + open(url: string, method?: string | 'GET'): this; + + /** Open URL in a new tab */ + openTab(url: string): this; + + pageMaker(url: any, _page: any, ...args: any[]): any; + + /** Save the current page as a pdf. */ + pdf(path: string, paperSize: { + format?: "A3" | "A4" | "A5" | "Legal" | "Letter" | "Tabloid", + orientation?: "portrait" | "landscape", + margin?: string + }): this; + + /** Get the plain text for the body of the page. */ + plainText(): string; + + /** Send Post data to a url. */ + post(url: string, postData: string): this; + + /** Send Put data to a url. */ + put(url: string, putData: string): this; + + /** Reload the page. */ + reload(): this; + + /** Save a screenshot to disk. */ + screenshot(path: string): this; + + /** Take a base64 encoded screenshot, e.g., PNG. */ + screenshotBase64(type: string | 'PNG'): any; + + /** Scroll to a position on the page. */ + scrollTo(top: number, left: number): this; + + /** Select a value in an html select element. */ + select(selector: string, value: string): any; + + /** Change the proxy settings. */ + setProxy(ip: string, port: string, type: string, username: string, password: string): this; + + /** Get the HTTP status of the last opened page. */ + status(): string; + + /** Switch to a child frame. */ + switchToChildFrame(nameOrPosition: string | number): this; + + /** Switch to the focused frame. */ + switchToFocusedFrame(): this; + + /** Switch to a frame inside the current frame. */ + switchToFrame(nameOrPosition: string | number): this; + + /** Switch to the main frame. */ + switchToMainFrame(): this; + + /** Switch to the parent frame of the current frame. */ + switchToParentFrame(): this; + + /** Switch to another of the open tabs */ + switchToTab(tabNumber: number): this; + + /** Returns the number of tabs */ + tabCount(): number; + + /** Get the text for the body of the page, or optionally for a selector. */ + text(selector?: string): string; + + /** Get the title of the current page. */ + title(): string; + + /** Simulate a keypress on a selector */ + type(selector: string, text: string, options?: object): this; + + /** Upload a file to the page. */ + upload(selector: string, file: string): this; + + /** Get the url of the current page. */ + url(): string; + + /** Get or set the user agent for Phantom. */ + userAgent(...args: any[]): any; + + /** Get the value of an element. */ + value(selector: string): string; + /** Sets the value of an element. */ + value(selector: string, value: string): this; + + /** Set the size of the viewport. */ + viewport(width: number, height: number): this; + /** Get the size of the viewport. */ + viewport(): object; + + /** Determines if an element is visible. */ + visible(selector: string): boolean; + + /** Wait for a specified period of time */ + wait(milliseconds: number): this; + + /** Waits for a function to evaluate to a given value in browser. If optsOrFn is a function, use the classic signature waitFor(fn, arg1, arg2, value), If arg is an object, use waitFor(options). */ + waitFor(...args: any[]): this; + + /** Wait for a page load to occur */ + waitForNextPage(object?: object): this; + + /** Wait for a selector to be present on the current page. */ + waitForSelector(selector: string, options: object): this; + + /** Get the width of an element. */ + width(selector: string): number; + + /** Set the zoom factor of the page. */ + zoom(zoomFactor: number): this; +} diff --git a/types/node-horseman/node-horseman-tests.ts b/types/node-horseman/node-horseman-tests.ts new file mode 100644 index 0000000000..f1d81058f6 --- /dev/null +++ b/types/node-horseman/node-horseman-tests.ts @@ -0,0 +1,11 @@ +import horseman = require("node-horseman"); + +const horse = new horseman({ + timeout: 10000 +}); + +horse.on('error', (msg: any, trace: any) => { console.log(msg, trace); }) +.open("http://example.org/").waitForNextPage().html().then((pageContent: string) => { + console.log(pageContent); + horse.close(); +}); diff --git a/types/node-horseman/tsconfig.json b/types/node-horseman/tsconfig.json new file mode 100644 index 0000000000..5490648512 --- /dev/null +++ b/types/node-horseman/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "strictFunctionTypes": true, + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-horseman-tests.ts" + ] +} diff --git a/types/node-horseman/tslint.json b/types/node-horseman/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/node-horseman/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e86a56d0ccd8cf5d074e2cf5b0cc41acba663bf3 Mon Sep 17 00:00:00 2001 From: Jinwoo Lee Date: Thu, 19 Oct 2017 10:22:12 -0700 Subject: [PATCH 057/314] Node http2: statCheck() may also return `false`. (#20692) * Node http2: statCheck() may also return `false`. https://nodejs.org/dist/latest-v8.x/docs/api/http2.html#http2_http2stream_respondwithfile_path_headers_options says: The options.statCheck function may also be used to cancel the send operation by returning false Related node code: - https://github.com/nodejs/node/blob/master/lib/internal/http2/core.js#L1621 - https://github.com/nodejs/node/blob/master/lib/internal/http2/core.js#L1671 * add tests for returning false from statCheck() * change `void|false` to `void|boolean` * fix lint error --- types/node/index.d.ts | 2 +- types/node/node-tests.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index d8e8fe3358..5d0ba05b93 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6112,7 +6112,7 @@ declare module "http2" { } export interface ServerStreamFileResponseOptions { - statCheck?: (stats: fs.Stats, headers: IncomingHttpHeaders, statOptions: StatOptions) => void; + statCheck?: (stats: fs.Stats, headers: IncomingHttpHeaders, statOptions: StatOptions) => void|boolean; getTrailers?: (trailers: IncomingHttpHeaders) => void; offset?: number; length?: number; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index c4cd693e03..7b36c859c7 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -3288,6 +3288,7 @@ namespace http2_tests { serverHttp2Stream.respondWithFD(0); serverHttp2Stream.respondWithFD(0, headers); serverHttp2Stream.respondWithFD(0, headers, options2); + serverHttp2Stream.respondWithFD(0, headers, {statCheck: () => false}); let options3: http2.ServerStreamFileResponseOptionsWithError = { onError: (err: NodeJS.ErrnoException) => {}, statCheck: (stats: fs.Stats, headers: http2.IncomingHttpHeaders, statOptions: http2.StatOptions) => {}, @@ -3298,6 +3299,7 @@ namespace http2_tests { serverHttp2Stream.respondWithFile(''); serverHttp2Stream.respondWithFile('', headers); serverHttp2Stream.respondWithFile('', headers, options3); + serverHttp2Stream.respondWithFile('', headers, {statCheck: () => false}); } // Http2Server / Http2SecureServer From 891a0d68419009e460948febd1d40f19b3efff4d Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 19 Oct 2017 11:29:04 -0700 Subject: [PATCH 058/314] dts-generator: Add dependency on "typescript" (#20730) --- types/dts-generator/package.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 types/dts-generator/package.json diff --git a/types/dts-generator/package.json b/types/dts-generator/package.json new file mode 100644 index 0000000000..2195330f38 --- /dev/null +++ b/types/dts-generator/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "typescript": "*" + } +} From fec630a446d8cd1155d0d8e4f53a4bc119143e92 Mon Sep 17 00:00:00 2001 From: Stephen Ierodiaconou Date: Thu, 19 Oct 2017 19:34:06 +0100 Subject: [PATCH 059/314] [next-redux-wrapper] update to support new option param and export interfaces used in return types (#20732) * [next-redux-wrapper] update to support new option param and export interfaces used in return types * Revert change to package.json --- types/next-redux-wrapper/index.d.ts | 29 ++++++++++--------- .../next-redux-wrapper-tests.tsx | 2 +- types/next-redux-wrapper/package.json | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/types/next-redux-wrapper/index.d.ts b/types/next-redux-wrapper/index.d.ts index dae0cf3841..1f5945741b 100644 --- a/types/next-redux-wrapper/index.d.ts +++ b/types/next-redux-wrapper/index.d.ts @@ -14,7 +14,7 @@ */ import * as React from 'react'; -import { IncomingMessage } from 'http'; +import { IncomingMessage, ServerResponse } from 'http'; import { Store, Component, MapDispatchToPropsParam, MapStateToPropsParam, @@ -23,28 +23,28 @@ import { export = nextReduxWrapper; -interface NextPageComponentMethods { - getInitialProps(props: any): Promise; -} -type NextReduxWrappedComponent = React.Component & NextPageComponentMethods; - -type NextStoreCreator = ( - initialState: TInitialState, - options: nextReduxWrapper.StoreCreatorOptions -) => Store; - declare function nextReduxWrapper( options: nextReduxWrapper.Options -): (Component: Component) => NextReduxWrappedComponent; +): (Component: Component) => nextReduxWrapper.NextReduxWrappedComponent; declare function nextReduxWrapper( - createStore: NextStoreCreator, + createStore: nextReduxWrapper.NextStoreCreator, mapStateToProps?: MapStateToPropsParam, mapDispatchToProps?: MapDispatchToPropsParam, mergeProps?: MergeProps, options?: ConnectOptions -): (Component: Component) => NextReduxWrappedComponent; +): (Component: Component) => nextReduxWrapper.NextReduxWrappedComponent; declare namespace nextReduxWrapper { + interface NextPageComponentMethods { + getInitialProps(props: any): Promise; + } + type NextReduxWrappedComponent = React.Component & NextPageComponentMethods; + + type NextStoreCreator = ( + initialState: TInitialState, + options: StoreCreatorOptions + ) => Store; + interface Options { createStore: NextStoreCreator; debug?: boolean; @@ -57,6 +57,7 @@ declare namespace nextReduxWrapper { interface StoreCreatorOptions extends Options { isServer: boolean; req?: IncomingMessage; + res?: ServerResponse; query?: any; } diff --git a/types/next-redux-wrapper/next-redux-wrapper-tests.tsx b/types/next-redux-wrapper/next-redux-wrapper-tests.tsx index 37bd8af4b8..40069aeb8d 100644 --- a/types/next-redux-wrapper/next-redux-wrapper-tests.tsx +++ b/types/next-redux-wrapper/next-redux-wrapper-tests.tsx @@ -70,7 +70,7 @@ const com5 = withRedux( (initialState: InitialState, options: StoreCreatorOptions) => { - if (options.isServer || options.req || options.query) { + if (options.isServer || options.req || options.query || options.res) { const a = 1; } return createStore(reducer, initialState); diff --git a/types/next-redux-wrapper/package.json b/types/next-redux-wrapper/package.json index 4bcc170ca3..6d68bf2f9b 100644 --- a/types/next-redux-wrapper/package.json +++ b/types/next-redux-wrapper/package.json @@ -3,4 +3,4 @@ "dependencies": { "redux": "^3.6.0" } -} \ No newline at end of file +} From 254fb86815a697567662f27592dc1f07256ae6ba Mon Sep 17 00:00:00 2001 From: Simon McClive Date: Thu, 19 Oct 2017 19:38:48 +0100 Subject: [PATCH 060/314] Add types for parent-package-json (#20714) * Add types for parent-package-json * Update return type to false and restructure tests * Remove multiple calls of parent() in tests * Test optional properties --- types/parent-package-json/index.d.ts | 17 +++++++++++++ .../parent-package-json-tests.ts | 10 ++++++++ types/parent-package-json/tsconfig.json | 24 +++++++++++++++++++ types/parent-package-json/tslint.json | 3 +++ 4 files changed, 54 insertions(+) create mode 100644 types/parent-package-json/index.d.ts create mode 100644 types/parent-package-json/parent-package-json-tests.ts create mode 100644 types/parent-package-json/tsconfig.json create mode 100644 types/parent-package-json/tslint.json diff --git a/types/parent-package-json/index.d.ts b/types/parent-package-json/index.d.ts new file mode 100644 index 0000000000..b0ab9ec3ce --- /dev/null +++ b/types/parent-package-json/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for parent-package-json 2.0 +// Project: https://github.com/maxrimue/parent-package-json +// Definitions by: Simon McClive +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export = ParentPackageJson; + +declare function ParentPackageJson(startPath?: string | null, ignore?: number): ParentPackageJson.ParentPackage | false; + +declare namespace ParentPackageJson { + interface ParentPackage { + read(): string; + path: string; + parse(): {[key: string]: any}; + } +} diff --git a/types/parent-package-json/parent-package-json-tests.ts b/types/parent-package-json/parent-package-json-tests.ts new file mode 100644 index 0000000000..41a5a7bdd0 --- /dev/null +++ b/types/parent-package-json/parent-package-json-tests.ts @@ -0,0 +1,10 @@ +import * as parent from 'parent-package-json'; + +const hasParent = parent('/optional/path/', 1); + +if (hasParent !== false) { + const pathToParent: string = hasParent.path; + const contentOfParent: string = hasParent.read(); + const JSONOfParent = hasParent.parse(); + const versionOfParent = JSONOfParent.version; +} diff --git a/types/parent-package-json/tsconfig.json b/types/parent-package-json/tsconfig.json new file mode 100644 index 0000000000..33d474c851 --- /dev/null +++ b/types/parent-package-json/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", + "parent-package-json-tests.ts" + ] +} diff --git a/types/parent-package-json/tslint.json b/types/parent-package-json/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/parent-package-json/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 18ab71a912052b27d2ab2af235865f3cd6cd74ae Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 19 Oct 2017 13:23:16 -0700 Subject: [PATCH 061/314] Additions to ISSUE_TEMPLATE (#20735) --- .github/ISSUE_TEMPLATE.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 4078b4808b..536e38c4e2 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,5 +1,9 @@ +If you know how to fix the issue, make a pull request instead. + - [ ] I tried using the `@types/xxxx` package and had problems. - [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript - [ ] I have a question that is inappropriate for [StackOverflow](https://stackoverflow.com/). (Please ask any appropriate questions there). - [ ] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see `Definitions by:` in `index.d.ts`) so they can respond. - Authors: @.... + +If you do not mention the authors the issue will be ignored. From be60958bd85d1a2d63cfc3c403b06bad3635112b Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 19 Oct 2017 13:23:32 -0700 Subject: [PATCH 062/314] Mention strictFunctionTypes in PULL_REQUUEST_TEMPLATE (#20736) --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 979a8311e0..4217471f9d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,7 +12,7 @@ If adding a new definition: - [ ] The package does not provide its own types, and you can not add them. - [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. - [ ] Create it with `dts-gen --dt`, not by basing it on an existing project. -- [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, and `strictNullChecks` set to `true`. +- [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, `strictNullChecks`, and `strictFunctionTypes` set to `true`. If changing an existing definition: - [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <> From 8f53357a4cc054add2111f7c3a07a92541298b5c Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 19 Oct 2017 13:32:47 -0700 Subject: [PATCH 063/314] sequelize: Allow 'boolean' in WhereOptions (#20690) --- types/sequelize/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index f1dc66fce5..f5b1befcc4 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3108,7 +3108,7 @@ declare namespace sequelize { * typesafety, but there is no way to pass the tests if we just remove it. */ type WhereOptions = { - [P in keyof T]?: string | number | WhereLogic | WhereOptions | col | and | or | WhereGeometryOptions | Array | null; + [P in keyof T]?: string | number | boolean | WhereLogic | WhereOptions | col | and | or | WhereGeometryOptions | Array | null; }; /** From 149031f781bcd52fe8b13940d51bbe6feae289ca Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 19 Oct 2017 13:32:59 -0700 Subject: [PATCH 064/314] Update TypeScript versions of packages that depend on vue (#20733) --- types/vue-i18n/index.d.ts | 1 + types/vue-scrollto/index.d.ts | 1 + types/vue-scrollto/tsconfig.json | 1 + 3 files changed, 3 insertions(+) diff --git a/types/vue-i18n/index.d.ts b/types/vue-i18n/index.d.ts index 19225a83dd..030487a98b 100644 --- a/types/vue-i18n/index.d.ts +++ b/types/vue-i18n/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kazupon/vue-i18n // Definitions by: Kombu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import Vue, { PluginFunction } from 'vue'; diff --git a/types/vue-scrollto/index.d.ts b/types/vue-scrollto/index.d.ts index e20879473f..5ca330d646 100644 --- a/types/vue-scrollto/index.d.ts +++ b/types/vue-scrollto/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rigor789/vue-scrollto#readme // Definitions by: Kovács Vince // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 import { PluginFunction } from "vue"; diff --git a/types/vue-scrollto/tsconfig.json b/types/vue-scrollto/tsconfig.json index 6afe67dfcb..fd030de5e6 100644 --- a/types/vue-scrollto/tsconfig.json +++ b/types/vue-scrollto/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From dd980c087a917ef4dc93cf4c3de6cab228fd8936 Mon Sep 17 00:00:00 2001 From: BehindTheMath Date: Thu, 19 Oct 2017 19:15:07 -0400 Subject: [PATCH 065/314] [github-username-regex] Add definitions (#20665) * [github-username-regex] Add definitions * [github-username-regex] Change to match CommonJS export format --- .../github-username-regex-tests.ts | 4 ++++ types/github-username-regex/index.d.ts | 7 ++++++ types/github-username-regex/tsconfig.json | 23 +++++++++++++++++++ types/github-username-regex/tslint.json | 1 + 4 files changed, 35 insertions(+) create mode 100644 types/github-username-regex/github-username-regex-tests.ts create mode 100644 types/github-username-regex/index.d.ts create mode 100644 types/github-username-regex/tsconfig.json create mode 100644 types/github-username-regex/tslint.json diff --git a/types/github-username-regex/github-username-regex-tests.ts b/types/github-username-regex/github-username-regex-tests.ts new file mode 100644 index 0000000000..d829752776 --- /dev/null +++ b/types/github-username-regex/github-username-regex-tests.ts @@ -0,0 +1,4 @@ +import githubUsernameRegex = require("github-username-regex"); + +const githubUsernameRegexString: string = githubUsernameRegex.source; +const valid: boolean = githubUsernameRegex.test("abc-123"); diff --git a/types/github-username-regex/index.d.ts b/types/github-username-regex/index.d.ts new file mode 100644 index 0000000000..59b3d703f7 --- /dev/null +++ b/types/github-username-regex/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for github-username-regex 1.0 +// Project: https://github.com/shinnn/github-username-regex +// Definitions by: BehindTheMath +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare const githubUsernameRegex: RegExp; +export = githubUsernameRegex; diff --git a/types/github-username-regex/tsconfig.json b/types/github-username-regex/tsconfig.json new file mode 100644 index 0000000000..4a30cf07ad --- /dev/null +++ b/types/github-username-regex/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", + "github-username-regex-tests.ts" + ] +} diff --git a/types/github-username-regex/tslint.json b/types/github-username-regex/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/github-username-regex/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d2cfe0ba3e1ecd6592700b346f4dae4957173e8a Mon Sep 17 00:00:00 2001 From: voxmatt Date: Thu, 19 Oct 2017 16:43:17 -0700 Subject: [PATCH 066/314] fixes for compat mode types when you're straddling modern and classic environments --- types/react-relay/compat.d.ts | 42 +++++++++++++---- types/react-relay/test/react-relay-tests.tsx | 47 +++++++++++++++++++- 2 files changed, 79 insertions(+), 10 deletions(-) diff --git a/types/react-relay/compat.d.ts b/types/react-relay/compat.d.ts index d214e451ae..527ef6fa42 100644 --- a/types/react-relay/compat.d.ts +++ b/types/react-relay/compat.d.ts @@ -1,13 +1,13 @@ export { QueryRenderer, - commitMutation, - createFragmentContainer, - createPaginationContainer, - createRefetchContainer, fetchQuery, graphql, } from "./index"; - +import { + ConnectionConfig, + RelayPaginationProp as RelayModernPaginationProp, + RelayRefetchProp as RelayModernRefetchProp +} from "./index"; import * as RelayRuntimeTypes from "relay-runtime"; import { RelayEnvironmentInterface } from "./classic"; @@ -33,34 +33,58 @@ export type ReactFragmentComponent = ComponentWithFragment | StatelessWith export type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; export type RelayClassicEnvironment = RelayEnvironmentInterface; + // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatTypes // ~~~~~~~~~~~~~~~~~~~~~ export type CompatEnvironment = RelayRuntimeTypes.Environment | RelayClassicEnvironment; +// ~~~~~~~~~~~~~~~~~~~~~ +// RelayProps +// ~~~~~~~~~~~~~~~~~~~~~ +export interface RelayProp { + environment: CompatEnvironment; +} + +export type RelayPaginationProp = RelayModernPaginationProp & RelayProp; +export type RelayRefetchProp = RelayModernRefetchProp & RelayProp; + // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatMutations // ~~~~~~~~~~~~~~~~~~~~~ -export function commitUpdate( +export function commitMutation( environment: CompatEnvironment, config: RelayRuntimeTypes.MutationConfig ): RelayRuntimeTypes.Disposable; -export function applyUpdate( +export function applyOptimisticMutation( environment: CompatEnvironment, config: RelayRuntimeTypes.OptimisticMutationConfig ): RelayRuntimeTypes.Disposable; // ~~~~~~~~~~~~~~~~~~~~~ -// RelayCompatContainer +// RelayCompatContainers // ~~~~~~~~~~~~~~~~~~~~~ export interface GeneratedNodeMap { [key: string]: RelayRuntimeTypes.GraphQLTaggedNode; } -export function createContainer( + +export function createFragmentContainer( Component: ReactBaseComponent, fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap ): ReactFragmentComponent; +export function createRefetchContainer( + Component: ReactBaseComponent, + fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap, + taggedNode: RelayRuntimeTypes.GraphQLTaggedNode +): ReactFragmentComponent; + +export function createPaginationContainer( + Component: ReactBaseComponent, + fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap, + connectionConfig: ConnectionConfig +): ReactFragmentComponent; + // ~~~~~~~~~~~~~~~~~~~~~ // injectDefaultVariablesProvider // ~~~~~~~~~~~~~~~~~~~~~ diff --git a/types/react-relay/test/react-relay-tests.tsx b/types/react-relay/test/react-relay-tests.tsx index 6caf997dba..612df078a1 100644 --- a/types/react-relay/test/react-relay-tests.tsx +++ b/types/react-relay/test/react-relay-tests.tsx @@ -332,9 +332,53 @@ requestSubscription( import { QueryRenderer as CompatQueryRenderer, createFragmentContainer as createFragmentContainerCompat, + commitMutation as commitMutationCompat, + CompatEnvironment, + RelayPaginationProp as RelayPaginationPropCompat, } from "react-relay/compat"; -// TODO? This is all more or less identical to modern... +// testting compat mutation with classic environment +function markNotificationAsReadCompat(environment: CompatEnvironment, source: string, storyID: string) { + const variables = { + input: { + source, + storyID, + }, + }; + + commitMutationCompat(environment, { + configs, + mutation, + optimisticResponse, + variables, + onCompleted: (response, errors) => { + console.log("Response received from server."); + }, + onError: err => console.error(err), + updater: (store, data) => { + const field = store.get(storyID); + if (field) { + field.setValue(data.story, "story"); + } + } + }); +} + +interface CompatProps { + relay: RelayPaginationPropCompat; +} + +export class CompatComponent extends React.Component { + markNotificationAsRead(source: string, storyID: string) { + markNotificationAsReadCompat(this.props.relay.environment, source, storyID); + } + + render() { + return (
); + } +} + +const CompatContainer = createFragmentContainerCompat(CompatComponent, {}); //////////////////////////// // RELAY-CLASSIC TESTS @@ -398,6 +442,7 @@ const ArtworkContainer = Relay.createContainer(Artwork, { artwork: () => Relay.QL` fragment on Artwork { title + ${ CompatContainer.getFragment('whatever') } } `, }, From f697a7ca1db4ca1a2a26c7379b4d6231caf8a628 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Thu, 19 Oct 2017 16:59:00 -0700 Subject: [PATCH 067/314] fixing linting errors surfaced by Travis --- types/react-relay/compat.d.ts | 1 - types/react-relay/test/react-relay-tests.tsx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/types/react-relay/compat.d.ts b/types/react-relay/compat.d.ts index 527ef6fa42..22585d03d0 100644 --- a/types/react-relay/compat.d.ts +++ b/types/react-relay/compat.d.ts @@ -33,7 +33,6 @@ export type ReactFragmentComponent = ComponentWithFragment | StatelessWith export type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; export type RelayClassicEnvironment = RelayEnvironmentInterface; - // ~~~~~~~~~~~~~~~~~~~~~ // RelayCompatTypes // ~~~~~~~~~~~~~~~~~~~~~ diff --git a/types/react-relay/test/react-relay-tests.tsx b/types/react-relay/test/react-relay-tests.tsx index 612df078a1..f73b7c00c7 100644 --- a/types/react-relay/test/react-relay-tests.tsx +++ b/types/react-relay/test/react-relay-tests.tsx @@ -368,7 +368,7 @@ interface CompatProps { relay: RelayPaginationPropCompat; } -export class CompatComponent extends React.Component { +export class CompatComponent extends React.Component { markNotificationAsRead(source: string, storyID: string) { markNotificationAsReadCompat(this.props.relay.environment, source, storyID); } From 6deecd5aaf40a74c1ba43911ee1ffab97e4fca17 Mon Sep 17 00:00:00 2001 From: Viktor Isaev Date: Fri, 20 Oct 2017 17:09:01 +0300 Subject: [PATCH 068/314] Fixed types in "restify-cookies". (#20752) * Added typings for "require-dir". * Fixed dtslint errors. * Fixed By field. * Added typings for "restify-cookies". * Added "cookies" field to Request interface. * Added typings for "heapdump". * Fixed types in "restify-cookies". * Added sameSite field to types in "restify-cookies". * Bumped version for "restify-cookies". * Fixed version for "restify-cookies". --- types/restify-cookies/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/restify-cookies/index.d.ts b/types/restify-cookies/index.d.ts index 7e794855cb..8f00f97538 100644 --- a/types/restify-cookies/index.d.ts +++ b/types/restify-cookies/index.d.ts @@ -11,9 +11,10 @@ declare module 'restify' { maxAge?: number; domain?: string; path?: string; - expires?: string; + expires?: Date; httpOnly?: boolean; secure?: boolean; + sameSite?: boolean|'lax'|'strict'; } interface Request { From 7239c6a38d1454aeb7ecffa297292de9a96da6c3 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Fri, 20 Oct 2017 17:21:38 +0300 Subject: [PATCH 069/314] new definition for youtube-dl (#20428) * new definition for youtube-dl * Could not parse version 2.5 * fixes * fixes * fixes * fixes * fixes * fixes * Prefer /// * few fixes * fixes * assert info: youtubedl.Info * fixes --- types/youtube-dl/index.d.ts | 22 ++++++++++++++++++++++ types/youtube-dl/tsconfig.json | 21 +++++++++++++++++++++ types/youtube-dl/tslint.json | 1 + types/youtube-dl/youtube-dl-tests.ts | 18 ++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 types/youtube-dl/index.d.ts create mode 100644 types/youtube-dl/tsconfig.json create mode 100644 types/youtube-dl/tslint.json create mode 100644 types/youtube-dl/youtube-dl-tests.ts diff --git a/types/youtube-dl/index.d.ts b/types/youtube-dl/index.d.ts new file mode 100644 index 0000000000..4daf21884b --- /dev/null +++ b/types/youtube-dl/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for youtube-dl 1.12 +// Project: https://www.npmjs.com/package/youtube-dl +// Definitions by: Bogdan Surai +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// +import * as fs from "fs"; + +export = youtubedl; +declare function youtubedl(url: string, arg: string[], opt: {[key: string]: string}): youtubedl.Youtubedl; +declare namespace youtubedl { + interface Youtubedl { + on(event: string, func: (info: Info) => void): this; + pipe(stream: fs.WriteStream): this; + } + interface Info { + _filename: string; + filename: string; + size: number; + } +} diff --git a/types/youtube-dl/tsconfig.json b/types/youtube-dl/tsconfig.json new file mode 100644 index 0000000000..2634bd2234 --- /dev/null +++ b/types/youtube-dl/tsconfig.json @@ -0,0 +1,21 @@ +{ + "files": [ + "index.d.ts", + "youtube-dl-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/youtube-dl/tslint.json b/types/youtube-dl/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/youtube-dl/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/youtube-dl/youtube-dl-tests.ts b/types/youtube-dl/youtube-dl-tests.ts new file mode 100644 index 0000000000..c85b1ffc92 --- /dev/null +++ b/types/youtube-dl/youtube-dl-tests.ts @@ -0,0 +1,18 @@ +import * as fs from 'fs'; +import youtubedl = require('youtube-dl'); + +const video = youtubedl('http://www.youtube.com/watch?v=90AiXO1pAiA', + // Optional arguments passed to youtube-dl. + ['--format=18'], + // Additional options can be given for calling `child_process.execFile()`. + { cwd: __dirname }); + +// Will be called when the download starts. +video.on('info', (info: youtubedl.Info) => { + console.log('Download started'); + console.log('_filename: ' + info._filename); + console.log('filename: ' + info.filename); + console.log('size: ' + info.size); +}); + +video.pipe(fs.createWriteStream('myvideo.mp4')); From 490c4210d68c8bb0b271b39695eec76016cebbf4 Mon Sep 17 00:00:00 2001 From: Philipp Shestakov Date: Fri, 20 Oct 2017 17:25:57 +0300 Subject: [PATCH 070/314] Added definitions for clusterize.js (#20738) * Added definitions for clusterize.js * Fixed definitions author. * Review fixes. * Review fix. --- types/clusterize.js/clusterize.js-tests.ts | 20 +++++++++++ types/clusterize.js/index.d.ts | 41 ++++++++++++++++++++++ types/clusterize.js/tsconfig.json | 23 ++++++++++++ types/clusterize.js/tslint.json | 1 + 4 files changed, 85 insertions(+) create mode 100644 types/clusterize.js/clusterize.js-tests.ts create mode 100644 types/clusterize.js/index.d.ts create mode 100644 types/clusterize.js/tsconfig.json create mode 100644 types/clusterize.js/tslint.json diff --git a/types/clusterize.js/clusterize.js-tests.ts b/types/clusterize.js/clusterize.js-tests.ts new file mode 100644 index 0000000000..acbfbc36f8 --- /dev/null +++ b/types/clusterize.js/clusterize.js-tests.ts @@ -0,0 +1,20 @@ +import Clusterize = require('clusterize.js'); + +const options: Clusterize.Options = { contentId: '', scrollId: '' }; +const clusterize = new Clusterize(options); + +clusterize.append(['
  • ']); + +clusterize.prepend(['
  • ']); + +clusterize.getRowsAmount(); + +clusterize.update(['
  • ']); + +clusterize.getScrollProgress(); + +clusterize.refresh(); + +clusterize.clear(); + +clusterize.destroy(); diff --git a/types/clusterize.js/index.d.ts b/types/clusterize.js/index.d.ts new file mode 100644 index 0000000000..7c549761d6 --- /dev/null +++ b/types/clusterize.js/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for clusterize.js 0.17 +// Project: https://github.com/NeXTs/Clusterize.js +// Definitions by: Pr1st0n +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Clusterize { + constructor(options: Clusterize.Options); + + destroy(clean?: boolean): void; + refresh(force?: boolean): void; + clear(): void; + getRowsAmount(): number; + getScrollProgress(): number; + update(data?: string[]): void; + append(rows: string[]): void; + prepend(rows: string[]): void; +} + +declare namespace Clusterize { + interface Options { + scrollId: string; + contentId: string; + rows?: string[]; + tag?: string; + rows_in_block?: number; + blocks_in_cluster?: number; + show_no_data_row?: boolean; + no_data_text?: string; + no_data_class?: string; + keep_parity?: boolean; + callbacks?: Callbacks; + } + + interface Callbacks { + clusterWillChange?(cb: () => void): void; + clusterChanged?(cb: () => void): void; + scrollingProgress?(cb: (progress: number) => void): void; + } +} + +export = Clusterize; diff --git a/types/clusterize.js/tsconfig.json b/types/clusterize.js/tsconfig.json new file mode 100644 index 0000000000..10ca5c2a1a --- /dev/null +++ b/types/clusterize.js/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", + "clusterize.js-tests.ts" + ] +} diff --git a/types/clusterize.js/tslint.json b/types/clusterize.js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/clusterize.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ed5cfecfd7ae7ce0a4a2c6911ffa4f5c05fbef83 Mon Sep 17 00:00:00 2001 From: Jacek Dargiel Date: Fri, 20 Oct 2017 17:17:25 +0200 Subject: [PATCH 071/314] Add ChartLayoutOptions (#20758) --- types/chart.js/index.d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 78f1aa6142..7d416ff6c5 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -160,6 +160,7 @@ declare namespace Chart { hover?: ChartHoverOptions; animation?: ChartAnimationOptions; elements?: ChartElementsOptions; + layout?: ChartLayoutOptions; scales?: ChartScales; showLines?: boolean; spanGaps?: boolean; @@ -312,6 +313,18 @@ declare namespace Chart { borderColor?: ChartColor; borderSkipped?: string; } + + interface ChartLayoutOptions { + padding?: ChartLayoutPaddingObject | number; + } + + interface ChartLayoutPaddingObject { + top?: number; + right?: number; + bottom?: number; + left?: number; + } + interface GridLineOptions { display?: boolean; color?: ChartColor; From 2753c44ac158c13db00c111153195062ca23df36 Mon Sep 17 00:00:00 2001 From: Nikolay Solovyov Date: Fri, 20 Oct 2017 18:17:49 +0300 Subject: [PATCH 072/314] Update index.d.ts (#20756) `activeIndex` and `activeShape` is optional parameters. Also, `activeIndex` can contains numbers and array of numbers, not an array of any. --- types/recharts/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 95656a7247..404fe5c444 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -345,8 +345,8 @@ export interface PieProps extends Partial { label?: boolean | any | React.ReactElement | RechartsFunction; labelLine?: boolean | any | React.ReactElement | RechartsFunction; data: any[]; - activeIndex: any[]; - activeShape: any | React.ReactElement | RechartsFunction; + activeIndex?: number | number[]; + activeShape?: any | React.ReactElement | RechartsFunction; isAnimationActive?: boolean; animationBegin?: number; animationEasing?: AnimationEasingType | RechartsFunction; From a41f8d2ddd0d325a0da5fb0b996da6897f8f50ae Mon Sep 17 00:00:00 2001 From: Piotr Roszatycki Date: Fri, 20 Oct 2017 17:21:44 +0200 Subject: [PATCH 073/314] nodemailer: version 4.2 (#20754) --- types/nodemailer/index.d.ts | 2 +- types/nodemailer/lib/smtp-connection.d.ts | 6 ++++++ types/nodemailer/nodemailer-tests.ts | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/nodemailer/index.d.ts b/types/nodemailer/index.d.ts index da0605ddcf..6a587bb720 100644 --- a/types/nodemailer/index.d.ts +++ b/types/nodemailer/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Nodemailer 4.1 +// Type definitions for Nodemailer 4.2 // Project: https://github.com/nodemailer/nodemailer // Definitions by: Rogier Schouten // Piotr Roszatycki diff --git a/types/nodemailer/lib/smtp-connection.d.ts b/types/nodemailer/lib/smtp-connection.d.ts index a2cb095210..49b1adef8e 100644 --- a/types/nodemailer/lib/smtp-connection.d.ts +++ b/types/nodemailer/lib/smtp-connection.d.ts @@ -88,6 +88,12 @@ declare namespace SMTPConnection { rejectedErrors?: SMTPError[]; /** the last response received from the server */ response: string; + /** how long was envelope prepared */ + envelopeTime: number; + /** how long was send stream prepared */ + messageTime: number; + /** how many bytes were streamed */ + messageSize: number; } interface Options { diff --git a/types/nodemailer/nodemailer-tests.ts b/types/nodemailer/nodemailer-tests.ts index 8baff03674..cb2cd9641f 100644 --- a/types/nodemailer/nodemailer-tests.ts +++ b/types/nodemailer/nodemailer-tests.ts @@ -1036,7 +1036,6 @@ namespace smtp_connection_test { if (err) throw err; connection.send({ from: 'a@example.com', to: 'b@example.net' }, 'message', (err, info) => { if (err) throw err; - console.log(info); connection.reset(() => { if (err) throw err; connection.quit(); From 399af551e6963ceca3b7ad15b0cc14f3708d1d24 Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Sat, 21 Oct 2017 00:28:12 +0900 Subject: [PATCH 074/314] [react-router] Fix for --strictFunctionTypes (#20746) * [react-router] Fix for --strictFunctionTypes It seems it's not possible for a SFC to conform to React.ComponentType | {}> with both strictFunctionTypes and strictNullChecks (they have to either be `Partial>` or `{}`). The whole point of the `| {}` is to allow for components that have defaulted `Props` / don't use any `Props` anyway, so adding it as another listed type should work. * Fix dtslint errors --- types/react-router/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index bfb5f16e7b..4e547c8341 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -65,7 +65,7 @@ export interface RouteComponentProps

    { export interface RouteProps { location?: H.Location; - component?: React.ComponentType | {}>; + component?: React.ComponentType> | React.ComponentType; render?: ((props: RouteComponentProps) => React.ReactNode); children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; path?: string; From 25af4237d27e89e49166b007861a8e9ee5370329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Tegelund?= Date: Sat, 21 Oct 2017 00:28:27 +0900 Subject: [PATCH 075/314] Add passHref to Link (#20745) --- types/next/link.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/next/link.d.ts b/types/next/link.d.ts index aca3190f7e..d931dd550d 100644 --- a/types/next/link.d.ts +++ b/types/next/link.d.ts @@ -10,6 +10,7 @@ export interface LinkState { onError?(error: any): void; href?: string | UrlLike; as?: string | UrlLike; + passHref?: boolean; children: React.ReactElement; } From 3bb8a665130be3304a81d52279d0b227f10ebd59 Mon Sep 17 00:00:00 2001 From: Cory Deppen Date: Fri, 20 Oct 2017 10:28:39 -0500 Subject: [PATCH 076/314] [redux-logger] Add optional logEntry param to LoggerPredicate (#20740) * Add optional logEntry param to LoggerPredicate * Enable linting Resolve errors and comply with DT formatting recommendations. --- types/redux-logger/index.d.ts | 64 ++++++---- types/redux-logger/package.json | 2 +- types/redux-logger/redux-logger-tests.ts | 152 ++++++++++++----------- types/redux-logger/tsconfig.json | 16 +-- types/redux-logger/tslint.json | 3 + 5 files changed, 125 insertions(+), 112 deletions(-) create mode 100644 types/redux-logger/tslint.json diff --git a/types/redux-logger/index.d.ts b/types/redux-logger/index.d.ts index d60d3ad218..c8ca66eda0 100644 --- a/types/redux-logger/index.d.ts +++ b/types/redux-logger/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redux-logger v3.0.0 +// Type definitions for redux-logger 3.0 // Project: https://github.com/fcomb/redux-logger // Definitions by: Alexander Rusakov // Kevin Groat @@ -6,45 +6,59 @@ export as namespace ReduxLogger; -import * as Redux from "redux"; +import * as Redux from 'redux'; export const logger: Redux.Middleware; -export type LoggerPredicate = (getState: () => any, action: any) => boolean; +export type LoggerPredicate = ( + getState: () => any, + action: any, + logEntry?: LogEntryObject +) => boolean; export type StateToString = (state: any) => string; export type ActionToString = (action: any) => string; export type ErrorToString = (error: any, prevState: any) => string; export interface ColorsObject { - title?: boolean | ActionToString; - prevState?: boolean | StateToString; - action?: boolean | ActionToString; - nextState?: boolean | StateToString; - error?: boolean | ErrorToString; + title?: boolean | ActionToString; + prevState?: boolean | StateToString; + action?: boolean | ActionToString; + nextState?: boolean | StateToString; + error?: boolean | ErrorToString; } export interface LevelObject { - prevState?: string | boolean | StateToString; - action?: string | boolean | ActionToString; - nextState?: string | boolean | StateToString; - error?: string | boolean | ErrorToString; + prevState?: string | boolean | StateToString; + action?: string | boolean | ActionToString; + nextState?: string | boolean | StateToString; + error?: string | boolean | ErrorToString; +} + +export interface LogEntryObject { + action?: string | boolean | ActionToString; + started?: number; + startedTime?: Date; + took?: number; + error?(error: any): any; + nextState?(state: any): any; + prevState?(state: any): any; } export interface ReduxLoggerOptions { - level?: string | ActionToString | LevelObject; - duration?: boolean; - timestamp?: boolean; - colors?: ColorsObject | false; - logger?: any; - logErrors?: boolean; - collapsed?: boolean | LoggerPredicate; - predicate?: LoggerPredicate; - stateTransformer?: (state: any) => any; - actionTransformer?: (action: any) => any; - errorTransformer?: (error: any) => any; - diff?: boolean; - diffPredicate?: LoggerPredicate; + level?: string | ActionToString | LevelObject; + duration?: boolean; + timestamp?: boolean; + colors?: ColorsObject | false; + logger?: any; + logErrors?: boolean; + collapsed?: boolean | LoggerPredicate; + predicate?: LoggerPredicate; + diff?: boolean; + diffPredicate?: LoggerPredicate; + stateTransformer?(state: any): any; + actionTransformer?(action: any): any; + errorTransformer?(error: any): any; } export function createLogger(options?: ReduxLoggerOptions): Redux.Middleware; diff --git a/types/redux-logger/package.json b/types/redux-logger/package.json index 4bcc170ca3..6d68bf2f9b 100644 --- a/types/redux-logger/package.json +++ b/types/redux-logger/package.json @@ -3,4 +3,4 @@ "dependencies": { "redux": "^3.6.0" } -} \ No newline at end of file +} diff --git a/types/redux-logger/redux-logger-tests.ts b/types/redux-logger/redux-logger-tests.ts index 7349e556c4..a3b77debd8 100644 --- a/types/redux-logger/redux-logger-tests.ts +++ b/types/redux-logger/redux-logger-tests.ts @@ -1,100 +1,104 @@ - -import { createLogger } from 'redux-logger'; -import logger from 'redux-logger'; +import logger, { createLogger } from 'redux-logger'; import { applyMiddleware, createStore } from 'redux'; -let loggerSimple = createLogger(); +const loggerSimple = createLogger(); -let loggerSimpleOpts = createLogger({ - duration: true, - timestamp: true, - logger: console, - logErrors: true, - predicate: (getState, action) => true, - stateTransformer: (state) => state, - actionTransformer: (action) => action, - errorTransformer: (error) => error, - diff: true, - diffPredicate: (getState, action) => true, +const loggerSimpleOpts = createLogger({ + duration: true, + timestamp: true, + logger: console, + logErrors: true, + predicate: (getState, action) => true, + stateTransformer: state => state, + actionTransformer: action => action, + errorTransformer: error => error, + diff: true, + diffPredicate: (getState, action) => true }); -let loggerCollapsedBool = createLogger({ - collapsed: true +const loggerCollapsedBool = createLogger({ + collapsed: true }); -let loggerCollapsedPredicate = createLogger({ - collapsed: (getAction, action) => true +const loggerCollapsedPredicate = createLogger({ + collapsed: (getAction, action) => true }); -let loggerColorsOverallBoolean = createLogger({ - colors: false +const loggerCollapsedLogEntryPredicate = createLogger({ + collapsed: (getAction, action, logEntry) => + logEntry !== undefined && !logEntry.error }); -let loggerColorsBoolean = createLogger({ - colors: { - title: false, - prevState: false, - action: false, - nextState: false, - error: false - } +const loggerColorsOverallBoolean = createLogger({ + colors: false }); -let loggerColorsFunction = createLogger({ - colors: { - title: (action) => '#000', - prevState: (state) => '#000', - action: (action) => '#000', - nextState: (state) => '#000', - error: (error, prevState) => '#000' - } +const loggerColorsBoolean = createLogger({ + colors: { + title: false, + prevState: false, + action: false, + nextState: false, + error: false + } }); -let loggerLevelString = createLogger({ - level: 'log' +const loggerColorsFunction = createLogger({ + colors: { + title: action => '#000', + prevState: state => '#000', + action: action => '#000', + nextState: state => '#000', + error: (error, prevState) => '#000' + } }); -let loggerLevelFunction = createLogger({ - level: (action) => 'log' +const loggerLevelString = createLogger({ + level: 'log' }); -let loggerLevelObjectFunction = createLogger({ - level: { - prevState: (state) => 'log', - action: (action) => 'log', - nextState: (state) => 'log', - error: (error, prevState) => 'log' - } +const loggerLevelFunction = createLogger({ + level: action => 'log' }); -let loggerLevelObjectBoolean = createLogger({ - level: { - prevState: false, - action: false, - nextState: false, - error: false - } +const loggerLevelObjectFunction = createLogger({ + level: { + prevState: state => 'log', + action: action => 'log', + nextState: state => 'log', + error: (error, prevState) => 'log' + } }); -let loggerLevelObjectString = createLogger({ - level: { - prevState: 'log', - action: 'log', - nextState: 'log', - error: 'log' - } +const loggerLevelObjectBoolean = createLogger({ + level: { + prevState: false, + action: false, + nextState: false, + error: false + } }); -let createStoreWithMiddleware = applyMiddleware( - logger, - loggerSimpleOpts, - loggerCollapsedBool, - loggerCollapsedPredicate, - loggerColorsBoolean, - loggerColorsFunction, - loggerLevelString, - loggerLevelFunction, - loggerLevelObjectFunction, - loggerLevelObjectBoolean, - loggerLevelObjectString +const loggerLevelObjectString = createLogger({ + level: { + prevState: 'log', + action: 'log', + nextState: 'log', + error: 'log' + } +}); + +const createStoreWithMiddleware = applyMiddleware( + logger, + loggerSimpleOpts, + loggerCollapsedBool, + loggerCollapsedPredicate, + loggerCollapsedLogEntryPredicate, + loggerColorsBoolean, + loggerColorsFunction, + loggerLevelString, + loggerLevelFunction, + loggerLevelObjectFunction, + loggerLevelObjectBoolean, + loggerLevelObjectString )(createStore); diff --git a/types/redux-logger/tsconfig.json b/types/redux-logger/tsconfig.json index 7441f646d7..1789641398 100644 --- a/types/redux-logger/tsconfig.json +++ b/types/redux-logger/tsconfig.json @@ -1,24 +1,16 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6", - "dom" - ], + "lib": ["es6", "dom"], "noImplicitAny": true, "noImplicitThis": false, "strictNullChecks": false, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "redux-logger-tests.ts" - ] -} \ No newline at end of file + "files": ["index.d.ts", "redux-logger-tests.ts"] +} diff --git a/types/redux-logger/tslint.json b/types/redux-logger/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/redux-logger/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From fee527c10343127ea695ac1370e893d60d0558d6 Mon Sep 17 00:00:00 2001 From: UrielCh Date: Fri, 20 Oct 2017 18:28:54 +0300 Subject: [PATCH 077/314] update CasperJS 1.0.29 to 1.1.4 (#20739) * update CasperJS 1.0.29 to 1.1.4 remove most oh the any type Set Optional parameter As Optional. * tslint casperJS --- types/casperjs/index.d.ts | 173 +++++++++++++++++++++++-------------- types/casperjs/tslint.json | 12 +++ 2 files changed, 119 insertions(+), 66 deletions(-) create mode 100644 types/casperjs/tslint.json diff --git a/types/casperjs/index.d.ts b/types/casperjs/index.d.ts index e8388d17c7..f2378f1f97 100644 --- a/types/casperjs/index.d.ts +++ b/types/casperjs/index.d.ts @@ -1,17 +1,17 @@ -// Type definitions for CasperJS v1.0.29 +// Type definitions for CasperJS 1.1 // Project: http://casperjs.org/ // Definitions by: Jed Mao +// Uriel Chemouni // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// - export function create(options?: CasperOptions): Casper; -export function selectXPath(expression: string): Object; +export function selectXPath(expression: string): object; export class Casper { - constructor(options: CasperOptions); test: Tester; @@ -23,23 +23,23 @@ export class Casper { // Methods back(): Casper; base64encode(url: string, method?: string, data?: any): string; - bypass(nb: number): any; - click(selector: string): boolean; + bypass(nb: number): Casper; + click(selector: string, X?: number | string, Y?: number | string): boolean; clickLabel(label: string, tag?: string): boolean; - capture(targetFilePath: string, clipRect: ClipRect): Casper; - captureBase64(format: string): string; - captureBase64(format: string, area: string): string; - captureBase64(format: string, area: ClipRect): string; - captureBase64(format: string, area: any): string; - captureSelector(targetFile: string, selector: string): Casper; + capture(targetFilePath: string, clipRect?: ClipRect, imgOptions?: ImgOptions): Casper; + captureBase64(format: string, area?: string | ClipRect | CasperSelector): string; + captureSelector(targetFile: string, selector: string, imgOptions?: ImgOptions): Casper; clear(): Casper; + clearCache(): Casper; + clearMemoryCache(): Casper; debugHTML(selector?: string, outer?: boolean): Casper; debugPage(): Casper; die(message: string, status?: number): Casper; - download(url: string, target?: string, method?: string, data?: any): Casper; + download(url: string, target: string, method?: string, data?: any): Casper; each(array: T[], fn: (this: Casper, item: T, index: number) => void): Casper; + eachThen(array: any[], then?: FunctionThen): Casper; echo(message: string, style?: string): Casper; - evaluate(fn: (...args: any[]) => T, ...args: any[]): T + evaluate(fn: (...args: any[]) => T, ...args: any[]): T; evaluateOrDie(fn: () => any, message?: string, status?: number): Casper; exit(status?: number): Casper; exists(selector: string): boolean; @@ -52,7 +52,7 @@ export class Casper { getCurrentUrl(): string; getElementAttribute(selector: string, attribute: string): string; getElementsAttribute(selector: string, attribute: string): string; - getElementBounds(selector: string): ElementBounds; + getElementBounds(selector: string, page?: boolean): ElementBounds | null; getElementsBounds(selector: string): ElementBounds[]; getElementInfo(selector: string): ElementInfo; getElementsInfo(selector: string): ElementInfo; @@ -61,83 +61,125 @@ export class Casper { getHTML(selector?: string, outer?: boolean): string; getPageContent(): string; getTitle(): string; - mouseEvent(type: string, selector: string): boolean; + mouseEvent(type: string, selector: string, X?: number|string, Y?: number|string): boolean; + newPage(): any; open(location: string, settings: OpenSettings): Casper; - reload(then?: (response: HttpResponse) => void): Casper; - repeat(times: number, then: Function): Casper; - resourceExists(test: Function): boolean; - resourceExists(test: string): boolean; - run(onComplete: Function, time?: number): Casper; + reload(then?: FunctionThen): Casper; + repeat(times: number, then: FunctionThen): Casper; + resourceExists(test: string | Function | RegExp): boolean; + run(onComplete?: Function, time?: number): Casper; scrollTo(x: number, y: number): Casper; scrollToBottom(): Casper; - sendKeys(selector: string, keys: string, options?: any): Casper; + sendKeys(selector: string, keys: string, options?: KeyOptions): Casper; setHttpAuth(username: string, password: string): Casper; - start(url?: string, then?: (response: HttpResponse) => void): Casper; - status(asString: boolean): any; + setMaxListeners(maxListeners: number): Casper; + start(url?: string, then?: FunctionThen): Casper; + status(asString?: false): number; + status(asString: true): string; + switchToFrame(frameInfo: string | number): Casper; + switchToMainFrame(): Casper; + switchToParentFrame(): Casper; then(fn: (this: Casper) => void): Casper; thenBypass(nb: number): Casper; thenBypassIf(condition: any, nb: number): Casper; thenBypassUnless(condition: any, nb: number): Casper; - thenClick(selector: string): Casper; + thenClick(selector: string, then?: FunctionThen): Casper; thenEvaluate(fn: () => any, ...args: any[]): Casper; thenOpen(location: string, then?: (response: HttpResponse) => void): Casper; thenOpen(location: string, options?: OpenSettings, then?: (response: HttpResponse) => void): Casper; - thenOpenAndEvaluate(location: string, then?: Function, ...args: any[]): Casper; + thenOpenAndEvaluate(location: string, then?: FunctionThen, ...args: any[]): Casper; toString(): string; unwait(): Casper; - userAgent(agent: string): string; - viewport(width: number, height: number): Casper; + // 2017-10-19 Doc said returning String but code return Casper object. + userAgent(agent: string): Casper; + viewport(width: number, height: number, then?: FunctionThen): Casper; visible(selector: string): boolean; - wait(timeout: number, then?: Function): Casper; - waitFor(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForAlert(then: Function, onTimeout?: Function, timeout?: number): Casper; - waitForPopup(urlPattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForPopup(urlPattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForUrl(url: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForUrl(url: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitWhileSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForResource(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForText(pattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForText(pattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitUntilVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitWhileVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; + wait(timeout: number, then?: FunctionThen): Casper; + waitFor(testFx: Function, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number, details?: any): Casper; + waitForAlert(then: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper; + waitForExec(command: string | null, parameter: string[], then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper; + waitForPopup(urlPattern: RegExp | string | number | FindByUrlNameTitle, then?: FunctionThen, onTimeout?: Function, timeout?: number): Casper; + waitForResource(testFx: RegExp | string | ((resource: {url: string}) => boolean), then?: FunctionThen, onTimeout?: Function, timeout?: number): Casper; + waitForUrl(url: RegExp | string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper; + waitForSelector(selector: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper; + waitWhileSelector(selector: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper; + waitForSelectorTextChange(selectors: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper; + waitForText(pattern: RegExp | string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper; + waitUntilVisible(selector: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper; + waitWhileVisible(selector: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper; warn(message: string): Casper; - withFrame(frameInfo: string, then: Function): Casper; - withFrame(frameInfo: number, then: Function): Casper; - withPopup(popupInfo: string, step: Function): Casper; - withPopup(popupInfo: RegExp, step: Function): Casper; + withFrame(frameInfo: string | number, then: FunctionThen): Casper; + withPopup(popupInfo: RegExp | string | number | FindByUrlNameTitle, step: FunctionThen): Casper; + withSelectorScope(selector: string, then: FunctionThen): Casper; zoom(factor: number): Casper; - removeAllFilters(filter: string): Casper; - setFilter(filter: string, cb: Function): boolean; + // do not exists anymore + // removeAllFilters(filter: string): Casper; + // do not exists anymore + // setFilter(filter: string, cb: Function): boolean; } -interface HttpResponse { +export type FunctionThen = (this: Casper, response: HttpResponse) => void; +export type FunctionOnTimeout = (this: Casper, timeout: number, details: any) => void; +// not visible in doc +// interface QtRuntimeObject {id?: any; url?: string;} +// see modules/pagestack.js in casperjs + +export interface ImgOptions { + // format to set the image format manually, avoiding relying on the filename + format?: string; + // quality to set the image quality, from 1 to 100 + quality?: number; +} + +export interface FindByUrlNameTitle { + url?: string; + title?: string; + windowName?: string; +} + +export interface Header { + name: string; + value: string; +} + +export interface CasperSelector { + type?: 'xpath' | 'css'; + path: string; +} + +export interface KeyOptions { + reset?: boolean; + keepFocus?: boolean; + modifiers?: string; // combinaison of 'ctrl+alt+shift+meta+keypad' +} + +export interface HttpResponse { contentType: string; - headers: any[]; + headers: Header[]; id: number; - redirectURL: string; + redirectURL: string | null; stage: string; status: number; statusText: string; time: string; url: string; + data: any; } -interface OpenSettings { +export interface OpenSettings { method: string; data: any; headers: any; } -interface ElementBounds { +export interface ElementBounds { top: number; left: number; width: number; height: number; } -interface ElementInfo { +export interface ElementInfo { nodeName: string; attributes: any; tag: string; @@ -150,7 +192,7 @@ interface ElementInfo { visible: boolean; } -interface CasperOptions { +export interface CasperOptions { clientScripts?: any[]; exitOnError?: boolean; httpStatusHandlers?: any; @@ -179,7 +221,7 @@ interface CasperOptions { waitTimeout?: number; } -interface ClientUtils { +export interface ClientUtils { echo(message: string): void; encode(contents: string): void; exists(selector: string): void; @@ -200,12 +242,12 @@ interface ClientUtils { visible(selector: string): void; } -interface Colorizer { +export interface Colorizer { colorize(text: string, styleName: string): void; format(text: string, style: any): void; } -interface Tester { +export interface Tester { assert(condition: boolean, message?: string): any; assertDoesntExist(selector: string, message?: string): any; assertElementCount(selctor: string, expected: number, message?: string): any; @@ -235,15 +277,14 @@ interface Tester { assertTruthy(subject: any, message?: string): any; assertType(input: any, type: string, message?: string): any; assertInstanceOf(input: any, ctor: Function, message?: string): any; - assertUrlMatch(pattern: string, message?: string): any; - assertUrlMatch(pattern: RegExp, message?: string): any; + assertUrlMatch(pattern: RegExp | string, message?: string): any; assertVisible(selector: string, message?: string): any; /* since 1.1 */ begin(description: string, planned: number, suite: Function): any; begin(description: string, suite: Function): any; - begin(description: string, planned: number, config: Object): any; - begin(description: string, config: Object): any; + begin(description: string, planned: number, config: object): any; + begin(description: string, config: object): any; colorize(message: string, style: string): any; comment(message: string): any; @@ -262,12 +303,12 @@ interface Tester { tearDown(fn: Function): any; } -interface Cases { +export interface Cases { length: number; cases: Case[]; } -interface Case { +export interface Case { success: boolean; type: string; standard: string; @@ -275,12 +316,12 @@ interface Case { values: CaseValues; } -interface CaseValues { +export interface CaseValues { subject: boolean; expected: boolean; } -interface Utils { +export interface Utils { betterTypeOf(input: any): any; dump(value: any): any; fileExt(file: string): any; diff --git a/types/casperjs/tslint.json b/types/casperjs/tslint.json new file mode 100644 index 0000000000..c2a140228c --- /dev/null +++ b/types/casperjs/tslint.json @@ -0,0 +1,12 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // need to fix some Function type + "ban-types": false, + // can not merge + // begin(description: string, planned: number, suite: Function): any; + // and + // begin(description: string, planned: number, config: object): any; + "unified-signatures": false + } +} From 09b08e4b7d90608d4849bfd7aecc937860314ea9 Mon Sep 17 00:00:00 2001 From: Alessandro Vergani Date: Fri, 20 Oct 2017 18:10:45 +0200 Subject: [PATCH 078/314] Fix circular-json declarations to match JSON object (#20755) * Fix circular-json declarations * Simplify definitions of circular-json --- types/circular-json/circular-json-tests.ts | 10 +++------- types/circular-json/index.d.ts | 13 +++---------- types/circular-json/tslint.json | 3 +++ 3 files changed, 9 insertions(+), 17 deletions(-) create mode 100644 types/circular-json/tslint.json diff --git a/types/circular-json/circular-json-tests.ts b/types/circular-json/circular-json-tests.ts index 41ec8f0a36..786ec5cec6 100644 --- a/types/circular-json/circular-json-tests.ts +++ b/types/circular-json/circular-json-tests.ts @@ -1,14 +1,10 @@ - import CircularJSON = require('circular-json'); -var replacer = (key: any, val: any) => { +const replacer = (key: any, val: any) => { return val; -} +}; -var replacerArray = ['a', 'x']; - -// implements JSON interface -var json_obj: JSON = CircularJSON; +const replacerArray = ['a', 'x']; CircularJSON.parse('{"a":"b"}'); diff --git a/types/circular-json/index.d.ts b/types/circular-json/index.d.ts index 1b4e5c1d2b..ce94972de4 100644 --- a/types/circular-json/index.d.ts +++ b/types/circular-json/index.d.ts @@ -1,14 +1,7 @@ -// Type definitions for circular-json v0.1.6 +// Type definitions for circular-json 0.4 // Project: https://github.com/WebReflection/circular-json // Definitions by: Jonathan Pevarnek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface ICircularJSON extends JSON { - parse(text: string, reviver?: (key: any, value: any) => any): any; - stringify(value: any, replacer?: ((key: string, value: any) => any) | any[], space?: any, placeholder?: boolean): string; -} - -declare var CircularJSON: ICircularJSON; - -export = CircularJSON; +export function parse(text: string, reviver?: (key: any, value: any) => any): any; +export function stringify(value: any, replacer?: ((key: string, value: any) => any) | Array | null, space?: any, placeholder?: boolean): string; diff --git a/types/circular-json/tslint.json b/types/circular-json/tslint.json new file mode 100644 index 0000000000..b4b47a0378 --- /dev/null +++ b/types/circular-json/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From bba52abf8e508948643f09549b9b9fde025a4f33 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 20 Oct 2017 10:00:14 -0700 Subject: [PATCH 079/314] js-data-angular and js-data-http: Add dependency on the old @types/js-data (#20689) --- types/js-data-angular/package.json | 6 ++++++ types/js-data-http/package.json | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 types/js-data-angular/package.json create mode 100644 types/js-data-http/package.json diff --git a/types/js-data-angular/package.json b/types/js-data-angular/package.json new file mode 100644 index 0000000000..f932c0aa52 --- /dev/null +++ b/types/js-data-angular/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "@types/js-data": "^2.8.31" + } +} diff --git a/types/js-data-http/package.json b/types/js-data-http/package.json new file mode 100644 index 0000000000..f932c0aa52 --- /dev/null +++ b/types/js-data-http/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "@types/js-data": "^2.8.31" + } +} From ab68c62063e2289fcf636ab9d2f3aa4f7b3ddc9a Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 20 Oct 2017 10:00:53 -0700 Subject: [PATCH 080/314] signals: Lint (#20648) --- types/signals/index.d.ts | 24 ++-- types/signals/signals-tests.ts | 206 ++++++++++++++++----------------- types/signals/tslint.json | 8 ++ 3 files changed, 125 insertions(+), 113 deletions(-) create mode 100644 types/signals/tslint.json diff --git a/types/signals/index.d.ts b/types/signals/index.d.ts index 3f0ed1fa84..50982ec988 100644 --- a/types/signals/index.d.ts +++ b/types/signals/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for JS-Signals +// Type definitions for JS-Signals 1.0 // Project: http://millermedeiros.github.io/js-signals/ // Definitions by: Diullei Gomes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare var signals: signals.SignalWrapper; @@ -9,9 +10,8 @@ export = signals; export as namespace signals; declare namespace signals { - interface SignalWrapper { - Signal: Signal + Signal: Signal; } interface SignalBinding { @@ -57,17 +57,21 @@ declare namespace signals { * * @param listener Signal handler function. * @param listenercontext Context on which listener will be executed (object that should represent the `this` variable inside listener function). - * @param priority The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0) + * @param priority The priority level of the event listener. + * Listeners with higher priority will be executed before listeners with lower priority. + * Listeners with same priority level will be executed at the same order as they were added. (default = 0) */ add(listener: (...params: T[]) => void, listenerContext?: any, priority?: Number): SignalBinding; /** - * Add listener to the signal that should be removed after first execution (will be executed only once). - * - * @param listener Signal handler function. - * @param listenercontext Context on which listener will be executed (object that should represent the `this` variable inside listener function). - * @param priority The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0) - */ + * Add listener to the signal that should be removed after first execution (will be executed only once). + * + * @param listener Signal handler function. + * @param listenercontext Context on which listener will be executed (object that should represent the `this` variable inside listener function). + * @param priority The priority level of the event listener. + * Listeners with higher priority will be executed before listeners with lower priority. + * Listeners with same priority level will be executed at the same order as they were added. (default = 0) + */ addOnce(listener: (...params: T[]) => void, listenerContext?: any, priority?: Number): SignalBinding; /** diff --git a/types/signals/signals-tests.ts b/types/signals/signals-tests.ts index 414b91edd7..b3d16d9d39 100644 --- a/types/signals/signals-tests.ts +++ b/types/signals/signals-tests.ts @@ -1,207 +1,207 @@ import signals = require("signals"); // lifted from https://github.com/millermedeiros/js-signals/wiki/Examples interface TestObject { - started: signals.Signal; - stopped: signals.Signal; + started: signals.Signal; + stopped: signals.Signal; } -namespace Signals.Tests { - //store local reference for brevity - var Signal = signals.Signal; +function tests() { + // store local reference for brevity + const Signal = signals.Signal; - //custom object that dispatch signals - var myObject: TestObject = { - started : new Signal(), //past tense is the recommended signal naming convention + // custom object that dispatch signals + const myObject: TestObject = { + started : new Signal(), // past tense is the recommended signal naming convention stopped : new Signal() }; - //single listener - function onStarted(param1:string, param2:string){ + // single listener + function onStarted(param1: string, param2: string) { alert(param1 + param2); } - myObject.started.add(onStarted); //add listener - myObject.started.dispatch('foo', 'bar'); //dispatch signal passing custom parameters - myObject.started.remove(onStarted); //remove a single listener + myObject.started.add(onStarted); // add listener + myObject.started.dispatch('foo', 'bar'); // dispatch signal passing custom parameters + myObject.started.remove(onStarted); // remove a single listener - //multiple listeners - function onStopped(){ + // multiple listeners + function onStopped() { alert('stopped'); } - function onStopped2(){ + function onStopped2() { alert('stopped listener 2'); } myObject.stopped.add(onStopped); myObject.stopped.add(onStopped2); myObject.stopped.dispatch(); - myObject.stopped.removeAll(); //remove all listeners of the `stopped` signal + myObject.stopped.removeAll(); // remove all listeners of the `stopped` signal - //multiple dispatches - var i = 0; - myObject.started.add(function(){ + // multiple dispatches + let i = 0; + myObject.started.add(() => { i += 1; alert(i); }); - myObject.started.dispatch(); //will alert 1 - myObject.started.dispatch(); //will alert 2 + myObject.started.dispatch(); // will alert 1 + myObject.started.dispatch(); // will alert 2 - //multiple dispatches + addOnce() - var i = 0; - myObject.started.addOnce(function(){ + // multiple dispatches + addOnce() + i = 0; + myObject.started.addOnce(() => { i += 1; alert(i); }); - myObject.started.dispatch(); //will alert 1 - myObject.started.dispatch(); //nothing happens + myObject.started.dispatch(); // will alert 1 + myObject.started.dispatch(); // nothing happens - //enable/disable signal - var i = 0; - myObject.started.add(function(){ + // enable/disable signal + i = 0; + myObject.started.add(() => { i += 1; alert(i); }); - myObject.started.dispatch(); //will alert 1 + myObject.started.dispatch(); // will alert 1 myObject.started.active = false; - myObject.started.dispatch(); //nothing happens + myObject.started.dispatch(); // nothing happens myObject.started.active = true; - myObject.started.dispatch(); //will alert 2 + myObject.started.dispatch(); // will alert 2 - //Stop/Halt Propagation (method 1) - myObject.started.add(function(){ - myObject.started.halt(); //prevent next listeners on the queue from being executed + // Stop/Halt Propagation (method 1) + myObject.started.add(() => { + myObject.started.halt(); // prevent next listeners on the queue from being executed }); - myObject.started.add(function(){ - alert('second listener'); //won't be called since first listener stops propagation + myObject.started.add(() => { + alert('second listener'); // won't be called since first listener stops propagation }); myObject.started.dispatch(); - //Stop/Halt Propagation (method 2) - myObject.started.add(function(){ - return false; //if handler returns `false` will also stop propagation + // Stop/Halt Propagation (method 2) + myObject.started.add(() => { + return false; // if handler returns `false` will also stop propagation }); - myObject.started.add(function(){ - alert('second listener'); //won't be called since first listener stops propagation + myObject.started.add(() => { + alert('second listener'); // won't be called since first listener stops propagation }); myObject.started.dispatch(); - //Set execution context of the listener handler - var foo = 'bar'; - var obj = { + // Set execution context of the listener handler + const foo = 'bar'; + const obj = { foo : 10 }; - function handler1(){ + function handler1() { alert(this.foo); } - function handler2(){ + function handler2() { alert(this.foo); } - //note that you cannot add the same handler twice to the same signal without removing it first - myObject.started.add(handler1); //default execution context - myObject.started.add(handler2, obj); //set a different execution context - myObject.started.dispatch(); //first handler will alert "bar", second will alert "10". + // note that you cannot add the same handler twice to the same signal without removing it first + myObject.started.add(handler1); // default execution context + myObject.started.add(handler2, obj); // set a different execution context + myObject.started.dispatch(); // first handler will alert "bar", second will alert "10". } -namespace Signals.AdvancedTests { - //store local reference for brevity - var Signal = signals.Signal; +function advancedTests() { + // store local reference for brevity + const Signal = signals.Signal; - //custom object that dispatch signals - var myObject: TestObject = { - started : new Signal(), //past tense is the recommended signal naming convention + // custom object that dispatch signals + const myObject: TestObject = { + started : new Signal(), // past tense is the recommended signal naming convention stopped : new Signal() }; - //Set listener priority/order (v0.5.3+) - var handler1 = function(){ + // Set listener priority/order (v0.5.3+) + let handler1 = () => { alert('foo'); }; - var handler2 = function(){ + let handler2 = () => { alert('bar'); }; - myObject.started.add(handler1); //default priority is 0 - myObject.started.add(handler2, null, 2); //setting priority to 2 will make `handler2` execute before `handler1` - myObject.started.dispatch(); //will alert "bar" than "foo" + myObject.started.add(handler1); // default priority is 0 + myObject.started.add(handler2, null, 2); // setting priority to 2 will make `handler2` execute before `handler1` + myObject.started.dispatch(); // will alert "bar" than "foo" - //Enable/Disable a single SignalBinding - var handler1 = function(){ + // Enable/Disable a single SignalBinding + handler1 = () => { alert('foo bar'); }; - var handler2 = function(){ + handler2 = () => { alert('lorem ipsum'); }; - var binding1 = myObject.started.add(handler1); //methods `add()` and `addOnce()` returns a SignalBinding object + let binding1 = myObject.started.add(handler1); // methods `add()` and `addOnce()` returns a SignalBinding object myObject.started.add(handler2); - myObject.started.dispatch(); //will alert "foo bar" than "lorem ipsum" - binding1.active = false; //disable a single binding - myObject.started.dispatch(); //will alert "lorem ipsum" + myObject.started.dispatch(); // will alert "foo bar" than "lorem ipsum" + binding1.active = false; // disable a single binding + myObject.started.dispatch(); // will alert "lorem ipsum" binding1.active = true; - myObject.started.dispatch(); //will alert "foo bar" than "lorem ipsum" + myObject.started.dispatch(); // will alert "foo bar" than "lorem ipsum" - //Manually execute a signal handler - var handler = function(){ + // Manually execute a signal handler + const handler = () => { alert('foo bar'); }; - var binding: signals.SignalBinding<() => void> = myObject.started.add(handler); //methods `add()` and `addOnce()` returns a SignalBinding object - binding.execute(); //will alert "foo bar" + let binding: signals.SignalBinding<() => void> = myObject.started.add(handler); // methods `add()` and `addOnce()` returns a SignalBinding object + binding.execute(); // will alert "foo bar" - //Retrieve anonymous listener - var binding:signals.SignalBinding<() => void> = myObject.started.add(function(){ + // Retrieve anonymous listener + binding = myObject.started.add(() => { alert('foo bar'); }); // note: in the original docs, this is handler, but that collides with handler above because these are in one giant scope // perhaps these are best split into functions for readability - var anonymousHandler = binding.getListener(); //reference to the anonymous function + const anonymousHandler = binding.getListener(); // reference to the anonymous function - //Remove / Detach anonymous listener - var binding:signals.SignalBinding<() => void> = myObject.started.add(function(){ + // Remove / Detach anonymous listener + binding = myObject.started.add(() => { alert('foo bar'); }); - myObject.started.dispatch(); //will alert "foo bar" + myObject.started.dispatch(); // will alert "foo bar" binding.detach(); - alert(binding.isBound()); //will alert `false` - myObject.started.dispatch(); //nothing happens + alert(binding.isBound()); // will alert `false` + myObject.started.dispatch(); // nothing happens - //Check if binding will execute only once - var binding1:signals.SignalBinding = myObject.started.add(function(){ + // Check if binding will execute only once + binding1 = myObject.started.add(() => { alert('foo bar'); }); - var binding2:signals.SignalBinding<() => void> = myObject.started.addOnce(function(){ + const binding2: signals.SignalBinding<() => void> = myObject.started.addOnce(() => { alert('foo bar'); }); - alert(binding1.isOnce()); //alert "false" - alert(binding2.isOnce()); //alert "true" + alert(binding1.isOnce()); // alert "false" + alert(binding2.isOnce()); // alert "true" - //Change listener execution context on-the-fly - var foo = 'bar'; - var obj = { + // Change listener execution context on-the-fly + const foo = 'bar'; + const obj = { foo : "it's over 9000!" }; - var binding:signals.SignalBinding<() => void> = myObject.started.add(function(){ + binding = myObject.started.add(function() { alert(this.foo); }); - myObject.started.dispatch(); //will alert "bar" + myObject.started.dispatch(); // will alert "bar" binding.context = obj; - myObject.started.dispatch(); //will alert "it's over 9000!" + myObject.started.dispatch(); // will alert "it's over 9000!" - //Add default parameters to Signal dispatch (v0.6.3+) - var binding:signals.SignalBinding<() => void> = myObject.started.add(function(a:string, b:string, c:string){ - alert(a +' '+ b +' '+ c); + // Add default parameters to Signal dispatch (v0.6.3+) + binding = myObject.started.add((a: string, b: string, c: string) => { + alert(`${a} ${b} ${c}`); }); - binding.params = ['lorem', 'ipsum']; //set default parameters of the binding - myObject.started.dispatch('dolor'); //will alert "lorem ipsum dolor" + binding.params = ['lorem', 'ipsum']; // set default parameters of the binding + myObject.started.dispatch('dolor'); // will alert "lorem ipsum dolor" - //Check if Signal has specific listener (v0.7.0+) - function onStart(a:string){ + // Check if Signal has specific listener (v0.7.0+) + function onStart(a: string) { console.log(a); } myObject.started.add(onStart); myObject.started.has(onStart); // true - //Memorize previously dispatched values / forget values (v0.7.0+) + // Memorize previously dispatched values / forget values (v0.7.0+) myObject.started.memorize = true; // default is false myObject.started.dispatch('foo'); diff --git a/types/signals/tslint.json b/types/signals/tslint.json new file mode 100644 index 0000000000..09c89d645d --- /dev/null +++ b/types/signals/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "ban-types": false, + "no-misused-new": false + } +} From e51980df25f26e7aa53816a4d6b5cf991a715454 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 20 Oct 2017 10:02:01 -0700 Subject: [PATCH 081/314] openpgp: Convert to external module (#20622) --- types/openpgp/index.d.ts | 407 ++++++++++++++++----------------- types/openpgp/openpgp-tests.ts | 4 +- types/openpgp/tslint.json | 20 ++ 3 files changed, 221 insertions(+), 210 deletions(-) create mode 100644 types/openpgp/tslint.json diff --git a/types/openpgp/index.d.ts b/types/openpgp/index.d.ts index 91b8dc2ca6..79e92daa7f 100644 --- a/types/openpgp/index.d.ts +++ b/types/openpgp/index.d.ts @@ -3,120 +3,119 @@ // Definitions by: Guillaume Lacasa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace openpgp { +export as namespace openpgp; - interface KeyPair { - key: key.Key, - privateKeyArmored: string, - publicKeyArmored: string - } - - interface KeyOptions { - keyType?: enums.publicKey, - numBits: number, - userId: string, - passphrase: string, - unlocked?: boolean - } - - interface Keyid { - bytes: string, - } - - interface Signature { - keyid: Keyid, - valid: boolean - } - - interface VerifiedMessage { - text: string, - signatures: Array - } - - /** Decrypts message and verifies signatures - - @param privateKey private key with decrypted secret key data - @param publicKeys array of keys to verify signatures - @param msg the message object with signed and encrypted data - */ - function decryptAndVerifyMessage(privateKey: key.Key, publicKeys: Array, msg: string): Promise; - /** Decrypts message and verifies signatures - - @param privateKey private key with decrypted secret key data - @param publicKey single key to verify signatures - @param msg the message object with signed and encrypted data - */ - function decryptAndVerifyMessage(privateKey: key.Key, publicKey: key.Key, msg: string): Promise; - - /** Decrypts message - - @param privateKey private key with decrypted secret key data - @param msg the message object with the encrypted data - */ - function decryptMessage(privateKey: key.Key, msg: message.Message): Promise; - - /** Encrypts message text with keys - @param keys array of keys used to encrypt the message - @param text message as native JavaScript string - @returns encrypted ASCII armored message - */ - function encryptMessage(keys: Array, message: string): Promise; - /** Encrypts message text with keys - - @param single key used to encrypt the message - @param text message as native JavaScript string - */ - function encryptMessage(key: key.Key, message: string): Promise; - - /** Generates a new OpenPGP key pair. Currently only supports RSA keys. Primary and subkey will be of same type. - @param options - */ - function generateKeyPair(options: KeyOptions): Promise; - - /** Signs message text and encrypts it - - @param publicKeys array of keys used to encrypt the message - @param privateKey private key with decrypted secret key data for signing - @param text private key with decrypted secret key data for signing - */ - function signAndEncryptMessage(publicKeys: Array, privateKey: key.Key, text: string): Promise; - /** Signs message text and encrypts it - - @param publicKeys single key used to encrypt the message - @param privateKey private key with decrypted secret key data for signing - @param text private key with decrypted secret key data for signing - */ - function signAndEncryptMessage(publicKey: key.Key, privateKey: key.Key, text: string): Promise; - - /** Signs a cleartext message - - @param privateKeys array of keys with decrypted secret key data to sign cleartext - @param text cleartext - */ - function signClearMessage(privateKeys: Array, text: string): Promise; - /** Signs a cleartext message - - @param privateKeys single key with decrypted secret key data to sign cleartext - @param text cleartext - */ - function signClearMessage(privateKey: key.Key, text: string): Promise; - - /** Verifies signatures of cleartext signed message - - @param publicKeys array of keys to verify signatures - @param msg cleartext message object with signatures - */ - function verifyClearSignedMessage(publicKeys: Array, msg: cleartext.CleartextMessage): Promise; - /** Verifies signatures of cleartext signed message - - @param publicKeys single key to verify signatures - @param msg cleartext message object with signatures - */ - function verifyClearSignedMessage(publicKey: key.Key, msg: cleartext.CleartextMessage): Promise; +export interface KeyPair { + key: key.Key, + privateKeyArmored: string, + publicKeyArmored: string } -declare namespace openpgp.armor { +export interface KeyOptions { + keyType?: enums.publicKey, + numBits: number, + userId: string, + passphrase: string, + unlocked?: boolean +} +export interface Keyid { + bytes: string, +} + +export interface Signature { + keyid: Keyid, + valid: boolean +} + +export interface VerifiedMessage { + text: string, + signatures: Array +} + +/** Decrypts message and verifies signatures + + @param privateKey private key with decrypted secret key data + @param publicKeys array of keys to verify signatures + @param msg the message object with signed and encrypted data + */ +export function decryptAndVerifyMessage(privateKey: key.Key, publicKeys: Array, msg: string): Promise; +/** Decrypts message and verifies signatures + + @param privateKey private key with decrypted secret key data + @param publicKey single key to verify signatures + @param msg the message object with signed and encrypted data + */ +export function decryptAndVerifyMessage(privateKey: key.Key, publicKey: key.Key, msg: string): Promise; + +/** Decrypts message + + @param privateKey private key with decrypted secret key data + @param msg the message object with the encrypted data + */ +export function decryptMessage(privateKey: key.Key, msg: message.Message): Promise; + +/** Encrypts message text with keys + @param keys array of keys used to encrypt the message + @param text message as native JavaScript string + @returns encrypted ASCII armored message + */ +export function encryptMessage(keys: Array, message: string): Promise; +/** Encrypts message text with keys + + @param single key used to encrypt the message + @param text message as native JavaScript string + */ +export function encryptMessage(key: key.Key, message: string): Promise; + +/** Generates a new OpenPGP key pair. Currently only supports RSA keys. Primary and subkey will be of same type. + @param options + */ +export function generateKeyPair(options: KeyOptions): Promise; + +/** Signs message text and encrypts it + + @param publicKeys array of keys used to encrypt the message + @param privateKey private key with decrypted secret key data for signing + @param text private key with decrypted secret key data for signing + */ +export function signAndEncryptMessage(publicKeys: Array, privateKey: key.Key, text: string): Promise; +/** Signs message text and encrypts it + + @param publicKeys single key used to encrypt the message + @param privateKey private key with decrypted secret key data for signing + @param text private key with decrypted secret key data for signing + */ +export function signAndEncryptMessage(publicKey: key.Key, privateKey: key.Key, text: string): Promise; + +/** Signs a cleartext message + + @param privateKeys array of keys with decrypted secret key data to sign cleartext + @param text cleartext + */ +export function signClearMessage(privateKeys: Array, text: string): Promise; +/** Signs a cleartext message + + @param privateKeys single key with decrypted secret key data to sign cleartext + @param text cleartext + */ +export function signClearMessage(privateKey: key.Key, text: string): Promise; + +/** Verifies signatures of cleartext signed message + + @param publicKeys array of keys to verify signatures + @param msg cleartext message object with signatures + */ +export function verifyClearSignedMessage(publicKeys: Array, msg: cleartext.CleartextMessage): Promise; +/** Verifies signatures of cleartext signed message + + @param publicKeys single key to verify signatures + @param msg cleartext message object with signatures + */ +export function verifyClearSignedMessage(publicKey: key.Key, msg: cleartext.CleartextMessage): Promise; + + +export namespace armor { /** Armor an OpenPGP binary packet block @param messagetype type of the message @@ -133,8 +132,7 @@ declare namespace openpgp.armor { function dearmor(text: string): Object; } -declare namespace openpgp.cleartext { - +export namespace cleartext { /** Class that represents an OpenPGP cleartext signed message. */ interface CleartextMessage { @@ -164,7 +162,7 @@ declare namespace openpgp.cleartext { function readArmored(armoredText: string): CleartextMessage; } -declare namespace openpgp.config { +export namespace config { var prefer_hash_algorithm: enums.hash; var encryption_cipher: enums.symmetric; var compression: enums.compression; @@ -175,7 +173,7 @@ declare namespace openpgp.config { var debug: boolean; } -declare namespace openpgp.crypto { +export namespace crypto { interface Mpi { data: number, read(input: string): number, @@ -211,92 +209,92 @@ declare namespace openpgp.crypto { @param data Data to be encrypted as MPI */ function publicKeyEncrypt(algo: enums.publicKey, publicMPIs: Array, data: Mpi): Array; + + + namespace cfb { + /** This function decrypts a given plaintext using the specified blockcipher to decrypt a message + @param cipherfn the algorithm cipher class to decrypt data in one block_size encryption + @param key binary string representation of key to be used to decrypt the ciphertext. This will be passed to the cipherfn + @param ciphertext to be decrypted provided as a string + @param resync a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Decryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. + */ + function decrypt(cipherfn: string, key: string, ciphertext: string, resync: boolean): string; + + /** This function encrypts a given with the specified prefixrandom using the specified blockcipher to encrypt a message + @param prefixrandom random bytes of block_size length provided as a string to be used in prefixing the data + @param cipherfn the algorithm cipher class to encrypt data in one block_size encryption + @param plaintext data to be encrypted provided as a string + @param key binary string representation of key to be used to encrypt the plaintext. This will be passed to the cipherfn + @param resync a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Encryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. + */ + function encrypt(prefixrandom: string, cipherfn: string, plaintext: string, key: string, resync: boolean): string; + + /** Decrypts the prefixed data for the Modification Detection Code (MDC) computation + @param cipherfn cipherfn.encrypt Cipher function to use + @param key binary string representation of key to be used to check the mdc This will be passed to the cipherfn + @param ciphertext The encrypted data + */ + function mdc(cipherfn: Object, key: string, ciphertext: string): string; + } + + namespace hash { + /** Create a hash on the specified data using the specified algorithm + @param algo Hash algorithm type + @param data Data to be hashed + */ + function digest(algo: enums.hash, data: string): string; + + /** Returns the hash size in bytes of the specified hash algorithm type + @param algo Hash algorithm type + */ + function getHashByteLength(algo: enums.hash): number; + } + + namespace random { + /** Create a secure random big integer of bits length + @param bits Bit length of the MPI to create + */ + function getRandomBigInteger(bits: number): number; + + /** Retrieve secure random byte string of the specified length + @param length Length in bytes to generate + */ + function getRandomBytes(length: number): string; + + /** Helper routine which calls platform specific crypto random generator + @param buf + */ + function getRandomValues(buf: Uint8Array): void; + + /** Return a secure random number in the specified range + @param from Min of the random number + @param to Max of the random number (max 32bit) + */ + function getSecureRandom(from: number, to: number): number; + } + + namespace signature { + /** Create a signature on data using the specified algorithm + @param hash_algo hash Algorithm to use + @param algo Asymmetric cipher algorithm to use + @param publicMPIs Public key multiprecision integers of the private key + @param secretMPIs Private key multiprecision integers which is used to sign the data + @param data Data to be signed + */ + function sign(hash_algo: enums.hash, algo: enums.publicKey, publicMPIs: Array, secretMPIs: Array, data: string): Mpi; + + /** + @param algo public Key algorithm + @param hash_algo Hash algorithm + @param msg_MPIs Signature multiprecision integers + @param publickey_MPIs Public key multiprecision integers + @param data Data on where the signature was computed on + */ + function verify(algo: enums.publicKey, hash_algo: enums.hash, msg_MPIs: Array, publickey_MPIs: Array, data: string): boolean; + } } -declare namespace openpgp.crypto.cfb { - /** This function decrypts a given plaintext using the specified blockcipher to decrypt a message - @param cipherfn the algorithm cipher class to decrypt data in one block_size encryption - @param key binary string representation of key to be used to decrypt the ciphertext. This will be passed to the cipherfn - @param ciphertext to be decrypted provided as a string - @param resync a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Decryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. - */ - function decrypt(cipherfn: string, key: string, ciphertext: string, resync: boolean): string; - - /** This function encrypts a given with the specified prefixrandom using the specified blockcipher to encrypt a message - @param prefixrandom random bytes of block_size length provided as a string to be used in prefixing the data - @param cipherfn the algorithm cipher class to encrypt data in one block_size encryption - @param plaintext data to be encrypted provided as a string - @param key binary string representation of key to be used to encrypt the plaintext. This will be passed to the cipherfn - @param resync a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Encryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. - */ - function encrypt(prefixrandom: string, cipherfn: string, plaintext: string, key: string, resync: boolean): string; - - /** Decrypts the prefixed data for the Modification Detection Code (MDC) computation - @param cipherfn cipherfn.encrypt Cipher function to use - @param key binary string representation of key to be used to check the mdc This will be passed to the cipherfn - @param ciphertext The encrypted data - */ - function mdc(cipherfn: Object, key: string, ciphertext: string): string; -} - -declare namespace openpgp.crypto.hash { - /** Create a hash on the specified data using the specified algorithm - @param algo Hash algorithm type - @param data Data to be hashed - */ - function digest(algo: enums.hash, data: string): string; - - /** Returns the hash size in bytes of the specified hash algorithm type - @param algo Hash algorithm type - */ - function getHashByteLength(algo: enums.hash): number; -} - -declare namespace openpgp.crypto.random { - /** Create a secure random big integer of bits length - @param bits Bit length of the MPI to create - */ - function getRandomBigInteger(bits: number): number; - - /** Retrieve secure random byte string of the specified length - @param length Length in bytes to generate - */ - function getRandomBytes(length: number): string; - - /** Helper routine which calls platform specific crypto random generator - @param buf - */ - function getRandomValues(buf: Uint8Array): void; - - /** Return a secure random number in the specified range - @param from Min of the random number - @param to Max of the random number (max 32bit) - */ - function getSecureRandom(from: number, to: number): number; -} - -declare namespace openpgp.crypto.signature { - /** Create a signature on data using the specified algorithm - @param hash_algo hash Algorithm to use - @param algo Asymmetric cipher algorithm to use - @param publicMPIs Public key multiprecision integers of the private key - @param secretMPIs Private key multiprecision integers which is used to sign the data - @param data Data to be signed - */ - function sign(hash_algo: enums.hash, algo: enums.publicKey, publicMPIs: Array, secretMPIs: Array, data: string): Mpi; - - /** - @param algo public Key algorithm - @param hash_algo Hash algorithm - @param msg_MPIs Signature multiprecision integers - @param publickey_MPIs Public key multiprecision integers - @param data Data on where the signature was computed on - */ - function verify(algo: enums.publicKey, hash_algo: enums.hash, msg_MPIs: Array, publickey_MPIs: Array, data: string): boolean; -} - -declare namespace openpgp.enums { - +export namespace enums { enum armor { multipart_section, multipart_last, @@ -372,8 +370,7 @@ declare namespace openpgp.enums { } } -declare namespace openpgp.key { - +export namespace key { interface KeyResult { keys: Array, err: Array @@ -408,10 +405,9 @@ declare namespace openpgp.key { @param armoredText text to be parsed */ function readArmored(armoredText: string): KeyResult; - } -declare namespace openpgp.message { +export namespace message { /** Class that represents an OpenPGP message. Can be an encrypted message, signed message, compressed message or literal message */ interface Message { @@ -477,8 +473,7 @@ declare namespace openpgp.message { function readArmored(armoredText: string): Message; } -declare namespace openpgp.packet { - +export namespace packet { interface PublicKey { algorithm: enums.publicKey; created: Date; @@ -509,7 +504,7 @@ declare namespace openpgp.packet { function newPacketFromTag(tag: string): Object; } -declare namespace openpgp.util { +export namespace util { /** Convert an array of integers(0.255) to a string @param bin An array of (binary) integers to convert */ @@ -583,6 +578,4 @@ declare namespace openpgp.util { @param bin An array of (binary) integers to convert */ function Uint8Array2str(bin: Uint8Array): string; - - } diff --git a/types/openpgp/openpgp-tests.ts b/types/openpgp/openpgp-tests.ts index a4a4200c56..fbe8a2e691 100644 --- a/types/openpgp/openpgp-tests.ts +++ b/types/openpgp/openpgp-tests.ts @@ -1,5 +1,3 @@ - - // Open PGP Sample codes var options: openpgp.KeyOptions = { @@ -125,4 +123,4 @@ openpgp.util.print_debug_hexstr_dump(""); openpgp.util.shiftRight("", 1); openpgp.util.str2bin(""); openpgp.util.str2Uint8Array(""); -openpgp.util.Uint8Array2str(openpgp.util.str2Uint8Array("")); \ No newline at end of file +openpgp.util.Uint8Array2str(openpgp.util.str2Uint8Array("")); diff --git a/types/openpgp/tslint.json b/types/openpgp/tslint.json new file mode 100644 index 0000000000..c28368c002 --- /dev/null +++ b/types/openpgp/tslint.json @@ -0,0 +1,20 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "array-type": false, + "ban-types": false, + "dt-header": false, + "jsdoc-format": false, + "max-line-length": false, + "no-consecutive-blank-lines": false, + "no-var-keyword": false, + "only-arrow-functions": false, + "prefer-const": false, + "semicolon": false, + "space-before-function-paren": false, + "typedef-whitespace": false, + "unified-signatures": false, + "whitespace": false + } +} \ No newline at end of file From 38e3db12b83247ccb7ad61503edd726cf2bfb080 Mon Sep 17 00:00:00 2001 From: Artem Malko Date: Sat, 21 Oct 2017 01:36:49 +0700 Subject: [PATCH 082/314] react Add 'as' attribute for link element (#20769) --- types/react/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 93cb62fbfa..f79caad296 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2493,6 +2493,7 @@ declare namespace React { allowFullScreen?: boolean; allowTransparency?: boolean; alt?: string; + as?: string; async?: boolean; autoComplete?: string; autoFocus?: boolean; @@ -2602,6 +2603,7 @@ declare namespace React { rel?: string; target?: string; type?: string; + as?: string; } // tslint:disable-next-line:no-empty-interface @@ -2787,6 +2789,7 @@ declare namespace React { rel?: string; sizes?: string; type?: string; + as?: string; } interface MapHTMLAttributes extends HTMLAttributes { From da6e5dabc87b1590c9f4e90ec71a4871de164663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kr=C3=B3l?= Date: Fri, 20 Oct 2017 22:19:43 +0200 Subject: [PATCH 083/314] Add react-dnd-touch-backend types (#20770) * Add react-dnd-touch-backend types * CS fixes * Add dom lib --- types/react-dnd-touch-backend/index.d.ts | 12 ++++++++++ .../react-dnd-touch-backend-tests.ts | 7 ++++++ types/react-dnd-touch-backend/tsconfig.json | 24 +++++++++++++++++++ types/react-dnd-touch-backend/tslint.json | 1 + 4 files changed, 44 insertions(+) create mode 100644 types/react-dnd-touch-backend/index.d.ts create mode 100644 types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts create mode 100644 types/react-dnd-touch-backend/tsconfig.json create mode 100644 types/react-dnd-touch-backend/tslint.json diff --git a/types/react-dnd-touch-backend/index.d.ts b/types/react-dnd-touch-backend/index.d.ts new file mode 100644 index 0000000000..91ea6ce999 --- /dev/null +++ b/types/react-dnd-touch-backend/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for react-dnd-touch-backend 0.3 +// Project: https://github.com/yahoo/react-dnd-touch-backend#readme +// Definitions by: Daniel Król +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as ReactDnd from "react-dnd"; + +export default function createTouchBackend(options: TouchBackendOptions): ReactDnd.Backend; + +export interface TouchBackendOptions { + enableMouseEvents?: boolean; +} diff --git a/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts b/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts new file mode 100644 index 0000000000..07994e71be --- /dev/null +++ b/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts @@ -0,0 +1,7 @@ +import * as ReactDnd from "react-dnd"; +import TouchBackend from "react-dnd-touch-backend"; + +const component = () => null; + +const dndComponent = ReactDnd.DragDropContext(TouchBackend)(component); +const dndComponentMouseEvents = ReactDnd.DragDropContext(TouchBackend({enableMouseEvents: true}))(component); diff --git a/types/react-dnd-touch-backend/tsconfig.json b/types/react-dnd-touch-backend/tsconfig.json new file mode 100644 index 0000000000..926592e1c3 --- /dev/null +++ b/types/react-dnd-touch-backend/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", + "react-dnd-touch-backend-tests.ts" + ] +} diff --git a/types/react-dnd-touch-backend/tslint.json b/types/react-dnd-touch-backend/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-dnd-touch-backend/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3f9b03e6730806b4f7a4abf357a22dbb88acba17 Mon Sep 17 00:00:00 2001 From: Jake Ginnivan Date: Sun, 22 Oct 2017 00:35:16 +0800 Subject: [PATCH 084/314] Added type definitions for pino-multi-stream (#20757) --- types/pino-multi-stream/index.d.ts | 27 +++++++++++++++++++ .../pino-multi-stream-tests.ts | 19 +++++++++++++ types/pino-multi-stream/tsconfig.json | 23 ++++++++++++++++ types/pino-multi-stream/tslint.json | 1 + 4 files changed, 70 insertions(+) create mode 100644 types/pino-multi-stream/index.d.ts create mode 100644 types/pino-multi-stream/pino-multi-stream-tests.ts create mode 100644 types/pino-multi-stream/tsconfig.json create mode 100644 types/pino-multi-stream/tslint.json diff --git a/types/pino-multi-stream/index.d.ts b/types/pino-multi-stream/index.d.ts new file mode 100644 index 0000000000..4aa8dcfb7d --- /dev/null +++ b/types/pino-multi-stream/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for pino-multi-stream 3.1 +// Project: https://github.com/pinojs/pino-multi-stream#readme +// Definitions by: Jake Ginnivan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 +import { + LoggerOptions as PinoLoggerOptions, + Logger as PinoLogger, + Level as PinoLevel, + stdSerializers as pinoStdSerializers +} from 'pino'; +import stream = require('stream'); + +declare namespace pinoms { + type Streams = Array<{ stream: NodeJS.WritableStream; level?: Level }>; + interface LoggerOptions extends PinoLoggerOptions { + streams?: Streams; + } + const stdSerializers: typeof pinoStdSerializers; + + function multistream(streams: Streams): stream.Writable; + type Level = PinoLevel; + type Logger = PinoLogger; +} + +declare function pinoms(options: pinoms.LoggerOptions): pinoms.Logger; +export = pinoms; diff --git a/types/pino-multi-stream/pino-multi-stream-tests.ts b/types/pino-multi-stream/pino-multi-stream-tests.ts new file mode 100644 index 0000000000..d9d0899256 --- /dev/null +++ b/types/pino-multi-stream/pino-multi-stream-tests.ts @@ -0,0 +1,19 @@ +import * as fs from 'fs'; +import * as pino from 'pino'; +import * as pinoms from 'pino-multi-stream'; + +const streams: pinoms.Streams = [ + { stream: process.stdout }, // an "info" level destination stream + { level: 'error', stream: process.stderr }, // an "error" level destination stream + { stream: fs.createWriteStream('/tmp/info.stream.out') }, + { level: 'fatal', stream: fs.createWriteStream('/tmp/fatal.stream.out') } +]; +const logger = pinoms({ + level: 'warn', + streams +}); + +const log = pino({ + level: 'debug' // this MUST be set at the lowest level of the + // destinations +}, pinoms.multistream(streams)); diff --git a/types/pino-multi-stream/tsconfig.json b/types/pino-multi-stream/tsconfig.json new file mode 100644 index 0000000000..7a060abb2e --- /dev/null +++ b/types/pino-multi-stream/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", + "pino-multi-stream-tests.ts" + ] +} diff --git a/types/pino-multi-stream/tslint.json b/types/pino-multi-stream/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pino-multi-stream/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 902a364510937e4dd505468be96908b1119fcad5 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sat, 21 Oct 2017 19:47:48 +0200 Subject: [PATCH 085/314] feat(cpx): add typings for `cpx` (#20786) * feat(cpx): add typings for `cpx` * cpx: add `strictFunctionTypes` * cpx: fix build --- types/cpx/cpx-tests.ts | 21 ++++++++++++++++++++ types/cpx/index.d.ts | 44 +++++++++++++++++++++++++++++++++++++++++ types/cpx/tsconfig.json | 23 +++++++++++++++++++++ types/cpx/tslint.json | 1 + 4 files changed, 89 insertions(+) create mode 100644 types/cpx/cpx-tests.ts create mode 100644 types/cpx/index.d.ts create mode 100644 types/cpx/tsconfig.json create mode 100644 types/cpx/tslint.json diff --git a/types/cpx/cpx-tests.ts b/types/cpx/cpx-tests.ts new file mode 100644 index 0000000000..dc92643fcc --- /dev/null +++ b/types/cpx/cpx-tests.ts @@ -0,0 +1,21 @@ +import * as cpx from "cpx"; + +const SRC = "**/.js"; +const DEST = ".tmp/"; +const callback = (error: Error | null) => { }; +const ASYNC_OPTIONS: cpx.AsyncOptions = { includeEmptyDirs: true }; +const SYNC_OPTIONS: cpx.SyncOptions = { preserve: true }; +const WATCH_OPTIONS: cpx.WatchOptions = { initialCopy: true }; + +cpx.copy(SRC, DEST); +cpx.copy(SRC, DEST, callback); +cpx.copy(SRC, DEST, ASYNC_OPTIONS); +cpx.copy(SRC, DEST, ASYNC_OPTIONS, callback); + +cpx.copySync(SRC, DEST, SYNC_OPTIONS); +cpx.copySync(SRC, DEST); + +const watch = cpx.watch(SRC, DEST, WATCH_OPTIONS); +watch.close(); +watch.open(); +watch.on("copy", (x) => x); diff --git a/types/cpx/index.d.ts b/types/cpx/index.d.ts new file mode 100644 index 0000000000..9a04cf1242 --- /dev/null +++ b/types/cpx/index.d.ts @@ -0,0 +1,44 @@ +// Type definitions for cpx 1.5 +// Project: https://github.com/mysticatea/cpx +// Definitions by: Alan Agius +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as stream from "stream"; + +export interface SyncOptions { + /** remove files that copied on past before copy. */ + clean?: boolean; + /** Follow symbolic links when copying from them. */ + dereference?: boolean; + /** Copy empty directories which is matched with the glob. */ + includeEmptyDirs?: boolean; + /** Preserve UID, GID, ATIME, and MTIME of files. */ + preserve?: boolean; + /** Do not overwrite files on destination if the source file is older. */ + update?: boolean; +} + +export interface AsyncOptions extends SyncOptions { + /** Function that creates a `stream.Transform` object to transform each copying file. */ + transform?(filepath: string): stream.Transform[]; +} + +export interface WatchOptions extends AsyncOptions, SyncOptions { + /** Flag to not copy at the initial time of watch. */ + initialCopy?: boolean; +} + +export class Watcher extends NodeJS.EventEmitter { + constructor(options: WatchOptions); + open(): void; + close(): void; +} + +export function copy(source: string, dest: string, options?: AsyncOptions, callback?: (error: Error | null) => void): void; +export function copy(source: string, dest: string, callback?: (error: Error | null) => void): void; + +export function copySync(source: string, dest: string, options?: SyncOptions): void; + +export function watch(source: string, dest: string, options?: WatchOptions): Watcher; diff --git a/types/cpx/tsconfig.json b/types/cpx/tsconfig.json new file mode 100644 index 0000000000..d22546d432 --- /dev/null +++ b/types/cpx/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", + "cpx-tests.ts" + ] +} diff --git a/types/cpx/tslint.json b/types/cpx/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cpx/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ed36d5538fe4656f9cf79e9c481d2102fc6e7bc6 Mon Sep 17 00:00:00 2001 From: Kaelig Deloumeau-Prigent Date: Sat, 21 Oct 2017 21:38:18 -0700 Subject: [PATCH 086/314] react: Add "as" attribute to link elements (#20628) * Add "as" attribute to links See corresponding addition here: https://github.com/facebook/react/pull/7582 * Add "as" attribute to link elements in React v16 definition * Turn commas into semicolons (React 15) * Turn commas into semicolons (React 16) --- types/react/index.d.ts | 3 ++- types/react/v15/index.d.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index f79caad296..ee3f9616ac 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -33,7 +33,7 @@ And since any object is assignable to {}, we would lose the type safety of the P Therefore, the type of props is left as Q, which should work for most cases. If you need to call cloneElement with key or ref, you'll need a type cast: interface ButtonProps { - label: string, + label: string; isDisabled?: boolean; } var element: React.CElement; @@ -2782,6 +2782,7 @@ declare namespace React { } interface LinkHTMLAttributes extends HTMLAttributes { + as?: string; href?: string; hrefLang?: string; integrity?: string; diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 6be40c0f6b..c35e2df3c0 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -35,7 +35,7 @@ Therefore, the type of props is left as Q, which should work for most cases. If you need to call cloneElement with key or ref, you'll need a type cast: interface ButtonProps { - label: string, + label: string; isDisabled?: boolean; } var element: React.CElement; @@ -2720,6 +2720,7 @@ declare namespace React { } interface LinkHTMLAttributes extends HTMLAttributes { + as?: string; href?: string; hrefLang?: string; integrity?: string; From 10612bcf84153db3d37a042d08f5b57ab5680333 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Sun, 22 Oct 2017 12:39:35 -0200 Subject: [PATCH 087/314] Update index.d.ts (#20811) remove duplicated `as` --- types/react/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index ee3f9616ac..77356b922b 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2782,7 +2782,6 @@ declare namespace React { } interface LinkHTMLAttributes extends HTMLAttributes { - as?: string; href?: string; hrefLang?: string; integrity?: string; From 84da98d35b4ed69ccf0f0d79a1b1e96d7316c3bc Mon Sep 17 00:00:00 2001 From: andy-ms Date: Sun, 22 Oct 2017 10:46:51 -0700 Subject: [PATCH 088/314] verror: Fix lint --- types/verror/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/verror/index.d.ts b/types/verror/index.d.ts index bddce14924..36d2a9ef3b 100644 --- a/types/verror/index.d.ts +++ b/types/verror/index.d.ts @@ -39,7 +39,7 @@ declare namespace VError { } interface Options { - cause?: Error | null | undefined; + cause?: Error | null; name?: string; strict?: boolean; constructorOpt?(...args: any[]): void; From 4a0d3be1c054f1e9fa9f94cceb0af0e9c815fed9 Mon Sep 17 00:00:00 2001 From: Andy Date: Sun, 22 Oct 2017 11:27:58 -0700 Subject: [PATCH 089/314] leaflet-*: Fix lint (#20841) --- types/leaflet-draw/tslint.json | 4 +++- types/leaflet-polylinedecorator/tslint.json | 8 +++++++- types/leaflet/tslint.json | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/types/leaflet-draw/tslint.json b/types/leaflet-draw/tslint.json index 4f44991c3c..ccc381f52f 100644 --- a/types/leaflet-draw/tslint.json +++ b/types/leaflet-draw/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "no-empty-interface": false + // TODOs + "no-empty-interface": false, + "no-unnecessary-class": false } } diff --git a/types/leaflet-polylinedecorator/tslint.json b/types/leaflet-polylinedecorator/tslint.json index 3db14f85ea..6a82dd0467 100644 --- a/types/leaflet-polylinedecorator/tslint.json +++ b/types/leaflet-polylinedecorator/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-unnecessary-class": false + } +} diff --git a/types/leaflet/tslint.json b/types/leaflet/tslint.json index a7cf035dfc..e504c08f8d 100644 --- a/types/leaflet/tslint.json +++ b/types/leaflet/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // TODOs + "no-unnecessary-class": false, "no-object-literal-type-assertion": false, "no-single-declare-module": false } From 097d2acf711df3ffb7a3df62554769b216876275 Mon Sep 17 00:00:00 2001 From: Andy Date: Sun, 22 Oct 2017 15:22:50 -0700 Subject: [PATCH 090/314] Miscellaneous lint fixes (#20849) --- types/activex-libreoffice/tslint.json | 1 + types/angular-block-ui/index.d.ts | 6 +- types/angular/angular-tests.ts | 8 +- types/angular/index.d.ts | 16 ++-- types/annyang/index.d.ts | 44 +-------- types/applicationinsights-js/tslint.json | 2 + types/arrify/index.d.ts | 1 - types/ascii2mathml/index.d.ts | 2 +- types/async/tslint.json | 1 + .../atom-mocha-test-runner-tests.ts | 2 +- types/autosize/index.d.ts | 9 -- types/babel-core/index.d.ts | 5 +- types/backbone.marionette/index.d.ts | 10 +- types/bagpipes/index.d.ts | 5 +- types/bitcoinjs-lib/index.d.ts | 2 +- types/blob-util/index.d.ts | 22 ----- types/bluebird-global/tslint.json | 1 + types/bluebird/tslint.json | 1 + types/bootstrap-slider/index.d.ts | 7 -- types/bull/index.d.ts | 4 +- types/bunyan-blackhole/index.d.ts | 4 +- types/chai-jest-snapshot/index.d.ts | 33 ++----- types/chroma-js/index.d.ts | 3 - types/clipboard/index.d.ts | 15 ++- types/combine-source-map/index.d.ts | 18 ++-- types/convert-source-map/index.d.ts | 18 ++-- types/convict/index.d.ts | 16 +--- types/cookie-signature/index.d.ts | 10 +- .../cordova-plugin-native-keyboard/index.d.ts | 18 ---- types/cytoscape/index.d.ts | 27 ++++-- types/delay/index.d.ts | 6 +- types/dom-inputevent/index.d.ts | 10 +- types/dwt/tslint.json | 2 + types/dwt/v12/tslint.json | 2 + types/electron-settings/v2/index.d.ts | 2 - types/execa/index.d.ts | 2 +- types/express-brute-mongo/index.d.ts | 7 -- types/express-brute-mongo/tslint.json | 5 +- types/express-mysql-session/index.d.ts | 71 -------------- types/firebird/index.d.ts | 18 +--- types/flickity/index.d.ts | 10 +- types/fm-websync/index.d.ts | 3 - types/fs-extra-promise-es6/index.d.ts | 72 -------------- types/fs-extra-promise/index.d.ts | 31 ------ types/fs-extra/index.d.ts | 6 -- types/geodesy/index.d.ts | 15 ++- types/geolib/index.d.ts | 55 +++++++---- .../google-protobuf/google-protobuf-tests.ts | 6 +- types/graphite-udp/index.d.ts | 12 --- types/grecaptcha/index.d.ts | 4 - types/har-format/index.d.ts | 28 ++++-- types/haversine/index.d.ts | 3 - types/hls.js/index.d.ts | 2 +- types/http-assert/index.d.ts | 51 +++------- types/http-proxy/index.d.ts | 1 - types/is-ip/index.d.ts | 24 +---- types/is-number/index.d.ts | 4 +- types/jasmine-fixture/index.d.ts | 7 +- types/jest/index.d.ts | 8 +- types/jquery-match-height/index.d.ts | 2 - types/jsforce/query.d.ts | 4 +- types/jsforce/tslint.json | 1 + types/json-rpc-ws/index.d.ts | 2 - types/jsonfile/index.d.ts | 28 +++--- types/jsrp/index.d.ts | 40 ++++---- types/jszip/index.d.ts | 7 +- types/kafka-node/tslint.json | 5 +- types/keycloak-js/tslint.json | 4 +- types/knuddels-userapps-api/tslint.json | 5 +- types/license-checker/index.d.ts | 1 - types/line-by-line/index.d.ts | 1 - types/linq4js/tslint.json | 1 + types/load-json-file/index.d.ts | 4 - types/make-dir/index.d.ts | 2 - types/merge2/index.d.ts | 2 +- types/modesl/tslint.json | 8 +- types/morgan/index.d.ts | 2 - types/multer/index.d.ts | 3 +- types/multimatch/index.d.ts | 9 +- types/nedb-logger/index.d.ts | 2 +- types/node-horseman/index.d.ts | 4 +- types/node-pg-migrate/tslint.json | 4 +- types/node-waves/index.d.ts | 10 +- types/node-wit/tslint.json | 8 +- types/node-xmpp-core/index.d.ts | 5 +- types/nodemailer/lib/addressparser.d.ts | 4 +- types/openpgp/tslint.json | 1 + types/p-settle/index.d.ts | 2 - .../passport-oauth2/passport-oauth2-tests.ts | 3 +- types/pikaday-time/index.d.ts | 2 +- types/pikaday/index.d.ts | 2 +- types/polylabel/index.d.ts | 7 +- types/pouchdb-find/index.d.ts | 3 +- types/prosemirror-inputrules/tslint.json | 6 +- types/prosemirror-markdown/tslint.json | 8 +- types/qr-image/index.d.ts | 15 +-- types/query-string/index.d.ts | 5 - types/quill/tslint.json | 5 +- types/relay-runtime/tslint.json | 6 +- types/remove-markdown/index.d.ts | 1 - types/restify-plugins/index.d.ts | 2 +- types/restling/index.d.ts | 94 ++++++++----------- types/rfc2047/index.d.ts | 8 +- types/riot/index.d.ts | 8 +- types/safe-regex/index.d.ts | 2 +- types/sap__xsenv/index.d.ts | 8 +- types/serialize-javascript/index.d.ts | 8 +- types/sha1/index.d.ts | 6 +- types/simple-oauth2/index.d.ts | 2 +- types/sinon/index.d.ts | 6 +- types/slocket/index.d.ts | 6 +- types/snazzy-info-window/index.d.ts | 1 - types/soundmanager2/index.d.ts | 5 +- types/sshpk/tslint.json | 8 +- .../string-similarity-tests.ts | 11 +-- types/strong-cluster-control/index.d.ts | 1 - types/sumo-logger/index.d.ts | 3 +- types/swagger-sails-hook/index.d.ts | 4 +- types/tabris-plugin-firebase/index.d.ts | 7 +- types/thrift/thrift-tests.ts | 2 - types/tinymce/tslint.json | 1 + types/tocktimer/index.d.ts | 7 +- types/undertaker-registry/index.d.ts | 8 +- types/universal-router/index.d.ts | 6 +- types/vast-client/index.d.ts | 2 +- types/viewerjs/index.d.ts | 8 +- types/vinyl-fs/index.d.ts | 12 ++- types/webassembly-js-api/tslint.json | 4 +- types/webdriverio/tslint.json | 1 + 129 files changed, 439 insertions(+), 814 deletions(-) diff --git a/types/activex-libreoffice/tslint.json b/types/activex-libreoffice/tslint.json index 098cdac415..58ae722582 100644 --- a/types/activex-libreoffice/tslint.json +++ b/types/activex-libreoffice/tslint.json @@ -3,6 +3,7 @@ "rules": { "interface-name": [false], "ban-types": false, + "no-redundant-jsdoc": false, "no-unnecessary-qualifier": false } } \ No newline at end of file diff --git a/types/angular-block-ui/index.d.ts b/types/angular-block-ui/index.d.ts index 47ba9902b9..f415d386e9 100644 --- a/types/angular-block-ui/index.d.ts +++ b/types/angular-block-ui/index.d.ts @@ -67,7 +67,7 @@ declare module 'angular' { * If the filter function returns a string it will be passed as the message * argument to the start method of the service. * - * @param {angular.IRequestConfig} config - the Angular request config object. + * @param config the Angular request config object. * */ requestFilter?(config: IRequestConfig): (string | boolean); @@ -123,7 +123,7 @@ declare module 'angular' { * * This behaviour can be modified in the configuration. * - * @param {string|IBlockUIConfig} messageOrOptions - + * @param messageOrOptions * Either supply the message (string) to be show in the * overlay or specify an IBlockUIConfig object that will be * merged/extended into the block ui instance state. @@ -156,7 +156,7 @@ declare module 'angular' { * Allows the message shown in the overlay to be updated * while to block is active. * - * @param {string} message - The message to show in the overlay. + * @param message The message to show in the overlay. */ message(message: string): void; diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 03f7af5160..6d8b11bffe 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -178,7 +178,7 @@ mod.controller('name', class { // $onChanges(x: number) { } }); mod.controller({ - MyCtrl: class{}, + MyCtrl: class {}, MyCtrl2() {}, MyCtrl3: ['$fooService', ($fooService: any) => { }] }); @@ -229,7 +229,7 @@ mod.provider(My.Namespace); mod.service('name', ($scope: ng.IScope) => {}); mod.service('name', ['$scope', ($scope: ng.IScope) => {}]); mod.service({ - MyCtrl: class{}, + MyCtrl: class {}, MyCtrl2: () => {}, // tslint:disable-line:object-literal-shorthand MyCtrl3: ['$fooService', ($fooService: any) => {}] }); @@ -491,9 +491,7 @@ namespace TestInjector { // $injector.instantiate { - class Foobar { - constructor($q) {} - } + class Foobar {} const result: Foobar = $injector.instantiate(Foobar); } diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index bcc8ab7466..45b9bea058 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1089,7 +1089,7 @@ declare namespace angular { * Retrieves or overrides whether to generate an error when a rejected promise is not handled. * This feature is enabled by default. * - * @returns {boolean} Current value + * @returns Current value */ errorOnUnhandledRejections(): boolean; @@ -1097,8 +1097,8 @@ declare namespace angular { * Retrieves or overrides whether to generate an error when a rejected promise is not handled. * This feature is enabled by default. * - * @param {boolean} value Whether to generate an error when a rejected promise is not handled. - * @returns {ng.IQProvider} Self for chaining otherwise. + * @param value Whether to generate an error when a rejected promise is not handled. + * @returns Self for chaining otherwise. */ errorOnUnhandledRejections(value: boolean): IQProvider; } @@ -1109,8 +1109,8 @@ declare namespace angular { * The successCallBack may return IPromise for when a $q.reject() needs to be returned * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. */ - then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: null | undefined, notifyCallback?: (state: any) => any): IPromise; - then(successCallback: (promiseValue: T) => IPromise|TResult2, errorCallback?: null | undefined, notifyCallback?: (state: any) => any): IPromise; + then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise; + then(successCallback: (promiseValue: T) => IPromise|TResult2, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise; then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback: (reason: any) => IPromise|TCatch, notifyCallback?: (state: any) => any): IPromise; then(successCallback: (promiseValue: T) => IPromise|TResult2, errorCallback: (reason: any) => IPromise|TCatch2, notifyCallback?: (state: any) => any): IPromise; @@ -1639,9 +1639,8 @@ declare namespace angular { useApplyAsync(value: boolean): IHttpProvider; /** - * - * @param {boolean=} value If true, `$http` will return a normal promise without the `success` and `error` methods. - * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. + * @param value If true, `$http` will return a normal promise without the `success` and `error` methods. + * @returns If a value is specified, returns the $httpProvider for chaining. * otherwise, returns the current configured value. */ useLegacyPromiseExtensions(value: boolean): boolean | IHttpProvider; @@ -1762,7 +1761,6 @@ declare namespace angular { (tpl: string, ignoreRequestError?: boolean): IPromise; /** * total amount of pending template requests being downloaded. - * @type {number} */ totalPendingRequests: number; } diff --git a/types/annyang/index.d.ts b/types/annyang/index.d.ts index fee0cb9acb..76f2bdb455 100644 --- a/types/annyang/index.d.ts +++ b/types/annyang/index.d.ts @@ -6,39 +6,23 @@ /** * Options for function `start` - * - * @export - * @interface StartOptions */ export interface StartOptions { /** * Should annyang restart itself if it is closed indirectly, because of silence or window conflicts? - * - * @type {boolean} */ autoRestart?: boolean; /** * Allow forcing continuous mode on or off. Annyang is pretty smart about this, so only set this if you know what you're doing. - * - * @type {boolean} */ continuous?: boolean; } /** * A command option that supports custom regular expressions - * - * @export - * @interface CommandOptionRegex */ export interface CommandOptionRegex { - /** - * @type {RegExp} - */ regexp: RegExp; - /** - * @type {() => any} - */ callback(): void; } @@ -50,8 +34,6 @@ export interface CommandOptionRegex { * {'hello :name': helloFunction, 'howdy': helloFunction}; * {'hi': helloFunction}; * ```` - * @export - * @interface CommandOption */ export interface CommandOption { [command: string]: CommandOptionRegex | (() => void); @@ -92,8 +74,6 @@ export interface Annyang { /** * Start listening. * It's a good idea to call this after adding some commands first, but not mandatory. - * - * @param {StartOptions} options */ start(options?: StartOptions): void; @@ -119,15 +99,13 @@ export interface Annyang { /** * Turn on output of debug messages to the console. Ugly, but super-handy! * - * @export - * @param {boolean} [newState=true] Turn on/off debug messages + * @param [newState=true] Turn on/off debug messages */ debug(newState?: boolean): void; /** * Set the language the user will speak in. If this method is not called, defaults to 'en-US'. * - * @param {string} lang * @see [Languages](https://github.com/TalAter/annyang/blob/master/docs/FAQ.md#what-languages-are-supported) */ setLanguage(lang: string): void; @@ -144,8 +122,6 @@ export interface Annyang { * annyang.addCommands(commands2); * // annyang will now listen to all three commands * ```` - * - * @param {CommandOption} commands */ addCommands(commands: CommandOption): void; @@ -161,7 +137,6 @@ export interface Annyang { * // Remove all existing commands * annyang.removeCommands(); * ```` - * @param {string} command */ removeCommands(command?: string): void; @@ -175,37 +150,22 @@ export interface Annyang { * // Don't respond to howdy or hi * annyang.removeCommands(['howdy', 'hi']); * ```` - * - * @param {string[]} command */ removeCommands(command: string[]): void; - /** - * @param {Events} event - * @param {(userSaid : string, commandText : string, results : string[]) => void} callback - * @param {*} [context] - */ addCallback(event: Events, callback: (userSaid?: string, commandText?: string, results?: string[]) => void, context?: any): void; - /** - * @param {Events} [event] - * @param {Function} [callback] - */ removeCallback(event?: Events, callback?: (userSaid: string, commandText: string, results: string[]) => void): void; /** * Returns true if speech recognition is currently on. * Returns false if speech recognition is off or annyang is paused. - * - * @returns {boolean} */ isListening(): boolean; /** * Returns the instance of the browser's SpeechRecognition object used by annyang. * Useful in case you want direct access to the browser's Speech Recognition engine. - * - * @returns {*} */ getSpeechRecognizer(): any; @@ -223,8 +183,6 @@ export interface Annyang { * ['Time for some thrilling heroics', 'Time for some thrilling aerobics'] * ); * ```` - * - * @param {string} command */ trigger(command: string | string[]): void; } diff --git a/types/applicationinsights-js/tslint.json b/types/applicationinsights-js/tslint.json index e4be61c456..482dffd727 100644 --- a/types/applicationinsights-js/tslint.json +++ b/types/applicationinsights-js/tslint.json @@ -6,7 +6,9 @@ "no-declare-current-package": false, "no-internal-module": false, "no-mergeable-namespace": false, + "no-redundant-jsdoc": false, "no-single-declare-module": false, + "no-unnecessary-class": false, "no-unnecessary-qualifier": false } } diff --git a/types/arrify/index.d.ts b/types/arrify/index.d.ts index 896ee23224..a1dda1b9ec 100644 --- a/types/arrify/index.d.ts +++ b/types/arrify/index.d.ts @@ -12,7 +12,6 @@ * arrify(1) // returns [1] * @example * arrify([2, 3]) // returns [2, 3] - * @param val */ declare function arrify(val: undefined | null | T | T[]): T[]; export = arrify; diff --git a/types/ascii2mathml/index.d.ts b/types/ascii2mathml/index.d.ts index 2b02dfea15..dcb9f7bb98 100644 --- a/types/ascii2mathml/index.d.ts +++ b/types/ascii2mathml/index.d.ts @@ -28,7 +28,7 @@ interface ascii2mathml { /** * Converts ASCIIMath expression to MathML markup. - * @param asciimath {string} ASCIIMath expression + * @param asciimath ASCIIMath expression * @param options Options */ (asciimath: string, options?: Options): string; diff --git a/types/async/tslint.json b/types/async/tslint.json index b1ab4a96cc..9380375afa 100644 --- a/types/async/tslint.json +++ b/types/async/tslint.json @@ -16,6 +16,7 @@ "no-void-expression": false, "object-literal-key-quotes": false, "object-literal-shorthand": false, + "one-line": false, "one-variable-per-declaration": false, "only-arrow-functions": false, "prefer-const": false, diff --git a/types/atom-mocha-test-runner/atom-mocha-test-runner-tests.ts b/types/atom-mocha-test-runner/atom-mocha-test-runner-tests.ts index 434e48f261..cae2dd0e54 100644 --- a/types/atom-mocha-test-runner/atom-mocha-test-runner-tests.ts +++ b/types/atom-mocha-test-runner/atom-mocha-test-runner-tests.ts @@ -34,5 +34,5 @@ async function runTests(): Promise { }; num = await defaultMochaRunner(runnerArgs); - return await testRunner(runnerArgs); + return testRunner(runnerArgs); } diff --git a/types/autosize/index.d.ts b/types/autosize/index.d.ts index a189b32817..b66dcc2aae 100644 --- a/types/autosize/index.d.ts +++ b/types/autosize/index.d.ts @@ -8,17 +8,14 @@ /** * Attach autosize to NodeList - * @param elements */ declare function autosize(elements: NodeList): NodeList; /** * Attach autosize to Element - * @param element */ declare function autosize(element: Element): Element; /** * Attach autosize to JQuery collection - * @param collection */ declare function autosize(collection: JQuery): JQuery; @@ -27,37 +24,31 @@ declare namespace autosize { * Triggers the height adjustment for an assigned textarea element. * Autosize will automatically adjust the textarea height on keyboard and window resize events. * There is no efficient way for Autosize to monitor for when another script has changed the textarea value or for changes in layout that impact the textarea element. - * @param elements */ function update(elements: NodeList): NodeList; /** * Triggers the height adjustment for an assigned textarea element. * Autosize will automatically adjust the textarea height on keyboard and window resize events. * There is no efficient way for Autosize to monitor for when another script has changed the textarea value or for changes in layout that impact the textarea element. - * @param element */ function update(element: Element): Element; /** * Triggers the height adjustment for an assigned textarea element. * Autosize will automatically adjust the textarea height on keyboard and window resize events. * There is no efficient way for Autosize to monitor for when another script has changed the textarea value or for changes in layout that impact the textarea element. - * @param collection */ function update(collection: JQuery): JQuery; /** * Removes Autosize and reverts any changes it made to the textarea element. - * @param elements */ function destroy(elements: NodeList): NodeList; /** * Removes Autosize and reverts any changes it made to the textarea element. - * @param element */ function destroy(element: Element): Element; /** * Removes Autosize and reverts any changes it made to the textarea element. - * @param collection */ function destroy(collection: JQuery): JQuery; } diff --git a/types/babel-core/index.d.ts b/types/babel-core/index.d.ts index a2476245c1..3a41d2d252 100644 --- a/types/babel-core/index.d.ts +++ b/types/babel-core/index.d.ts @@ -162,8 +162,9 @@ export interface TransformOptions { /** Indicate the mode the code should be parsed in. Can be either “script” or “module”. Default: "module" */ sourceType?: "script" | "module"; - /** An optional callback that can be used to wrap visitor methods. - * NOTE: This is useful for things like introspection, and not really needed for implementing anything. + /** + * An optional callback that can be used to wrap visitor methods. + * NOTE: This is useful for things like introspection, and not really needed for implementing anything. */ wrapPluginVisitorMethod?(pluginAlias: string, visitorType: 'enter' | 'exit', callback: (path: NodePath, state: any) => void): (path: NodePath, state: any) => void ; } diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index be3dfd8582..cd8ccd3821 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -691,7 +691,7 @@ export class Region extends Object implements DomMixin { * Render a template with data by passing in the template selector and the * data to render. This is the default renderer that is used by Marionette. */ -export class Renderer { +export namespace Renderer { /** * This method returns a string containing the result of applying the * template using the data object as the context. @@ -703,7 +703,7 @@ export class Renderer { * that returns valid HTML as a string from the data parameter passed to * the function. */ - static render(template: any, data: any): string; + function render(template: any, data: any): string; } export interface ViewOptions extends Backbone.ViewOptions, ViewMixinOptions { @@ -1614,11 +1614,11 @@ export class Behavior extends Object { /** * DEPRECATED */ -export class Behaviors { +export namespace Behaviors { /** * This method defines where your behavior classes are stored. Override this to provide another lookup. */ - static behaviorsLookup(): any; + function behaviorsLookup(): any; /** * This method has a default implementation that is simple to override. It @@ -1626,5 +1626,5 @@ export class Behaviors { * Behaviors.behaviorsLookup or elsewhere. Note that it should return the type of the * class to instantiate, not an instance of that class. */ - static getBehaviorClass(options: any, key: string): any; + function getBehaviorClass(options: any, key: string): any; } diff --git a/types/bagpipes/index.d.ts b/types/bagpipes/index.d.ts index ec1d0cceb7..309ae38318 100755 --- a/types/bagpipes/index.d.ts +++ b/types/bagpipes/index.d.ts @@ -4,7 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface FittingContext { - /** The input defined in the fitting definition + /** + * The input defined in the fitting definition * (string, number, object, array) */ input: any; @@ -56,7 +57,7 @@ export type Fitting = ( * Executed during parsing * @see {@link https://github.com/apigee-127/bagpipes#fittings|Docs} * - * @param {Object} fittingDef Fitting Definition + * @param fittingDef Fitting Definition */ export type FittingFactory = (fittingDef: FittingDef, bagpipes: any) => Fitting; diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 796758715d..4caa6e1e2d 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -62,7 +62,7 @@ export class Block { } export class ECPair { - constructor(d: BigInteger, Q?: null | undefined, options?: { compressed?: boolean, network?: Network }); + constructor(d: BigInteger, Q?: null, options?: { compressed?: boolean, network?: Network }); constructor(d: null | undefined, Q: any, options?: { compressed?: boolean, network?: Network }); // Q should be ECPoint, but not sure how to define such type diff --git a/types/blob-util/index.d.ts b/types/blob-util/index.d.ts index 9ab6cb4b5f..7710734bf2 100644 --- a/types/blob-util/index.d.ts +++ b/types/blob-util/index.d.ts @@ -14,59 +14,43 @@ export function createBlob(parts: any[], options?: { type: string }): Blob; /** * Shim for URL.createObjectURL() to support browsers that only have the prefixed webkitURL (e.g. Android <4.4). - * - * @param blob */ export function createObjectURL(blob: Blob): string; /** * Shim for URL.revokeObjectURL() to support browsers that only have the prefixed webkitURL (e.g. Android <4.4). - * - * @param url */ export function revokeObjectURL(url: string): void; /** * Convert a Blob to a binary string. - * - * @param blob */ export function blobToBinaryString(blob: Blob): Promise; /** * Convert a binary string to a Blob. - * - * @param binary * @param type the content type */ export function binaryStringToBlob(binary: string, type?: string): Promise; /** * Convert a Blob to a base-64 string. - * - * @param blob */ export function blobToBase64String(blob: Blob): Promise; /** * Convert a base-64 string to a Blob. - * - * @param base64 * @param type the content type */ export function base64StringToBlob(base64: string, type?: string): Promise; /** * Convert a data URL string (e.g. `'data:image/png;base64,iVBORw0KG...'`) to a Blob. - * - * @param dataURL */ export function dataURLToBlob(dataURL: string): Promise; /** * Convert a Blob to a data URL string (e.g. `'data:image/png;base64,iVBORw0KG...'`). - * - * @param blob */ export function blobToDataURL(blob: Blob): Promise; @@ -75,7 +59,6 @@ export function blobToDataURL(blob: Blob): Promise; * * Note: this will coerce the image to the desired content type, and it will only paint the first frame of an animated GIF. * - * @param src * @param type the content type (optional, defaults to 'image/png') * @param crossOrigin for CORS-enabled images, set this to 'Anonymous' to avoid "tainted canvas" errors * @param quality a number between 0 and 1 indicating image quality if the requested type is 'image/jpeg' or 'image/webp' @@ -85,7 +68,6 @@ export function imgSrcToDataURL(src: string, type?: string, crossOrigin?: string /** * Convert a canvas to a Blob. * - * @param src * @param type the content type (optional, defaults to 'image/png') * @param quality a number between 0 and 1 indicating image quality if the requested type is 'image/jpeg' or 'image/webp' */ @@ -96,7 +78,6 @@ export function canvasToBlob(canvas: HTMLCanvasElement, type?: string, quality?: * * Note: this will coerce the image to the desired content type, and it will only paint the first frame of an animated GIF. * - * @param src * @param type the content type (optional, defaults to 'image/png') * @param crossOrigin for CORS-enabled images, set this to 'Anonymous' to avoid "tainted canvas" errors * @param quality a number between 0 and 1 indicating image quality if the requested type is 'image/jpeg' or 'image/webp' @@ -106,14 +87,11 @@ export function imgSrcToBlob(src: string, type?: string, crossOrigin?: string, q /** * Convert an ArrayBuffer to a Blob. * - * @param arrayBuff * @param type the content type */ export function arrayBufferToBlob(arrayBuff: ArrayBuffer, type?: string): Promise; /** * Convert a Blob to an ArrayBuffer. - * - * @param blob */ export function blobToArrayBuffer(blob: Blob): Promise; diff --git a/types/bluebird-global/tslint.json b/types/bluebird-global/tslint.json index 1d81af2349..31bf31d881 100644 --- a/types/bluebird-global/tslint.json +++ b/types/bluebird-global/tslint.json @@ -6,6 +6,7 @@ "array-type": false, "unified-signatures": false, "ban-types": false, + "no-redundant-undefined": false, "no-unnecessary-generics": false } } diff --git a/types/bluebird/tslint.json b/types/bluebird/tslint.json index 44da6a5d92..3f946593ed 100644 --- a/types/bluebird/tslint.json +++ b/types/bluebird/tslint.json @@ -3,6 +3,7 @@ "rules": { "adjacent-overload-signatures": false, "max-line-length": [true, 490], + "no-redundant-undefined": false, "no-unnecessary-callback-wrapper": false, "no-unnecessary-generics": false, "no-void-expression": false, diff --git a/types/bootstrap-slider/index.d.ts b/types/bootstrap-slider/index.d.ts index 557c7aa5ad..b17f912d57 100644 --- a/types/bootstrap-slider/index.d.ts +++ b/types/bootstrap-slider/index.d.ts @@ -134,7 +134,6 @@ interface SliderPlugin { (methodName: string, ...args: any[]): TJQuery; /** * Creates a slider from the current element. - * @param options */ (options?: SliderOptions): TJQuery; } @@ -163,9 +162,6 @@ declare class Slider { /** * Set a new value for the slider. If optional triggerSlideEvent parameter is true, 'slide' events will be triggered. * If optional triggerChangeEvent parameter is true, 'change' events will be triggered. - * @param newValue - * @param triggerSlideEvent - * @param triggerChangeEvent */ setValue(newValue: number, triggerSlideEvent?: boolean, triggerChangeEvent?: boolean): this; /** @@ -186,13 +182,10 @@ declare class Slider { isEnabled(): boolean; /** * Updates the slider's attributes - * @param attribute - * @param value */ setAttribute(attribute: string, value: any): this; /** * Get the slider's attributes - * @param attribute */ getAttribute(attribute: string): any; /** diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 5754236da8..abfd4ddd98 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -88,13 +88,13 @@ declare namespace Bull { /** * Removes a job from the queue and from any lists it may be included in. - * @returns {Promise} A promise that resolves when the job is removed. + * @returns A promise that resolves when the job is removed. */ remove(): Promise; /** * Re-run a job that has failed. - * @returns {Promise} A promise that resolves when the job is scheduled for retry. + * @returns A promise that resolves when the job is scheduled for retry. */ retry(): Promise; diff --git a/types/bunyan-blackhole/index.d.ts b/types/bunyan-blackhole/index.d.ts index f8be6fc730..2ece8b2f40 100644 --- a/types/bunyan-blackhole/index.d.ts +++ b/types/bunyan-blackhole/index.d.ts @@ -7,8 +7,8 @@ import * as Logger from "bunyan"; /** * Constructor. - * @param {string} [name] name of the blackhole Logger - * @return {Logger} A bunyan logger . + * @param name name of the blackhole Logger + * @return A bunyan logger . */ declare function bunyanBlackHole(name: string): Logger; export = bunyanBlackHole; diff --git a/types/chai-jest-snapshot/index.d.ts b/types/chai-jest-snapshot/index.d.ts index f19158e282..40ce5afc1b 100644 --- a/types/chai-jest-snapshot/index.d.ts +++ b/types/chai-jest-snapshot/index.d.ts @@ -9,12 +9,7 @@ declare global { namespace Chai { interface Assertion { - /** - * Assert that the object matches the snapshot - * @param snapshotFilename - * @param snapshotName - * @param update - */ + /** Assert that the object matches the snapshot */ matchSnapshot(snapshotFilename?: string, snapshotName?: string, update?: boolean): Assertion; matchSnapshot(update: boolean): Assertion; } @@ -22,40 +17,24 @@ declare global { } interface ChaiJestSnapshot { - /** - * Chai bootstrapper - * @param chai - * @param utils - */ + /** Chai bootstrapper */ (chai: any, utils: any): void; - /** - * Set snapshot file name - * @param filename - */ + /** Set snapshot file name */ setFileName(filename: string): void; /** * Set snapshot test name - * @param testname */ setTestName(testname: string): void; - /** - * Configure snapshot name using mocha context - * @param context - */ + /** Configure snapshot name using mocha context */ configureUsingMochaContext(context: Mocha.IBeforeAndAfterContext): void; - /** - * Reset snapshot registry - */ + /** Reset snapshot registry */ resetSnapshotRegistry(): void; - /** - * Add a serializer plugin - * @param serializer - */ + /** Add a serializer plugin */ addSerializer(serializer: any): void; } diff --git a/types/chroma-js/index.d.ts b/types/chroma-js/index.d.ts index f826c8f254..c18484dc1f 100644 --- a/types/chroma-js/index.d.ts +++ b/types/chroma-js/index.d.ts @@ -34,9 +34,6 @@ declare namespace chroma { /** * Create a color in the specified color space using a, b and c as values. * - * @param a - * @param b - * @param c * @param colorSpace The color space to use. Defaults to "rgb". * @return the color object. */ diff --git a/types/clipboard/index.d.ts b/types/clipboard/index.d.ts index 0aa51518dd..76d28674d6 100644 --- a/types/clipboard/index.d.ts +++ b/types/clipboard/index.d.ts @@ -8,7 +8,7 @@ declare class Clipboard { /** * Subscribes to events that indicate the result of a copy/cut operation. - * @param type {"success" | "error"} Event type ('success' or 'error'). + * @param type Event type ('success' or 'error'). * @param handler Callback function. */ on(type: "success" | "error", handler: (e: Clipboard.Event) => void): this; @@ -29,22 +29,21 @@ declare namespace Clipboard { interface Options { /** * Overwrites default command ('cut' or 'copy'). - * @param {Element} elem Current element - * @returns {String} Only 'cut' or 'copy'. + * @param elem Current element */ - action?(elem: Element): string; + action?(elem: Element): "cut" | "copy"; /** * Overwrites default target input element. - * @param {Element} elem Current element - * @returns {Element} element to use. + * @param elem Current element + * @returns element to use. */ target?(elem: Element): Element; /** * Returns the explicit text to copy. - * @param {Element} elem Current element - * @returns {String} Text to be copied. + * @param elem Current element + * @returns Text to be copied. */ text?(elem: Element): string; } diff --git a/types/combine-source-map/index.d.ts b/types/combine-source-map/index.d.ts index 43f1c994b0..3855942092 100644 --- a/types/combine-source-map/index.d.ts +++ b/types/combine-source-map/index.d.ts @@ -3,13 +3,15 @@ // Definitions by: TeamworkGuy2 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** Add source maps of multiple files, offset them and then combine them into one source map. +/** + * Add source maps of multiple files, offset them and then combine them into one source map. * (documentation based on project's README file) */ declare class Combiner { constructor(file?: string, sourceRoot?: string); - /** Adds map to underlying source map. + /** + * Adds map to underlying source map. * If source contains a source map comment that has the source of the original file inlined it will offset these * mappings and include them. * If no source map comment is found or it has no source inlined, mappings for the file will be generated and included @@ -18,12 +20,14 @@ declare class Combiner { */ addFile(opts: { sourceFile: string; source: string }, offset?: Combiner.Offset): Combiner; - /** output the combined source map in base64 format + /** + * output the combined source map in base64 format * @return base64 encoded combined source map */ base64(): string; - /** generate a base64 encoded sourceMappingURL comment + /** + * generate a base64 encoded sourceMappingURL comment * @return base64 encoded sourceMappingUrl comment of the combined source map */ comment(): string; @@ -40,15 +44,15 @@ declare namespace Combiner { column?: number; } - /** Create a source map combiner that accepts multiple files, offsets them and then combines them into one source map. + /** + * Create a source map combiner that accepts multiple files, offsets them and then combines them into one source map. * @param file optional name of the generated file * @param sourceRoot optional sourceRoot of the map to be generated * @return Combiner instance to which source maps can be added and later combined */ function create(file?: string, sourceRoot?: string): Combiner; - /** removeComments - * @param src + /** * @return src with all sourceMappingUrl comments removed */ function removeComments(src: string): string; diff --git a/types/convert-source-map/index.d.ts b/types/convert-source-map/index.d.ts index 6b1346b61f..6950445a6c 100644 --- a/types/convert-source-map/index.d.ts +++ b/types/convert-source-map/index.d.ts @@ -3,7 +3,8 @@ // Definitions by: Andrew Gaspar , Melvin Groenhoff , TeamworkGuy2 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** Converts a source-map from/to different formats and allows adding/changing properties. +/** + * Converts a source-map from/to different formats and allows adding/changing properties. * (documentation based on project's README file) */ export interface SourceMapConverter { @@ -19,7 +20,8 @@ export interface SourceMapConverter { /** Converts source map to base64 encoded json string */ toBase64(): string; - /** Converts source map to an inline comment that can be appended to the source-file. + /** + * Converts source map to an inline comment that can be appended to the source-file. * By default, the comment is formatted like: //# sourceMappingURL=..., which you would normally see in a JS source file. * When options.multiline == true, the comment is formatted like: /*# sourceMappingURL=... *\/, which you would find in a CSS source file */ @@ -47,16 +49,19 @@ export function fromBase64(base64: string): SourceMapConverter; /** Returns source map converter from given base64 encoded json string prefixed with //# sourceMappingURL=... */ export function fromComment(comment: string): SourceMapConverter; -/** Returns source map converter from given filename by parsing //# sourceMappingURL=filename. +/** + * Returns source map converter from given filename by parsing //# sourceMappingURL=filename. * filename must point to a file that is found inside the mapFileDir. Most tools store this file right next to the generated file, i.e. the one containing the source map. */ export function fromMapFileComment(comment: string, commentFileDir: string): SourceMapConverter; -/** Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found. +/** + * Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found. */ export function fromSource(content: string): SourceMapConverter | null; -/** Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found. +/** + * Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found. * The sourcemap will be read from the map file found by parsing # sourceMappingURL=file comment. For more info see fromMapFileComment. */ export function fromMapFileSource(content: string, commentFileDir: string): SourceMapConverter | null; @@ -73,7 +78,8 @@ export const commentRegex: RegExp; /** Returns a new regex used to find source map comments pointing to map files */ export const mapFileCommentRegex: RegExp; -/** Returns a comment that links to an external source map via file. +/** + * Returns a comment that links to an external source map via file. * By default, the comment is formatted like: //# sourceMappingURL=..., which you would normally see in a JS source file. * When options.multiline == true, the comment is formatted like: /*# sourceMappingURL=... *\/, which you would find in a CSS source file. */ diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index 5aac427dd0..9a31e0ccbb 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -69,48 +69,40 @@ declare namespace convict { * Sets the value of name to value. name can use dot notation to reference * nested values, e.g. "database.port". If objects in the chain don't yet * exist, they will be initialized to empty objects - * - * @return {Config} instance */ set(name: string, value: any): Config; /** * Loads and merges a JavaScript object into config - * - * @return {Config} instance */ load(conf: Object): Config; /** * Loads and merges JSON configuration file(s) into config - * - * @return {Config} instance */ loadFile(files: string | string[]): Config; /** * Validates config against the schema used to initialize it - * - * @param options */ validate(options?: ValidateOptions): Config; /** * Exports all the properties (that is the keys and their current values) as a {JSON} {Object} - * @returns {Object} A {JSON} compliant {Object} + * @returns A {JSON} compliant {Object} */ getProperties(): Object; /** * Exports the schema as a {JSON} {Object} - * @returns {Object} A {JSON} compliant {Object} + * @returns A {JSON} compliant {Object} */ getSchema(): Object; /** * Exports all the properties (that is the keys and their current values) as a JSON string. - * @returns {String} a string representing this object + * @returns A string representing this object */ toString(): string; /** * Exports the schema as a JSON string. - * @returns {String} a string representing the schema of this {Config} + * @returns A string representing the schema of this {Config} */ getSchemaString(): string; } diff --git a/types/cookie-signature/index.d.ts b/types/cookie-signature/index.d.ts index b9b29911a6..cb044f4636 100644 --- a/types/cookie-signature/index.d.ts +++ b/types/cookie-signature/index.d.ts @@ -3,19 +3,11 @@ // Definitions by: François Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * Sign the given `val` with `secret`. - * @param {string} val - * @param {string} secret - * @return {string} - */ +/** Sign the given `val` with `secret`. */ export function sign(value: string, secret: string): string; /** * Unsign and decode the given `val` with `secret`, * returning `false` if the signature is invalid. - * @param {string} val - * @param {string} secret - * @return {string|boolean} */ export function unsign(value: string, secret: string): string | boolean; diff --git a/types/cordova-plugin-native-keyboard/index.d.ts b/types/cordova-plugin-native-keyboard/index.d.ts index 0f64199bd1..9acc3d0be5 100644 --- a/types/cordova-plugin-native-keyboard/index.d.ts +++ b/types/cordova-plugin-native-keyboard/index.d.ts @@ -6,7 +6,6 @@ interface NativeKeyboard { /** * Show the messenger, the bare minimum which has to be passed to the function is * the onSubmit callback - * @param options */ showMessenger( options: NativeKeyboardShowOptions @@ -16,10 +15,6 @@ interface NativeKeyboard { * It's likely your app only has 1 one page where you want to show the messenger, * so you want to hide it when the user navigates away. You can choose to do this * either animated (a quick slide down animation) or not. - * - * @param options - * @param onSuccess - * @param onError */ hideMessenger( options?: NativeKeyboardHideOptions, @@ -29,9 +24,6 @@ interface NativeKeyboard { /** * Show a previously hidden keyboard - * - * @param onSuccess - * @param onError */ showMessengerKeyboard( onSuccess?: () => void, @@ -40,9 +32,6 @@ interface NativeKeyboard { /** * Hide the keyboard, but not the messenger bar - * - * @param onSuccess - * @param onError */ hideMessengerKeyboard( onSuccess?: () => void, @@ -53,10 +42,6 @@ interface NativeKeyboard { * Manipulate the messenger while it's open. For instance if you want to * update the text programmatically based on what the user typed (by responding to * onTextChanged events). - * - * @param options - * @param onSuccess - * @param onError */ updateMessenger( options: NativeKeyboardUpdateOptions, @@ -92,7 +77,6 @@ interface NativeKeyboardHideOptions { interface NativeKeyboardShowOptions { /** * Callback function, which is being called as soon as the user submits - * @param text */ onSubmit(text: string): void; @@ -119,8 +103,6 @@ interface NativeKeyboardShowOptions { /** * Callback function which is being executed as soon as the entered text changes. Will * return the new text - * - * @param text */ onTextChanged?(text: string): void; diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 3a618195d1..21d6d4344b 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -2711,7 +2711,8 @@ declare namespace cytoscape { * http://js.cytoscape.org/#eles.degreeCentrality */ interface SearchDegreeCentralityOptions { - /** The root node (selector or collection) for which the + /** + * The root node (selector or collection) for which the * centrality calculation is made. */ root: NodeSingular | Selector; @@ -2725,7 +2726,8 @@ declare namespace cytoscape { * in the centrality calculation. */ alpha?: number; - /** A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or + /** + * Whether the directed indegree and outdegree centrality is calculated (true) or * whether the undirected centrality is calculated (false, default). */ directed?: boolean; @@ -2757,7 +2759,8 @@ declare namespace cytoscape { * in the centrality calculation. */ alpha?: number; - /** A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or + /** + * A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or * whether the undirected centrality is calculated (false, default). */ directed?: boolean; @@ -2780,14 +2783,16 @@ declare namespace cytoscape { * http://js.cytoscape.org/#eles.closenessCentrality */ interface SearchClosenessCentralityOptions { - /** The root node (selector or collection) for which the + /** + * The root node (selector or collection) for which the * centrality calculation is made. */ root: NodeSingular | Selector; /** A function that returns the weight for the edge. */ weight?(edge: EdgeSingular): number; - /** A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or + /** + * A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or * whether the undirected centrality is calculated (false, default). */ directed?: boolean; @@ -2829,7 +2834,8 @@ declare namespace cytoscape { /** A function that returns the weight for the edge. */ weight?(edge: EdgeSingular): number; - /** A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or + /** + * A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or * whether the undirected centrality is calculated (false, default). */ directed?: boolean; @@ -3976,7 +3982,8 @@ declare namespace cytoscape { originalEvent: EventObject; } interface LayoutEventObject extends AbstractEventObject { - /** layout : indicates the corresponding layout that triggered the event + /** + * layout : indicates the corresponding layout that triggered the event * (useful if running multiple layouts simultaneously) */ layout: any; @@ -4357,12 +4364,14 @@ declare namespace cytoscape { * A new, developer accessible layout can be made via cy.makeLayout(). */ interface LayoutManipulation { - /** Start running the layout + /** + * Start running the layout * http://js.cytoscape.org/#layout.run */ run(): void; start(): void; - /** Stop running the (asynchronous/discrete) layout + /** + * Stop running the (asynchronous/discrete) layout * http://js.cytoscape.org/#layout.stop */ stop(): void; diff --git a/types/delay/index.d.ts b/types/delay/index.d.ts index f84c7ab5e4..0ec894f1e1 100644 --- a/types/delay/index.d.ts +++ b/types/delay/index.d.ts @@ -22,9 +22,9 @@ declare namespace delay { type PDelayedPassThroughThunk = ((value: TValue) => DelayedPromiseLike) & DelayedPromiseLike; interface DelayedPromiseLike { - then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): Promise; cancel(): void; } } diff --git a/types/dom-inputevent/index.d.ts b/types/dom-inputevent/index.d.ts index df1cce5ec4..0d2111a0e0 100644 --- a/types/dom-inputevent/index.d.ts +++ b/types/dom-inputevent/index.d.ts @@ -7,11 +7,11 @@ interface InputEventInit extends UIEventInit { data?: string; isComposing: boolean; } -interface InputEvent extends UIEvent { + +// tslint:disable-next-line no-empty-interface +interface InputEvent extends UIEvent {} +declare class InputEvent { + constructor(typeArg: 'input' | 'beforeinput', inputEventInit?: InputEventInit); readonly data: string; readonly isComposing: boolean; } - -declare class InputEvent { - constructor(typeArg: 'input' | 'beforeinput', inputEventInit?: InputEventInit); -} diff --git a/types/dwt/tslint.json b/types/dwt/tslint.json index acce7c8a0b..5d3b93bdf9 100644 --- a/types/dwt/tslint.json +++ b/types/dwt/tslint.json @@ -1,7 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { + "jsdoc-format": false, "max-line-length": [false], + "no-redundant-jsdoc": false, "no-trailing-whitespace": false, "space-before-function-paren": false, "only-arrow-functions": [false] diff --git a/types/dwt/v12/tslint.json b/types/dwt/v12/tslint.json index acce7c8a0b..5d3b93bdf9 100644 --- a/types/dwt/v12/tslint.json +++ b/types/dwt/v12/tslint.json @@ -1,7 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { + "jsdoc-format": false, "max-line-length": [false], + "no-redundant-jsdoc": false, "no-trailing-whitespace": false, "space-before-function-paren": false, "only-arrow-functions": [false] diff --git a/types/electron-settings/v2/index.d.ts b/types/electron-settings/v2/index.d.ts index a869fd52b8..2f767358e5 100644 --- a/types/electron-settings/v2/index.d.ts +++ b/types/electron-settings/v2/index.d.ts @@ -73,7 +73,6 @@ declare class Settings extends EventEmitter { * * @param keyPath The path to the key whose value we wish to set. This key need not already exist. * @param value The value to set the key at the chosen key path to. This must be a data type supported by JSON: object, array, string, number, boolean, or null. - * @param options * @throws if key path is not a string. * @throws if options is not an object. * @see setSync @@ -91,7 +90,6 @@ declare class Settings extends EventEmitter { * Deletes the key and value at the chosen key path. * * @param keyPath The path to the key we wish to unset. - * @param options * @throws if keyPath is not a string. * @throws if options is not an object. * @see deleteSync diff --git a/types/execa/index.d.ts b/types/execa/index.d.ts index c74c60672d..84c6939798 100644 --- a/types/execa/index.d.ts +++ b/types/execa/index.d.ts @@ -43,7 +43,7 @@ interface ExecaReturns { type ExecaError = Error & ExecaReturns; interface ExecaChildPromise { - catch(onrejected?: ((reason: ExecaError) => TResult | PromiseLike) | undefined | null): Promise; + catch(onrejected?: ((reason: ExecaError) => TResult | PromiseLike) | null): Promise; } type ExecaChildProcess = ChildProcess & ExecaChildPromise & Promise; diff --git a/types/express-brute-mongo/index.d.ts b/types/express-brute-mongo/index.d.ts index 56af09a099..0b637ed37b 100644 --- a/types/express-brute-mongo/index.d.ts +++ b/types/express-brute-mongo/index.d.ts @@ -8,15 +8,8 @@ import { Collection } from "mongodb"; /** * @summary MongoDB store adapter. - * @class */ declare class MongoStore { - /** - * @summary Constructor. - * @constructor - * @param {Function} getCollection The collection. - * @param {Object} options The otpions. - */ constructor(getCollection: (collection: (c: Collection) => void) => void, options?: Object); } export = MongoStore; diff --git a/types/express-brute-mongo/tslint.json b/types/express-brute-mongo/tslint.json index c0ad422b87..81e3db2614 100644 --- a/types/express-brute-mongo/tslint.json +++ b/types/express-brute-mongo/tslint.json @@ -1,8 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - // TODO + // TODOs "ban-types": false, - "dt-header": false + "dt-header": false, + "no-unnecessary-class": false } } diff --git a/types/express-mysql-session/index.d.ts b/types/express-mysql-session/index.d.ts index f8d6282ecd..14c857b5dc 100644 --- a/types/express-mysql-session/index.d.ts +++ b/types/express-mysql-session/index.d.ts @@ -30,106 +30,35 @@ declare namespace MySQLStore { } declare class MySQLStore { - /** - * @param {MySQLStore.Options} options - * @param {any} connection? - * @param {(error:any)=>void} callback? - */ constructor(options: MySQLStore.Options, connection?: any, callback?: (error: any) => void); - /** - * @returns void - */ setDefaultOptions(): void; - /** - * @param {(error:any)=>void} callback? - * @returns void - */ createDatabaseTable(callback?: (error: any) => void): void; - /** - * @param {string} sessionId - * @param {(error:any,session:any)=>void} callback? - * @returns void - */ get(sessionId: string, callback?: (error: any, session: any) => void): void; - /** - * @param {string} sessionId - * @param {any} data - * @param {(error:any)=>void} callback? - * @returns void - */ set(sessionId: string, data: any, callback?: (error: any) => void): void; - /** - * @param {string} sessionId - * @param {any} data - * @param {(error:any)=>void} callback? - * @returns void - */ touch(sessionId: string, data: any, callback?: (error: any) => void): void; - /** - * @param {string} sessionId - * @param {(error:any)=>void} callback? - * @returns void - */ destroy(sessionId: string, callback?: (error: any) => void): void; - /** - * @param {(error:any,count:any)=>void} callback? - * @returns void - */ length(callback?: (error: any, count: any) => void): void; - /** - * @param {(error:any)=>void} callback? - * @returns void - */ clear(callback?: (error: any) => void): void; - /** - * @param {(error:any)=>void} callback? - * @returns void - */ clearExpiredSessions(callback?: (error: any) => void): void; - /** - * @param {number} interval - * @returns void - */ setExpirationInterval(interval: number): void; - /** - * @returns void - */ clearExpirationInterval(): void; - /** - * @param {()=>void} callback? - * @returns void - */ close(callback?: () => void): void; - /** - * @param {any} object - * @param {any} defaultValues - * @param {any} options? - * @returns void - */ default(object: any, defaultValues: any, options?: any): void; - /** - * @param {any} object - * @returns void - */ clone(object: any): void; - /** - * @param {any} value - * @returns void - */ isObject(value: any): void; } diff --git a/types/firebird/index.d.ts b/types/firebird/index.d.ts index eaa20682a6..771a61f706 100644 --- a/types/firebird/index.d.ts +++ b/types/firebird/index.d.ts @@ -29,10 +29,6 @@ declare module 'firebird' { * Connects you to database, * * @param database a database name in Firebird notation, i.e. : - * @param username user name - * @param pasword - * @param role - * * @throws raises exception on error (try to catch it). */ connectSync(db: string, user: string, pass: string, role: string): void; @@ -41,9 +37,6 @@ declare module 'firebird' { * Asynchronously connects you to Database. * * @param database a database name in Firebird notation, i.e. : - * @param username user name - * @param pasword - * @param role * @param callback function(err), where err is error object in case of error. */ connect(db: string, user: string, pass: string, role: string, callback: (err: Error | null) => void): void; @@ -148,7 +141,8 @@ declare module 'firebird' { */ start(callback: (err: Error | null) => void): void; - /**Synchronously prepares SQL statement and returns FBStatement object. + /** + * Synchronously prepares SQL statement and returns FBStatement object. * * @param sql an SQL query to prepare. */ @@ -327,7 +321,7 @@ declare module 'firebird' { * Synchronously prepares SQL statement * * @param sql an SQL query to prepare. - * @returns @see FBStatement object in context of this transaction. + * @returns object in context of this transaction. */ prepareSync(sql: string): FBStatement; @@ -357,9 +351,6 @@ declare module 'firebird' { /** * Same as @see execSync but executes statement in context of given @see Transaction obejct. - * - * @param transaction - * @param params */ execInTransSync(transaction: Transaction, ...params: DataType[]): void; @@ -377,9 +368,6 @@ declare module 'firebird' { /** * Same as @see exec but executes statement in context of given @see Transaction obejct. - * - * @param transaction - * @param params */ execInTrans(transaction: Transaction, ...params: DataType[]): void; } diff --git a/types/flickity/index.d.ts b/types/flickity/index.d.ts index fda440b1fe..ae5dc46cb7 100644 --- a/types/flickity/index.d.ts +++ b/types/flickity/index.d.ts @@ -80,19 +80,16 @@ declare class Flickity { // properties /** - * @type integer * The selected cell index. */ selectedIndex: number; /** - * @type Element * The selected cell element. */ selectedElement: Element; /** - * @type Element[] * The array of cells. Use cells.length for the total number of cells. */ cells: Element[]; @@ -144,10 +141,9 @@ declare class Flickity { /** * Select a slide of a cell. Useful for groupCells. * - * @param {number | string} index Zero-based index OR selector string of the cell to select. - * @param {boolean} [isWrapped] Optional. If true, the last slide will be selected if at the first slide. - * @param {boolean} [isInstant] If true, immediately view the selected slide without animation. - * @memberof Flickity + * @param index Zero-based index OR selector string of the cell to select. + * @param isWrapped If true, the last slide will be selected if at the first slide. + * @param isInstant If true, immediately view the selected slide without animation. */ selectCell(index: number | string, isWrapped?: boolean, isInstant?: boolean): void; diff --git a/types/fm-websync/index.d.ts b/types/fm-websync/index.d.ts index ef5d51d64b..997c4666d1 100644 --- a/types/fm-websync/index.d.ts +++ b/types/fm-websync/index.d.ts @@ -469,8 +469,6 @@ declare namespace fm { * While this method will typically run asychronously, the WebSync client is designed to be used without (much) consideration for its asynchronous nature. * To that end, any calls to methods that require an active connection, like bind, subscribe and publish, will be queued automatically and executed once this * method has completed successfully. - * - * @param connectConfig */ connect(config: connectConfig): client; @@ -506,7 +504,6 @@ declare namespace fm { * Unsubscribes the client from receiving messages on one or more channels. * When the unsubscribe completes successfully, the callback specified by onSuccess will be invoked, passing in the unsubscribed channel(s), * including any modifications made on the server. - * @param config */ unsubscribe(config: unsubscribeConfig): client; } diff --git a/types/fs-extra-promise-es6/index.d.ts b/types/fs-extra-promise-es6/index.d.ts index f5847dd6f0..0f52b5c02e 100644 --- a/types/fs-extra-promise-es6/index.d.ts +++ b/types/fs-extra-promise-es6/index.d.ts @@ -117,64 +117,15 @@ export function write(fd: number, buffer: NodeBuffer, offset: number, length: nu export function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: NodeBuffer) => void): void; export function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; -/** - * readFile - * @param filename - * @param options - * string: encoding - * OpenOptions: options - * @param callback - */ export function readFile(filename: string, options: OpenOptions | string, callback: (err: Error, data: string) => void): void; export function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void): void; export function readFileSync(filename: string): NodeBuffer; -/** - * readFileSync - * @param filename - * @param options - * string: encoding - * OpenOptions: options - */ export function readFileSync(filename: string, options: OpenOptions | string): string; -/** - * writeFile - * @param filename - * @param data - * @param options - * string: encoding - * OpenOptions: options - * @param callback - */ export function writeFile(filename: string, data: any, callback?: (err: Error) => void): void; export function writeFile(filename: string, data: any, options: OpenOptions | string, callback?: (err: Error) => void): void; -/** - * writeFileSync - * @param filename - * @param data - * @param option - * string: encoding - * OpenOptions: options - */ export function writeFileSync(filename: string, data: any, option?: OpenOptions | string): void; -/** - * appendFile - * @param filename - * @param data - * @param option: - * string: encoding - * OpenOptions: options - * @param callback - */ export function appendFile(filename: string, data: any, callback?: (err: Error) => void): void; export function appendFile(filename: string, data: any, option: OpenOptions | string, callback?: (err: Error) => void): void; -/** - * appendFileSync - * @param filename - * @param data - * @param option - * string: encoding - * OpenOptions: options - */ export function appendFileSync(filename: string, data: any, option?: OpenOptions | string): void; export function watchFile(filename: string, listener: { curr: Stats; prev: Stats; }): void; export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void; @@ -252,32 +203,9 @@ export function futimesAsync(fd: number, atime: number, mtime: number): Promise< export function fsyncAsync(fd: number): Promise; export function writeAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>; export function readAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>; -/** - * readFileAsync - * @param filename - * @param options: - * string: encoding - * OpenOptions: options - */ export function readFileAsync(filename: string, options: OpenOptions | string): Promise; export function readFileAsync(filename: string): Promise; -/** - * writeFileAsync - * @param filename - * @param data - * @param options: - * string: encoding - * OpenOptions: options - */ export function writeFileAsync(filename: string, data: any, options?: OpenOptions | string): Promise; -/** - * appendFileAsync - * @param filename - * @param data - * @param option: - * string: encoding - * OpenOptions: option - */ export function appendFileAsync(filename: string, data: any, option?: OpenOptions | string): Promise; export function existsAsync(path: string): Promise; diff --git a/types/fs-extra-promise/index.d.ts b/types/fs-extra-promise/index.d.ts index 9d174f791f..de47c81a1e 100644 --- a/types/fs-extra-promise/index.d.ts +++ b/types/fs-extra-promise/index.d.ts @@ -19,14 +19,6 @@ export interface MkdirOptions { } // promisified versions -/** - * copyAsync - * @param src - * @param dest - * @param options - * CopyFilter: filter - * CopyOptions: options - */ export function copyAsync(src: string, dest: string, options?: CopyFilter | CopyOptions): Promise; export function createFileAsync(file: string): Promise; @@ -75,32 +67,9 @@ export function futimesAsync(fd: number, atime: number, mtime: number): Promise< export function fsyncAsync(fd: number): Promise; export function writeAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>; export function readAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>; -/** - * readFileAsync - * @param filename - * @param options: - * string: encoding - * ReadOptions: options - */ export function readFileAsync(filename: string, options: string | ReadOptions): Promise; export function readFileAsync(filename: string): Promise; -/** - * writeFileAsync - * @param filename - * @param data - * @param options: - * string: encoding - * WriteOptions: options - */ export function writeFileAsync(filename: string, data: any, options?: string | WriteOptions): Promise; -/** - * appendFileAsync - * @param filename - * @param data - * @param options: - * string: encoding - * WriteOptions: options - */ export function appendFileAsync(filename: string, data: any, option?: string | WriteOptions): Promise; export function existsAsync(path: string): Promise; diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index 60c112c68b..84548e48a4 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -154,15 +154,12 @@ export function lstat(path: string | Buffer): Promise; /** * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. * - * @param path * @param callback No arguments other than a possible exception are given to the completion callback. */ export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. * - * @param path - * @param mode * @param callback No arguments other than a possible exception are given to the completion callback. */ export function mkdir(path: string | Buffer, mode: number | string, callback: (err?: NodeJS.ErrnoException | null) => void): void; @@ -200,7 +197,6 @@ export function rename(oldPath: string, newPath: string): Promise; /** * Asynchronous rmdir - removes the directory specified in {path} * - * @param path * @param callback No arguments other than a possible exception are given to the completion callback. */ export function rmdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void; @@ -219,7 +215,6 @@ export function truncate(path: string | Buffer, len?: number): Promise; /** * Asynchronous unlink - deletes the file specified in {path} * - * @param path * @param callback No arguments other than a possible exception are given to the completion callback. */ export function unlink(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void; @@ -245,7 +240,6 @@ export function writeFile(file: string | Buffer | number, data: any, options: { /** * Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * - * @param prefix * @param callback The created folder path is passed as a string to the callback's second parameter. */ export function mkdtemp(prefix: string): Promise; diff --git a/types/geodesy/index.d.ts b/types/geodesy/index.d.ts index 1d8ef3e110..d66de9fe3d 100644 --- a/types/geodesy/index.d.ts +++ b/types/geodesy/index.d.ts @@ -94,15 +94,12 @@ export class Utm { export namespace Dms { let separator: string; -} - -export class Dms { - static parseDMS(dmsStr: string): number; - static toDMS(deg: number, format?: format, dp?: 0 | 2 | 4): string; - static toLat(deg: number, format?: format, dp?: 0 | 2 | 4): string; - static toLon(deg: number, format?: format, dp?: 0 | 2 | 4): string; - static toBrng(deg: number, format?: format, dp?: 0 | 2 | 4): string; - static compassPoint(bearing: number, precision?: 1 | 2 | 3): string; + function parseDMS(dmsStr: string): number; + function toDMS(deg: number, format?: format, dp?: 0 | 2 | 4): string; + function toLat(deg: number, format?: format, dp?: 0 | 2 | 4): string; + function toLon(deg: number, format?: format, dp?: 0 | 2 | 4): string; + function toBrng(deg: number, format?: format, dp?: 0 | 2 | 4): string; + function compassPoint(bearing: number, precision?: 1 | 2 | 3): string; } export class Vector3d { diff --git a/types/geolib/index.d.ts b/types/geolib/index.d.ts index 8842c3eb20..b8638ecc71 100644 --- a/types/geolib/index.d.ts +++ b/types/geolib/index.d.ts @@ -47,25 +47,29 @@ declare namespace geolib { unit: string; } - /** Calculates the distance between two geo coordinates + /** + * Calculates the distance between two geo coordinates * * Return value is always float and represents the distance in meters. */ function getDistance(start: PositionAsDecimal|PositionAsSexadecimal, end: PositionAsDecimal|PositionAsSexadecimal, accuracy?: number, precision?: number): number; - /** Calculates the distance between two geo coordinates but this method is far more inaccurate as compared to getDistance. + /** + * Calculates the distance between two geo coordinates but this method is far more inaccurate as compared to getDistance. * It can take up 2 to 3 arguments. start, end and accuracy can be defined in the same as in getDistance. * * Return value is always float that represents the distance in meters. */ function getDistanceSimple(start: PositionAsDecimal|PositionAsSexadecimal, end: PositionAsDecimal|PositionAsSexadecimal, accuracy?: number): number; - /** Calculates the geographical center of all points in a collection of geo coordinates + /** + * Calculates the geographical center of all points in a collection of geo coordinates * Takes an object or array of coordinates and calculates the center of it. */ function getCenter(coords: PositionAsDecimal[]): PositionAsDecimal; - /** Calculates the center of the bounds of geo coordinates. Takes an array of coordinates, + /** + * Calculates the center of the bounds of geo coordinates. Takes an array of coordinates, * calculate the border of those, and gives back the center of that rectangle. On polygons * like political borders (eg. states), this may gives a closer result to human expectation, * than getCenter, because that function can be disturbed by uneven distribution of point in @@ -74,25 +78,29 @@ declare namespace geolib { */ function getCenterOfBounds(coords: PositionAsDecimal[]): PositionAsDecimal; - /** Calculates the bounds of geo coordinates. + /** + * Calculates the bounds of geo coordinates. * * Returns maximum and minimum, latitude, longitude, and elevation (if provided) in form of an object */ function getBounds(coords: PositionWithElevation[]): Bound; - /** Checks whether a point is inside of a polygon or not. Note: the polygon coords must be in correct order! + /** + * Checks whether a point is inside of a polygon or not. Note: the polygon coords must be in correct order! * * Returns true or false */ function isPointInside(latlng: PositionAsDecimal, polygon: PositionAsDecimal[]): boolean; - /** Similar to is point inside: checks whether a point is inside of a circle or not. + /** + * Similar to is point inside: checks whether a point is inside of a circle or not. * * Returns true or false */ function isPointInCircle(latlng: PositionAsDecimal, center: PositionAsDecimal, radius: number): boolean; - /** Gets rhumb line bearing of two points. Find out about the difference between rhumb line and great circle bearing on Wikipedia. + /** + * Gets rhumb line bearing of two points. Find out about the difference between rhumb line and great circle bearing on Wikipedia. * Rhumb line should be fine in most cases: http://en.wikipedia.org/wiki/Rhumb_line#General_and_mathematical_description Function * is heavily based on Doug Vanderweide's great PHP version (licensed under GPL 3.0) * http://www.dougv.com/2009/07/13/calculating-the-bearing-and-compass-rose-direction-between-two-latitude-longitude-coordinates-in-php/ @@ -101,13 +109,15 @@ declare namespace geolib { */ function getRhumbLineBearing(originLL: PositionAsDecimal, destLL: PositionAsDecimal): number; - /** Gets great circle bearing of two points. See description of getRhumbLineBearing for more information. + /** + * Gets great circle bearing of two points. See description of getRhumbLineBearing for more information. * * Returns calculated bearing as integer */ function getBearing(originLL: PositionAsDecimal, destLL: PositionAsDecimal): number; - /** Gets the compass direction from an origin coordinate (originLL) to a destination coordinate (destLL). + /** + * Gets the compass direction from an origin coordinate (originLL) to a destination coordinate (destLL). * Bearing mode. Can be either circle or rhumbline (default). * * Returns an object with a rough (NESW) and an exact direction (NNE, NE, ENE, E, ESE, etc). @@ -120,22 +130,27 @@ declare namespace geolib { /** Finds the nearest coordinate to a reference coordinate. */ function findNearest(latlng: PositionAsDecimal, coords: PositionAsDecimal[], offset?: number, limit?: number): Distance[]; - /** Calculates the length of a collection of coordinates. + /** + * Calculates the length of a collection of coordinates. * * Returns the length of the path in meters */ function getPathLength(coords: PositionAsDecimal[]): number; - /** Calculates the speed between two points within a given time span. + /** + * Calculates the speed between two points within a given time span. * * Returns the speed in options.unit (default is km/h). */ function getSpeed(coords: PositionInTime[], option?: SpeedOption): number; - /** Calculates if given point lies in a line formed by start and end */ + /** + * Calculates if given point lies in a line formed by start and end + */ function isPointInLine(point: PositionAsDecimal, start: PositionAsDecimal, end: PositionAsDecimal): boolean; - /** Converts a given distance (in meters) to another unit. + /** + * Converts a given distance (in meters) to another unit. * distance distance to be converted (source must be in meter). unit can be one of: * - m (meter) * - km (kilometers) @@ -155,17 +170,20 @@ declare namespace geolib { /** Converts a decimal coordinate to sexagesimal format */ function decimal2sexagesimal(coord: number): string; - /** Returns the latitude for a given point and converts it to decimal. + /** + * Returns the latitude for a given point and converts it to decimal. * Works with: latitude, lat, 1 (GeoJSON array) */ function latitude(latlng: any): number; - /** Returns the longitude for a given point and converts it to decimal. + /** + * Returns the longitude for a given point and converts it to decimal. * Works with: longitude, lng, lon, 0 (GeoJSON array) */ function longitude(latlng: any): number; - /** Returns the elevation for a given point and converts it to decimal. + /** + * Returns the elevation for a given point and converts it to decimal. * Works with: elevation, elev, alt, altitude, 2 (GeoJSON array) */ function elevation(latlng: any): number; @@ -173,7 +191,8 @@ declare namespace geolib { /** Checks if a coordinate is already in decimal format and, if not, converts it to */ function useDecimal(latlng: string|number): number; - /** Computes the destination point given an initial point, a distance (in meters) and a bearing (in degrees). + /** + * Computes the destination point given an initial point, a distance (in meters) and a bearing (in degrees). * If no radius is given it defaults to the mean earth radius of 6371000 meter. * * Returns an object: `{"latitude": destLat, "longitude": destLng}` diff --git a/types/google-protobuf/google-protobuf-tests.ts b/types/google-protobuf/google-protobuf-tests.ts index 19421754ac..ee9a1c8d66 100644 --- a/types/google-protobuf/google-protobuf-tests.ts +++ b/types/google-protobuf/google-protobuf-tests.ts @@ -93,15 +93,15 @@ class MySimple extends jspb.Message { const field = reader.getFieldNumber(); switch (field) { case 1: - const value1 = /** @type {string} */ (reader.readString()); + const value1 = reader.readString(); msg.setMyString(value1); break; case 2: - const value2 = /** @type {boolean} */ (reader.readBool()); + const value2 = reader.readBool(); msg.setMyBool(value2); break; case 3: - const value3 = /** @type {string} */ (reader.readString()); + const value3 = reader.readString(); msg.addSomeLabels(value3); break; case 4: diff --git a/types/graphite-udp/index.d.ts b/types/graphite-udp/index.d.ts index 167b85673a..dbd07ddf43 100644 --- a/types/graphite-udp/index.d.ts +++ b/types/graphite-udp/index.d.ts @@ -55,10 +55,6 @@ export interface ClientOptions { /** * called when metrics are sent * Defaults to null - * - * @param {error} Error - * @param {metrics} - * @return void */ callback?(error: Error, metrics: any): void; } @@ -68,19 +64,11 @@ export class Client { /** * During the interval time option, if 2 or more metrics with the same name are sent, metrics will be added (summed) - * - * @param {name} - * @param {value} number - * @return void */ add(name: string, value: number): void; /** * During the interval time option, if 2 or more metrics with the same name are sent, the last one will be used - * - * @param {name} metric name (my.test.metric) - * @param {value} number - * @return void */ put(name: string, value: number): void; diff --git a/types/grecaptcha/index.d.ts b/types/grecaptcha/index.d.ts index 59d1fa6699..067139e6c9 100644 --- a/types/grecaptcha/index.d.ts +++ b/types/grecaptcha/index.d.ts @@ -46,21 +46,18 @@ declare namespace ReCaptchaV2 { * Optional. The color theme of the widget. * Accepted values: "light", "dark" * @default "light" - * @type {Theme} */ theme?: Theme; /** * Optional. The type of CAPTCHA to serve. * Accepted values: "audio", "image" * @default "image" - * @type {Type} */ type?: Type; /** * Optional. The size of the widget. * Accepted values: "compact", "normal", "invisible". * @default "compact" - * @type {Size} */ size?: Size; /** @@ -77,7 +74,6 @@ declare namespace ReCaptchaV2 { * Optional. The badge location for g-recaptcha with size of "invisible". * * @default "bottomright" - * @type {Badge} */ badge?: Badge; /** diff --git a/types/har-format/index.d.ts b/types/har-format/index.d.ts index 09ea2791fd..3ab7fd773e 100644 --- a/types/har-format/index.d.ts +++ b/types/har-format/index.d.ts @@ -82,7 +82,8 @@ export interface Browser { * http://www.softwareishard.com/blog/har-12-spec/#pages */ export interface Page { - /** Date and time stamp for the beginning of the page load + /** + * Date and time stamp for the beginning of the page load * * (ISO 8601 - `YYYY-MM-DDThh:mm:ss.sTZD`, * e.g. `2009-07-24T19:20:30.45+01:00`). @@ -266,19 +267,21 @@ export interface Page { * http://www.softwareishard.com/blog/har-12-spec/#pageTimings */ export interface PageTiming { - /** Content of the page loaded. Number of milliseconds since page load + /** + * Content of the page loaded. Number of milliseconds since page load * started (`page.startedDateTime`). * * Use `-1` if the timing does not apply to the current request. */ onContentLoad?: number; - /** Page is loaded (`onLoad` event fired). Number of milliseconds since + /** + * Page is loaded (`onLoad` event fired). Number of milliseconds since * page load started (`page.startedDateTime`). * * Use `-1` if the timing does not apply to the current request. */ onLoad?: number; - /** A comment provided by the user or the application */ + /** A comment provided by the user or the application */ comment?: string; _startRender?: number; } @@ -562,7 +565,8 @@ export interface Response { * of header objects._ */ headersSize: number; - /** Size of the received response body in bytes. + /** + * Size of the received response body in bytes. * * - Set to zero in case of responses coming from the cache (`304`). * - Set to `-1` if the info is not available. @@ -633,12 +637,14 @@ export interface QueryString { export interface PostData { /** Mime type of posted data. */ mimeType: string; - /** List of posted parameters (in case of URL encoded parameters). + /** + * List of posted parameters (in case of URL encoded parameters). * * _`text` and `params` fields are mutually exclusive._ */ params: Param[]; - /** Plain text posted data + /** + * Plain text posted data * * _`params` and `text` fields are mutually exclusive._ */ @@ -733,14 +739,16 @@ export interface Cache { comment?: string; } export interface CacheDetails { - /** Expiration time of the cache entry. + /** + * Expiration time of the cache entry. * * _(Format not documente but assumingly ISO 8601 - * `YYYY-MM-DDThh:mm:ss.sTZD`)_ */ expires?: string; - /** The last time the cache entry was opened. - * * + /** + * The last time the cache entry was opened. + * * _(Format not documente but assumingly ISO 8601 - * `YYYY-MM-DDThh:mm:ss.sTZD`)_ */ diff --git a/types/haversine/index.d.ts b/types/haversine/index.d.ts index aa3c0cb1aa..6fed860d8b 100644 --- a/types/haversine/index.d.ts +++ b/types/haversine/index.d.ts @@ -23,9 +23,6 @@ declare namespace haversine { /** * Determines the great-circle distance between two points on a sphere given their longitudes and latitudes - * @param start - * @param end - * @param options */ declare function haversine( start: haversine.Coordinate, diff --git a/types/hls.js/index.d.ts b/types/hls.js/index.d.ts index f496f2d165..3567db3f87 100644 --- a/types/hls.js/index.d.ts +++ b/types/hls.js/index.d.ts @@ -1540,7 +1540,7 @@ declare namespace Hls { * Customized text track syncronization controller. */ interface TimelineController { - /**d + /** * clean-up all used resources */ destory(): void; diff --git a/types/http-assert/index.d.ts b/types/http-assert/index.d.ts index 47b283db92..4e9ca6657d 100644 --- a/types/http-assert/index.d.ts +++ b/types/http-assert/index.d.ts @@ -4,49 +4,26 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** - * @param {number} [status] the status code - * @param {string} [msg] the message of the error, defaulting to node's text for that status code - * @param {object} [opts] custom properties to attach to the error object + * @param status the status code + * @param msg the message of the error, defaulting to node's text for that status code + * @param opts custom properties to attach to the error object */ declare function assert(value: any, status?: number, msg?: string, opts?: {}): void; declare namespace assert { /** - * @param {number} [status] the status code - * @param {string} [msg] the message of the error, defaulting to node's text for that status code - * @param {object} [opts] custom properties to attach to the error object + * @param status the status code + * @param msg the message of the error, defaulting to node's text for that status code + * @param opts custom properties to attach to the error object */ - function equal(a: T, b: T, status?: number, msg?: string, opts?: {}): void; - /** - * @param {number} [status] the status code - * @param {string} [msg] the message of the error, defaulting to node's text for that status code - * @param {object} [opts] custom properties to attach to the error object - */ - function notEqual(a: T, b: T, status?: number, msg?: string, opts?: {}): void; - /** - * @param {number} [status] the status code - * @param {string} [msg] the message of the error, defaulting to node's text for that status code - * @param {object} [opts] custom properties to attach to the error object - */ - function strictEqual(a: T, b: T, status?: number, msg?: string, opts?: {}): void; - /** - * @param {number} [status] the status code - * @param {string} [msg] the message of the error, defaulting to node's text for that status code - * @param {object} [opts] custom properties to attach to the error object - */ - function notStrictEqual(a: T, b: T, status?: number, msg?: string, opts?: {}): void; - /** - * @param {number} [status] the status code - * @param {string} [msg] the message of the error, defaulting to node's text for that status code - * @param {object} [opts] custom properties to attach to the error object - */ - function deepEqual(a: T, b: T, status?: number, msg?: string, opts?: {}): void; - /** - * @param {number} [status] the status code - * @param {string} [msg] the message of the error, defaulting to node's text for that status code - * @param {object} [opts] custom properties to attach to the error object - */ - function notDeepEqual(a: T, b: T, status?: number, msg?: string, opts?: {}): void; + type Assert = (a: T, b: T, status?: number, msg?: string, opts?: {}) => void; + + const equal: Assert; + const notEqual: Assert; + const strictEqual: Assert; + const notStrictEqual: Assert; + const deepEqual: Assert; + const notDeepEqual: Assert; } export = assert; diff --git a/types/http-proxy/index.d.ts b/types/http-proxy/index.d.ts index 4ed829d390..6c4b885ac2 100644 --- a/types/http-proxy/index.d.ts +++ b/types/http-proxy/index.d.ts @@ -32,7 +32,6 @@ declare class Server extends events.EventEmitter { * @param req - Client request. * @param res - Client response. * @param options - Additionnal options. - * @param */ web( req: http.IncomingMessage, diff --git a/types/is-ip/index.d.ts b/types/is-ip/index.d.ts index c706d50397..70d8ebb88e 100644 --- a/types/is-ip/index.d.ts +++ b/types/is-ip/index.d.ts @@ -3,32 +3,14 @@ // Definitions by: coderslagoon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * Check if input is IPv4 or IPv6. - * - * @param {input} input - * - * @returns {boolean} - */ +/** Check if input is IPv4 or IPv6. */ declare function isIp(input: string): boolean; declare namespace isIp { - /** - * Check if input is IPv4. - * - * @param {input} input - * - * @returns {boolean} - */ + /** Check if input is IPv4. */ function v4(input: string): boolean; - /** - * Check if input is IPv6. - * - * @param {input} input - * - * @returns {boolean} - */ + /** Check if input is IPv6. */ function v6(input: string): boolean; } diff --git a/types/is-number/index.d.ts b/types/is-number/index.d.ts index 27d7328456..fff535c46a 100644 --- a/types/is-number/index.d.ts +++ b/types/is-number/index.d.ts @@ -7,7 +7,7 @@ export = is_number; /** * Will test to see if the argument is a valid number, excluding Infinity and NaN. - * @param {*} num - Any value that should be tested for being a number - * @returns {boolean} - true if the parameter is a valid number, otherwise false + * @param num Any value that should be tested for being a number + * @returns true if the parameter is a valid number, otherwise false */ declare function is_number(num: any): boolean; diff --git a/types/jasmine-fixture/index.d.ts b/types/jasmine-fixture/index.d.ts index a49aeca029..82449ffc01 100644 --- a/types/jasmine-fixture/index.d.ts +++ b/types/jasmine-fixture/index.d.ts @@ -8,13 +8,14 @@ /** * Affixes the given jquery selectors into the body and will be removed after each spec - * @param {string} selector The JQuery selector to be added to the dom + * @param selector The JQuery selector to be added to the dom */ declare function affix(selector: string): JQuery; interface JQuery { - /** Affixes the given jquery selectors into the element and will be removed after each spec - * @param {string} selector The JQuery selector to be added to the dom + /** + * Affixes the given jquery selectors into the element and will be removed after each spec + * @param selector The JQuery selector to be added to the dom */ affix(selector: string): JQuery; } diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 80afeab207..18b3db361a 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -198,9 +198,9 @@ declare namespace jest { /** * Creates a test closure. * - * @param {string} name The name of your test - * @param {fn?} ProvidesCallback The function for your test - * @param {timeout?} timeout The timeout for an async function test + * @param name The name of your test + * @param fn The function for your test + * @param timeout The timeout for an async function test */ (name: string, fn?: ProvidesCallback, timeout?: number): void; /** @@ -290,7 +290,7 @@ declare namespace jest { * The `expect` function is used every time you want to test a value. * You will rarely call `expect` by itself. * - * @param {any} actual The value to apply matchers against. + * @param actual The value to apply matchers against. */ (actual: any): Matchers; anything(): any; diff --git a/types/jquery-match-height/index.d.ts b/types/jquery-match-height/index.d.ts index 491a0dbe1d..2c2a69db67 100644 --- a/types/jquery-match-height/index.d.ts +++ b/types/jquery-match-height/index.d.ts @@ -14,8 +14,6 @@ interface JQueryMatchHeight { /** * Set all selected elements to the height of the tallest. * If the items are on multiple rows, the items of each row will be set to the tallest of that row. - * - * @param options */ (options?: JQueryMatchHeight.Options): JQuery; _update(): void; diff --git a/types/jsforce/query.d.ts b/types/jsforce/query.d.ts index d0353ec638..242d89b358 100644 --- a/types/jsforce/query.d.ts +++ b/types/jsforce/query.d.ts @@ -47,8 +47,8 @@ export class Query extends Readable implements Promise { where(conditions: Object | string): Query; // Implementing promise methods - then(onfulfilled?: any | undefined | null): Promise; - catch(onrejected?: any | undefined | null): Promise; + then(onfulfilled?: any): Promise; + catch(onrejected?: any): Promise; [Symbol.toStringTag]: "Promise"; } diff --git a/types/jsforce/tslint.json b/types/jsforce/tslint.json index 5fdd35f19c..3b1f082eb2 100644 --- a/types/jsforce/tslint.json +++ b/types/jsforce/tslint.json @@ -4,6 +4,7 @@ // TODOs "ban-types": false, "no-any-union": false, + "no-unnecessary-class": false, "no-unnecessary-generics": false } } diff --git a/types/json-rpc-ws/index.d.ts b/types/json-rpc-ws/index.d.ts index c3023c409e..9faaeefd66 100644 --- a/types/json-rpc-ws/index.d.ts +++ b/types/json-rpc-ws/index.d.ts @@ -80,8 +80,6 @@ export class Base { getConnection(id: string): Connection; /** * Shut down all existing connections - * - * @public */ hangup(): void; } diff --git a/types/jsonfile/index.d.ts b/types/jsonfile/index.d.ts index bed60556a1..62227c9e84 100644 --- a/types/jsonfile/index.d.ts +++ b/types/jsonfile/index.d.ts @@ -8,13 +8,13 @@ import { Url } from 'url'; export type FSReadOptions = { - encoding?: null | undefined; - flag?: string | undefined; + encoding?: null; + flag?: string; } | null | undefined; export type FSWriteOptions = string | { - encoding?: string | null | undefined; - mode?: string | number | undefined; - flag?: string | undefined; + encoding?: string | null; + mode?: string | number; + flag?: string; } | null | undefined; export type ReadCallback = (err: NodeJS.ErrnoException | null, data: Buffer) => void; @@ -29,23 +29,23 @@ export interface FS { } export type JFReadOptions = { - encoding?: null | undefined; - flag?: string | undefined; + encoding?: null; + flag?: string; throws?: boolean; fs?: FS; - reviver?: ((key: any, value: any) => any) | undefined; + reviver?: (key: any, value: any) => any; } | null | undefined; export type JFWriteOptions = string | { - encoding?: string | null | undefined; - mode?: string | number | undefined; - flag?: string | undefined; + encoding?: string | null; + mode?: string | number; + flag?: string; throws?: boolean; fs?: FS; EOL?: string; - spaces?: string | number | undefined; - replacer?: ((key: string, value: any) => any) | undefined; - } | null | undefined; + spaces?: string | number; + replacer?: (key: string, value: any) => any; + } | null; export type JFReadCallback = (err: NodeJS.ErrnoException | null, data: any) => void; diff --git a/types/jsrp/index.d.ts b/types/jsrp/index.d.ts index 27f52c9e91..6cdb2abd7f 100644 --- a/types/jsrp/index.d.ts +++ b/types/jsrp/index.d.ts @@ -28,58 +28,58 @@ export class client { /** * Initialise the client SRP and calculate needed SRP values - * @param {ClientOptions} options - the client options including the username and password - * @param {function(): any} callback - called when the client instance is ready to use + * @param options - the client options including the username and password + * @param callback - called when the client instance is ready to use */ init(options: ClientOptions, callback: () => any): void; /** * Returns the hex representation of the client's A value - * @returns {string} - hex representation of A + * @returns hex representation of A */ getPublicKey(): string; /** * Set the salt generated by the server for later computations - * @param {string} hexSalt - hex value of the salt + * @param hexSalt - hex value of the salt */ setSalt(hexSalt: string): void; /** * Sets the server's B value on the client and compute values to complete authentication - * @param {string} hexB - hex representation of B + * @param hexB - hex representation of B * @throws Will throw an error if the server provides an incorrect value */ setServerPublicKey(hexB: string): void; /** * Returns the hex representation of the client's M1 proof - * @returns {string} - hex representation of M1 + * @returns hex representation of M1 */ getProof(): string; /** * Verifies the server's M2 proof against the client's. Only call after using {@link getProof}. - * @param {string} hexM2 - hex representation of M2 - * @returns {boolean} - true if it matches the client's proof, false if it doesn't + * @param hexM2 - hex representation of M2 + * @returns true if it matches the client's proof, false if it doesn't */ checkServerProof(hexM2: string): boolean; /** * Returns the hex representation of the shared secret key, K - * @returns {string} - hex representation of K + * @returns hex representation of K */ getSharedKey(): string; /** * Generate the v and salt values from values passed into init(). - * @param {function(*, Verifier): *} callback - callback has an error as the first argument, or an object containing the verifier and salt as the second. + * @param callback - callback has an error as the first argument, or an object containing the verifier and salt as the second. */ createVerifier(callback: (error: any, result: Verifier) => any): void; /** * Returns the hex representation of the salt - * @returns {string} - hex representation of the salt + * @returns hex representation of the salt */ getSalt(): string; } @@ -90,46 +90,46 @@ export class server { /** * Initialise the server SRP and calculate needed SRP values - * @param {ServerOptions} options - the server options including the verifier and salt - * @param {function(): void} callback - called when the server instance is ready to use + * @param options - the server options including the verifier and salt + * @param callback - called when the server instance is ready to use */ init(options: ServerOptions, callback: () => any): void; /** * Returns the hex representation of the server's B value - * @returns {string} - hex representation of B + * @returns hex representation of B */ getPublicKey(): string; /** * Returns the hex representation of the salt, as was passed into {@link init} - * @returns {string} - hex representation of the salt + * @returns hex representation of the salt */ getSalt(): string; /** * Sets the client's A value on the server, and compute values to complete authentication - * @param {string} hexA - hex representation of A + * @param hexA - hex representation of A * @throws Will throw an error if the client provides an incorrect value */ setClientPublicKey(hexA: string): void; /** * Returns the hex representation of the shared secret key, K - * @returns {string} - hex representation of K + * @returns hex representation of K */ getSharedKey(): string; /** * Verifies the clients's M1 proof against the server's. - * @param {string} M1hex - hex representation of M1 - * @returns {boolean} - true if it matches the server's proof, false if it doesn't + * @param M1hex - hex representation of M1 + * @returns true if it matches the server's proof, false if it doesn't */ checkClientProof(M1hex: string): boolean; /** * Returns the hex representation of the server's M2 proof - * @returns {string} - hex representation of M2 + * @returns hex representation of M2 */ getProof(): string; } diff --git a/types/jszip/index.d.ts b/types/jszip/index.d.ts index 0962f46ff8..a6253e60b8 100644 --- a/types/jszip/index.d.ts +++ b/types/jszip/index.d.ts @@ -64,8 +64,8 @@ declare namespace JSZip { /** * Prepare the content in the asked type. - * @param {String} type the type of the result. - * @param {OnUpdateCallback} onUpdate a function to call on each internal update. + * @param type the type of the result. + * @param onUpdate a function to call on each internal update. * @return Promise the promise of the result. */ async(type: T, onUpdate?: OnUpdateCallback): Promise; @@ -75,7 +75,8 @@ declare namespace JSZip { interface JSZipFileOptions { /** Set to `true` if the data is `base64` encoded. For example image data from a `` element. Plain text and HTML do not need this option. */ base64?: boolean; - /** Set to `true` if the data should be treated as raw content, `false` if this is a text. If `base64` is used, + /** + * Set to `true` if the data should be treated as raw content, `false` if this is a text. If `base64` is used, * this defaults to `true`, if the data is not a `string`, this will be set to `true`. */ binary?: boolean; diff --git a/types/kafka-node/tslint.json b/types/kafka-node/tslint.json index b1439230db..75a24b3163 100644 --- a/types/kafka-node/tslint.json +++ b/types/kafka-node/tslint.json @@ -1,7 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - // TODO - "no-any-union": false + // TODOs + "no-any-union": false, + "no-unnecessary-class": false } } diff --git a/types/keycloak-js/tslint.json b/types/keycloak-js/tslint.json index f2ffe2445b..df4e2dbdfb 100644 --- a/types/keycloak-js/tslint.json +++ b/types/keycloak-js/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "no-duplicate-imports": false + // TODOs + "no-duplicate-imports": false, + "no-redundant-jsdoc": false } } diff --git a/types/knuddels-userapps-api/tslint.json b/types/knuddels-userapps-api/tslint.json index 07a8255955..67eb97841e 100644 --- a/types/knuddels-userapps-api/tslint.json +++ b/types/knuddels-userapps-api/tslint.json @@ -1,7 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - // TODO - "no-mergeable-namespace": false + // TODOs + "no-mergeable-namespace": false, + "no-unnecsesary-class": false } } diff --git a/types/license-checker/index.d.ts b/types/license-checker/index.d.ts index ec4ec39658..d0286a05af 100644 --- a/types/license-checker/index.d.ts +++ b/types/license-checker/index.d.ts @@ -82,6 +82,5 @@ export interface ModuleInfos { /** * Run the license check * @param opts specifies the path to the module to check dependencies of - * @param callback */ export function init(opts: InitOpts, callback: (err: Error, ret: ModuleInfos) => void): void; diff --git a/types/line-by-line/index.d.ts b/types/line-by-line/index.d.ts index 605c5cd07e..9cfeab723c 100644 --- a/types/line-by-line/index.d.ts +++ b/types/line-by-line/index.d.ts @@ -13,7 +13,6 @@ export = LineByLineReader; interface LineByLineReader extends EventEmitter { /** * subscribe to an event emitted by reader - * @param event {@link LineByLineReaderEvent} * @param listener A void function with one param */ on(event: LineByLineReaderEvent, listener: (value: any) => void): this; diff --git a/types/linq4js/tslint.json b/types/linq4js/tslint.json index 3393f9dcca..bb491510c7 100644 --- a/types/linq4js/tslint.json +++ b/types/linq4js/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "no-any-union": false, + "no-unnecessary-class": false, "no-unnecessary-generics": false } } diff --git a/types/load-json-file/index.d.ts b/types/load-json-file/index.d.ts index d52a24d8fe..ec554289a5 100644 --- a/types/load-json-file/index.d.ts +++ b/types/load-json-file/index.d.ts @@ -6,15 +6,11 @@ interface LoadJsonFile { /** * Returns a promise for the parsed JSON. - * - * @param filepath */ (filepath: string): Promise; /** * Returns the parsed JSON. - * - * @param filepath */ sync(filepath: string): any; } diff --git a/types/make-dir/index.d.ts b/types/make-dir/index.d.ts index 905343c883..a47b86dfac 100644 --- a/types/make-dir/index.d.ts +++ b/types/make-dir/index.d.ts @@ -12,7 +12,6 @@ export = makeDir; /** * Returns a `Promise` for the path to the created directory. * @param path Directory to create. - * @param options */ declare function makeDir(path: string, options?: makeDir.Options): Promise; @@ -20,7 +19,6 @@ declare namespace makeDir { /** * Returns the path to the created directory. * @param path Directory to create. - * @param options */ function sync(path: string, options?: Options): string; diff --git a/types/merge2/index.d.ts b/types/merge2/index.d.ts index c9c6ddb606..e5f836658e 100644 --- a/types/merge2/index.d.ts +++ b/types/merge2/index.d.ts @@ -52,7 +52,7 @@ declare namespace merge2 { * If you set end === false in options, this event give you a notice that * you should add more streams to merge, or end the mergedStream. * - * @param {string} event The 'queueDrain' event + * @param event The 'queueDrain' event * * @return This stream */ diff --git a/types/modesl/tslint.json b/types/modesl/tslint.json index 3db14f85ea..6a82dd0467 100644 --- a/types/modesl/tslint.json +++ b/types/modesl/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-unnecessary-class": false + } +} diff --git a/types/morgan/index.d.ts b/types/morgan/index.d.ts index e557bd46d9..097758465a 100644 --- a/types/morgan/index.d.ts +++ b/types/morgan/index.d.ts @@ -49,8 +49,6 @@ declare namespace morgan { * client error codes, cyan for redirection codes, and uncolored for * all other codes. * :method :url :status :response-time ms - :res[content-length] - * @param format - * @param options */ (format: 'dev', options?: Options): express.RequestHandler; diff --git a/types/multer/index.d.ts b/types/multer/index.d.ts index 8682c57e3a..d6e73f9ddf 100644 --- a/types/multer/index.d.ts +++ b/types/multer/index.d.ts @@ -23,7 +23,8 @@ declare namespace multer { dest?: string; /** The storage engine to use for uploaded files. */ storage?: StorageEngine; - /** An object specifying the size limits of the following optional properties. This object is passed to busboy + /** + * An object specifying the size limits of the following optional properties. This object is passed to busboy * directly, and the details of properties can be found on https://github.com/mscdex/busboy#busboy-methods */ limits?: { diff --git a/types/multimatch/index.d.ts b/types/multimatch/index.d.ts index 3eeecc3791..67af567cfa 100644 --- a/types/multimatch/index.d.ts +++ b/types/multimatch/index.d.ts @@ -6,10 +6,8 @@ /** * Match utility function which supports multiple pattern globbing. * - * @param {string[]} paths list to match against. - * @param {string[]} patterns globbing patterns to use. e.g. `[*, "!cake"]`. - * @param {multimatch.MultimatchOptions} [options] - * @returns {string[]} + * @param paths list to match against. + * @param patterns globbing patterns to use. e.g. `[*, "!cake"]`. */ declare function multimatch(paths: string[], patterns: string | string[], options?: multimatch.MultimatchOptions): string[]; @@ -61,7 +59,8 @@ declare namespace multimatch { /** Suppress the behavior of treating a leading `!` character as negation. */ nonegate?: boolean; - /** Returns from negate expressions the same as if they were not negated. + /** + * Returns from negate expressions the same as if they were not negated. * (Ie, true on a hit, false on a miss.) */ flipNegate?: boolean; diff --git a/types/nedb-logger/index.d.ts b/types/nedb-logger/index.d.ts index 58f0fa718c..9ac1d823f3 100644 --- a/types/nedb-logger/index.d.ts +++ b/types/nedb-logger/index.d.ts @@ -12,7 +12,7 @@ declare class NeDBLoggerDataStore { /** * Insert a new document - * @param {Function} cb Optional callback, signature: err, insertedDoc + * @param cb Optional callback, signature: err, insertedDoc */ insert(newDoc: T, cb?: (err: Error, document: T) => void): void; } diff --git a/types/node-horseman/index.d.ts b/types/node-horseman/index.d.ts index 46ca810233..760bcd9527 100644 --- a/types/node-horseman/index.d.ts +++ b/types/node-horseman/index.d.ts @@ -103,7 +103,9 @@ declare class horseman { /** Fire a mouse event. */ mouseEvent(type?: string, x?: number, y?: number, button?: string): this; - /** Handles page events. * eventType can be one of: + /** + * Handles page events. + * eventType can be one of: * initialized - callback() * loadStarted - callback() * loadFinished - callback(status) diff --git a/types/node-pg-migrate/tslint.json b/types/node-pg-migrate/tslint.json index 1061428d6e..11ffe86764 100644 --- a/types/node-pg-migrate/tslint.json +++ b/types/node-pg-migrate/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "no-object-literal-type-assertion": false + // TODOs + "no-object-literal-type-assertion": false, + "no-unnecessary-class": false } } diff --git a/types/node-waves/index.d.ts b/types/node-waves/index.d.ts index b4f3f946ef..fd2cb4937c 100644 --- a/types/node-waves/index.d.ts +++ b/types/node-waves/index.d.ts @@ -46,21 +46,21 @@ export function init(config?: WavesConfig): void; * Attach ripple effect by adding `.waves-effect` to HTML element. * Make sure you call `init` to activate the ripple. * - * @param {ElementTarget} elements elements to target. - * @param {(string | string[])} [classes] classes to add. + * @param elements elements to target. + * @param classes classes to add. */ export function attach(elements: ElementTarget, classes?: string | string[]): void; /** * Creates a ripple effect in HTML element programmatically. - * @param {ElementTarget} elements elements to target (must have `.waves-effect` already applied, ideally via `attach`). - * @param {RippleOptions} [options] specify how long to wait between starting and stopping the ripple, and it's position inside the element. + * @param elements elements to target (must have `.waves-effect` already applied, ideally via `attach`). + * @param options specify how long to wait between starting and stopping the ripple, and it's position inside the element. */ export function ripple(elements: ElementTarget, options?: RippleOptions): void; /** * Removes all ripples from inside an element immediately. * - * @param {ElementTarget} elements elements to remove ripples from. + * @param elements elements to remove ripples from. */ export function calm(elements: ElementTarget): void; diff --git a/types/node-wit/tslint.json b/types/node-wit/tslint.json index 3db14f85ea..d5ed3f0240 100644 --- a/types/node-wit/tslint.json +++ b/types/node-wit/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "no-unnecessary-class": false + } +} diff --git a/types/node-xmpp-core/index.d.ts b/types/node-xmpp-core/index.d.ts index 20937aae98..79d742cfd0 100644 --- a/types/node-xmpp-core/index.d.ts +++ b/types/node-xmpp-core/index.d.ts @@ -35,9 +35,8 @@ export class Stanza extends Element { * https://facebook.github.io/jsx/ * Returns a Stanza if name is presence, message or iq an ltx Element otherwise. * - * @param {string} name name of the element - * @param {any} attrs attribute key/value pairs - * @return {Element} Stanza or Element + * @param name name of the element + * @param attrs attribute key/value pairs */ export function createStanza(name: string, attrs?: any): Element; diff --git a/types/nodemailer/lib/addressparser.d.ts b/types/nodemailer/lib/addressparser.d.ts index 4a6f2962cf..dbf5cda468 100644 --- a/types/nodemailer/lib/addressparser.d.ts +++ b/types/nodemailer/lib/addressparser.d.ts @@ -16,8 +16,8 @@ declare namespace addressparser { * * [{name: 'Name', address: 'address@domain'}] * - * @param {String} str Address field - * @return {Array} An array of address objects + * @param str Address field + * @return An array of address objects */ declare function addressparser(address: string): addressparser.Address; diff --git a/types/openpgp/tslint.json b/types/openpgp/tslint.json index c28368c002..ee0546a40f 100644 --- a/types/openpgp/tslint.json +++ b/types/openpgp/tslint.json @@ -8,6 +8,7 @@ "jsdoc-format": false, "max-line-length": false, "no-consecutive-blank-lines": false, + "no-redundant-jsdoc": false, "no-var-keyword": false, "only-arrow-functions": false, "prefer-const": false, diff --git a/types/p-settle/index.d.ts b/types/p-settle/index.d.ts index 26acaccfb1..7298ea055e 100644 --- a/types/p-settle/index.d.ts +++ b/types/p-settle/index.d.ts @@ -22,8 +22,6 @@ declare namespace pSettle { * * `isFulfilled` * * `isRejected` * * `value` or `reason` (Depending on whether the promise fulfilled or rejected) - * - * @param input */ declare function pSettle(input: Iterable>): Promise>>; diff --git a/types/passport-oauth2/passport-oauth2-tests.ts b/types/passport-oauth2/passport-oauth2-tests.ts index 23f97c38ea..bfedf67dad 100644 --- a/types/passport-oauth2/passport-oauth2-tests.ts +++ b/types/passport-oauth2/passport-oauth2-tests.ts @@ -1,5 +1,4 @@ -// tslint:disable-next-line:no-duplicate-imports -import * as OAuth2Strategy from 'passport-oauth2'; +import OAuth2Strategy = require('passport-oauth2'); import { Strategy, StrategyOptions, StrategyOptionsWithRequest, VerifyCallback, AuthorizationError, TokenError, InternalOAuthError } from 'passport-oauth2'; import { Strategy as PassportStrategy } from 'passport'; import { Request } from 'express'; diff --git a/types/pikaday-time/index.d.ts b/types/pikaday-time/index.d.ts index d1cd056b79..bc8b76a2ef 100644 --- a/types/pikaday-time/index.d.ts +++ b/types/pikaday-time/index.d.ts @@ -18,7 +18,7 @@ declare class Pikaday { * Extends the existing configuration options for Pikaday object with the options provided. * Can be used to change/extend the configurations on runtime. * @param options full/partial configuration options. - * @returns {} extended configurations. + * @returns extended configurations. */ config(options: Pikaday.PikadayOptions): Pikaday.PikadayOptions; diff --git a/types/pikaday/index.d.ts b/types/pikaday/index.d.ts index 956356f265..9dc370054f 100644 --- a/types/pikaday/index.d.ts +++ b/types/pikaday/index.d.ts @@ -20,7 +20,7 @@ declare class Pikaday { * Extends the existing configuration options for Pikaday object with the options provided. * Can be used to change/extend the configurations on runtime. * @param options full/partial configuration options. - * @returns {} extended configurations. + * @returns extended configurations. */ config(options: Pikaday.PikadayOptions): Pikaday.PikadayOptions; diff --git a/types/polylabel/index.d.ts b/types/polylabel/index.d.ts index b9a16ed265..f43724741a 100644 --- a/types/polylabel/index.d.ts +++ b/types/polylabel/index.d.ts @@ -6,10 +6,9 @@ /** * Polylabel returns the pole of inaccessibility coordinate in [x, y] format. * - * @param {Array} polygon - Given polygon coordinates in GeoJSON-like format - * @param {number} precision - Precision (1.0 by default) - * @param {boolean} debug - Debugging for Console - * @return {Array} + * @param polygon - Given polygon coordinates in GeoJSON-like format + * @param precision - Precision (1.0 by default) + * @param debug - Debugging for Console * @example * var p = polylabel(polygon, 1.0); */ diff --git a/types/pouchdb-find/index.d.ts b/types/pouchdb-find/index.d.ts index d45b8c40bc..7e974b8921 100644 --- a/types/pouchdb-find/index.d.ts +++ b/types/pouchdb-find/index.d.ts @@ -45,7 +45,8 @@ declare namespace PouchDB { /** Special condition to match the length of an array field in a document. Non-array fields cannot match this condition. */ $size?: number; - /** Divisor and Remainder are both positive or negative integers. + /** + * Divisor and Remainder are both positive or negative integers. * Non-integer values result in a 404 status. * Matches documents where (field % Divisor == Remainder) is true, and only when the document field is an integer. * [divisor, remainder] diff --git a/types/prosemirror-inputrules/tslint.json b/types/prosemirror-inputrules/tslint.json index f93cf8562a..f0f7a6f17a 100644 --- a/types/prosemirror-inputrules/tslint.json +++ b/types/prosemirror-inputrules/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-unnecessary-class": false + } } diff --git a/types/prosemirror-markdown/tslint.json b/types/prosemirror-markdown/tslint.json index 3db14f85ea..d5ed3f0240 100644 --- a/types/prosemirror-markdown/tslint.json +++ b/types/prosemirror-markdown/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "no-unnecessary-class": false + } +} diff --git a/types/qr-image/index.d.ts b/types/qr-image/index.d.ts index 593adce02f..a84f9b10ce 100644 --- a/types/qr-image/index.d.ts +++ b/types/qr-image/index.d.ts @@ -10,16 +10,9 @@ */ export type ec_level = 'L' | 'M' | 'Q' | 'H'; -/** - * image type. Possible values png (default), svg, pdf and eps. - */ +/** @default 'png' */ export type image_type = 'png' | 'svg' | 'pdf' | 'eps'; -/** - * image options object: - * - * @interface IOptions - */ export interface Options { ec_level?: ec_level; // error correction level. One of L, M, Q, H. Default M. type?: image_type; // image type. Possible values png(default), svg, pdf and eps. @@ -29,12 +22,12 @@ export interface Options { } export function image(text: string, level?: ec_level): NodeJS.ReadableStream; -export function image(text: string, optoins?: Options): NodeJS.ReadableStream; +export function image(text: string, options?: Options): NodeJS.ReadableStream; export function imageSync(text: string, level?: ec_level): Buffer; -export function imageSync(text: string, optoins?: Options): string | Buffer; +export function imageSync(text: string, options?: Options): string | Buffer; export function svgObject(text: string, level?: ec_level): any; -export function svgObject(text: string, optoins?: Options): any; +export function svgObject(text: string, options?: Options): any; export function matrix(text: string, level?: ec_level): any[][]; diff --git a/types/query-string/index.d.ts b/types/query-string/index.d.ts index f2145df75f..e7f51453eb 100644 --- a/types/query-string/index.d.ts +++ b/types/query-string/index.d.ts @@ -13,7 +13,6 @@ export interface ParseOptions { /** * Parse a query string into an object. * Leading ? or # are ignored, so you can pass location.search or location.hash directly. - * @param str */ export function parse(str: string, options?: ParseOptions): any; @@ -25,14 +24,10 @@ export interface StringifyOptions { /** * Stringify an object into a query string, sorting the keys. - * - * @param obj */ export function stringify(obj: object, options?: StringifyOptions): string; /** * Extract a query string from a URL that can be passed into .parse(). - * - * @param str */ export function extract(str: string): string; diff --git a/types/quill/tslint.json b/types/quill/tslint.json index b1439230db..b7d2f20244 100644 --- a/types/quill/tslint.json +++ b/types/quill/tslint.json @@ -1,7 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - // TODO - "no-any-union": false + // TODOs + "no-any-union": false, + "no-redundant-jsdoc": false } } diff --git a/types/relay-runtime/tslint.json b/types/relay-runtime/tslint.json index f93cf8562a..f0f7a6f17a 100644 --- a/types/relay-runtime/tslint.json +++ b/types/relay-runtime/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-unnecessary-class": false + } } diff --git a/types/remove-markdown/index.d.ts b/types/remove-markdown/index.d.ts index 6268109366..57e1bdea8c 100644 --- a/types/remove-markdown/index.d.ts +++ b/types/remove-markdown/index.d.ts @@ -8,7 +8,6 @@ export = RemoveMarkdown; /** * Strip Markdown formatting from text * @param markdown Markdown text - * @param options */ declare function RemoveMarkdown(markdown: string, options?: { stripListLeaders?: boolean diff --git a/types/restify-plugins/index.d.ts b/types/restify-plugins/index.d.ts index fd9688c937..05a289c529 100644 --- a/types/restify-plugins/index.d.ts +++ b/types/restify-plugins/index.d.ts @@ -309,7 +309,7 @@ export function dateParser(delta?: number): RequestHandler; export function gzipResponse(options?: any): RequestHandler; export interface ServeStatic { - appendRequestPath?: boolean | undefined; + appendRequestPath?: boolean; directory?: string; maxAge?: number; match?: any; diff --git a/types/restling/index.d.ts b/types/restling/index.d.ts index 02a083078a..2a06d6c3aa 100644 --- a/types/restling/index.d.ts +++ b/types/restling/index.d.ts @@ -9,93 +9,93 @@ import { ServerResponse } from "http"; /** * Create a DELETE request. - * @param {string} url A url address. - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param options Options. + * @return Result. */ export function del(url: string, options?: RestlingOptions): Promise; /** * Create a GET request. - * @param {string} url A url address. - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param options Options. + * @return Result. */ export function get(url: string, options?: RestlingOptions): Promise; /** * Create a HEAD request. - * @param {string} url A url address. - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param options Options. + * @return Result. */ export function head(url: string, options?: RestlingOptions): Promise; /** * Send json data via GET method. - * @param {string} url A url address. - * @param {any} data JSON body - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param data JSON body + * @param options Options. + * @return Result. */ export function json(url: string, data?: any, options?: RestlingOptions, method?: string): Promise; /** * Create a PATCH request. - * @param {string} url A url address. - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param options Options. + * @return Result. */ export function patch(url: string, options?: RestlingOptions): Promise; /** * Send json data via PATCH method. - * @param {string} url A url address. - * @param {any} data JSON body - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param data JSON body + * @param options Options. + * @return Result. */ export function patchJson(url: string, data?: any, options?: RestlingOptions): Promise; /** * Create a POST request. - * @param {string} url A url address. - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param options Options. + * @return Result. */ export function post(url: string, options?: RestlingOptions): Promise; /** * Send json data via POST method. - * @param {string} url A url address. - * @param {any} data JSON body - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param data JSON body + * @param options Options. + * @return Result. */ export function postJson(url: string, data?: any, options?: RestlingOptions): Promise; /** * Create a PUT request. - * @param {string} url A url address. - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param options Options. + * @return Result. */ export function put(url: string, options?: RestlingOptions): Promise; /** * Send json data via PUT method. - * @param {string} url A url address. - * @param {any} data JSON body - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param data JSON body + * @param options Options. + * @return Result. */ export function putJson(url: string, data?: any, options?: RestlingOptions): Promise; /** * Create a request. - * @param {string} url A url address. - * @param {RestlingOptions} options Options. - * @return {Promise} Result. + * @param url A url address. + * @param options Options. + * @return Result. */ export function request(url: string, options?: RestlingOptions): Promise; @@ -107,7 +107,6 @@ export function allAsync(requests: { [key: string]: { url: string, options?: Res /** * Interface for the result. - * @interface */ export interface RestlingResult { data?: any; @@ -116,7 +115,6 @@ export interface RestlingResult { /** * Interface for the header. - * @interface */ export interface RestlerOptionsHeader { [headerName: string]: string; @@ -124,109 +122,91 @@ export interface RestlerOptionsHeader { /** * Interface for restler options. - * @interface */ export interface RestlingOptions { /** * OAuth Bearer Token. - * @type {string} */ accessToken?: string; /** * HTTP Agent instance to use. If not defined globalAgent will be used. If false opts out of connection pooling with an Agent, defaults request to Connection: close. - * @type {any} */ agent?: any; /** * A http.Client instance if you want to reuse or implement some kind of connection pooling. - * @type {any} */ client?: any; /** * Data to be added to the body of the request. - * @type {any} */ data?: any; /** * Encoding of the response body - * @type {string} */ decoding?: string; /** * Encoding of the request body. - * @type {string} */ encoding?: string; /** * If set will recursively follow redirects. - * @type {boolean} */ followRedirects?: boolean; /** * A hash of HTTP headers to be sent. - * @type {RestlerOptionsHeader} */ headers?: RestlerOptionsHeader; /** * Request method - * @type {string} */ method?: string; /** * If set the data passed will be formatted as multipart/form-encoded. - * @type {boolean} */ multipart?: boolean; /** * A function that will be called on the returned data. Use any of predefined restler.parsers. - * @type {any} */ parser?: any; /** * Basic auth password. - * @type {string} */ password?: string; /** * Query string variables as a javascript object, will override the querystring in the URL. - * @type {any} */ query?: any; /** * If true, the server certificate is verified against the list of supplied CAs. * An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. - * @type {boolean} */ rejectUnauthorized?: boolean; /** * Emit the timeout event when the response does not return within the said value (in ms). - * @type {number} */ timeout?: number; /** * Basic auth username. - * @type {string} */ username?: string; /** * Options for xml2js. - * @type {any} */ xml2js?: any; } diff --git a/types/rfc2047/index.d.ts b/types/rfc2047/index.d.ts index 224ec8bbd0..a7b05e08fc 100644 --- a/types/rfc2047/index.d.ts +++ b/types/rfc2047/index.d.ts @@ -5,14 +5,14 @@ /** * Decode - * @param {string} encodedText Encoded Text - * @return {string} Decoded Text + * @param encodedText Encoded Text + * @return Decoded Text */ export function decode(encodedText: string): string; /** * Encode - * @param {string} decodedText Decoded Text - * @return {string} Encoded Text + * @param decodedText Decoded Text + * @return Encoded Text */ export function encode(decodedText: string): string; diff --git a/types/riot/index.d.ts b/types/riot/index.d.ts index 079132db72..2a7a22b596 100644 --- a/types/riot/index.d.ts +++ b/types/riot/index.d.ts @@ -66,8 +66,8 @@ export interface StyleManager { /** * Save a tag style to be later injected into DOM - * @param {string} css - css string - * @param {string} name - if it's passed the css will be mapped to a tagname + * @param css - css string + * @param name - if it's passed the css will be mapped to a tagname */ add(css: string, name?: string): void; @@ -109,7 +109,7 @@ export interface DOMUtil { /** * Check if a DOM node is an svg element * @param element - node to check - * @returns { boolean } True if element is an svg element + * @returns True if element is an svg element */ isSvg(element: Element): element is SVGElement; @@ -715,7 +715,7 @@ export function compile(callback: () => void): void; * Compiles the given tag but doesn't execute it, if `skipExecution` parameter is `true` * @param tag Tag definition * @param skipExecution If `true` tag is not executed after compilation - * @return {string} Compiled JavaScript as string + * @return Compiled JavaScript as string */ export function compile(tag: string, skipExecution?: boolean): string; diff --git a/types/safe-regex/index.d.ts b/types/safe-regex/index.d.ts index 582f8fa443..41aca4c6b3 100644 --- a/types/safe-regex/index.d.ts +++ b/types/safe-regex/index.d.ts @@ -4,4 +4,4 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = safe_regex; -declare function safe_regex(re: string | RegExp, opts?: { limit?: number | undefined }): boolean; +declare function safe_regex(re: string | RegExp, opts?: { limit?: number }): boolean; diff --git a/types/sap__xsenv/index.d.ts b/types/sap__xsenv/index.d.ts index 3858f77feb..6f1b895a33 100644 --- a/types/sap__xsenv/index.d.ts +++ b/types/sap__xsenv/index.d.ts @@ -21,7 +21,7 @@ export function cfServiceCredentials(filter: ServiceFilter): any; /** * Returns an array of Cloud Foundry services matching the given filter. * - * @param filter {(string|Object|function)} + * @param filter * - if string, returns the service with the same service instance name (name property) * - if Object, should have some of these properties [name, label, tag, plan] and returns all services * where all of the given properties match. Given tag matches if it is present in the tags array. @@ -35,12 +35,12 @@ export function filterCFServices(filter: ServiceFilter): any; * * If a service is not found in VCAP_SERVICES, returns default service configuration loaded from a JSON file. * - * @param query {object} describes requested Cloud Foundry services, each property value is a filter + * @param query describes requested Cloud Foundry services, each property value is a filter * as described in filterCFServices. - * @param servicesFile {string} path to JSON file to load default service configuration (default is default-services.json). + * @param servicesFile path to JSON file to load default service configuration (default is default-services.json). * If null, do not load default service configuration. * - * @returns {object} with the same properties as in query argument where the value of each + * @returns with the same properties as in query argument where the value of each * property is the respective service credentials object. * @throws Error, if for some of the requested services no or multiple instances are found; Error, if query parameter is not provided */ diff --git a/types/serialize-javascript/index.d.ts b/types/serialize-javascript/index.d.ts index deb4331961..b0331a3d03 100644 --- a/types/serialize-javascript/index.d.ts +++ b/types/serialize-javascript/index.d.ts @@ -9,7 +9,7 @@ declare namespace serializeJavascript { * This option is the same as the space argument that can be passed to JSON.stringify. * It can be used to add whitespace and indentation to the serialized output to make it more readable. */ - space?: string | number | undefined; + space?: string | number; /** * This option is a signal to serialize() that the object being serialized does not contain any function or regexps values. * This enables a hot-path that allows serialization to be over 3x faster. @@ -21,9 +21,9 @@ declare namespace serializeJavascript { /** * Serialize JavaScript to a superset of JSON that includes regular expressions and functions. - * @param {any} input data to serialize - * @param {serializeJavascript.SerializeJSOptions} options optional object - * @returns {string} serialized data + * @param input data to serialize + * @param options optional object + * @returns serialized data */ declare function serializeJavascript(input: any, options?: serializeJavascript.SerializeJSOptions): string; export = serializeJavascript; diff --git a/types/sha1/index.d.ts b/types/sha1/index.d.ts index 81b2202dc3..bb55d2f4fc 100644 --- a/types/sha1/index.d.ts +++ b/types/sha1/index.d.ts @@ -8,9 +8,9 @@ /** * js function for hashing messages with SHA1 * - * @param {(string | Buffer)} message - a string or buffer to hash - * @param {Sha1Options} options - an options object - * @returns {string} the resultant SHA1 hash of the given message + * @param message - a string or buffer to hash + * @param options - an options object + * @returns the resultant SHA1 hash of the given message */ declare function main(message: string | Buffer, options?: Sha1Options): string | Uint8Array; export = main; diff --git a/types/simple-oauth2/index.d.ts b/types/simple-oauth2/index.d.ts index 37add22766..499f39e56e 100644 --- a/types/simple-oauth2/index.d.ts +++ b/types/simple-oauth2/index.d.ts @@ -83,7 +83,7 @@ export interface OAuthClient { authorizationCode: { /** * Redirect the user to the autorization page - * @return {string} the absolute authorization url + * @return the absolute authorization url */ authorizeURL(params?: { /** A string that represents the registered application URI where the user is redirected after authentication */ diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index f8258efc95..9442289490 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -529,7 +529,7 @@ declare namespace Sinon { /** * Creates a new object with the given functions as the prototype and stubs all implemented functions. * - * @type TType Type being stubbed. + * @template TType Type being stubbed. * @param constructor Object or class to stub. * @returns A stubbed version of the constructor. * @remarks The given constructor function is not invoked. See also the stub API. @@ -543,7 +543,7 @@ declare namespace Sinon { /** * Stubbed type of an object with members replaced by stubs. * - * @type TType Type being stubbed. + * @template TType Type being stubbed. */ interface StubbableType { new(...args: any[]): TType; @@ -552,7 +552,7 @@ declare namespace Sinon { /** * An instance of a stubbed object type with members replaced by stubs. * - * @type TType Object type being stubbed. + * @template TType Object type being stubbed. */ type SinonStubbedInstance = { [P in keyof TType]: SinonStub; diff --git a/types/slocket/index.d.ts b/types/slocket/index.d.ts index a33ab9ffd8..c21fb10c23 100644 --- a/types/slocket/index.d.ts +++ b/types/slocket/index.d.ts @@ -19,9 +19,9 @@ interface Slocket { declare namespace slocket { interface Slocket extends EventEmitter { then( - onfulfilled?: ((value: Lock) => TResult1 | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; + onfulfilled?: ((value: Lock) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): Promise; } interface Lock { diff --git a/types/snazzy-info-window/index.d.ts b/types/snazzy-info-window/index.d.ts index e4f644ece0..bf0f527b28 100644 --- a/types/snazzy-info-window/index.d.ts +++ b/types/snazzy-info-window/index.d.ts @@ -304,7 +304,6 @@ declare class SnazzyInfoWindow extends google.maps.OverlayView { * Set the position of the info window. * A valid Google Map instance must be associated to the info window. * This could be either through the marker or map option. - * @param latLng */ setPosition(latLng: google.maps.LatLng | google.maps.LatLngLiteral): void; diff --git a/types/soundmanager2/index.d.ts b/types/soundmanager2/index.d.ts index d211e4c359..5f5e9a1ffb 100644 --- a/types/soundmanager2/index.d.ts +++ b/types/soundmanager2/index.d.ts @@ -60,7 +60,6 @@ declare namespace soundmanager { * soundmanager2_flash9.swf and debug versions etc.) Note that SM2 will * append the correct SWF file name, depending on flashVersion and * debugMode settings. - * @type {string} */ url?: string; @@ -110,8 +109,6 @@ declare namespace soundmanager { clearOnPosition(id: string, msecOffset: number, callback?: (() => void)): SMSound; /** * Creates a sound object, supporting an arbitrary number of optional arguments. Returns a SMSound object instance. At minimum, a url parameter is required. - * @param {SoundProperties} properties [description] - * @return {SMSound} [description] */ createSound(properties: SoundProperties): SMSound; destroySound(id: string): void; @@ -135,7 +132,7 @@ declare namespace soundmanager { setVolume(id: string, volume: number): SMSound; /** * Sets the volume of all sound objects. Accepted values: 0-100. Affects volume property. - * @param {number} volume [Volume of all sound objects. Accepted values: 0 - 100] + * @param volume Volume of all sound objects. Accepted values: 0 - 100 */ setVolume(volume: number): void; stop(id: string): SMSound; diff --git a/types/sshpk/tslint.json b/types/sshpk/tslint.json index 3db14f85ea..6a82dd0467 100644 --- a/types/sshpk/tslint.json +++ b/types/sshpk/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-unnecessary-class": false + } +} diff --git a/types/string-similarity/string-similarity-tests.ts b/types/string-similarity/string-similarity-tests.ts index 216c1dedf2..1e5003522c 100644 --- a/types/string-similarity/string-similarity-tests.ts +++ b/types/string-similarity/string-similarity-tests.ts @@ -9,16 +9,11 @@ const match: stringSimilarity.BestMatch = stringSimilarity.findBestMatch('Olive- ]); // ratings accessible -for (const rating of match.ratings){ - isString(rating.target); - isNumber(rating.rating); +for (const rating of match.ratings) { + rating.target; // $ExpectType string + rating.rating; // $ExpectType number } // bestMatch accessible match.bestMatch.rating; match.bestMatch.target; - -function isString(x: string): void { -} -function isNumber(x: number): void { -} diff --git a/types/strong-cluster-control/index.d.ts b/types/strong-cluster-control/index.d.ts index e0b3fb5c12..d0d577236c 100644 --- a/types/strong-cluster-control/index.d.ts +++ b/types/strong-cluster-control/index.d.ts @@ -53,7 +53,6 @@ declare namespace StrongClusterControl { /** * @description Stop the controller, after stopping workers (if the size is being controlled, see setSize()). - * @param callback */ stop(callback?: () => any): this; diff --git a/types/sumo-logger/index.d.ts b/types/sumo-logger/index.d.ts index 9ada2e9051..bc89e0eaa8 100644 --- a/types/sumo-logger/index.d.ts +++ b/types/sumo-logger/index.d.ts @@ -118,7 +118,8 @@ declare class SumoLogger { */ log(event: Partial & T): void; - /** Force any pending logs to be sent immediately. This is mainly for use in a + /** + * Force any pending logs to be sent immediately. This is mainly for use in a * logOut/`window.onBeforeUnload` flow to ensure that any remaining queued * messages are sent to Sumo Logic. */ diff --git a/types/swagger-sails-hook/index.d.ts b/types/swagger-sails-hook/index.d.ts index 203dc5d62f..6376d6d94b 100644 --- a/types/swagger-sails-hook/index.d.ts +++ b/types/swagger-sails-hook/index.d.ts @@ -14,7 +14,7 @@ export = SwaggerHook; /** * Create a new `swagger-sails-hook` sails hook and register it with `sails` - * @param {any} sails - reference to the running sails instance + * @param sails - reference to the running sails instance * @returns SailsHook - `swagger-sails-hook` object implementing the Sails' hook specification. */ declare function SwaggerHook(sails: any): SwaggerHook.SailsHook; @@ -30,7 +30,7 @@ declare namespace SwaggerHook { /** * Perform startup tasks. * All Sails configuration is guaranteed to be completed before a hook’s initialize function runs. - * @param {Function} done - called when `swagger-sails-hook`'s startup tasks have finished. + * @param done - called when `swagger-sails-hook`'s startup tasks have finished. */ initialize(done: () => any): void; diff --git a/types/tabris-plugin-firebase/index.d.ts b/types/tabris-plugin-firebase/index.d.ts index 3a9e7b350f..0ade0c9dcf 100644 --- a/types/tabris-plugin-firebase/index.d.ts +++ b/types/tabris-plugin-firebase/index.d.ts @@ -68,7 +68,6 @@ declare class NativeObject { /** * Gets the current value of the given *property*. - * @param property */ get(property: string): any; @@ -116,14 +115,11 @@ declare class NativeObject { /** * Sets the given property. - * @param property - * @param value */ set(property: string, value: any): this; /** * Sets all key-value pairs in the properties object as widget properties. - * @param properties */ set(properties: object): this; @@ -137,9 +133,8 @@ declare class NativeObject { /** * An application-wide unique identifier automatically assigned to all native objects on creation. - * @static */ - readonly cid: string; + static readonly cid: string; } interface PropertyChangedEvent { diff --git a/types/thrift/thrift-tests.ts b/types/thrift/thrift-tests.ts index da9e9eafa0..c829b8e41c 100644 --- a/types/thrift/thrift-tests.ts +++ b/types/thrift/thrift-tests.ts @@ -23,11 +23,9 @@ interface MockServiceHandlers { } class MockProcessor { - constructor() {} } class MockClient { - constructor() {} } const mockServiceHandlers: MockServiceHandlers = { diff --git a/types/tinymce/tslint.json b/types/tinymce/tslint.json index a42975357d..4df63472dd 100644 --- a/types/tinymce/tslint.json +++ b/types/tinymce/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "no-empty-interface": false, + "no-unnecessary-class": false, "no-unnecessary-generics": false } } diff --git a/types/tocktimer/index.d.ts b/types/tocktimer/index.d.ts index 20bd344c83..a48929f169 100644 --- a/types/tocktimer/index.d.ts +++ b/types/tocktimer/index.d.ts @@ -31,13 +31,12 @@ declare namespace t { class Tock { /** * Create a Tock instance - * @param opts */ constructor(opts?: TockOptions) /** * Start the timer - * @param [time] {Number} Optional. Can be either a countdown value or a starting value. + * @param time Can be either a countdown value or a starting value. * If a countdown timer then set time to count down from. * If a starting value then set time to the desired start time to count up from. */ @@ -65,14 +64,11 @@ declare namespace t { /** * Convert number of milliseconds to a MM:SS time string. Won't handle times greater than 1 hour - * @param ms */ msToTime: (ms: number) => string; /** * Convert number of milliseconds to timecode string - * @param ms - * @param showMs */ msToTimecode: (ms: number, showMs?: boolean) => string; @@ -80,7 +76,6 @@ declare namespace t { * Convert a time string to a number of milliseconds. Should be a duration as a string of form MM:SS, MM:SS:ms, MM:SS.ms, HH:MM:SS * Alternatively a time in the future can be provided using the form yyyy-mm-dd HH:MM:SS.ms. The difference between this time and present will be returned. * If the input cannot be recognized as one of the above then 0 is returned - * @param ms */ timeToMS: (time: string) => number; } diff --git a/types/undertaker-registry/index.d.ts b/types/undertaker-registry/index.d.ts index 02bff9fab3..34b56b4113 100644 --- a/types/undertaker-registry/index.d.ts +++ b/types/undertaker-registry/index.d.ts @@ -8,7 +8,7 @@ declare class UndertakerRegistry { * Returns the task with that name or undefined if no task is registered with that name. * Useful for custom task storage. * Custom registries can override this method when inheriting from this default registry. - * @param taskName {string} - Name of task. + * @param taskName - Name of task. */ get(taskName: string): TTaskFunction; @@ -16,7 +16,7 @@ declare class UndertakerRegistry { * No-op method that receives the undertaker instance. * Useful to set pre-defined tasks using the undertaker.task(taskName, fn) method. * Custom registries can override this method when inheriting from this default registry. - * @param taker {any} - Instance of undertaker. + * @param taker - Instance of undertaker. */ init(taker: any): void; @@ -25,8 +25,8 @@ declare class UndertakerRegistry { * If set modifies a task, it should return the new task so Undertaker can properly maintain metadata for the task. * Useful for adding custom behavior to every task as it is registered in the system. * Custom registries can override this method when inheriting from this default registry. - * @param taskName {string} - Name of task. - * @param fn {UndertakerRegistry.TaskFunction} - Task function. + * @param taskName - Name of task. + * @param fn - Task function. */ set(taskName: string, fn: TTaskFunction): TTaskFunction; diff --git a/types/universal-router/index.d.ts b/types/universal-router/index.d.ts index b17256ce77..47a7384872 100644 --- a/types/universal-router/index.d.ts +++ b/types/universal-router/index.d.ts @@ -60,9 +60,9 @@ export type Routes = Array>; * @template R Result that every action function resolves to. If the action * returns a Promise, R can be the type the Promise resolves to. * - * @param {Routes | Route} routes - Single route or array of routes. - * @param {string | String | Context & C} pathOrContext - path to resolve or + * @param routes - Single route or array of routes. + * @param pathOrContext - path to resolve or * context object that contains the path along with other data. - * @return {Promise} - Result of matched action function wrapped in a Promsie. + * @return - Result of matched action function wrapped in a Promsie. */ export function resolve(routes: Routes | Route, pathOrContext: string | String | Context & C): Promise; diff --git a/types/vast-client/index.d.ts b/types/vast-client/index.d.ts index 680e1e2dd8..4ab079a431 100644 --- a/types/vast-client/index.d.ts +++ b/types/vast-client/index.d.ts @@ -200,7 +200,7 @@ export interface VastRequestOptions { * A VAST XML document. When response is provided, no Ajax request is made and thus the url parameter is ignored. */ response?: string; - /**a + /** * A URL handler module, used to fetch the VAST document instead of the default ones. */ urlhandler?: any; diff --git a/types/viewerjs/index.d.ts b/types/viewerjs/index.d.ts index 28c26c911e..20a0806633 100644 --- a/types/viewerjs/index.d.ts +++ b/types/viewerjs/index.d.ts @@ -212,7 +212,6 @@ declare namespace Viewer { /** * Change the global default options. - * @param options */ function setDefaults(options: ViewerOption): void; @@ -222,7 +221,8 @@ declare namespace Viewer { function noConflict(): void; } -/** * JavaScript image viewer. +/** + * JavaScript image viewer. * @see {@link https://github.com/fengyuanchen/viewerjs} */ declare class Viewer { @@ -292,7 +292,6 @@ declare class Viewer { /** * Rotate the image to an absolute degree. - * @param degree */ rotateTo(degree: number): void; @@ -365,7 +364,8 @@ declare class Viewer { destroy(): void; } -/** JavaScript image viewer. +/** + * JavaScript image viewer. * @see {@link https://github.com/fengyuanchen/viewerjs} */ export = Viewer; diff --git a/types/vinyl-fs/index.d.ts b/types/vinyl-fs/index.d.ts index 4e0ac3317b..d3b13baeaa 100644 --- a/types/vinyl-fs/index.d.ts +++ b/types/vinyl-fs/index.d.ts @@ -108,12 +108,14 @@ export interface SrcOptions extends globStream.Options { } export interface DestOptions { - /** Specify the working directory the folder is relative to + /** + * Specify the working directory the folder is relative to * Default is process.cwd() */ cwd?: string; - /** Specify the mode the files should be created with + /** + * Specify the mode the files should be created with * Default is the mode of the input file (file.stat.mode) * or the process mode if the input file has no mode property */ @@ -125,12 +127,14 @@ export interface DestOptions { /** Specify if existing files with the same path should be overwritten or not. Default is true, to always overwrite existing files */ overwrite?: boolean; - /** Enables sourcemap support on files passed through the stream. Will write inline soucemaps if + /** + * Enables sourcemap support on files passed through the stream. Will write inline soucemaps if * specified as true. Specifying a string path will write external sourcemaps at the given path. */ sourcemaps?: true | string; - /** When creating a symlink, whether or not the created symlink should be relative. If false, + /** + * When creating a symlink, whether or not the created symlink should be relative. If false, * the symlink will be absolute. Note: This option will be ignored if a junction is being created. */ relativeSymlinks?: boolean; diff --git a/types/webassembly-js-api/tslint.json b/types/webassembly-js-api/tslint.json index 65c83fb1e3..d8590b6513 100644 --- a/types/webassembly-js-api/tslint.json +++ b/types/webassembly-js-api/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "dt-header": false + // TODOs + "dt-header": false, + "no-unnecessary-class": false } } diff --git a/types/webdriverio/tslint.json b/types/webdriverio/tslint.json index 1881fbd79d..5ab241cb96 100644 --- a/types/webdriverio/tslint.json +++ b/types/webdriverio/tslint.json @@ -6,6 +6,7 @@ "no-declare-current-package": false, "no-single-declare-module": false, "unified-signatures": false, + "no-unnecessary-class": false, "no-unnecessary-generics": false } } From 8f3fc5b8d7e2289662cda090bfbab287b26fabbf Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 23 Oct 2017 16:10:43 +0200 Subject: [PATCH 091/314] Updated type definitions to yFiles for HTML 2.0.1.3 (#20611) * Updated type definitions to yFiles for HTML 2.0.1.3 * Changed version number in header. --- types/yfiles/index.d.ts | 3119 ++++++++++++++++++++------------------- 1 file changed, 1572 insertions(+), 1547 deletions(-) diff --git a/types/yfiles/index.d.ts b/types/yfiles/index.d.ts index a3593bdc76..2d47b00067 100644 --- a/types/yfiles/index.d.ts +++ b/types/yfiles/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for yFiles for HTML 2.0.1.2 +// Type definitions for yFiles for HTML 2.0.13 // Project: http://www.yworks.com/products/yfiles-for-html // Definitions by: yWorks GmbH HTML Team // Definitions: https://github.com/yWorks/DefinitelyTyped /**************************************************************************** ** - ** This file is part of yFiles for HTML 2.0.1.2 + ** This file is part of yFiles for HTML 2.0.1.3 ** ** yWorks proprietary/confidential. Use is subject to license terms. ** @@ -25,8 +25,7 @@ declare namespace yfiles{ function BaseClass(...base:any[]):yfiles.lang.ClassConstructor; function BaseClass(...base:any[]):yfiles.lang.ClassConstructor; } -} -declare namespace yfiles{ +}declare namespace yfiles{ export namespace lang{ /** * The root of the class hierarchy of the yFiles for HTML class framework. @@ -158,15 +157,15 @@ declare namespace yfiles{ * var MyList = yfiles.lang.Class('MyList', { * $extends: my.AbstractList, * $with: [my.Iterable, my.Collection], - * + * * constructor: function() { // the constructor function * }, - * + * * add: function(obj) { ... }, * size: { // transformed into a property * 'get': function() { return ...; } * }, - * + * * $static: { * create: function() { ... } * } @@ -176,7 +175,7 @@ declare namespace yfiles{ * list.add("hello"); * list.size === 1; // true * - * + * *

    * The constructor property can be either a function (in case of a single constructor) or an object that is transformed * into named constructors. @@ -197,7 +196,7 @@ declare namespace yfiles{ * myrect = new Rect.FromPoint({x: 10, y: 10}, 50, 50); * myrect instanceof Rect; // true * - * + * *

    * Named constructors can call other constructors and can be written like any other constructor, i.e. this will be a new * instance of the class that is being constructed. @@ -211,7 +210,7 @@ declare namespace yfiles{ *

          * Rect.$super.toString.call(this);
          * 
    - * + * *

    * If you do not specify the parent class of a new class, then {@link yfiles.lang.Object} will be used as its base type. The parent * class of {@link yfiles.lang.Object} is the standard JavaScript Object.prototype. @@ -285,13 +284,13 @@ declare namespace yfiles{ * //yfiles.lang.Class.injectInterfaces(myHitTestable, [yfiles.drawing.IHitTestable.$class, yfiles.support.ILookup.$class]); * //As well as using a variable number of arguments, such as: * //yfiles.lang.Class.injectInterfaces(myHitTestable, yfiles.drawing.IHitTestable, yfiles.support.ILookup); - * + * * //This is true now: * yfiles.drawing.IHitTestable.isInstance(myHitTestable); * //And the object can be used where an interface instance is expected: * graphEditorInputMode.clickInputMode.validClickHitTestable = myHitTestable; * - * + * *

    * It is also possible to modify an object prototype, e.g. in TypeScript: Class definition: *

    @@ -302,7 +301,7 @@ declare namespace yfiles{ * } * } * - * + * *

    * Usage: *

    @@ -317,7 +316,7 @@ declare namespace yfiles{ * //And the object can be used where an interface instance is expected: * graphEditorInputMode.clickInputMode.validClickHitTestable = myHitTestable; * - * + * * @param obj The object to modify. * @param interfaces Array or variable number of {@link }s, {@link } objects of interfaces or fully qualified string * names of interfaces. @@ -439,7 +438,7 @@ declare namespace yfiles{ /** * This methods creates an instance of the struct in which all of its values are set to their default values without using * any of its constructors. - * @returns + * @returns * @static */ static createDefault():any; @@ -478,7 +477,7 @@ declare namespace yfiles{ * }); * if(state === RequestState.FAILED) { ... } * - * + * * @class */ export interface Enum extends yfiles.lang.Object{} @@ -691,7 +690,7 @@ declare namespace yfiles{ * var attr = yfiles.lang.Attribute.getCustomAttribute(MyClass.$class, MyAttribute.$class); * console.log(attr.message + ' ' + attr.recipient); // 'hello world' * - * + * *

    * Even though MyAttribute is invoked at the definition of MyClass, no attribute is created until the reflection API is * used (in the above example: using getCustomAttribute). @@ -908,7 +907,7 @@ declare namespace yfiles{ /** * Compares this object to the given object of the same type. * @param obj The object to compare this to. - * @returns + * @returns *