From 0a888350c63fffcea9022b63dcd66b6be7dda007 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 15 Mar 2023 18:54:24 -0700 Subject: [PATCH] Update baselines missed in PR --- .../intraExpressionInferencesJsx.errors.txt | 115 ++++++++++++++++++ .../intraExpressionInferencesJsx.symbols | 2 - .../intraExpressionInferencesJsx.types | 16 +-- ...WithSpreadingResultOfGenericFunction.types | 1 - 4 files changed, 123 insertions(+), 11 deletions(-) create mode 100644 tests/baselines/reference/intraExpressionInferencesJsx.errors.txt diff --git a/tests/baselines/reference/intraExpressionInferencesJsx.errors.txt b/tests/baselines/reference/intraExpressionInferencesJsx.errors.txt new file mode 100644 index 0000000000000..4de857ddb20ed --- /dev/null +++ b/tests/baselines/reference/intraExpressionInferencesJsx.errors.txt @@ -0,0 +1,115 @@ +tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferencesJsx.tsx(107,17): error TS18046: 'arg' is of type 'unknown'. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferencesJsx.tsx (1 errors) ==== + /// + + // repro from #52798 + + type A = { + a: boolean; + }; + + type B = { + b: string; + }; + + type C = { + c: number; + }; + + type Animations = { + [key: string]: { value: number } & ( + | ({ kind: "a"; func?(): Partial } & A) + | ({ kind: "b"; func?(): Partial } & B) + | ({ kind: "c"; func?(): Partial } & C) + ); + }; + + type StyleParam = Record; + + type AnimatedViewProps = { + style: (animationsValues: StyleParam) => string; + animations: T; + }; + + const Component = ({ + animations, + style, + }: AnimatedViewProps) => <>; + + { + return ""; + }} + />; + { + return ""; + }} + />; + { + return { + a: true, + }; + }, + }, + }} + style={(anim) => { + return ""; + }} + />; + + // repro from #52786 + + interface Props { + a: (x: string) => T; + b: (arg: T) => void; + } + + function Foo(props: Props) { + return
; + } + + 10} + b={(arg) => { arg.toString(); }} + />; + + 10} + b={(arg) => { arg.toString(); }} + />; + + 10, + b: (arg) => { arg.toString(); }, + ~~~ +!!! error TS18046: 'arg' is of type 'unknown'. + }} />; + \ No newline at end of file diff --git a/tests/baselines/reference/intraExpressionInferencesJsx.symbols b/tests/baselines/reference/intraExpressionInferencesJsx.symbols index 798c76fbcefb5..91b4dce923e75 100644 --- a/tests/baselines/reference/intraExpressionInferencesJsx.symbols +++ b/tests/baselines/reference/intraExpressionInferencesJsx.symbols @@ -266,9 +266,7 @@ function Foo(props: Props) { b: (arg) => { arg.toString(); }, >b : Symbol(b, Decl(intraExpressionInferencesJsx.tsx, 105, 15)) >arg : Symbol(arg, Decl(intraExpressionInferencesJsx.tsx, 106, 6)) ->arg.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) >arg : Symbol(arg, Decl(intraExpressionInferencesJsx.tsx, 106, 6)) ->toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) }} />; diff --git a/tests/baselines/reference/intraExpressionInferencesJsx.types b/tests/baselines/reference/intraExpressionInferencesJsx.types index 642809682ecf5..c4edd6c23a150 100644 --- a/tests/baselines/reference/intraExpressionInferencesJsx.types +++ b/tests/baselines/reference/intraExpressionInferencesJsx.types @@ -276,7 +276,7 @@ function Foo(props: Props) { 10, b: (arg) => { arg.toString(); },}} /> : JSX.Element >Foo : (props: Props) => JSX.Element ->{ a: (x) => 10, b: (arg) => { arg.toString(); },} : { a: (x: string) => number; b: (arg: number) => void; } +>{ a: (x) => 10, b: (arg) => { arg.toString(); },} : { a: (x: string) => number; b: (arg: unknown) => void; } a: (x) => 10, >a : (x: string) => number @@ -285,13 +285,13 @@ function Foo(props: Props) { >10 : 10 b: (arg) => { arg.toString(); }, ->b : (arg: number) => void ->(arg) => { arg.toString(); } : (arg: number) => void ->arg : number ->arg.toString() : string ->arg.toString : (radix?: number | undefined) => string ->arg : number ->toString : (radix?: number | undefined) => string +>b : (arg: unknown) => void +>(arg) => { arg.toString(); } : (arg: unknown) => void +>arg : unknown +>arg.toString() : any +>arg.toString : any +>arg : unknown +>toString : any }} />; diff --git a/tests/baselines/reference/jsxGenericComponentWithSpreadingResultOfGenericFunction.types b/tests/baselines/reference/jsxGenericComponentWithSpreadingResultOfGenericFunction.types index 7d6093bcd9efb..be35455d7bdfd 100644 --- a/tests/baselines/reference/jsxGenericComponentWithSpreadingResultOfGenericFunction.types +++ b/tests/baselines/reference/jsxGenericComponentWithSpreadingResultOfGenericFunction.types @@ -21,7 +21,6 @@ declare const otherProps: { bar: string, qwe: boolean } declare function GenericComponent(props: T): null >GenericComponent : (props: T) => null >props : T ->null : null ; // no error > : JSX.Element