diff --git a/tests/cases/compiler/genericFunctionInference2.ts b/tests/cases/compiler/genericFunctionInference2.ts new file mode 100644 index 00000000000..56caca847c2 --- /dev/null +++ b/tests/cases/compiler/genericFunctionInference2.ts @@ -0,0 +1,15 @@ +// Repro from #30685 + +type Reducer = (state: S) => S; +declare function combineReducers(reducers: { [K in keyof S]: Reducer }): Reducer; + +type MyState = { combined: { foo: number } }; +declare const foo: Reducer; + +const myReducer1: Reducer = combineReducers({ + combined: combineReducers({ foo }), +}); + +const myReducer2 = combineReducers({ + combined: combineReducers({ foo }), +});