Fixed regression in reverse mapped type inference caused by cache leak (#59232)

Co-authored-by: Gabriela Araujo Britto <gabrielaa@microsoft.com>
This commit is contained in:
Mateusz Burzyński
2024-07-13 00:50:43 +02:00
committed by GitHub
parent 9c093c13e6
commit 6d3be985c8
6 changed files with 300 additions and 13 deletions

View File

@@ -0,0 +1,40 @@
// @strict: true
// @noEmit: true
type Action<T extends string = string> = {
type: T;
};
interface UnknownAction extends Action {
[extraProps: string]: unknown;
}
type Reducer<S = any, A extends Action = UnknownAction> = (
state: S | undefined,
action: A,
) => S;
type ReducersMapObject<S = any, A extends Action = UnknownAction> = {
[K in keyof S]: Reducer<S[K], A>;
};
interface ConfigureStoreOptions<S = any, A extends Action = UnknownAction> {
reducer: Reducer<S, A> | ReducersMapObject<S, A>;
}
declare function configureStore<S = any, A extends Action = UnknownAction>(
options: ConfigureStoreOptions<S, A>,
): void;
{
const reducer: Reducer<number> = () => 0;
const store1 = configureStore({ reducer });
}
const counterReducer1: Reducer<number> = () => 0;
const store2 = configureStore({
reducer: {
counter1: counterReducer1,
},
});
export {}