Skip to content

Commit 7d57833

Browse files
committed
Workaround to test PR build
1 parent 54f06fe commit 7d57833

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "type-mapping",
3-
"version": "1.19.2",
3+
"version": "1.19.3",
44
"description": "Map input data safely",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/functional-lib/operator/cache.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@ export type CacheMapper<
1313
CachedT,
1414
F extends ExtendedMapper<any, any, [CachedT]>
1515
> = (
16+
/**
17+
* This type,
18+
* ```ts
19+
* Extract<F, (name: string, mixed: any, ...args: any[]) => any>
20+
* ```
21+
*
22+
* is necessary because of this bug,
23+
* https://github.com/microsoft/TypeScript/pull/32924#issuecomment-521826091
24+
*/
1625
& Mapper<
17-
HandledInputOf<F>,
18-
OutputOf<F>
26+
HandledInputOf<Extract<F, (name: string, mixed: any, ...args: any[]) => any>>,
27+
OutputOf<Extract<F, (name: string, mixed: any, ...args: any[]) => any>>
1928
>
20-
& ExtractExpectedInputOrUnknown<F>
21-
& ExtractMappableInputOrUnknown<F>
22-
& ExtractRunTimeModifierOrUnknown<F>
29+
& ExtractExpectedInputOrUnknown<Extract<F, (name: string, mixed: any, ...args: any[]) => any>>
30+
& ExtractMappableInputOrUnknown<Extract<F, (name: string, mixed: any, ...args: any[]) => any>>
31+
& ExtractRunTimeModifierOrUnknown<Extract<F, (name: string, mixed: any, ...args: any[]) => any>>
2332
);
2433

2534
export function cache<
@@ -32,8 +41,8 @@ export function cache<
3241
CacheMapper<CachedT, F>
3342
) {
3443
const result = copyRunTimeModifier(
35-
f,
36-
(name : string, mixed : HandledInputOf<F>) : OutputOf<F> => {
44+
f as Extract<F, (name: string, mixed: any, ...args: any[]) => any>,
45+
(name : string, mixed : HandledInputOf<Extract<F, (name: string, mixed: any, ...args: any[]) => any>>) : OutputOf<Extract<F, (name: string, mixed: any, ...args: any[]) => any>> => {
3746
return f(name, mixed, cached);
3847
}
3948
)

0 commit comments

Comments
 (0)