TypeScript Version: 3.6.3
Search Terms: reference
Code
import { memoize } from 'lodash';
export const fn = memoize((num: number) => num + 1);
Expected behavior:
The resulting .d.ts file should look like this:
export declare const fn: ((num: number) => number) & import("lodash").MemoizedFunction;
Actual behavior:
Instead, since TS 3.6, this is what is generated:
/// <reference types="lodash/common/common" />
/// <reference types="lodash/common/array" />
/// <reference types="lodash/common/collection" />
/// <reference types="lodash/common/date" />
/// <reference types="lodash/common/function" />
/// <reference types="lodash/common/lang" />
/// <reference types="lodash/common/math" />
/// <reference types="lodash/common/number" />
/// <reference types="lodash/common/object" />
/// <reference types="lodash/common/seq" />
/// <reference types="lodash/common/string" />
/// <reference types="lodash/common/util" />
export declare const fn: ((num: number) => number) & import("lodash").MemoizedFunction;
This breaks the types for consumers of this .d.ts file:
$ npx tsc
node_modules/@types/lodash/ts3.1/common/common.d.ts:190:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
190 interface Function<T extends (...args: any) => any> extends LoDashImplicitWrapper<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/common.d.ts:200:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
200 interface FunctionChain<T extends (...args: any) => any> extends LoDashExplicitWrapper<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:35:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
35 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:41:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
41 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:297:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
297 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:309:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
309 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:333:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
333 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:345:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
345 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:394:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
394 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:400:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
400 interface FunctionChain<T extends (...args: any) => any> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:470:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
470 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:476:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
476 interface FunctionChain<T extends (...args: any) => any> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:504:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
504 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:510:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
510 interface FunctionChain<T extends (...args: any) => any> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:526:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
526 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:530:49 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
530 negate(): Function<(...args: Parameters<T>) => boolean>;
~
node_modules/@types/lodash/ts3.1/common/function.d.ts:532:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
532 interface FunctionChain<T extends (...args: any) => any> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:536:54 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
536 negate(): FunctionChain<(...args: Parameters<T>) => boolean>;
~
node_modules/@types/lodash/ts3.1/common/function.d.ts:548:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
548 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:554:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
554 interface FunctionChain<T extends (...args: any) => any> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:571:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
571 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:577:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
577 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:625:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
625 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:741:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
741 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:902:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
902 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1065:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
1065 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1239:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
1239 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1245:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
1245 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1264:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
1264 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1270:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
1270 interface FunctionChain<T extends (...args: any) => any> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1288:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
1288 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1292:73 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
1292 spread(start?: number): Function<(...args: any[]) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1294:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
1294 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1298:78 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
1298 spread(start?: number): FunctionChain<(...args: any[]) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1329:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
1329 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1335:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
1335 interface FunctionChain<T extends (...args: any) => any> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1356:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
1356 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1360:34 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
1360 unary(): Function<(arg1: Parameters<T>['0']) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1360:45 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
1360 unary(): Function<(arg1: Parameters<T>['0']) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1360:68 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
1360 unary(): Function<(arg1: Parameters<T>['0']) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1362:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
1362 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1366:39 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
1366 unary(): FunctionChain<(arg1: Parameters<T>['0']) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1366:50 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
1366 unary(): FunctionChain<(arg1: Parameters<T>['0']) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/function.d.ts:1366:73 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
1366 unary(): FunctionChain<(arg1: Parameters<T>['0']) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/lang.d.ts:33:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
33 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/lang.d.ts:69:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
69 interface FunctionChain<T extends (...args: any) => any> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/seq.d.ts:65:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
65 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:205:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
205 interface Function<T extends (...arg: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:209:57 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
209 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) =>
R7): Function<(...args: Parameters<T>) => R7>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:209:194 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
209 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) =>
R7): Function<(...args: Parameters<T>) => R7>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:213:57 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
213 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) =>
R7, ...func: Array<Many<(a: any) => any>>): Function<(...args: Parameters<T>) => any>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:213:233 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
213 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) =>
R7, ...func: Array<Many<(a: any) => any>>): Function<(...args: Parameters<T>) => any>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:217:53 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
217 flow<R2, R3, R4, R5, R6>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): Function<(...args: Parameters<T>) => R6>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:217:171 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
217 flow<R2, R3, R4, R5, R6>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): Function<(...args: Parameters<T>) => R6>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:221:49 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
221 flow<R2, R3, R4, R5>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): Function<(...args: Parameters<T>) => R5>; ~
node_modules/@types/lodash/ts3.1/common/util.d.ts:221:148 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
221 flow<R2, R3, R4, R5>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): Function<(...args: Parameters<T>) => R5>; ~
node_modules/@types/lodash/ts3.1/common/util.d.ts:225:45 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
225 flow<R2, R3, R4>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): Function<(...args: Parameters<T>) => R4>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:225:125 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
225 flow<R2, R3, R4>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): Function<(...args: Parameters<T>) => R4>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:229:41 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
229 flow<R2, R3>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3): Function<(...args: Parameters<T>) => R3>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:229:102 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
229 flow<R2, R3>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3): Function<(...args: Parameters<T>) => R3>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:233:37 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
233 flow<R2>(f2: (a: ReturnType<T>) => R2): Function<(...args: Parameters<T>) => R2>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:233:79 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
233 flow<R2>(f2: (a: ReturnType<T>) => R2): Function<(...args: Parameters<T>) => R2>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:239:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
239 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:243:57 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
243 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) =>
R7): FunctionChain<(...args: Parameters<T>) => R7>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:243:199 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
243 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) =>
R7): FunctionChain<(...args: Parameters<T>) => R7>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:247:57 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
247 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) =>
R7, ...func: Array<Many<(a: any) => any>>): FunctionChain<(...args: Parameters<T>) => any>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:247:238 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
247 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) =>
R7, ...func: Array<Many<(a: any) => any>>): FunctionChain<(...args: Parameters<T>) => any>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:251:53 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
251 flow<R2, R3, R4, R5, R6>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): FunctionChain<(...args: Parameters<T>) => R6>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:251:176 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
251 flow<R2, R3, R4, R5, R6>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): FunctionChain<(...args: Parameters<T>) => R6>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:255:49 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
255 flow<R2, R3, R4, R5>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): FunctionChain<(...args: Parameters<T>) => R5>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:255:153 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
255 flow<R2, R3, R4, R5>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): FunctionChain<(...args: Parameters<T>) => R5>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:259:45 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
259 flow<R2, R3, R4>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): FunctionChain<(...args: Parameters<T>) => R4>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:259:130 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
259 flow<R2, R3, R4>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): FunctionChain<(...args: Parameters<T>) => R4>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:263:41 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
263 flow<R2, R3>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3): FunctionChain<(...args: Parameters<T>) => R3>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:263:107 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
263 flow<R2, R3>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3): FunctionChain<(...args: Parameters<T>) => R3>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:267:37 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
267 flow<R2>(f2: (a: ReturnType<T>) => R2): FunctionChain<(...args: Parameters<T>) => R2>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:267:84 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
267 flow<R2>(f2: (a: ReturnType<T>) => R2): FunctionChain<(...args: Parameters<T>) => R2>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:308:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
308 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:312:71 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
312 flowRight<A extends any[], R1, R2, R3, R4, R5>(f6: (a: R5) => Parameters<T>["0"], f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:312:82 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
312 flowRight<A extends any[], R1, R2, R3, R4, R5>(f6: (a: R5) => Parameters<T>["0"], f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:312:228 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
312 flowRight<A extends any[], R1, R2, R3, R4, R5>(f6: (a: R5) => Parameters<T>["0"], f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:316:67 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
316 flowRight<A extends any[], R1, R2, R3, R4>(f5: (a: R4) => Parameters<T>["0"], f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:316:78 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
316 flowRight<A extends any[], R1, R2, R3, R4>(f5: (a: R4) => Parameters<T>["0"], f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:316:205 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
316 flowRight<A extends any[], R1, R2, R3, R4>(f5: (a: R4) => Parameters<T>["0"], f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:320:63 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
320 flowRight<A extends any[], R1, R2, R3>(f4: (a: R3) => Parameters<T>["0"], f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:320:74 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
320 flowRight<A extends any[], R1, R2, R3>(f4: (a: R3) => Parameters<T>["0"], f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:320:182 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
320 flowRight<A extends any[], R1, R2, R3>(f4: (a: R3) => Parameters<T>["0"], f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:324:59 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
324 flowRight<A extends any[], R1, R2>(f3: (a: R2) => Parameters<T>["0"], f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:324:70 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
324 flowRight<A extends any[], R1, R2>(f3: (a: R2) => Parameters<T>["0"], f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:324:159 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
324 flowRight<A extends any[], R1, R2>(f3: (a: R2) => Parameters<T>["0"], f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:328:55 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
328 flowRight<A extends any[], R1>(f2: (a: R1) => Parameters<T>["0"], f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:328:66 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
328 flowRight<A extends any[], R1>(f2: (a: R1) => Parameters<T>["0"], f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:328:136 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
328 flowRight<A extends any[], R1>(f2: (a: R1) => Parameters<T>["0"], f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:332:56 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
332 flowRight<A extends any[]>(f1: (...args: A) => Parameters<T>["0"]): Function<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:332:67 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
332 flowRight<A extends any[]>(f1: (...args: A) => Parameters<T>["0"]): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:332:113 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
332 flowRight<A extends any[]>(f1: (...args: A) => Parameters<T>["0"]): Function<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:338:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
338 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:342:71 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
342 flowRight<A extends any[], R1, R2, R3, R4, R5>(f6: (a: R5) => Parameters<T>["0"], f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:342:82 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
342 flowRight<A extends any[], R1, R2, R3, R4, R5>(f6: (a: R5) => Parameters<T>["0"], f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:342:233 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
342 flowRight<A extends any[], R1, R2, R3, R4, R5>(f6: (a: R5) => Parameters<T>["0"], f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:346:67 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
346 flowRight<A extends any[], R1, R2, R3, R4>(f5: (a: R4) => Parameters<T>["0"], f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:346:78 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
346 flowRight<A extends any[], R1, R2, R3, R4>(f5: (a: R4) => Parameters<T>["0"], f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:346:210 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
346 flowRight<A extends any[], R1, R2, R3, R4>(f5: (a: R4) => Parameters<T>["0"], f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:350:63 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
350 flowRight<A extends any[], R1, R2, R3>(f4: (a: R3) => Parameters<T>["0"], f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:350:74 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
350 flowRight<A extends any[], R1, R2, R3>(f4: (a: R3) => Parameters<T>["0"], f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:350:187 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
350 flowRight<A extends any[], R1, R2, R3>(f4: (a: R3) => Parameters<T>["0"], f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:354:59 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
354 flowRight<A extends any[], R1, R2>(f3: (a: R2) => Parameters<T>["0"], f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:354:70 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
354 flowRight<A extends any[], R1, R2>(f3: (a: R2) => Parameters<T>["0"], f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:354:164 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
354 flowRight<A extends any[], R1, R2>(f3: (a: R2) => Parameters<T>["0"], f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:358:55 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
358 flowRight<A extends any[], R1>(f2: (a: R1) => Parameters<T>["0"], f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:358:66 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
358 flowRight<A extends any[], R1>(f2: (a: R1) => Parameters<T>["0"], f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:358:141 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
358 flowRight<A extends any[], R1>(f2: (a: R1) => Parameters<T>["0"], f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:362:56 - error TS2536: Type '"0"' cannot be used to index type 'Parameters<T>'.
362 flowRight<A extends any[]>(f1: (...args: A) => Parameters<T>["0"]): FunctionChain<(...args: A) => ReturnType<T>>;
~~~~~~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:362:67 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
362 flowRight<A extends any[]>(f1: (...args: A) => Parameters<T>["0"]): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:362:118 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
362 flowRight<A extends any[]>(f1: (...args: A) => Parameters<T>["0"]): FunctionChain<(...args: A) => ReturnType<T>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:429:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
429 interface Function<T extends (...args: any) => any> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:453:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
453 interface FunctionChain<T extends (...args: any) => any> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:728:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
728 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:732:126 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
732 over<TResult>(...iteratees: Array<Many<(...args: any[]) => TResult>>): Function<(...args: any[]) => Array<ReturnType<T> | TResult>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:740:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
740 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:744:131 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
744 over<TResult>(...iteratees: Array<Many<(...args: any[]) => TResult>>): FunctionChain<(...args: any[]) => Array<ReturnType<T> | TResult>>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:763:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
763 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:767:115 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
767 overEvery<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): Function<(...args: Parameters<T> | TArgs[]) => boolean>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:775:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
775 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:779:120 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
779 overEvery<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): FunctionChain<(...args: Parameters<T> | TArgs[]) => boolean>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:798:15 - error TS2428: All declarations of 'Function' must have identical type parameters.
798 interface Function<T> {
~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:802:114 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
802 overSome<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): Function<(...args: Parameters<T> | TArgs[]) => boolean>;
~
node_modules/@types/lodash/ts3.1/common/util.d.ts:810:15 - error TS2428: All declarations of 'FunctionChain' must have identical type parameters.
810 interface FunctionChain<T> {
~~~~~~~~~~~~~
node_modules/@types/lodash/ts3.1/common/util.d.ts:814:119 - error TS2344: Type 'T' does not satisfy the constraint '(...args: any) => any'.
814 overSome<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): FunctionChain<(...args: Parameters<T> | TArgs[]) => boolean>;
~
Found 129 errors.
Playground Link: The playground doesn't have TS 3.6 yet. Β―\_(γ)_/Β―
Related Issues: I don't think so.
Playground also doesn't generate .d.ts files for display yet =x
Errr, far as I can tell, that error in @types/lodash is legit. it attempts to merge multiple interfaces that have the same name, but differing type parameters. The issue is that we fail to report it. Here's a more minimal repro without declaration emit involved. If you compile this:
/// <reference types="lodash" />
/// <reference types="lodash/common/common" />
you get no errors. If you compile this:
/// <reference types="lodash/common/common" />
/// <reference types="lodash" />
you get _all the errors_ - the errors are seemingly dependent on the order the files are found in!
Here's a minimal repro:
this has no error:
namespace ns {
interface Function<T extends (...args: any) => any> {
throttle(): Function<T>;
}
interface Function<T> {
unary(): Function<() => ReturnType<T>>;
}
}
this does:
namespace ns {
interface Function<T> {
unary(): Function<() => ReturnType<T>>;
}
interface Function<T extends (...args: any) => any> {
throttle(): Function<T>;
}
}
π€¦ββ
https://github.com/microsoft/TypeScript/pull/20883 γ°οΈβγ°οΈ
@mattmccutchen you from 2018 win for having opened https://github.com/microsoft/TypeScript/issues/23909 which dupes this first. Ya gotta stick to your guns π
What about the references included in the emitted .d.ts file? It doesn't seem like these should be there, and it was working fine with TS 3.5.
What about the references included in the emitted .d.ts file? It doesn't seem like these should be there, and it was working fine with TS 3.5.
They not _strictly_ needed in this case, since lodash's root happens to import all of those files itself, however the MemoizedFunction interface used is partially defined by augmentations in each of those files - we don't _know_ that the root lodash import pulled in all of them (it might not!), so we include direct refs, just to be safe and ensure the whole type as we know it is included.
@weswigham Will the fix be included in an eventual 3.6.4 release?
That would be up to @DanielRosenwasser, otherwise it's 3.7 bound.
@typescript-bot cherry-pick this to release-3.6
@RyanCavanaugh
@DanielRosenwasser pls - the PR's thataways -----> https://github.com/microsoft/TypeScript/pull/33426
Make the bot smarter
Most helpful comment
@mattmccutchen you from 2018 win for having opened https://github.com/microsoft/TypeScript/issues/23909 which dupes this first. Ya gotta stick to your guns π