diff --git a/tests/cases/compiler/genericFunctionInference2.ts b/tests/cases/compiler/genericFunctionInference2.ts index 56caca847c2..b83247a7781 100644 --- a/tests/cases/compiler/genericFunctionInference2.ts +++ b/tests/cases/compiler/genericFunctionInference2.ts @@ -13,3 +13,18 @@ const myReducer1: Reducer = combineReducers({ const myReducer2 = combineReducers({ combined: combineReducers({ foo }), }); + +// Repro from #30942 + +declare function withH(handlerCreators: HandleCreatorsFactory): U; + +type Props = { out: number } + +type HandleCreatorsFactory = (initialProps: T) => { [P in keyof U]: (props: T) => U[P] }; + +const enhancer4 = withH((props: Props) => ({ + onChange: (props) => (e: any) => {}, + onSubmit: (props) => (e: any) => {}, +})); + +enhancer4.onChange(null);