This commit is contained in:
Anders Hejlsberg 2016-05-25 11:17:03 -07:00
parent a431a0b60b
commit 6a27289b2d
4 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,17 @@
//// [intersectionTypeInference1.ts]
// Repro from #8801
function alert(s: string) {}
const parameterFn = (props:{store:string}) => alert(props.store)
const brokenFunction = <OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o
export const Form3 = brokenFunction(parameterFn)({store: "hello"})
//// [intersectionTypeInference1.js]
// Repro from #8801
"use strict";
function alert(s) { }
var parameterFn = function (props) { return alert(props.store); };
var brokenFunction = function (f) { return function (o) { return o; }; };
exports.Form3 = brokenFunction(parameterFn)({ store: "hello" });

View file

@ -0,0 +1,33 @@
=== tests/cases/compiler/intersectionTypeInference1.ts ===
// Repro from #8801
function alert(s: string) {}
>alert : Symbol(alert, Decl(intersectionTypeInference1.ts, 0, 0))
>s : Symbol(s, Decl(intersectionTypeInference1.ts, 2, 15))
const parameterFn = (props:{store:string}) => alert(props.store)
>parameterFn : Symbol(parameterFn, Decl(intersectionTypeInference1.ts, 4, 5))
>props : Symbol(props, Decl(intersectionTypeInference1.ts, 4, 21))
>store : Symbol(store, Decl(intersectionTypeInference1.ts, 4, 28))
>alert : Symbol(alert, Decl(intersectionTypeInference1.ts, 0, 0))
>props.store : Symbol(store, Decl(intersectionTypeInference1.ts, 4, 28))
>props : Symbol(props, Decl(intersectionTypeInference1.ts, 4, 21))
>store : Symbol(store, Decl(intersectionTypeInference1.ts, 4, 28))
const brokenFunction = <OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o
>brokenFunction : Symbol(brokenFunction, Decl(intersectionTypeInference1.ts, 5, 5))
>OwnProps : Symbol(OwnProps, Decl(intersectionTypeInference1.ts, 5, 24))
>f : Symbol(f, Decl(intersectionTypeInference1.ts, 5, 34))
>p : Symbol(p, Decl(intersectionTypeInference1.ts, 5, 38))
>dispatch : Symbol(dispatch, Decl(intersectionTypeInference1.ts, 5, 42))
>OwnProps : Symbol(OwnProps, Decl(intersectionTypeInference1.ts, 5, 24))
>o : Symbol(o, Decl(intersectionTypeInference1.ts, 5, 85))
>OwnProps : Symbol(OwnProps, Decl(intersectionTypeInference1.ts, 5, 24))
>o : Symbol(o, Decl(intersectionTypeInference1.ts, 5, 85))
export const Form3 = brokenFunction(parameterFn)({store: "hello"})
>Form3 : Symbol(Form3, Decl(intersectionTypeInference1.ts, 6, 12))
>brokenFunction : Symbol(brokenFunction, Decl(intersectionTypeInference1.ts, 5, 5))
>parameterFn : Symbol(parameterFn, Decl(intersectionTypeInference1.ts, 4, 5))
>store : Symbol(store, Decl(intersectionTypeInference1.ts, 6, 50))

View file

@ -0,0 +1,41 @@
=== tests/cases/compiler/intersectionTypeInference1.ts ===
// Repro from #8801
function alert(s: string) {}
>alert : (s: string) => void
>s : string
const parameterFn = (props:{store:string}) => alert(props.store)
>parameterFn : (props: { store: string; }) => void
>(props:{store:string}) => alert(props.store) : (props: { store: string; }) => void
>props : { store: string; }
>store : string
>alert(props.store) : void
>alert : (s: string) => void
>props.store : string
>props : { store: string; }
>store : string
const brokenFunction = <OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o
>brokenFunction : <OwnProps>(f: (p: { dispatch: number; } & OwnProps) => void) => (o: OwnProps) => OwnProps
><OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o : <OwnProps>(f: (p: { dispatch: number; } & OwnProps) => void) => (o: OwnProps) => OwnProps
>OwnProps : OwnProps
>f : (p: { dispatch: number; } & OwnProps) => void
>p : { dispatch: number; } & OwnProps
>dispatch : number
>OwnProps : OwnProps
>(o: OwnProps) => o : (o: OwnProps) => OwnProps
>o : OwnProps
>OwnProps : OwnProps
>o : OwnProps
export const Form3 = brokenFunction(parameterFn)({store: "hello"})
>Form3 : { store: string; }
>brokenFunction(parameterFn)({store: "hello"}) : { store: string; }
>brokenFunction(parameterFn) : (o: { store: string; }) => { store: string; }
>brokenFunction : <OwnProps>(f: (p: { dispatch: number; } & OwnProps) => void) => (o: OwnProps) => OwnProps
>parameterFn : (props: { store: string; }) => void
>{store: "hello"} : { store: string; }
>store : string
>"hello" : string

View file

@ -0,0 +1,7 @@
// Repro from #8801
function alert(s: string) {}
const parameterFn = (props:{store:string}) => alert(props.store)
const brokenFunction = <OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o
export const Form3 = brokenFunction(parameterFn)({store: "hello"})