From 90bda7f70d2147da737db34fef752f403ab145dc Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:13:10 -0700 Subject: [PATCH] Try making parenthesizeConstituentTypeOfUnionType a no-op --- src/compiler/factory/parenthesizerRules.ts | 10 ++--- .../reference/controlFlowIfStatement.types | 2 +- ...tReusesTypeNode2(strictnullchecks=true).js | 12 +++--- ...itUsingAlternativeContainingModules1.types | 6 +-- ...itUsingAlternativeContainingModules2.types | 8 ++-- ...riminableUnionWithIntersectedMembers.types | 2 +- .../reference/discriminatedUnionTypes2.types | 4 +- ...ckIntersectionWithRecursiveType.errors.txt | 12 +++--- ...tyCheckIntersectionWithRecursiveType.types | 4 +- ...yCheckWithMultipleDiscriminants.errors.txt | 4 +- ...opertyCheckWithMultipleDiscriminants.types | 2 +- .../expressionWithJSDocTypeArguments.types | 4 +- ...ableDeclaration_Writes_Let_LiteralType1.ts | 2 +- ...ableDeclaration_Writes_Let_LiteralType2.ts | 2 +- ...Declaration_Writes_Let_TypeWithComments.ts | 2 +- .../generatorYieldContextualType.types | 4 +- .../inDoesNotOperateOnPrimitiveTypes.types | 2 +- .../reference/inKeywordAndIntersection.types | 8 ++-- .../inKeywordTypeguard(strict=true).types | 10 ++--- .../inferenceDoesNotAddUndefinedOrNull.types | 4 +- ...eOfNullableObjectTypesWithCommonBase.types | 4 +- .../intersectionAndUnionTypes.errors.txt | 32 ++++++++-------- .../reference/intersectionAndUnionTypes.types | 26 ++++++------- ...sectionMemberOfUnionNarrowsCorrectly.types | 2 +- .../reference/intersectionNarrowing.types | 24 ++++++------ .../intersectionOfUnionNarrowing.types | 4 +- .../intersectionTypeNormalization.types | 20 +++++----- .../intersectionWithUnionConstraint.types | 2 +- .../intraExpressionInferencesJsx.types | 2 +- .../jsdocParseBackquotedParamName.types | 2 +- .../jsdocPostfixEqualsAddsOptionality.types | 2 +- .../reference/keyofAndIndexedAccess2.types | 2 +- ...teralFreshnessPropagationOnNarrowing.types | 18 ++++----- tests/baselines/reference/mappedTypes4.types | 2 +- .../reference/narrowingByTypeofInSwitch.types | 8 ++-- .../reference/narrowingTypeofFunction.types | 10 ++--- .../reference/narrowingUnionToUnion.types | 4 +- .../nonPrimitiveAndEmptyObject.types | 2 +- .../objectLiteralExcessProperties.types | 2 +- tests/baselines/reference/objectSpread.types | 24 ++++++------ ...artialOfLargeAPIIsAbleToBeWorkedWith.types | 4 +- .../reference/primitiveUnionDetection.types | 4 +- .../specialIntersectionsInMappedTypes.types | 2 +- .../reference/spreadObjectOrFalsy.js | 2 +- .../reference/spreadObjectOrFalsy.types | 8 ++-- .../reference/templateLiteralTypes2.types | 4 +- .../reference/templateLiteralTypes3.types | 6 +-- .../templateLiteralTypesPatterns.types | 8 ++-- .../reference/thisTypeInObjectLiterals2.types | 2 +- .../typeGuardIntersectionTypes.types | 2 +- .../typeGuardsWithInstanceOf.errors.txt | 8 ++-- .../reference/typeGuardsWithInstanceOf.types | 6 +-- ...uncalledFunctionChecksInConditional2.types | 2 +- .../reference/unionTypeInference.types | 14 +++---- .../reference/unknownControlFlow.types | 38 +++++++++---------- .../reference/voidUndefinedReduction.types | 2 +- .../fourslash/codeFixAddVoidToPromise.4.ts | 2 +- .../fourslash/codeFixAddVoidToPromiseJS.4.ts | 2 +- .../codeFixAddVoidToPromiseJS_all.ts | 2 +- .../fourslash/codeFixAddVoidToPromise_all.ts | 2 +- 60 files changed, 208 insertions(+), 208 deletions(-) diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index b90cc220fb616..ee741ec59b63e 100644 --- a/src/compiler/factory/parenthesizerRules.ts +++ b/src/compiler/factory/parenthesizerRules.ts @@ -491,11 +491,11 @@ export function createParenthesizerRules(factory: NodeFactory): ParenthesizerRul // // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type: TypeNode) { - switch (type.kind) { - case SyntaxKind.UnionType: // Not strictly necessary, but a union containing a union should have been flattened - case SyntaxKind.IntersectionType: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests - return factory.createParenthesizedType(type); - } + // switch (type.kind) { + // case SyntaxKind.UnionType: // Not strictly necessary, but a union containing a union should have been flattened + // case SyntaxKind.IntersectionType: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + // return factory.createParenthesizedType(type); + // } return parenthesizeCheckTypeOfConditionalType(type); } diff --git a/tests/baselines/reference/controlFlowIfStatement.types b/tests/baselines/reference/controlFlowIfStatement.types index b43a26891415a..2816203ceeb80 100644 --- a/tests/baselines/reference/controlFlowIfStatement.types +++ b/tests/baselines/reference/controlFlowIfStatement.types @@ -106,7 +106,7 @@ function c(data: string | T): T { >JSON.parse : (text: string, reviver?: (this: any, key: string, value: any) => any) => any >JSON : JSON >parse : (text: string, reviver?: (this: any, key: string, value: any) => any) => any ->data : string | (T & string) +>data : string | T & string } else { return data; diff --git a/tests/baselines/reference/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js b/tests/baselines/reference/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js index 9161a318be440..c72b56c13f6f3 100644 --- a/tests/baselines/reference/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js +++ b/tests/baselines/reference/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js @@ -38,9 +38,9 @@ export declare const vConst: {} & { export declare function fn(p?: {} & { name: string; }): void; -export declare function fnWithRequiredDefaultParam(p: ({} & { +export declare function fnWithRequiredDefaultParam(p: {} & { name: string; -}) | undefined, req: number): void; +} | undefined, req: number): void; export declare class C { ctorField: {} & { name: string; @@ -57,9 +57,9 @@ export declare class C { method(p?: {} & { name: string; }): void; - methodWithRequiredDefault(p: ({} & { + methodWithRequiredDefault(p: {} & { name: string; - }) | undefined, req: number): void; + } | undefined, req: number): void; constructor(ctorField?: {} & { name: string; }); @@ -74,6 +74,6 @@ declare const _default: {} & { name: string; }; export default _default; -export declare function fnWithPartialAnnotationOnDefaultparam(x: ({} & { +export declare function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string; -}) | undefined, b: number): void; +} | undefined, b: number): void; diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types index 3e4b04385237a..997b388a3464d 100644 --- a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types @@ -301,11 +301,11 @@ export { type UseQueryReturnType, useQuery }; === node_modules/@tanstack/vue-query/build/modern/index.d.ts === export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; >UseQueryReturnType : any ->useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: number | boolean | ((failureCount: number, error: TError) => boolean) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType === src/index.mts === import { useQuery } from '@tanstack/vue-query' ->useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: number | boolean | ((failureCount: number, error: TError) => boolean) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType const baseUrl = 'https://api.publicapis.org/' >baseUrl : "https://api.publicapis.org/" @@ -412,7 +412,7 @@ export const useEntries = () => { return useQuery({ >useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType ->useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: number | boolean | ((failureCount: number, error: TError) => boolean) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType >{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } queryKey: entryKeys.list(), diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types index a0454cddfd856..22bcd5d3b6dd7 100644 --- a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types @@ -304,12 +304,12 @@ export { type UseQueryReturnType as b, useQuery as u }; export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; >b : any >UseQueryReturnType : any ->u : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b ->useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>u : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: number | boolean | ((failureCount: number, error: TError) => boolean) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: number | boolean | ((failureCount: number, error: TError) => boolean) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b === src/index.mts === import { useQuery } from '@tanstack/vue-query' ->useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: number | boolean | ((failureCount: number, error: TError) => boolean) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b const baseUrl = 'https://api.publicapis.org/' >baseUrl : "https://api.publicapis.org/" @@ -416,7 +416,7 @@ export const useEntries = () => { return useQuery({ >useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b ->useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +>useQuery : (options: { enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; retry?: number | boolean | ((failureCount: number, error: TError) => boolean) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b >{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } queryKey: entryKeys.list(), diff --git a/tests/baselines/reference/discriminableUnionWithIntersectedMembers.types b/tests/baselines/reference/discriminableUnionWithIntersectedMembers.types index 7c2d60312774e..cab5d263e0cb3 100644 --- a/tests/baselines/reference/discriminableUnionWithIntersectedMembers.types +++ b/tests/baselines/reference/discriminableUnionWithIntersectedMembers.types @@ -3,7 +3,7 @@ === discriminableUnionWithIntersectedMembers.ts === // regression test for https://github.com/microsoft/TypeScript/issues/33243 type X = ->X : ({ x: 'x'; y: number; } & { y: number; }) | ({ x: 'y'; y: number; z?: boolean; } & { y: number; }) +>X : { x: 'x'; y: number; } & { y: number; } | { x: 'y'; y: number; z?: boolean; } & { y: number; } | { x: 'x', y: number } & { y: number } >x : "x" diff --git a/tests/baselines/reference/discriminatedUnionTypes2.types b/tests/baselines/reference/discriminatedUnionTypes2.types index e58eae29afeb9..1d7bd83023971 100644 --- a/tests/baselines/reference/discriminatedUnionTypes2.types +++ b/tests/baselines/reference/discriminatedUnionTypes2.types @@ -383,14 +383,14 @@ function foo1(x: RuntimeValue & { type: 'number' }) { function foo2(x: RuntimeValue & ({ type: 'number' } | { type: 'string' })) { >foo2 : (x: RuntimeValue & ({ type: 'number';} | { type: 'string';})) => void ->x : ({ type: "number"; value: number; } & { type: 'number'; }) | ({ type: "string"; value: string; } & { type: 'string'; }) +>x : { type: "number"; value: number; } & { type: 'number'; } | { type: "string"; value: string; } & { type: 'string'; } >type : "number" >type : "string" if (x.type === 'number') { >x.type === 'number' : boolean >x.type : "string" | "number" ->x : ({ type: "number"; value: number; } & { type: "number"; }) | ({ type: "string"; value: string; } & { type: "string"; }) +>x : { type: "number"; value: number; } & { type: "number"; } | { type: "string"; value: string; } & { type: "string"; } >type : "string" | "number" >'number' : "number" diff --git a/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.errors.txt b/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.errors.txt index faf11254bbc04..7842b6a269dcd 100644 --- a/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.errors.txt +++ b/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.errors.txt @@ -1,7 +1,7 @@ excessPropertyCheckIntersectionWithRecursiveType.ts(13,9): error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type '{ l2: Schema1; }'. -excessPropertyCheckIntersectionWithRecursiveType.ts(26,9): error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type '{ l2: ({ type: "boolean"; } & Example) | ({ type: "boolean"; } & Example); }'. +excessPropertyCheckIntersectionWithRecursiveType.ts(26,9): error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type '{ l2: { type: "boolean"; } & Example | { type: "boolean"; } & Example; }'. excessPropertyCheckIntersectionWithRecursiveType.ts(39,9): error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type '{ l2: Schema3; }'. -excessPropertyCheckIntersectionWithRecursiveType.ts(52,9): error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type 'Example<{ l2: boolean; }> & { l2: ({ type: "boolean"; } & Example) | ({ type: "boolean"; } & Example); }'. +excessPropertyCheckIntersectionWithRecursiveType.ts(52,9): error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type 'Example<{ l2: boolean; }> & { l2: { type: "boolean"; } & Example | { type: "boolean"; } & Example; }'. excessPropertyCheckIntersectionWithRecursiveType.ts(86,11): error TS2353: Object literal may only specify known properties, and 'children' does not exist in type 'User'. excessPropertyCheckIntersectionWithRecursiveType.ts(102,35): error TS2339: Property 'children' does not exist on type 'User'. @@ -37,8 +37,8 @@ excessPropertyCheckIntersectionWithRecursiveType.ts(102,35): error TS2339: Prope l2: { type: 'boolean' }, invalid: false, ~~~~~~~ -!!! error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type '{ l2: ({ type: "boolean"; } & Example) | ({ type: "boolean"; } & Example); }'. -!!! related TS6500 excessPropertyCheckIntersectionWithRecursiveType.ts:19:78: The expected type comes from property 'props' which is declared here on type '{ props: { l2: ({ type: "boolean"; } & Example) | ({ type: "boolean"; } & Example); }; } & Example<{ l2: boolean; }>' +!!! error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type '{ l2: { type: "boolean"; } & Example | { type: "boolean"; } & Example; }'. +!!! related TS6500 excessPropertyCheckIntersectionWithRecursiveType.ts:19:78: The expected type comes from property 'props' which is declared here on type '{ props: { l2: { type: "boolean"; } & Example | { type: "boolean"; } & Example; }; } & Example<{ l2: boolean; }>' }, }, }, @@ -69,8 +69,8 @@ excessPropertyCheckIntersectionWithRecursiveType.ts(102,35): error TS2339: Prope l2: { type: 'boolean' }, invalid: false, ~~~~~~~ -!!! error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type 'Example<{ l2: boolean; }> & { l2: ({ type: "boolean"; } & Example) | ({ type: "boolean"; } & Example); }'. -!!! related TS6500 excessPropertyCheckIntersectionWithRecursiveType.ts:45:78: The expected type comes from property 'props' which is declared here on type '{ props: Example<{ l2: boolean; }> & { l2: ({ type: "boolean"; } & Example) | ({ type: "boolean"; } & Example); }; }' +!!! error TS2353: Object literal may only specify known properties, and 'invalid' does not exist in type 'Example<{ l2: boolean; }> & { l2: { type: "boolean"; } & Example | { type: "boolean"; } & Example; }'. +!!! related TS6500 excessPropertyCheckIntersectionWithRecursiveType.ts:45:78: The expected type comes from property 'props' which is declared here on type '{ props: Example<{ l2: boolean; }> & { l2: { type: "boolean"; } & Example | { type: "boolean"; } & Example; }; }' }, }, }, diff --git a/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.types b/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.types index fa4aa4a937156..dce481a668cd9 100644 --- a/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.types +++ b/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.types @@ -54,7 +54,7 @@ type Schema2 = (T extends boolean ? { type: 'boolean'; } & Example : { pro >props : { [P in keyof T]: Schema2; } export const schemaObj2: Schema2 = { ->schemaObj2 : { props: { l1: { props: { l2: ({ type: "boolean"; } & Example) | ({ type: "boolean"; } & Example); }; } & Example<{ l2: boolean; }>; }; } & Example +>schemaObj2 : { props: { l1: { props: { l2: { type: "boolean"; } & Example | { type: "boolean"; } & Example; }; } & Example<{ l2: boolean; }>; }; } & Example >{ props: { l1: { props: { l2: { type: 'boolean' }, invalid: false, }, }, },} : { props: { l1: { props: { l2: { type: "boolean"; }; invalid: boolean; }; }; }; } props: { @@ -126,7 +126,7 @@ type Schema4 = (T extends boolean ? { type: 'boolean'; } & Example : { pro >props : Example & { [P in keyof T]: Schema4; } export const schemaObj4: Schema4 = { ->schemaObj4 : { props: Example & { l1: { props: Example<{ l2: boolean; }> & { l2: ({ type: "boolean"; } & Example) | ({ type: "boolean"; } & Example); }; }; }; } +>schemaObj4 : { props: Example & { l1: { props: Example<{ l2: boolean; }> & { l2: { type: "boolean"; } & Example | { type: "boolean"; } & Example; }; }; }; } >{ props: { l1: { props: { l2: { type: 'boolean' }, invalid: false, }, }, },} : { props: { l1: { props: { l2: { type: "boolean"; }; invalid: boolean; }; }; }; } props: { diff --git a/tests/baselines/reference/excessPropertyCheckWithMultipleDiscriminants.errors.txt b/tests/baselines/reference/excessPropertyCheckWithMultipleDiscriminants.errors.txt index 1bffdedd51fdd..189e35baaa5d8 100644 --- a/tests/baselines/reference/excessPropertyCheckWithMultipleDiscriminants.errors.txt +++ b/tests/baselines/reference/excessPropertyCheckWithMultipleDiscriminants.errors.txt @@ -2,7 +2,7 @@ excessPropertyCheckWithMultipleDiscriminants.ts(30,5): error TS2353: Object lite excessPropertyCheckWithMultipleDiscriminants.ts(41,5): error TS2353: Object literal may only specify known properties, and 'p3' does not exist in type '{ p1: "left"; p2: boolean; }'. excessPropertyCheckWithMultipleDiscriminants.ts(50,5): error TS2353: Object literal may only specify known properties, and 'p4' does not exist in type '{ p1: "left"; p2: true; p3: number; } | { p1: "left"; p2: boolean; }'. excessPropertyCheckWithMultipleDiscriminants.ts(57,5): error TS2353: Object literal may only specify known properties, and 'p3' does not exist in type '{ p1: "right"; p2: false; p4: string; }'. -excessPropertyCheckWithMultipleDiscriminants.ts(83,5): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'Common | (Common & A)'. +excessPropertyCheckWithMultipleDiscriminants.ts(83,5): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'Common | Common & A'. excessPropertyCheckWithMultipleDiscriminants.ts(93,5): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'Common | A'. excessPropertyCheckWithMultipleDiscriminants.ts(131,5): error TS2353: Object literal may only specify known properties, and 'autoIncrement' does not exist in type 'StringAttribute | OneToOneAttribute'. excessPropertyCheckWithMultipleDiscriminants.ts(137,5): error TS2353: Object literal may only specify known properties, and 'autoIncrement' does not exist in type 'StringAttribute'. @@ -101,7 +101,7 @@ excessPropertyCheckWithMultipleDiscriminants.ts(137,5): error TS2353: Object lit a: 1, b: 1 // excess property ~ -!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'Common | (Common & A)'. +!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type 'Common | Common & A'. } type CommonWithDisjointOverlappingOptionals = Common | A | B; diff --git a/tests/baselines/reference/excessPropertyCheckWithMultipleDiscriminants.types b/tests/baselines/reference/excessPropertyCheckWithMultipleDiscriminants.types index abd3c275fdc31..f634deb2a6bd0 100644 --- a/tests/baselines/reference/excessPropertyCheckWithMultipleDiscriminants.types +++ b/tests/baselines/reference/excessPropertyCheckWithMultipleDiscriminants.types @@ -166,7 +166,7 @@ interface B { } type CommonWithOverlappingOptionals = Common | (Common & A) | (Common & B); ->CommonWithOverlappingOptionals : Common | (Common & A) | (Common & B) +>CommonWithOverlappingOptionals : Common | Common & A | Common & B // Should reject { b } because reduced to Common | (Common & A) const c1: CommonWithOverlappingOptionals = { diff --git a/tests/baselines/reference/expressionWithJSDocTypeArguments.types b/tests/baselines/reference/expressionWithJSDocTypeArguments.types index 55079e7604443..b615e7ce11557 100644 --- a/tests/baselines/reference/expressionWithJSDocTypeArguments.types +++ b/tests/baselines/reference/expressionWithJSDocTypeArguments.types @@ -47,7 +47,7 @@ type TNopeFoo = typeof foo; >foo : (x: T) => T type TComeOnFoo = typeof foo; ->TComeOnFoo : typeof foo<(string | null) | null> +>TComeOnFoo : typeof foo >foo : (x: T) => T const WhatBar = Bar; @@ -83,6 +83,6 @@ type TNopeBar = typeof Bar; >Bar : typeof Bar type TComeOnBar = typeof Bar; ->TComeOnBar : typeof Bar<(string | null) | null> +>TComeOnBar : typeof Bar >Bar : typeof Bar diff --git a/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_LiteralType1.ts b/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_LiteralType1.ts index 06de0fd4f368a..a6f36dda16035 100644 --- a/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_LiteralType1.ts +++ b/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_LiteralType1.ts @@ -23,7 +23,7 @@ function f() { function f() { let a = 1; - let x: (8 | 10 | 2) | undefined; + let x: 8 | 10 | 2 | undefined; ({ x, a } = /*RENAME*/newFunction(a)); a; x; } diff --git a/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_LiteralType2.ts b/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_LiteralType2.ts index 4679b89f06839..98ba27552e33f 100644 --- a/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_LiteralType2.ts +++ b/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_LiteralType2.ts @@ -23,7 +23,7 @@ function f() { function f() { let a = 1; - let x: ("a" | 'b') | undefined; + let x: "a" | 'b' | undefined; ({ x, a } = /*RENAME*/newFunction(a)); a; x; } diff --git a/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_TypeWithComments.ts b/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_TypeWithComments.ts index 71c4d9b79ff7d..d1bdf2a81ed40 100644 --- a/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_TypeWithComments.ts +++ b/tests/baselines/reference/extractFunction/extractFunction_VariableDeclaration_Writes_Let_TypeWithComments.ts @@ -23,7 +23,7 @@ function f() { function f() { let a = 1; - let x: (/*A*/ "a" /*B*/ | /*C*/ 'b' /*D*/) | undefined; + let x: /*A*/ /*A*/ "a" /*B*/ | /*C*/ 'b' /*D*/ | undefined; ({ x, a } = /*RENAME*/newFunction(a)); a; x; } diff --git a/tests/baselines/reference/generatorYieldContextualType.types b/tests/baselines/reference/generatorYieldContextualType.types index 280565cf56eee..211d0e7a0bc02 100644 --- a/tests/baselines/reference/generatorYieldContextualType.types +++ b/tests/baselines/reference/generatorYieldContextualType.types @@ -70,9 +70,9 @@ namespace Directive { >value : T | Directive >"number" : "number" >Directive[value] != null : boolean ->Directive[value] : (typeof Directive)[Directive | (T & number)] +>Directive[value] : (typeof Directive)[Directive | T & number] >Directive : typeof Directive ->value : Directive | (T & number) +>value : Directive | T & number } } diff --git a/tests/baselines/reference/inDoesNotOperateOnPrimitiveTypes.types b/tests/baselines/reference/inDoesNotOperateOnPrimitiveTypes.types index 96b6c5812c5a9..34e7634de5af4 100644 --- a/tests/baselines/reference/inDoesNotOperateOnPrimitiveTypes.types +++ b/tests/baselines/reference/inDoesNotOperateOnPrimitiveTypes.types @@ -148,7 +148,7 @@ function union5(p: T | U) "key" in p; >"key" in p : boolean >"key" : "key" ->p : (T & object) | (U & object) +>p : T & object | U & object } } diff --git a/tests/baselines/reference/inKeywordAndIntersection.types b/tests/baselines/reference/inKeywordAndIntersection.types index 826b26714a36f..05efc8bc66693 100644 --- a/tests/baselines/reference/inKeywordAndIntersection.types +++ b/tests/baselines/reference/inKeywordAndIntersection.types @@ -12,17 +12,17 @@ class B { b = 0 } >0 : 0 function f10(obj: A & { x: string } | B) { ->f10 : (obj: (A & { x: string;}) | B) => void ->obj : B | (A & { x: string; }) +>f10 : (obj: A & { x: string;} | B) => void +>obj : B | A & { x: string; } >x : string if (obj instanceof Object) { >obj instanceof Object : boolean ->obj : B | (A & { x: string; }) +>obj : B | A & { x: string; } >Object : ObjectConstructor obj; // A & { x: string } | B ->obj : B | (A & { x: string; }) +>obj : B | A & { x: string; } } else { obj; // Error diff --git a/tests/baselines/reference/inKeywordTypeguard(strict=true).types b/tests/baselines/reference/inKeywordTypeguard(strict=true).types index 09f2a5099fefb..6952a975268fb 100644 --- a/tests/baselines/reference/inKeywordTypeguard(strict=true).types +++ b/tests/baselines/reference/inKeywordTypeguard(strict=true).types @@ -447,15 +447,15 @@ function negativeIntersectionTest() { >window : Window & typeof globalThis window.ontouchstart ->window.ontouchstart : (((this: GlobalEventHandlers, ev: TouchEvent) => any) & ((this: Window, ev: TouchEvent) => any)) | null | undefined +>window.ontouchstart : ((this: GlobalEventHandlers, ev: TouchEvent) => any) & ((this: Window, ev: TouchEvent) => any) | null | undefined >window : Window & typeof globalThis ->ontouchstart : (((this: GlobalEventHandlers, ev: TouchEvent) => any) & ((this: Window, ev: TouchEvent) => any)) | null | undefined +>ontouchstart : ((this: GlobalEventHandlers, ev: TouchEvent) => any) & ((this: Window, ev: TouchEvent) => any) | null | undefined } else { window.ontouchstart ->window.ontouchstart : (((this: GlobalEventHandlers, ev: TouchEvent) => any) & ((this: Window, ev: TouchEvent) => any)) | null | undefined +>window.ontouchstart : ((this: GlobalEventHandlers, ev: TouchEvent) => any) & ((this: Window, ev: TouchEvent) => any) | null | undefined >window : Window & typeof globalThis ->ontouchstart : (((this: GlobalEventHandlers, ev: TouchEvent) => any) & ((this: Window, ev: TouchEvent) => any)) | null | undefined +>ontouchstart : ((this: GlobalEventHandlers, ev: TouchEvent) => any) & ((this: Window, ev: TouchEvent) => any) | null | undefined } } @@ -1035,7 +1035,7 @@ function foo(value: A) { >value : A >"object" : "object" >value !== null : boolean ->value : (A & object) | (A & null) +>value : A & object | A & null >"prop" in value : boolean >"prop" : "prop" >value : A & object diff --git a/tests/baselines/reference/inferenceDoesNotAddUndefinedOrNull.types b/tests/baselines/reference/inferenceDoesNotAddUndefinedOrNull.types index 123c4ed08a176..78364b21232ff 100644 --- a/tests/baselines/reference/inferenceDoesNotAddUndefinedOrNull.types +++ b/tests/baselines/reference/inferenceDoesNotAddUndefinedOrNull.types @@ -57,7 +57,7 @@ function flatMapChildren(node: Node, cb: (child: Node) => readonly T[] | T | >...toArray(value) : T >toArray(value) : readonly T[] >toArray : { (value: T_1 | T_1[]): T_1[]; (value: T_2 | readonly T_2[]): readonly T_2[]; } ->value : readonly T[] | (T & ({} | null)) +>value : readonly T[] | T & ({} | null) } }); return result; @@ -100,7 +100,7 @@ function flatMapChildren2(node: Node, cb: (child: Node) => readonly T[] | T | >...toArray(value) : T >toArray(value) : readonly T[] >toArray : { (value: T_1 | T_1[]): T_1[]; (value: T_2 | readonly T_2[]): readonly T_2[]; } ->value : readonly T[] | (T & ({} | undefined)) +>value : readonly T[] | T & ({} | undefined) } }); return result; diff --git a/tests/baselines/reference/inferenceOfNullableObjectTypesWithCommonBase.types b/tests/baselines/reference/inferenceOfNullableObjectTypesWithCommonBase.types index 54c6e3740f7ba..b4b96feab8de7 100644 --- a/tests/baselines/reference/inferenceOfNullableObjectTypesWithCommonBase.types +++ b/tests/baselines/reference/inferenceOfNullableObjectTypesWithCommonBase.types @@ -138,14 +138,14 @@ equal(v as string, v as string & { tag: 'foo' } | undefined); >equal : (a: T, b: T) => void >v as string : string >v : never ->v as string & { tag: 'foo' } | undefined : (string & { tag: 'foo'; }) | undefined +>v as string & { tag: 'foo' } | undefined : string & { tag: 'foo'; } | undefined >v : never >tag : "foo" equal(v as string & { tag: 'foo' } | undefined, v as string); >equal(v as string & { tag: 'foo' } | undefined, v as string) : void >equal : (a: T, b: T) => void ->v as string & { tag: 'foo' } | undefined : (string & { tag: 'foo'; }) | undefined +>v as string & { tag: 'foo' } | undefined : string & { tag: 'foo'; } | undefined >v : never >tag : "foo" >v as string : string diff --git a/tests/baselines/reference/intersectionAndUnionTypes.errors.txt b/tests/baselines/reference/intersectionAndUnionTypes.errors.txt index 6bdfc0df64cc4..09f4153bc1d3f 100644 --- a/tests/baselines/reference/intersectionAndUnionTypes.errors.txt +++ b/tests/baselines/reference/intersectionAndUnionTypes.errors.txt @@ -2,22 +2,22 @@ intersectionAndUnionTypes.ts(19,1): error TS2322: Type 'A' is not assignable to Property 'b' is missing in type 'A' but required in type 'B'. intersectionAndUnionTypes.ts(20,1): error TS2322: Type 'B' is not assignable to type 'A & B'. Property 'a' is missing in type 'B' but required in type 'A'. -intersectionAndUnionTypes.ts(23,1): error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'. - Type 'A' is not assignable to type '(A & B) | (C & D)'. +intersectionAndUnionTypes.ts(23,1): error TS2322: Type 'A | B' is not assignable to type 'A & B | C & D'. + Type 'A' is not assignable to type 'A & B | C & D'. Type 'A' is not assignable to type 'A & B'. -intersectionAndUnionTypes.ts(25,1): error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'. - Type 'C' is not assignable to type '(A & B) | (C & D)'. +intersectionAndUnionTypes.ts(25,1): error TS2322: Type 'C | D' is not assignable to type 'A & B | C & D'. + Type 'C' is not assignable to type 'A & B | C & D'. Type 'C' is not assignable to type 'C & D'. Property 'd' is missing in type 'C' but required in type 'D'. -intersectionAndUnionTypes.ts(26,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'. +intersectionAndUnionTypes.ts(26,1): error TS2322: Type 'A & B | C & D' is not assignable to type 'A & B'. Type 'C & D' is not assignable to type 'A & B'. Property 'a' is missing in type 'C & D' but required in type 'A'. -intersectionAndUnionTypes.ts(27,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'. +intersectionAndUnionTypes.ts(27,1): error TS2322: Type 'A & B | C & D' is not assignable to type 'A | B'. Type 'C & D' is not assignable to type 'A | B'. -intersectionAndUnionTypes.ts(28,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'. +intersectionAndUnionTypes.ts(28,1): error TS2322: Type 'A & B | C & D' is not assignable to type 'C & D'. Type 'A & B' is not assignable to type 'C & D'. Property 'c' is missing in type 'A & B' but required in type 'C'. -intersectionAndUnionTypes.ts(29,1): error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'. +intersectionAndUnionTypes.ts(29,1): error TS2322: Type 'A & B | C & D' is not assignable to type 'C | D'. Type 'A & B' is not assignable to type 'C | D'. intersectionAndUnionTypes.ts(31,1): error TS2322: Type 'A & B' is not assignable to type '(A | B) & (C | D)'. Type 'A & B' is not assignable to type 'B & D'. @@ -74,36 +74,36 @@ intersectionAndUnionTypes.ts(37,1): error TS2322: Type '(A | B) & (C | D)' is no x = anb; // Ok x = aob; ~ -!!! error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'. -!!! error TS2322: Type 'A' is not assignable to type '(A & B) | (C & D)'. +!!! error TS2322: Type 'A | B' is not assignable to type 'A & B | C & D'. +!!! error TS2322: Type 'A' is not assignable to type 'A & B | C & D'. !!! error TS2322: Type 'A' is not assignable to type 'A & B'. x = cnd; // Ok x = cod; ~ -!!! error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'. -!!! error TS2322: Type 'C' is not assignable to type '(A & B) | (C & D)'. +!!! error TS2322: Type 'C | D' is not assignable to type 'A & B | C & D'. +!!! error TS2322: Type 'C' is not assignable to type 'A & B | C & D'. !!! error TS2322: Type 'C' is not assignable to type 'C & D'. !!! error TS2322: Property 'd' is missing in type 'C' but required in type 'D'. !!! related TS2728 intersectionAndUnionTypes.ts:4:15: 'd' is declared here. anb = x; ~~~ -!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A & B'. +!!! error TS2322: Type 'A & B | C & D' is not assignable to type 'A & B'. !!! error TS2322: Type 'C & D' is not assignable to type 'A & B'. !!! error TS2322: Property 'a' is missing in type 'C & D' but required in type 'A'. !!! related TS2728 intersectionAndUnionTypes.ts:1:15: 'a' is declared here. aob = x; ~~~ -!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'A | B'. +!!! error TS2322: Type 'A & B | C & D' is not assignable to type 'A | B'. !!! error TS2322: Type 'C & D' is not assignable to type 'A | B'. cnd = x; ~~~ -!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C & D'. +!!! error TS2322: Type 'A & B | C & D' is not assignable to type 'C & D'. !!! error TS2322: Type 'A & B' is not assignable to type 'C & D'. !!! error TS2322: Property 'c' is missing in type 'A & B' but required in type 'C'. !!! related TS2728 intersectionAndUnionTypes.ts:3:15: 'c' is declared here. cod = x; ~~~ -!!! error TS2322: Type '(A & B) | (C & D)' is not assignable to type 'C | D'. +!!! error TS2322: Type 'A & B | C & D' is not assignable to type 'C | D'. !!! error TS2322: Type 'A & B' is not assignable to type 'C | D'. y = anb; diff --git a/tests/baselines/reference/intersectionAndUnionTypes.types b/tests/baselines/reference/intersectionAndUnionTypes.types index 7cfa1d9856731..68dfe52f7081a 100644 --- a/tests/baselines/reference/intersectionAndUnionTypes.types +++ b/tests/baselines/reference/intersectionAndUnionTypes.types @@ -38,7 +38,7 @@ var cod: C | D; >cod : C | D var x: A & B | C & D; ->x : (A & B) | (C & D) +>x : A & B | C & D var y: (A | B) & (C | D); >y : (A | B) & (C | D) @@ -65,43 +65,43 @@ anb = b; x = anb; // Ok >x = anb : A & B ->x : (A & B) | (C & D) +>x : A & B | C & D >anb : A & B x = aob; >x = aob : A | B ->x : (A & B) | (C & D) +>x : A & B | C & D >aob : A | B x = cnd; // Ok >x = cnd : C & D ->x : (A & B) | (C & D) +>x : A & B | C & D >cnd : C & D x = cod; >x = cod : C | D ->x : (A & B) | (C & D) +>x : A & B | C & D >cod : C | D anb = x; ->anb = x : (A & B) | (C & D) +>anb = x : A & B | C & D >anb : A & B ->x : (A & B) | (C & D) +>x : A & B | C & D aob = x; ->aob = x : (A & B) | (C & D) +>aob = x : A & B | C & D >aob : A | B ->x : (A & B) | (C & D) +>x : A & B | C & D cnd = x; ->cnd = x : (A & B) | (C & D) +>cnd = x : A & B | C & D >cnd : C & D ->x : (A & B) | (C & D) +>x : A & B | C & D cod = x; ->cod = x : (A & B) | (C & D) +>cod = x : A & B | C & D >cod : C | D ->x : (A & B) | (C & D) +>x : A & B | C & D y = anb; >y = anb : A & B diff --git a/tests/baselines/reference/intersectionMemberOfUnionNarrowsCorrectly.types b/tests/baselines/reference/intersectionMemberOfUnionNarrowsCorrectly.types index cc5b6d1fb992d..724b6d31b09c5 100644 --- a/tests/baselines/reference/intersectionMemberOfUnionNarrowsCorrectly.types +++ b/tests/baselines/reference/intersectionMemberOfUnionNarrowsCorrectly.types @@ -2,7 +2,7 @@ === intersectionMemberOfUnionNarrowsCorrectly.ts === export type U = { kind?: 'A', a: string } | { kind?: 'B' } & { b: string }; ->U : { kind?: 'A'; a: string; } | ({ kind?: 'B'; } & { b: string; }) +>U : { kind?: 'A'; a: string; } | { kind?: 'B'; } & { b: string; } >kind : "A" >a : string >kind : "B" diff --git a/tests/baselines/reference/intersectionNarrowing.types b/tests/baselines/reference/intersectionNarrowing.types index 5ff057a759a2a..cdfed50505e18 100644 --- a/tests/baselines/reference/intersectionNarrowing.types +++ b/tests/baselines/reference/intersectionNarrowing.types @@ -4,11 +4,11 @@ // Repros from #43130 function f1(x: T & string | T & undefined) { ->f1 : (x: (T & string) | (T & undefined)) => void ->x : (T & string) | (T & undefined) +>f1 : (x: T & string | T & undefined) => void +>x : T & string | T & undefined if (x) { ->x : (T & string) | (T & undefined) +>x : T & string | T & undefined x; // Should narrow to T & string >x : T & string @@ -16,12 +16,12 @@ function f1(x: T & string | T & undefined) { } function f2(x: T & string | T & undefined) { ->f2 : (x: (T & string) | (T & undefined)) => void ->x : (T & string) | (T & undefined) +>f2 : (x: T & string | T & undefined) => void +>x : T & string | T & undefined if (x !== undefined) { >x !== undefined : boolean ->x : (T & string) | (T & undefined) +>x : T & string | T & undefined >undefined : undefined x; // Should narrow to T & string @@ -34,13 +34,13 @@ function f2(x: T & string | T & undefined) { } function f3(x: T & string | T & number) { ->f3 : (x: (T & string) | (T & number)) => void ->x : (T & string) | (T & number) +>f3 : (x: T & string | T & number) => void +>x : T & string | T & number if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->x : (T & string) | (T & number) +>x : T & string | T & number >"string" : "string" x; // Should narrow to T & string @@ -53,11 +53,11 @@ function f3(x: T & string | T & number) { } function f4(x: T & 1 | T & 2) { ->f4 : (x: (T & 1) | (T & 2)) => void ->x : (T & 1) | (T & 2) +>f4 : (x: T & 1 | T & 2) => void +>x : T & 1 | T & 2 switch (x) { ->x : (T & 1) | (T & 2) +>x : T & 1 | T & 2 case 1: x; break; // T & 1 >1 : 1 diff --git a/tests/baselines/reference/intersectionOfUnionNarrowing.types b/tests/baselines/reference/intersectionOfUnionNarrowing.types index fb459b30dda14..ad8c3a63cd2e6 100644 --- a/tests/baselines/reference/intersectionOfUnionNarrowing.types +++ b/tests/baselines/reference/intersectionOfUnionNarrowing.types @@ -22,9 +22,9 @@ declare const q: X & AorB; if (q.a !== undefined) { >q.a !== undefined : boolean ->q.a : ({ aProp: string; } & object) | undefined +>q.a : { aProp: string; } & object | undefined >q : X & AorB ->a : ({ aProp: string; } & object) | undefined +>a : { aProp: string; } & object | undefined >undefined : undefined q.a.aProp; diff --git a/tests/baselines/reference/intersectionTypeNormalization.types b/tests/baselines/reference/intersectionTypeNormalization.types index 73b4b76ca1bcf..74debd050bd7d 100644 --- a/tests/baselines/reference/intersectionTypeNormalization.types +++ b/tests/baselines/reference/intersectionTypeNormalization.types @@ -18,10 +18,10 @@ type X1 = (A | B) & (C | D); >X1 : (A | B) & (C | D) type X2 = A & (C | D) | B & (C | D) ->X2 : (A & (C | D)) | (B & (C | D)) +>X2 : A & (C | D) | B & (C | D) type X3 = A & C | A & D | B & C | B & D; ->X3 : (A & C) | (A & D) | (B & C) | (B & D) +>X3 : A & C | A & D | B & C | B & D var x: X1; >x : X1 @@ -40,13 +40,13 @@ interface Y { y: string } // Identical ways of writing the same type type Y1 = (A | X & Y) & (C | D); ->Y1 : (A | (X & Y)) & (C | D) +>Y1 : (A | X & Y) & (C | D) type Y2 = A & (C | D) | X & Y & (C | D) ->Y2 : (A & (C | D)) | (X & Y & (C | D)) +>Y2 : A & (C | D) | X & Y & (C | D) type Y3 = A & C | A & D | X & Y & C | X & Y & D; ->Y3 : (A & C) | (A & D) | (X & Y & C) | (X & Y & D) +>Y3 : A & C | A & D | X & Y & C | X & Y & D var y: Y1; >y : Y1 @@ -65,16 +65,16 @@ interface N { n: string } // Identical ways of writing the same type type Z1 = (A | X & (M | N)) & (C | D); ->Z1 : (A | (X & (M | N))) & (C | D) +>Z1 : (A | X & (M | N)) & (C | D) type Z2 = A & (C | D) | X & (M | N) & (C | D) ->Z2 : (A & (C | D)) | (X & (M | N) & (C | D)) +>Z2 : A & (C | D) | X & (M | N) & (C | D) type Z3 = A & C | A & D | X & (M | N) & C | X & (M | N) & D; ->Z3 : (A & C) | (A & D) | (X & (M | N) & C) | (X & (M | N) & D) +>Z3 : A & C | A & D | X & (M | N) & C | X & (M | N) & D type Z4 = A & C | A & D | X & M & C | X & N & C | X & M & D | X & N & D; ->Z4 : (A & C) | (A & D) | (X & M & C) | (X & M & D) | (X & N & C) | (X & N & D) +>Z4 : A & C | A & D | X & M & C | X & M & D | X & N & C | X & N & D var z: Z1; >z : Z1 @@ -110,7 +110,7 @@ type IntersectionFail = BoxedValue & ToString >IntersectionFail : BoxedValue & ToString type IntersectionInline = { kind: 'int', num: number } & ToString ->IntersectionInline : ({ kind: 'int'; num: number; } & ToString) | ({ kind: 'string'; str: string; } & ToString) +>IntersectionInline : { kind: 'int'; num: number; } & ToString | { kind: 'string'; str: string; } & ToString >kind : "int" >num : number diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.types b/tests/baselines/reference/intersectionWithUnionConstraint.types index 86c318fe89bb1..db7e6ee83c09f 100644 --- a/tests/baselines/reference/intersectionWithUnionConstraint.types +++ b/tests/baselines/reference/intersectionWithUnionConstraint.types @@ -45,7 +45,7 @@ type T1 = (string | number | undefined) & (string | null | undefined); // strin function f3(x: T & (number | object | undefined)) { >f3 : (x: T & (number | object | undefined)) => void ->x : (T & undefined) | (T & number) +>x : T & undefined | T & number const y: number | undefined = x; >y : number | undefined diff --git a/tests/baselines/reference/intraExpressionInferencesJsx.types b/tests/baselines/reference/intraExpressionInferencesJsx.types index d228486e3972f..147cc27e33385 100644 --- a/tests/baselines/reference/intraExpressionInferencesJsx.types +++ b/tests/baselines/reference/intraExpressionInferencesJsx.types @@ -36,7 +36,7 @@ type C = { }; type Animations = { ->Animations : { [key: string]: { value: number; } & (({ kind: "a"; func?(): Partial; } & A) | ({ kind: "b"; func?(): Partial; } & B) | ({ kind: "c"; func?(): Partial; } & C)); } +>Animations : { [key: string]: { value: number; } & ({ kind: "a"; func?(): Partial; } & A | { kind: "b"; func?(): Partial; } & B | { kind: "c"; func?(): Partial; } & C); } [key: string]: { value: number } & ( >key : string diff --git a/tests/baselines/reference/jsdocParseBackquotedParamName.types b/tests/baselines/reference/jsdocParseBackquotedParamName.types index 7b097e0fb00a6..9640abe86ca49 100644 --- a/tests/baselines/reference/jsdocParseBackquotedParamName.types +++ b/tests/baselines/reference/jsdocParseBackquotedParamName.types @@ -6,7 +6,7 @@ * @param `bwarg` {?number?} */ function f(args, bwarg) { ->f : (args?: string | undefined, bwarg: (number | null) | null) => void +>f : (args?: string | undefined, bwarg: number | null | null) => void >args : string | undefined >bwarg : number | null } diff --git a/tests/baselines/reference/jsdocPostfixEqualsAddsOptionality.types b/tests/baselines/reference/jsdocPostfixEqualsAddsOptionality.types index b707bb3190682..e96799965915a 100644 --- a/tests/baselines/reference/jsdocPostfixEqualsAddsOptionality.types +++ b/tests/baselines/reference/jsdocPostfixEqualsAddsOptionality.types @@ -40,7 +40,7 @@ f(1) /** @param {???!?number?=} a */ function g(a) { ->g : (a?: (((((number | null) | null) | null) | null) | null) | undefined) => void +>g : (a?: number | null | null | null | null | null | undefined) => void >a : number | null | undefined a = 1 diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.types b/tests/baselines/reference/keyofAndIndexedAccess2.types index 75f8fa87095d5..597e95897553f 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.types +++ b/tests/baselines/reference/keyofAndIndexedAccess2.types @@ -571,7 +571,7 @@ for (const action of actions) { window[action](x, y); >window[action](x, y) : void ->window[action] : (((x: number, y: number) => void) & ((x: number, y: number) => void)) | (((width: number, height: number) => void) & ((width: number, height: number) => void)) +>window[action] : ((x: number, y: number) => void) & ((x: number, y: number) => void) | ((width: number, height: number) => void) & ((width: number, height: number) => void) >window : Window & typeof globalThis >action : "resizeTo" | "resizeBy" >x : number diff --git a/tests/baselines/reference/literalFreshnessPropagationOnNarrowing.types b/tests/baselines/reference/literalFreshnessPropagationOnNarrowing.types index 3897d16855402..766580b5ed2d7 100644 --- a/tests/baselines/reference/literalFreshnessPropagationOnNarrowing.types +++ b/tests/baselines/reference/literalFreshnessPropagationOnNarrowing.types @@ -33,7 +33,7 @@ function f2() { >false : false type ElementOrArray = Element | Element[]; ->ElementOrArray : (string | false) | (string | false)[] +>ElementOrArray : string | false | (string | false)[] let el: Element = null as any; >el : string | false @@ -44,31 +44,31 @@ function f2() { >null as any : any let elOrA: ElementOrArray = null as any; ->elOrA : (string | false) | (string | false)[] +>elOrA : string | false | (string | false)[] >null as any : any // Desired/actual: All OK let a1: ElementOrArray = el; ->a1 : (string | false) | (string | false)[] +>a1 : string | false | (string | false)[] >el : string | false let a2: ElementOrArray = arr; ->a2 : (string | false) | (string | false)[] +>a2 : string | false | (string | false)[] >arr : (string | false)[] let a3: ElementOrArray = [el]; ->a3 : (string | false) | (string | false)[] +>a3 : string | false | (string | false)[] >[el] : (string | false)[] >el : string | false let a4: ElementOrArray = Array.isArray(elOrA) ? elOrA : [elOrA]; ->a4 : (string | false) | (string | false)[] +>a4 : string | false | (string | false)[] >Array.isArray(elOrA) ? elOrA : [elOrA] : (string | false)[] >Array.isArray(elOrA) : boolean >Array.isArray : (arg: any) => arg is any[] >Array : ArrayConstructor >isArray : (arg: any) => arg is any[] ->elOrA : (string | false) | (string | false)[] +>elOrA : string | false | (string | false)[] >elOrA : (string | false)[] >[elOrA] : (string | false)[] >elOrA : string | false @@ -77,7 +77,7 @@ function f2() { // 3.0: Error // 3.1: OK let a5: ElementOrArray = [...Array.isArray(elOrA) ? elOrA : [elOrA]]; ->a5 : (string | false) | (string | false)[] +>a5 : string | false | (string | false)[] >[...Array.isArray(elOrA) ? elOrA : [elOrA]] : (string | false)[] >...Array.isArray(elOrA) ? elOrA : [elOrA] : string | false >Array.isArray(elOrA) ? elOrA : [elOrA] : (string | false)[] @@ -85,7 +85,7 @@ function f2() { >Array.isArray : (arg: any) => arg is any[] >Array : ArrayConstructor >isArray : (arg: any) => arg is any[] ->elOrA : (string | false) | (string | false)[] +>elOrA : string | false | (string | false)[] >elOrA : (string | false)[] >[elOrA] : (string | false)[] >elOrA : string | false diff --git a/tests/baselines/reference/mappedTypes4.types b/tests/baselines/reference/mappedTypes4.types index d897a9ac17103..faf97454827f2 100644 --- a/tests/baselines/reference/mappedTypes4.types +++ b/tests/baselines/reference/mappedTypes4.types @@ -29,7 +29,7 @@ function boxify(obj: T): Boxified { for (let k in obj) { >k : Extract ->obj : (T & object) | (T & null) +>obj : T & object | T & null result[k] = { value: obj[k] }; >result[k] = { value: obj[k] } : { value: (T & object)[Extract]; } diff --git a/tests/baselines/reference/narrowingByTypeofInSwitch.types b/tests/baselines/reference/narrowingByTypeofInSwitch.types index 9c10f1ec21d9e..a0dbe659fb308 100644 --- a/tests/baselines/reference/narrowingByTypeofInSwitch.types +++ b/tests/baselines/reference/narrowingByTypeofInSwitch.types @@ -565,8 +565,8 @@ function multipleGenericFuse(xy: X | case 'number': return [xy] >'number' : "number" ->[xy] : [(X & number) | (Y & number)] ->xy : (X & number) | (Y & number) +>[xy] : [X & number | Y & number] +>xy : X & number | Y & number } } @@ -1105,8 +1105,8 @@ function multipleGenericFuseWithBoth case `number`: return [xy] >`number` : "number" ->[xy] : [(X & number) | (Y & number)] ->xy : (X & number) | (Y & number) +>[xy] : [X & number | Y & number] +>xy : X & number | Y & number } } diff --git a/tests/baselines/reference/narrowingTypeofFunction.types b/tests/baselines/reference/narrowingTypeofFunction.types index a617ee86153f0..1d8ecb09288f4 100644 --- a/tests/baselines/reference/narrowingTypeofFunction.types +++ b/tests/baselines/reference/narrowingTypeofFunction.types @@ -9,12 +9,12 @@ interface F { (): string } function f1(a: (F & Meta) | string) { >f1 : (a: (F & Meta) | string) => void ->a : string | (F & Meta) +>a : string | F & Meta if (typeof a === "function") { >typeof a === "function" : boolean >typeof a : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->a : string | (F & Meta) +>a : string | F & Meta >"function" : "function" a; @@ -27,13 +27,13 @@ function f1(a: (F & Meta) | string) { } function f2(x: (T & F) | T & string) { ->f2 : (x: (T & F) | (T & string)) => void ->x : (T & F) | (T & string) +>f2 : (x: (T & F) | T & string) => void +>x : T & F | T & string if (typeof x === "function") { >typeof x === "function" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->x : (T & F) | (T & string) +>x : T & F | T & string >"function" : "function" x; diff --git a/tests/baselines/reference/narrowingUnionToUnion.types b/tests/baselines/reference/narrowingUnionToUnion.types index 07ecb01d82220..2b6dd657df972 100644 --- a/tests/baselines/reference/narrowingUnionToUnion.types +++ b/tests/baselines/reference/narrowingUnionToUnion.types @@ -33,7 +33,7 @@ function fx2(x: T | undefined) { >x : T | undefined x; // T & Falsy | undefined ->x : (T & null) | (T & false) | (T & "") | (T & 0) | (T & 0n) | undefined +>x : T & null | T & false | T & "" | T & 0 | T & 0n | undefined } } @@ -47,7 +47,7 @@ function fx3(x: T) { >x : string | number x; // T & "" | T & 0 ->x : (T & "") | (T & 0) +>x : T & "" | T & 0 } } diff --git a/tests/baselines/reference/nonPrimitiveAndEmptyObject.types b/tests/baselines/reference/nonPrimitiveAndEmptyObject.types index b357cc5d53649..39b39b7381a99 100644 --- a/tests/baselines/reference/nonPrimitiveAndEmptyObject.types +++ b/tests/baselines/reference/nonPrimitiveAndEmptyObject.types @@ -10,7 +10,7 @@ export interface BarProps { export interface FooProps { fooProps?: BarProps & object; ->fooProps : (BarProps & object) | undefined +>fooProps : BarProps & object | undefined } declare const foo: FooProps; diff --git a/tests/baselines/reference/objectLiteralExcessProperties.types b/tests/baselines/reference/objectLiteralExcessProperties.types index aa3ab0fd95740..7f495844e8271 100644 --- a/tests/baselines/reference/objectLiteralExcessProperties.types +++ b/tests/baselines/reference/objectLiteralExcessProperties.types @@ -134,7 +134,7 @@ function test() { // Excess property checks only on non-generic parts of unions const obj4: T & { prop: boolean } | { name: string } = { name: "test", prop: true }; ->obj4 : (T & { prop: boolean; }) | { name: string; } +>obj4 : T & { prop: boolean; } | { name: string; } >prop : boolean >name : string >{ name: "test", prop: true } : { name: string; prop: boolean; } diff --git a/tests/baselines/reference/objectSpread.types b/tests/baselines/reference/objectSpread.types index bdbb500e22704..249755248edf2 100644 --- a/tests/baselines/reference/objectSpread.types +++ b/tests/baselines/reference/objectSpread.types @@ -672,8 +672,8 @@ function genericSpread(t: T, u: U, v: T | U, w: T | { s: string }, obj: { >v : T | U let x12 = { ...v, ...obj }; ->x12 : (T & { x: number; }) | (U & { x: number; }) ->{ ...v, ...obj } : (T & { x: number; }) | (U & { x: number; }) +>x12 : T & { x: number; } | U & { x: number; } +>{ ...v, ...obj } : T & { x: number; } | U & { x: number; } >v : T | U >obj : { x: number; } @@ -683,33 +683,33 @@ function genericSpread(t: T, u: U, v: T | U, w: T | { s: string }, obj: { >w : T | { s: string; } let x14 = { ...w, ...obj }; ->x14 : (T & { x: number; }) | { x: number; s: string; } ->{ ...w, ...obj } : (T & { x: number; }) | { x: number; s: string; } +>x14 : T & { x: number; } | { x: number; s: string; } +>{ ...w, ...obj } : T & { x: number; } | { x: number; s: string; } >w : T | { s: string; } >obj : { x: number; } let x15 = { ...t, ...v }; ->x15 : T | (T & U) ->{ ...t, ...v } : T | (T & U) +>x15 : T | T & U +>{ ...t, ...v } : T | T & U >t : T >v : T | U let x16 = { ...t, ...w }; ->x16 : T | (T & { s: string; }) ->{ ...t, ...w } : T | (T & { s: string; }) +>x16 : T | T & { s: string; } +>{ ...t, ...w } : T | T & { s: string; } >t : T >w : T | { s: string; } let x17 = { ...t, ...w, ...obj }; ->x17 : (T & { x: number; }) | (T & { x: number; s: string; }) ->{ ...t, ...w, ...obj } : (T & { x: number; }) | (T & { x: number; s: string; }) +>x17 : T & { x: number; } | T & { x: number; s: string; } +>{ ...t, ...w, ...obj } : T & { x: number; } | T & { x: number; s: string; } >t : T >w : T | { s: string; } >obj : { x: number; } let x18 = { ...t, ...v, ...w }; ->x18 : T | (T & U) | (T & { s: string; }) | (T & U & { s: string; }) ->{ ...t, ...v, ...w } : T | (T & U) | (T & { s: string; }) | (T & U & { s: string; }) +>x18 : T | T & U | T & { s: string; } | T & U & { s: string; } +>{ ...t, ...v, ...w } : T | T & U | T & { s: string; } | T & U & { s: string; } >t : T >v : T | U >w : T | { s: string; } diff --git a/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types b/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types index 6eaddd180b569..347130b2bfcf0 100644 --- a/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types +++ b/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types @@ -224,7 +224,7 @@ for (const k of keys) { obj[k] = () => "12"; // shouldn't cause a complexity error >obj[k] = () => "12" : () => string ->obj[k] : (((x: 0) => string) & ((x: 1) => string) & ((x: 2) => string) & ((x: 3) => string) & ((x: 4) => string) & ((x: 5) => string) & ((x: 6) => string) & ((x: 7) => string) & ((x: 8) => string) & ((x: 9) => string) & ((x: 10) => string) & ((x: 11) => string) & ((x: 12) => string) & ((x: 13) => string) & ((x: 14) => string) & ((x: 15) => string) & ((x: 16) => string) & ((x: 17) => string) & ((x: 18) => string) & ((x: 19) => string) & ((x: 20) => string) & ((x: 21) => string) & ((x: 22) => string) & ((x: 23) => string) & ((x: 24) => string) & ((x: 25) => string) & ((x: 26) => string) & ((x: 27) => string) & ((x: 28) => string) & ((x: 29) => string) & ((x: 30) => string) & ((x: 31) => string) & ((x: 32) => string) & ((x: 33) => string) & ((x: 34) => string) & ((x: 35) => string) & ((x: 36) => string) & ((x: 37) => string) & ((x: 38) => string) & ((x: 39) => string) & ((x: 40) => string) & ((x: 41) => string) & ((x: 42) => string) & ((x: 43) => string) & ((x: 44) => string) & ((x: 45) => string) & ((x: 46) => string) & ((x: 47) => string) & ((x: 48) => string) & ((x: 49) => string) & ((x: 50) => string) & ((x: 51) => string)) | undefined +>obj[k] : ((x: 0) => string) & ((x: 1) => string) & ((x: 2) => string) & ((x: 3) => string) & ((x: 4) => string) & ((x: 5) => string) & ((x: 6) => string) & ((x: 7) => string) & ((x: 8) => string) & ((x: 9) => string) & ((x: 10) => string) & ((x: 11) => string) & ((x: 12) => string) & ((x: 13) => string) & ((x: 14) => string) & ((x: 15) => string) & ((x: 16) => string) & ((x: 17) => string) & ((x: 18) => string) & ((x: 19) => string) & ((x: 20) => string) & ((x: 21) => string) & ((x: 22) => string) & ((x: 23) => string) & ((x: 24) => string) & ((x: 25) => string) & ((x: 26) => string) & ((x: 27) => string) & ((x: 28) => string) & ((x: 29) => string) & ((x: 30) => string) & ((x: 31) => string) & ((x: 32) => string) & ((x: 33) => string) & ((x: 34) => string) & ((x: 35) => string) & ((x: 36) => string) & ((x: 37) => string) & ((x: 38) => string) & ((x: 39) => string) & ((x: 40) => string) & ((x: 41) => string) & ((x: 42) => string) & ((x: 43) => string) & ((x: 44) => string) & ((x: 45) => string) & ((x: 46) => string) & ((x: 47) => string) & ((x: 48) => string) & ((x: 49) => string) & ((x: 50) => string) & ((x: 51) => string) | undefined >obj : Partial >k : keyof MyAPI >() => "12" : () => string @@ -244,7 +244,7 @@ for (const k of keys) { obj2[k] = () => "12"; // shouldn't cause a complexity error >obj2[k] = () => "12" : () => string ->obj2[k] : (((x: 0) => string) & ((x: 1) => string) & ((x: 2) => string) & ((x: 3) => string) & ((x: 4) => string) & ((x: 5) => string) & ((x: 6) => string) & ((x: 7) => string) & ((x: 8) => string) & ((x: 9) => string) & ((x: 10) => string) & ((x: 11) => string) & ((x: 12) => string) & ((x: 13) => string) & ((x: 14) => string) & ((x: 15) => string) & ((x: 16) => string) & ((x: 17) => string) & ((x: 18) => string) & ((x: 19) => string) & ((x: 20) => string) & ((x: 21) => string) & ((x: 22) => string) & ((x: 23) => string) & ((x: 24) => string) & ((x: 25) => string) & ((x: 26) => string) & ((x: 27) => string) & ((x: 28) => string) & ((x: 29) => string) & ((x: 30) => string) & ((x: 31) => string) & ((x: 32) => string) & ((x: 33) => string) & ((x: 34) => string) & ((x: 35) => string) & ((x: 36) => string) & ((x: 37) => string) & ((x: 38) => string) & ((x: 39) => string) & ((x: 40) => string) & ((x: 41) => string) & ((x: 42) => string) & ((x: 43) => string) & ((x: 44) => string) & ((x: 45) => string) & ((x: 46) => string) & ((x: 47) => string) & ((x: 48) => string) & ((x: 49) => string) & ((x: 50) => string) & ((x: 51) => string)) | null | undefined +>obj2[k] : ((x: 0) => string) & ((x: 1) => string) & ((x: 2) => string) & ((x: 3) => string) & ((x: 4) => string) & ((x: 5) => string) & ((x: 6) => string) & ((x: 7) => string) & ((x: 8) => string) & ((x: 9) => string) & ((x: 10) => string) & ((x: 11) => string) & ((x: 12) => string) & ((x: 13) => string) & ((x: 14) => string) & ((x: 15) => string) & ((x: 16) => string) & ((x: 17) => string) & ((x: 18) => string) & ((x: 19) => string) & ((x: 20) => string) & ((x: 21) => string) & ((x: 22) => string) & ((x: 23) => string) & ((x: 24) => string) & ((x: 25) => string) & ((x: 26) => string) & ((x: 27) => string) & ((x: 28) => string) & ((x: 29) => string) & ((x: 30) => string) & ((x: 31) => string) & ((x: 32) => string) & ((x: 33) => string) & ((x: 34) => string) & ((x: 35) => string) & ((x: 36) => string) & ((x: 37) => string) & ((x: 38) => string) & ((x: 39) => string) & ((x: 40) => string) & ((x: 41) => string) & ((x: 42) => string) & ((x: 43) => string) & ((x: 44) => string) & ((x: 45) => string) & ((x: 46) => string) & ((x: 47) => string) & ((x: 48) => string) & ((x: 49) => string) & ((x: 50) => string) & ((x: 51) => string) | null | undefined >obj2 : PartialNull >k : keyof MyAPI >() => "12" : () => string diff --git a/tests/baselines/reference/primitiveUnionDetection.types b/tests/baselines/reference/primitiveUnionDetection.types index d51a4d85e43b2..644727c52282c 100644 --- a/tests/baselines/reference/primitiveUnionDetection.types +++ b/tests/baselines/reference/primitiveUnionDetection.types @@ -8,14 +8,14 @@ type Kind = "one" | "two" | "three"; declare function getInterfaceFromString(options?: { type?: T } & { type?: Kind }): T; >getInterfaceFromString : (options?: { type?: T;} & { type?: Kind;}) => T ->options : ({ type?: T | undefined; } & { type?: Kind | undefined; }) | undefined +>options : { type?: T | undefined; } & { type?: Kind | undefined; } | undefined >type : T | undefined >type : Kind | undefined const result = getInterfaceFromString({ type: 'two' }); >result : "two" >getInterfaceFromString({ type: 'two' }) : "two" ->getInterfaceFromString : (options?: ({ type?: T | undefined; } & { type?: Kind | undefined; }) | undefined) => T +>getInterfaceFromString : (options?: { type?: T | undefined; } & { type?: Kind | undefined; } | undefined) => T >{ type: 'two' } : { type: "two"; } >type : "two" >'two' : "two" diff --git a/tests/baselines/reference/specialIntersectionsInMappedTypes.types b/tests/baselines/reference/specialIntersectionsInMappedTypes.types index 8b5910cf3556e..4f57a9bc08018 100644 --- a/tests/baselines/reference/specialIntersectionsInMappedTypes.types +++ b/tests/baselines/reference/specialIntersectionsInMappedTypes.types @@ -4,7 +4,7 @@ // Repro from #50683 type Alignment = (string & {}) | "left" | "center" | "right"; ->Alignment : (string & {}) | "left" | "center" | "right" +>Alignment : string & {} | "left" | "center" | "right" type Alignments = Record; >Alignments : { [x: string & {}]: string; left: string; center: string; right: string; } diff --git a/tests/baselines/reference/spreadObjectOrFalsy.js b/tests/baselines/reference/spreadObjectOrFalsy.js index 979b98f14d411..2cf058d13d395 100644 --- a/tests/baselines/reference/spreadObjectOrFalsy.js +++ b/tests/baselines/reference/spreadObjectOrFalsy.js @@ -106,7 +106,7 @@ var Foo = /** @class */ (function () { //// [spreadObjectOrFalsy.d.ts] declare function f1(a: T & undefined): any; -declare function f2(a: T | T & undefined): T | (T & undefined); +declare function f2(a: T | T & undefined): T | T & undefined; declare function f3(a: T): any; declare function f4(a: object | T): {}; declare function f5(a: S | T): S | T; diff --git a/tests/baselines/reference/spreadObjectOrFalsy.types b/tests/baselines/reference/spreadObjectOrFalsy.types index 3f57c796bdf7b..accc089e42ae5 100644 --- a/tests/baselines/reference/spreadObjectOrFalsy.types +++ b/tests/baselines/reference/spreadObjectOrFalsy.types @@ -11,12 +11,12 @@ function f1(a: T & undefined) { } function f2(a: T | T & undefined) { ->f2 : (a: T | (T & undefined)) => T | (T & undefined) ->a : T | (T & undefined) +>f2 : (a: T | T & undefined) => T | T & undefined +>a : T | T & undefined return { ...a }; ->{ ...a } : T | (T & undefined) ->a : T | (T & undefined) +>{ ...a } : T | T & undefined +>a : T | T & undefined } function f3(a: T) { diff --git a/tests/baselines/reference/templateLiteralTypes2.types b/tests/baselines/reference/templateLiteralTypes2.types index 05dd8a396e75f..dff381a1250e1 100644 --- a/tests/baselines/reference/templateLiteralTypes2.types +++ b/tests/baselines/reference/templateLiteralTypes2.types @@ -404,12 +404,12 @@ const interpolatedStyle = { rotate: 12 }; function C2(transform: "-moz-initial" | (string & {})) { return 12; } >C2 : (transform: "-moz-initial" | (string & {})) => number ->transform : (string & {}) | "-moz-initial" +>transform : string & {} | "-moz-initial" >12 : 12 C2(`rotate(${interpolatedStyle.rotate}dig)`); >C2(`rotate(${interpolatedStyle.rotate}dig)`) : number ->C2 : (transform: (string & {}) | "-moz-initial") => number +>C2 : (transform: string & {} | "-moz-initial") => number >`rotate(${interpolatedStyle.rotate}dig)` : `rotate(${number}dig)` >interpolatedStyle.rotate : number >interpolatedStyle : { rotate: number; } diff --git a/tests/baselines/reference/templateLiteralTypes3.types b/tests/baselines/reference/templateLiteralTypes3.types index 3f7f5f028c707..f426c1f380215 100644 --- a/tests/baselines/reference/templateLiteralTypes3.types +++ b/tests/baselines/reference/templateLiteralTypes3.types @@ -608,16 +608,16 @@ function a() { >id : string let x: keyof T & string | `-${keyof T & string}`; ->x : (keyof T & string) | `-${keyof T & string}` +>x : keyof T & string | `-${keyof T & string}` x = "id"; >x = "id" : "id" ->x : (keyof T & string) | `-${keyof T & string}` +>x : keyof T & string | `-${keyof T & string}` >"id" : "id" x = "-id"; >x = "-id" : "-id" ->x : (keyof T & string) | `-${keyof T & string}` +>x : keyof T & string | `-${keyof T & string}` >"-id" : "-id" } diff --git a/tests/baselines/reference/templateLiteralTypesPatterns.types b/tests/baselines/reference/templateLiteralTypesPatterns.types index d63799df57018..d3a6a36364618 100644 --- a/tests/baselines/reference/templateLiteralTypesPatterns.types +++ b/tests/baselines/reference/templateLiteralTypesPatterns.types @@ -638,20 +638,20 @@ export abstract class BB { // repro from https://github.com/microsoft/TypeScript/issues/54177#issuecomment-1538436654 function conversionTest(groupName: | "downcast" | "dataDowncast" | "editingDowncast" | `${string}Downcast` & {}) {} >conversionTest : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | `${string}Downcast` & {}) => void ->groupName : (`${string}Downcast` & {}) | "downcast" | "dataDowncast" | "editingDowncast" +>groupName : `${string}Downcast` & {} | "downcast" | "dataDowncast" | "editingDowncast" conversionTest("testDowncast"); >conversionTest("testDowncast") : void ->conversionTest : (groupName: (`${string}Downcast` & {}) | "downcast" | "dataDowncast" | "editingDowncast") => void +>conversionTest : (groupName: `${string}Downcast` & {} | "downcast" | "dataDowncast" | "editingDowncast") => void >"testDowncast" : "testDowncast" function conversionTest2(groupName: | "downcast" | "dataDowncast" | "editingDowncast" | {} & `${string}Downcast`) {} >conversionTest2 : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | {} & `${string}Downcast`) => void ->groupName : "downcast" | "dataDowncast" | "editingDowncast" | ({} & `${string}Downcast`) +>groupName : "downcast" | "dataDowncast" | "editingDowncast" | {} & `${string}Downcast` conversionTest2("testDowncast"); >conversionTest2("testDowncast") : void ->conversionTest2 : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | ({} & `${string}Downcast`)) => void +>conversionTest2 : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | {} & `${string}Downcast`) => void >"testDowncast" : "testDowncast" function conversionTest3(groupName: | "downcast" | "dataDowncast" | "editingDowncast" | `${string & {}}Downcast`) {} diff --git a/tests/baselines/reference/thisTypeInObjectLiterals2.types b/tests/baselines/reference/thisTypeInObjectLiterals2.types index 2ff93e76de1ea..7029957182789 100644 --- a/tests/baselines/reference/thisTypeInObjectLiterals2.types +++ b/tests/baselines/reference/thisTypeInObjectLiterals2.types @@ -406,7 +406,7 @@ type ObjectDescriptor = { >data : D | undefined methods?: M & ThisType; // Type of 'this' in methods is D & M ->methods : (M & ThisType) | undefined +>methods : M & ThisType | undefined } declare function makeObject(desc: ObjectDescriptor): D & M; diff --git a/tests/baselines/reference/typeGuardIntersectionTypes.types b/tests/baselines/reference/typeGuardIntersectionTypes.types index e4bf0989dc6e5..89704b0eaa16a 100644 --- a/tests/baselines/reference/typeGuardIntersectionTypes.types +++ b/tests/baselines/reference/typeGuardIntersectionTypes.types @@ -94,7 +94,7 @@ function isB(toTest: any): toTest is B { // a function that turns an A into an A & B function union(a: A): A & B | null { ->union : (a: A) => (A & B) | null +>union : (a: A) => A & B | null >a : A if (isB(a)) { diff --git a/tests/baselines/reference/typeGuardsWithInstanceOf.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOf.errors.txt index a799f0e8d810c..a818f6deb916a 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOf.errors.txt +++ b/tests/baselines/reference/typeGuardsWithInstanceOf.errors.txt @@ -1,8 +1,8 @@ typeGuardsWithInstanceOf.ts(7,20): error TS2339: Property 'global' does not exist on type 'never'. The intersection 'I & RegExp' was reduced to 'never' because property 'global' has conflicting types in some constituents. -typeGuardsWithInstanceOf.ts(36,11): error TS2339: Property 'onChanges' does not exist on type 'C | (Validator & Partial)'. +typeGuardsWithInstanceOf.ts(36,11): error TS2339: Property 'onChanges' does not exist on type 'C | Validator & Partial'. Property 'onChanges' does not exist on type 'C'. -typeGuardsWithInstanceOf.ts(37,11): error TS2339: Property 'onChanges' does not exist on type 'C | (Validator & Partial)'. +typeGuardsWithInstanceOf.ts(37,11): error TS2339: Property 'onChanges' does not exist on type 'C | Validator & Partial'. Property 'onChanges' does not exist on type 'C'. @@ -47,11 +47,11 @@ typeGuardsWithInstanceOf.ts(37,11): error TS2339: Property 'onChanges' does not // before 4.1. if (v.onChanges) { ~~~~~~~~~ -!!! error TS2339: Property 'onChanges' does not exist on type 'C | (Validator & Partial)'. +!!! error TS2339: Property 'onChanges' does not exist on type 'C | Validator & Partial'. !!! error TS2339: Property 'onChanges' does not exist on type 'C'. v.onChanges({}); ~~~~~~~~~ -!!! error TS2339: Property 'onChanges' does not exist on type 'C | (Validator & Partial)'. +!!! error TS2339: Property 'onChanges' does not exist on type 'C | Validator & Partial'. !!! error TS2339: Property 'onChanges' does not exist on type 'C'. } } diff --git a/tests/baselines/reference/typeGuardsWithInstanceOf.types b/tests/baselines/reference/typeGuardsWithInstanceOf.types index 3e59a13b20c25..90e7878b30050 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOf.types +++ b/tests/baselines/reference/typeGuardsWithInstanceOf.types @@ -68,7 +68,7 @@ function foo() { >v : C } v // Validator & Partial via subtype reduction ->v : C | (Validator & Partial) +>v : C | Validator & Partial // In 4.1, we introduced a change which _fixed_ a bug with CFA // correctly setting this to be the right object. With 4.2, @@ -76,13 +76,13 @@ function foo() { // before 4.1. if (v.onChanges) { >v.onChanges : any ->v : C | (Validator & Partial) +>v : C | Validator & Partial >onChanges : any v.onChanges({}); >v.onChanges({}) : any >v.onChanges : any ->v : C | (Validator & Partial) +>v : C | Validator & Partial >onChanges : any >{} : {} } diff --git a/tests/baselines/reference/uncalledFunctionChecksInConditional2.types b/tests/baselines/reference/uncalledFunctionChecksInConditional2.types index b1da3ccf7460b..cd22cd7690036 100644 --- a/tests/baselines/reference/uncalledFunctionChecksInConditional2.types +++ b/tests/baselines/reference/uncalledFunctionChecksInConditional2.types @@ -235,7 +235,7 @@ function isMobile() { typeof window !== 'undefined' && >typeof window !== 'undefined' && window.matchMedia && // no error window.matchMedia('(max-device-width: 680px)') : false | MediaQueryList ->typeof window !== 'undefined' && window.matchMedia : false | (((query: string) => MediaQueryList) & ((query: string) => MediaQueryList)) +>typeof window !== 'undefined' && window.matchMedia : false | ((query: string) => MediaQueryList) & ((query: string) => MediaQueryList) >typeof window !== 'undefined' : boolean >typeof window : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" >window : Window & typeof globalThis diff --git a/tests/baselines/reference/unionTypeInference.types b/tests/baselines/reference/unionTypeInference.types index 89bc8b57d0742..ed470c6e504b2 100644 --- a/tests/baselines/reference/unionTypeInference.types +++ b/tests/baselines/reference/unionTypeInference.types @@ -214,26 +214,26 @@ async function fun(deepPromised: DeepPromised) { >deepPromised : DeepPromised for (const value of Object.values(deepPromisedWithIndexer)) { ->value : {} | ({ [containsPromises]?: true | undefined; } & {}) | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined ->Object.values(deepPromisedWithIndexer) : ({} | ({ [containsPromises]?: true | undefined; } & {}) | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined)[] +>value : {} | { [containsPromises]?: true | undefined; } & {} | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined +>Object.values(deepPromisedWithIndexer) : ({} | { [containsPromises]?: true | undefined; } & {} | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined)[] >Object.values : { (o: { [s: string]: T_1; } | ArrayLike): T_1[]; (o: {}): any[]; } >Object : ObjectConstructor >values : { (o: { [s: string]: T_1; } | ArrayLike): T_1[]; (o: {}): any[]; } >deepPromisedWithIndexer : DeepPromised<{ [name: string]: {} | null | undefined; }> const awaitedValue = await value; ->awaitedValue : {} | ({ [containsPromises]?: true | undefined; } & {}) | null | undefined ->await value : {} | ({ [containsPromises]?: true | undefined; } & {}) | null | undefined ->value : {} | ({ [containsPromises]?: true | undefined; } & {}) | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined +>awaitedValue : {} | { [containsPromises]?: true | undefined; } & {} | null | undefined +>await value : {} | { [containsPromises]?: true | undefined; } & {} | null | undefined +>value : {} | { [containsPromises]?: true | undefined; } & {} | Promise<{ [containsPromises]?: true | undefined; } & {}> | null | undefined if (awaitedValue) ->awaitedValue : {} | ({ [containsPromises]?: true | undefined; } & {}) | null | undefined +>awaitedValue : {} | { [containsPromises]?: true | undefined; } & {} | null | undefined await fun(awaitedValue); >await fun(awaitedValue) : void >fun(awaitedValue) : Promise >fun : (deepPromised: DeepPromised) => Promise ->awaitedValue : {} | ({ [containsPromises]?: true | undefined; } & {}) +>awaitedValue : {} | { [containsPromises]?: true | undefined; } & {} } } diff --git a/tests/baselines/reference/unknownControlFlow.types b/tests/baselines/reference/unknownControlFlow.types index 7b320964b838a..d19a544cc86f2 100644 --- a/tests/baselines/reference/unknownControlFlow.types +++ b/tests/baselines/reference/unknownControlFlow.types @@ -344,14 +344,14 @@ function f23(x: T | undefined | null) { >undefined : undefined x; // T & {} | null ->x : (T & {}) | null +>x : T & {} | null } if (x !== null) { >x !== null : boolean >x : T | null | undefined x; // T & {} | undefined ->x : (T & {}) | undefined +>x : T & {} | undefined } if (x != undefined) { >x != undefined : boolean @@ -396,7 +396,7 @@ function f31(x: T) { >"object" : "object" x; // T & object | T & null ->x : (T & object) | (T & null) +>x : T & object | T & null } if (x && typeof x === "object") { >x && typeof x === "object" : boolean @@ -410,12 +410,12 @@ function f31(x: T) { >x : T & object } if (typeof x === "object" && x) { ->typeof x === "object" && x : false | (T & object) | (T & null) +>typeof x === "object" && x : false | T & object | T & null >typeof x === "object" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" >x : T >"object" : "object" ->x : (T & object) | (T & null) +>x : T & object | T & null x; // T & object >x : T & object @@ -557,16 +557,16 @@ function f41(a: T) { >a : T let a3 = ensureNotNull(ensureNotNull(a)); // T & {} | T & undefined ->a3 : (T & undefined) | (T & {}) ->ensureNotNull(ensureNotNull(a)) : (T & undefined) | (T & {}) +>a3 : T & undefined | T & {} +>ensureNotNull(ensureNotNull(a)) : T & undefined | T & {} >ensureNotNull : (x: T_1) => T_1 & ({} | undefined) >ensureNotNull(a) : T & ({} | undefined) >ensureNotNull : (x: T_1) => T_1 & ({} | undefined) >a : T let a4 = ensureNotUndefined(ensureNotUndefined(a)); // T & {} | T & null ->a4 : (T & {}) | (T & null) ->ensureNotUndefined(ensureNotUndefined(a)) : (T & {}) | (T & null) +>a4 : T & {} | T & null +>ensureNotUndefined(ensureNotUndefined(a)) : T & {} | T & null >ensureNotUndefined : (x: T_1) => T_1 & ({} | null) >ensureNotUndefined(a) : T & ({} | null) >ensureNotUndefined : (x: T_1) => T_1 & ({} | null) @@ -581,32 +581,32 @@ function f41(a: T) { >a : T let a6 = ensureNotNull(possiblyNullOrUndefined(a)); // T & {} | undefined ->a6 : (T & {}) | undefined ->ensureNotNull(possiblyNullOrUndefined(a)) : (T & {}) | undefined +>a6 : T & {} | undefined +>ensureNotNull(possiblyNullOrUndefined(a)) : T & {} | undefined >ensureNotNull : (x: T_1) => T_1 & ({} | undefined) >possiblyNullOrUndefined(a) : T | null | undefined >possiblyNullOrUndefined : (x: T_1) => T_1 | null | undefined >a : T let a7 = ensureNotUndefined(possiblyNullOrUndefined(a)); // T & {} | null ->a7 : (T & {}) | null ->ensureNotUndefined(possiblyNullOrUndefined(a)) : (T & {}) | null +>a7 : T & {} | null +>ensureNotUndefined(possiblyNullOrUndefined(a)) : T & {} | null >ensureNotUndefined : (x: T_1) => T_1 & ({} | null) >possiblyNullOrUndefined(a) : T | null | undefined >possiblyNullOrUndefined : (x: T_1) => T_1 | null | undefined >a : T let a8 = ensureNotNull(possiblyUndefined(a)); // T & {} | undefined ->a8 : (T & {}) | undefined ->ensureNotNull(possiblyUndefined(a)) : (T & {}) | undefined +>a8 : T & {} | undefined +>ensureNotNull(possiblyUndefined(a)) : T & {} | undefined >ensureNotNull : (x: T_1) => T_1 & ({} | undefined) >possiblyUndefined(a) : T | undefined >possiblyUndefined : (x: T_1) => T_1 | undefined >a : T let a9 = ensureNotUndefined(possiblyNull(a)); // T & {} | null ->a9 : (T & {}) | null ->ensureNotUndefined(possiblyNull(a)) : (T & {}) | null +>a9 : T & {} | null +>ensureNotUndefined(possiblyNull(a)) : T & {} | null >ensureNotUndefined : (x: T_1) => T_1 & ({} | null) >possiblyNull(a) : T | null >possiblyNull : (x: T_1) => T_1 | null @@ -633,9 +633,9 @@ function deepEquals(a: T, b: T): boolean { >b : T >'object' : "object" >!a : boolean ->a : (T & object) | (T & null) +>a : T & object | T & null >!b : boolean ->b : (T & object) | (T & null) +>b : T & object | T & null return false; >false : false diff --git a/tests/baselines/reference/voidUndefinedReduction.types b/tests/baselines/reference/voidUndefinedReduction.types index 30515344e11c3..24a0ebaed13a4 100644 --- a/tests/baselines/reference/voidUndefinedReduction.types +++ b/tests/baselines/reference/voidUndefinedReduction.types @@ -13,7 +13,7 @@ function isDefined(value: T | undefined | null | void): value is T { >value : void | T | null | undefined >undefined : undefined >value !== null : boolean ->value : (T & {}) | null +>value : T & {} | null } declare const foo: string | undefined; diff --git a/tests/cases/fourslash/codeFixAddVoidToPromise.4.ts b/tests/cases/fourslash/codeFixAddVoidToPromise.4.ts index b414cb4d1e730..2f2770b436cd1 100644 --- a/tests/cases/fourslash/codeFixAddVoidToPromise.4.ts +++ b/tests/cases/fourslash/codeFixAddVoidToPromise.4.ts @@ -10,5 +10,5 @@ verify.codeFix({ errorCode: 2794, description: "Add 'void' to Promise resolved without a value", index: 0, - newFileContent: `const p4 = new Promise<({ x: number } & { y: string }) | void>(resolve => resolve());` + newFileContent: `const p4 = new Promise<{ x: number } & { y: string } | void>(resolve => resolve());` }); diff --git a/tests/cases/fourslash/codeFixAddVoidToPromiseJS.4.ts b/tests/cases/fourslash/codeFixAddVoidToPromiseJS.4.ts index 7985d9febc885..b2ece7bdfa4ee 100644 --- a/tests/cases/fourslash/codeFixAddVoidToPromiseJS.4.ts +++ b/tests/cases/fourslash/codeFixAddVoidToPromiseJS.4.ts @@ -12,5 +12,5 @@ verify.codeFix({ errorCode: 2810, description: "Add 'void' to Promise resolved without a value", index: 2, - newFileContent: `const p4 = /** @type {Promise<({ x: number } & { y: string }) | void>} */(new Promise(resolve => resolve()));` + newFileContent: `const p4 = /** @type {Promise<{ x: number } & { y: string } | void>} */(new Promise(resolve => resolve()));` }); diff --git a/tests/cases/fourslash/codeFixAddVoidToPromiseJS_all.ts b/tests/cases/fourslash/codeFixAddVoidToPromiseJS_all.ts index 5c37cd851d9ae..55446cfbfdefd 100644 --- a/tests/cases/fourslash/codeFixAddVoidToPromiseJS_all.ts +++ b/tests/cases/fourslash/codeFixAddVoidToPromiseJS_all.ts @@ -17,5 +17,5 @@ verify.codeFixAll({ newFileContent: `const p1 = /** @type {Promise} */(new Promise(resolve => resolve())); const p2 = /** @type {Promise} */(new Promise(resolve => resolve())); const p3 = /** @type {Promise} */(new Promise(resolve => resolve())); -const p4 = /** @type {Promise<({ x: number } & { y: string }) | void>} */(new Promise(resolve => resolve()));` +const p4 = /** @type {Promise<{ x: number } & { y: string } | void>} */(new Promise(resolve => resolve()));` }); diff --git a/tests/cases/fourslash/codeFixAddVoidToPromise_all.ts b/tests/cases/fourslash/codeFixAddVoidToPromise_all.ts index 6f31d3388f211..b3da799ea8d07 100644 --- a/tests/cases/fourslash/codeFixAddVoidToPromise_all.ts +++ b/tests/cases/fourslash/codeFixAddVoidToPromise_all.ts @@ -15,5 +15,5 @@ verify.codeFixAll({ newFileContent: `const p1 = new Promise(resolve => resolve()); const p2 = new Promise(resolve => resolve()); const p3 = new Promise(resolve => resolve()); -const p4 = new Promise<({ x: number } & { y: string }) | void>(resolve => resolve());` +const p4 = new Promise<{ x: number } & { y: string } | void>(resolve => resolve());` });