Add test
This commit is contained in:
parent
a431a0b60b
commit
6a27289b2d
17
tests/baselines/reference/intersectionTypeInference1.js
Normal file
17
tests/baselines/reference/intersectionTypeInference1.js
Normal 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" });
|
33
tests/baselines/reference/intersectionTypeInference1.symbols
Normal file
33
tests/baselines/reference/intersectionTypeInference1.symbols
Normal 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))
|
||||||
|
|
41
tests/baselines/reference/intersectionTypeInference1.types
Normal file
41
tests/baselines/reference/intersectionTypeInference1.types
Normal 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
|
||||||
|
|
7
tests/cases/compiler/intersectionTypeInference1.ts
Normal file
7
tests/cases/compiler/intersectionTypeInference1.ts
Normal 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"})
|
Loading…
Reference in a new issue