Skip to content

Commit 6a27289

Browse files
committed
Add test
1 parent a431a0b commit 6a27289

4 files changed

Lines changed: 98 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//// [intersectionTypeInference1.ts]
2+
// Repro from #8801
3+
4+
function alert(s: string) {}
5+
6+
const parameterFn = (props:{store:string}) => alert(props.store)
7+
const brokenFunction = <OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o
8+
export const Form3 = brokenFunction(parameterFn)({store: "hello"})
9+
10+
11+
//// [intersectionTypeInference1.js]
12+
// Repro from #8801
13+
"use strict";
14+
function alert(s) { }
15+
var parameterFn = function (props) { return alert(props.store); };
16+
var brokenFunction = function (f) { return function (o) { return o; }; };
17+
exports.Form3 = brokenFunction(parameterFn)({ store: "hello" });
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
=== tests/cases/compiler/intersectionTypeInference1.ts ===
2+
// Repro from #8801
3+
4+
function alert(s: string) {}
5+
>alert : Symbol(alert, Decl(intersectionTypeInference1.ts, 0, 0))
6+
>s : Symbol(s, Decl(intersectionTypeInference1.ts, 2, 15))
7+
8+
const parameterFn = (props:{store:string}) => alert(props.store)
9+
>parameterFn : Symbol(parameterFn, Decl(intersectionTypeInference1.ts, 4, 5))
10+
>props : Symbol(props, Decl(intersectionTypeInference1.ts, 4, 21))
11+
>store : Symbol(store, Decl(intersectionTypeInference1.ts, 4, 28))
12+
>alert : Symbol(alert, Decl(intersectionTypeInference1.ts, 0, 0))
13+
>props.store : Symbol(store, Decl(intersectionTypeInference1.ts, 4, 28))
14+
>props : Symbol(props, Decl(intersectionTypeInference1.ts, 4, 21))
15+
>store : Symbol(store, Decl(intersectionTypeInference1.ts, 4, 28))
16+
17+
const brokenFunction = <OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o
18+
>brokenFunction : Symbol(brokenFunction, Decl(intersectionTypeInference1.ts, 5, 5))
19+
>OwnProps : Symbol(OwnProps, Decl(intersectionTypeInference1.ts, 5, 24))
20+
>f : Symbol(f, Decl(intersectionTypeInference1.ts, 5, 34))
21+
>p : Symbol(p, Decl(intersectionTypeInference1.ts, 5, 38))
22+
>dispatch : Symbol(dispatch, Decl(intersectionTypeInference1.ts, 5, 42))
23+
>OwnProps : Symbol(OwnProps, Decl(intersectionTypeInference1.ts, 5, 24))
24+
>o : Symbol(o, Decl(intersectionTypeInference1.ts, 5, 85))
25+
>OwnProps : Symbol(OwnProps, Decl(intersectionTypeInference1.ts, 5, 24))
26+
>o : Symbol(o, Decl(intersectionTypeInference1.ts, 5, 85))
27+
28+
export const Form3 = brokenFunction(parameterFn)({store: "hello"})
29+
>Form3 : Symbol(Form3, Decl(intersectionTypeInference1.ts, 6, 12))
30+
>brokenFunction : Symbol(brokenFunction, Decl(intersectionTypeInference1.ts, 5, 5))
31+
>parameterFn : Symbol(parameterFn, Decl(intersectionTypeInference1.ts, 4, 5))
32+
>store : Symbol(store, Decl(intersectionTypeInference1.ts, 6, 50))
33+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
=== tests/cases/compiler/intersectionTypeInference1.ts ===
2+
// Repro from #8801
3+
4+
function alert(s: string) {}
5+
>alert : (s: string) => void
6+
>s : string
7+
8+
const parameterFn = (props:{store:string}) => alert(props.store)
9+
>parameterFn : (props: { store: string; }) => void
10+
>(props:{store:string}) => alert(props.store) : (props: { store: string; }) => void
11+
>props : { store: string; }
12+
>store : string
13+
>alert(props.store) : void
14+
>alert : (s: string) => void
15+
>props.store : string
16+
>props : { store: string; }
17+
>store : string
18+
19+
const brokenFunction = <OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o
20+
>brokenFunction : <OwnProps>(f: (p: { dispatch: number; } & OwnProps) => void) => (o: OwnProps) => OwnProps
21+
><OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o : <OwnProps>(f: (p: { dispatch: number; } & OwnProps) => void) => (o: OwnProps) => OwnProps
22+
>OwnProps : OwnProps
23+
>f : (p: { dispatch: number; } & OwnProps) => void
24+
>p : { dispatch: number; } & OwnProps
25+
>dispatch : number
26+
>OwnProps : OwnProps
27+
>(o: OwnProps) => o : (o: OwnProps) => OwnProps
28+
>o : OwnProps
29+
>OwnProps : OwnProps
30+
>o : OwnProps
31+
32+
export const Form3 = brokenFunction(parameterFn)({store: "hello"})
33+
>Form3 : { store: string; }
34+
>brokenFunction(parameterFn)({store: "hello"}) : { store: string; }
35+
>brokenFunction(parameterFn) : (o: { store: string; }) => { store: string; }
36+
>brokenFunction : <OwnProps>(f: (p: { dispatch: number; } & OwnProps) => void) => (o: OwnProps) => OwnProps
37+
>parameterFn : (props: { store: string; }) => void
38+
>{store: "hello"} : { store: string; }
39+
>store : string
40+
>"hello" : string
41+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Repro from #8801
2+
3+
function alert(s: string) {}
4+
5+
const parameterFn = (props:{store:string}) => alert(props.store)
6+
const brokenFunction = <OwnProps>(f: (p: {dispatch: number} & OwnProps) => void) => (o: OwnProps) => o
7+
export const Form3 = brokenFunction(parameterFn)({store: "hello"})

0 commit comments

Comments
 (0)