Accept new baselines

This commit is contained in:
Anders Hejlsberg 2019-04-16 10:00:56 -07:00
parent dbe71a2ddd
commit 4668411464
3 changed files with 119 additions and 0 deletions

View file

@ -14,6 +14,21 @@ const myReducer1: Reducer<MyState> = combineReducers({
const myReducer2 = combineReducers({
combined: combineReducers({ foo }),
});
// Repro from #30942
declare function withH<T, U>(handlerCreators: HandleCreatorsFactory<T, U>): U;
type Props = { out: number }
type HandleCreatorsFactory<T, U> = (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);
//// [genericFunctionInference2.js]
@ -24,3 +39,8 @@ var myReducer1 = combineReducers({
var myReducer2 = combineReducers({
combined: combineReducers({ foo: foo })
});
var enhancer4 = withH(function (props) { return ({
onChange: function (props) { return function (e) { }; },
onSubmit: function (props) { return function (e) { }; }
}); });
enhancer4.onChange(null);

View file

@ -54,3 +54,55 @@ const myReducer2 = combineReducers({
});
// Repro from #30942
declare function withH<T, U>(handlerCreators: HandleCreatorsFactory<T, U>): U;
>withH : Symbol(withH, Decl(genericFunctionInference2.ts, 14, 3))
>T : Symbol(T, Decl(genericFunctionInference2.ts, 18, 23))
>U : Symbol(U, Decl(genericFunctionInference2.ts, 18, 25))
>handlerCreators : Symbol(handlerCreators, Decl(genericFunctionInference2.ts, 18, 29))
>HandleCreatorsFactory : Symbol(HandleCreatorsFactory, Decl(genericFunctionInference2.ts, 20, 28))
>T : Symbol(T, Decl(genericFunctionInference2.ts, 18, 23))
>U : Symbol(U, Decl(genericFunctionInference2.ts, 18, 25))
>U : Symbol(U, Decl(genericFunctionInference2.ts, 18, 25))
type Props = { out: number }
>Props : Symbol(Props, Decl(genericFunctionInference2.ts, 18, 78))
>out : Symbol(out, Decl(genericFunctionInference2.ts, 20, 14))
type HandleCreatorsFactory<T, U> = (initialProps: T) => { [P in keyof U]: (props: T) => U[P] };
>HandleCreatorsFactory : Symbol(HandleCreatorsFactory, Decl(genericFunctionInference2.ts, 20, 28))
>T : Symbol(T, Decl(genericFunctionInference2.ts, 22, 27))
>U : Symbol(U, Decl(genericFunctionInference2.ts, 22, 29))
>initialProps : Symbol(initialProps, Decl(genericFunctionInference2.ts, 22, 36))
>T : Symbol(T, Decl(genericFunctionInference2.ts, 22, 27))
>P : Symbol(P, Decl(genericFunctionInference2.ts, 22, 59))
>U : Symbol(U, Decl(genericFunctionInference2.ts, 22, 29))
>props : Symbol(props, Decl(genericFunctionInference2.ts, 22, 75))
>T : Symbol(T, Decl(genericFunctionInference2.ts, 22, 27))
>U : Symbol(U, Decl(genericFunctionInference2.ts, 22, 29))
>P : Symbol(P, Decl(genericFunctionInference2.ts, 22, 59))
const enhancer4 = withH((props: Props) => ({
>enhancer4 : Symbol(enhancer4, Decl(genericFunctionInference2.ts, 24, 5))
>withH : Symbol(withH, Decl(genericFunctionInference2.ts, 14, 3))
>props : Symbol(props, Decl(genericFunctionInference2.ts, 24, 25))
>Props : Symbol(Props, Decl(genericFunctionInference2.ts, 18, 78))
onChange: (props) => (e: any) => {},
>onChange : Symbol(onChange, Decl(genericFunctionInference2.ts, 24, 44))
>props : Symbol(props, Decl(genericFunctionInference2.ts, 25, 15))
>e : Symbol(e, Decl(genericFunctionInference2.ts, 25, 26))
onSubmit: (props) => (e: any) => {},
>onSubmit : Symbol(onSubmit, Decl(genericFunctionInference2.ts, 25, 40))
>props : Symbol(props, Decl(genericFunctionInference2.ts, 26, 15))
>e : Symbol(e, Decl(genericFunctionInference2.ts, 26, 26))
}));
enhancer4.onChange(null);
>enhancer4.onChange : Symbol(onChange, Decl(genericFunctionInference2.ts, 24, 44))
>enhancer4 : Symbol(enhancer4, Decl(genericFunctionInference2.ts, 24, 5))
>onChange : Symbol(onChange, Decl(genericFunctionInference2.ts, 24, 44))

View file

@ -47,3 +47,50 @@ const myReducer2 = combineReducers({
});
// Repro from #30942
declare function withH<T, U>(handlerCreators: HandleCreatorsFactory<T, U>): U;
>withH : <T, U>(handlerCreators: HandleCreatorsFactory<T, U>) => U
>handlerCreators : HandleCreatorsFactory<T, U>
type Props = { out: number }
>Props : Props
>out : number
type HandleCreatorsFactory<T, U> = (initialProps: T) => { [P in keyof U]: (props: T) => U[P] };
>HandleCreatorsFactory : HandleCreatorsFactory<T, U>
>initialProps : T
>props : T
const enhancer4 = withH((props: Props) => ({
>enhancer4 : { onChange: (e: any) => void; onSubmit: (e: any) => void; }
>withH((props: Props) => ({ onChange: (props) => (e: any) => {}, onSubmit: (props) => (e: any) => {},})) : { onChange: (e: any) => void; onSubmit: (e: any) => void; }
>withH : <T, U>(handlerCreators: HandleCreatorsFactory<T, U>) => U
>(props: Props) => ({ onChange: (props) => (e: any) => {}, onSubmit: (props) => (e: any) => {},}) : (props: Props) => { onChange: (props: Props) => (e: any) => void; onSubmit: (props: Props) => (e: any) => void; }
>props : Props
>({ onChange: (props) => (e: any) => {}, onSubmit: (props) => (e: any) => {},}) : { onChange: (props: Props) => (e: any) => void; onSubmit: (props: Props) => (e: any) => void; }
>{ onChange: (props) => (e: any) => {}, onSubmit: (props) => (e: any) => {},} : { onChange: (props: Props) => (e: any) => void; onSubmit: (props: Props) => (e: any) => void; }
onChange: (props) => (e: any) => {},
>onChange : (props: Props) => (e: any) => void
>(props) => (e: any) => {} : (props: Props) => (e: any) => void
>props : Props
>(e: any) => {} : (e: any) => void
>e : any
onSubmit: (props) => (e: any) => {},
>onSubmit : (props: Props) => (e: any) => void
>(props) => (e: any) => {} : (props: Props) => (e: any) => void
>props : Props
>(e: any) => {} : (e: any) => void
>e : any
}));
enhancer4.onChange(null);
>enhancer4.onChange(null) : void
>enhancer4.onChange : (e: any) => void
>enhancer4 : { onChange: (e: any) => void; onSubmit: (e: any) => void; }
>onChange : (e: any) => void
>null : null