diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index 3a67604847438..7b5895b52bfe0 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/arrayFind.types b/tests/baselines/reference/arrayFind.types index 1e7527ada5e15..97d87495beaa2 100644 --- a/tests/baselines/reference/arrayFind.types +++ b/tests/baselines/reference/arrayFind.types @@ -40,12 +40,12 @@ const foundNumber: number | undefined = arrayOfStringsNumbersAndBooleans.find(is > : ^^^^^^ >arrayOfStringsNumbersAndBooleans.find(isNumber) : number > : ^^^^^^ ->arrayOfStringsNumbersAndBooleans.find : { (predicate: (value: string | number | boolean, index: number, obj: (string | number | boolean)[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: string | number | boolean, index: number, obj: (string | number | boolean)[]) => unknown, thisArg?: any): (string | number | boolean) | undefined; } -> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ +>arrayOfStringsNumbersAndBooleans.find : { (predicate: (value: string | number | boolean, index: number, obj: (string | number | boolean)[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: string | number | boolean, index: number, obj: (string | number | boolean)[]) => unknown, thisArg?: any): string | number | boolean | undefined; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ >arrayOfStringsNumbersAndBooleans : (string | number | boolean)[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->find : { (predicate: (value: string | number | boolean, index: number, obj: (string | number | boolean)[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: string | number | boolean, index: number, obj: (string | number | boolean)[]) => unknown, thisArg?: any): (string | number | boolean) | undefined; } -> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ +>find : { (predicate: (value: string | number | boolean, index: number, obj: (string | number | boolean)[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: string | number | boolean, index: number, obj: (string | number | boolean)[]) => unknown, thisArg?: any): string | number | boolean | undefined; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ >isNumber : (x: any) => x is number > : ^ ^^ ^^^^^ @@ -62,12 +62,12 @@ const readonlyFoundNumber: number | undefined = readonlyArrayOfStringsNumbersAnd > : ^^^^^^ >readonlyArrayOfStringsNumbersAndBooleans.find(isNumber) : number > : ^^^^^^ ->readonlyArrayOfStringsNumbersAndBooleans.find : { (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => unknown, thisArg?: any): (string | number | boolean) | undefined; } -> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ +>readonlyArrayOfStringsNumbersAndBooleans.find : { (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => unknown, thisArg?: any): string | number | boolean | undefined; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ >readonlyArrayOfStringsNumbersAndBooleans : readonly (string | number | boolean)[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->find : { (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => unknown, thisArg?: any): (string | number | boolean) | undefined; } -> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ +>find : { (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => unknown, thisArg?: any): string | number | boolean | undefined; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ >isNumber : (x: any) => x is number > : ^ ^^ ^^^^^ diff --git a/tests/baselines/reference/controlFlowIfStatement.types b/tests/baselines/reference/controlFlowIfStatement.types index 823f3de5f6795..10e3bc89fece3 100644 --- a/tests/baselines/reference/controlFlowIfStatement.types +++ b/tests/baselines/reference/controlFlowIfStatement.types @@ -156,8 +156,8 @@ function c(data: string | T): T { > : ^^^^ >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 5395a0a05aa3a..06eda9059f4a9 100644 --- a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules1.types @@ -372,13 +372,13 @@ export { type UseQueryReturnType, useQuery }; export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; >UseQueryReturnType : any > : ^^^ ->useQuery : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType -> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ +>useQuery : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { 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; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType -> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ +>useQuery : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType +> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ const baseUrl = 'https://api.publicapis.org/' >baseUrl : "https://api.publicapis.org/" @@ -544,8 +544,8 @@ 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; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType -> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ +>useQuery : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { 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[]; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types index 0d04a08f5cf1b..871e3323728fd 100644 --- a/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types +++ b/tests/baselines/reference/declarationEmitUsingAlternativeContainingModules2.types @@ -378,15 +378,15 @@ export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; > : ^^^ >UseQueryReturnType : any > : ^^^ ->u : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b -> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ ->useQuery : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b -> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ +>u : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ +>useQuery : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { 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; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b -> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ +>useQuery : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b +> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ const baseUrl = 'https://api.publicapis.org/' >baseUrl : "https://api.publicapis.org/" @@ -552,8 +552,8 @@ 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; refetchInterval?: number; 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); } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b -> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ +>useQuery : (options: { enabled?: boolean; refetchInterval?: number; 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); } & { 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[]; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/discriminatedUnionTypes2.types b/tests/baselines/reference/discriminatedUnionTypes2.types index f67c4ae4daa10..352debd893fdd 100644 --- a/tests/baselines/reference/discriminatedUnionTypes2.types +++ b/tests/baselines/reference/discriminatedUnionTypes2.types @@ -590,8 +590,8 @@ 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" @@ -602,8 +602,8 @@ function foo2(x: RuntimeValue & ({ type: 'number' } | { type: 'string' })) { > : ^^^^^^^ >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 313700a47e74f..5d566d1fdda3d 100644 --- a/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.types +++ b/tests/baselines/reference/excessPropertyCheckIntersectionWithRecursiveType.types @@ -79,8 +79,8 @@ type Schema2 = (T extends boolean ? { type: 'boolean'; } & Example : { pro > : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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; }; }; }; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,8 +185,8 @@ type Schema4 = (T extends boolean ? { type: 'boolean'; } & Example : { pro > : ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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; }; }; }; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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/expressionWithJSDocTypeArguments.types b/tests/baselines/reference/expressionWithJSDocTypeArguments.types index 2dc32904f8162..af81275d395dd 100644 --- a/tests/baselines/reference/expressionWithJSDocTypeArguments.types +++ b/tests/baselines/reference/expressionWithJSDocTypeArguments.types @@ -70,8 +70,8 @@ type TNopeFoo = typeof foo; > : ^ ^^ ^^ ^^^^^ type TComeOnFoo = typeof foo; ->TComeOnFoo : typeof foo<(string | null) | null> -> : ^ ^^^^^ ^^^^ +>TComeOnFoo : typeof foo +> : ^^^^ ^^^^ >foo : (x: T) => T > : ^ ^^ ^^ ^^^^^ @@ -126,8 +126,8 @@ type TNopeBar = 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 c209a51388415..fbc25584ac22d 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: (0o10 | 10 | 0b10) | undefined; + let x: 0o10 | 10 | 0b10 | 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 70ee0b52e5cf8..1f2ee7ef80f50 100644 --- a/tests/baselines/reference/generatorYieldContextualType.types +++ b/tests/baselines/reference/generatorYieldContextualType.types @@ -102,12 +102,12 @@ namespace Directive { > : ^^^^^^^^ >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 21c427bfcf690..e7964115fec66 100644 --- a/tests/baselines/reference/inDoesNotOperateOnPrimitiveTypes.types +++ b/tests/baselines/reference/inDoesNotOperateOnPrimitiveTypes.types @@ -218,8 +218,8 @@ function union5(p: T | U) > : ^^^^^^^ >"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 88803f0ef3e1b..64a6618df016c 100644 --- a/tests/baselines/reference/inKeywordAndIntersection.types +++ b/tests/baselines/reference/inKeywordAndIntersection.types @@ -18,24 +18,24 @@ class B { b = 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 118e1c698a636..2c419e808ca6c 100644 --- a/tests/baselines/reference/inKeywordTypeguard(strict=true).types +++ b/tests/baselines/reference/inKeywordTypeguard(strict=true).types @@ -682,21 +682,21 @@ function negativeIntersectionTest() { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 +> : ^^ ^^ ^^ ^^ ^^^^^ ^^^^^^ ^^ ^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^ } } @@ -1612,8 +1612,8 @@ function foo(value: A) { > : ^^^^^^^^ >value !== null : boolean > : ^^^^^^^ ->value : (A & object) | (A & null) -> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>value : A & object | A & null +> : ^^^^^^^^^^^^^^^^^^^^^ >"prop" in value : boolean > : ^^^^^^^ >"prop" : "prop" diff --git a/tests/baselines/reference/inferenceDoesNotAddUndefinedOrNull.types b/tests/baselines/reference/inferenceDoesNotAddUndefinedOrNull.types index 4cca9aa7ffa65..a5c6061847a56 100644 --- a/tests/baselines/reference/inferenceDoesNotAddUndefinedOrNull.types +++ b/tests/baselines/reference/inferenceDoesNotAddUndefinedOrNull.types @@ -92,8 +92,8 @@ function flatMapChildren(node: Node, cb: (child: Node) => readonly T[] | T | > : ^^^^^^^^^^^^ >toArray : { (value: T_1 | T_1[]): T_1[]; (value: T_1 | readonly T_1[]): readonly T_1[]; } > : ^^^^^^^^ ^^ ^^^ ^^^^^^^^ ^^ ^^^ ^^^ ->value : readonly T[] | (T & ({} | null)) -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>value : readonly T[] | T & ({} | null) +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } }); return result; @@ -162,8 +162,8 @@ function flatMapChildren2(node: Node, cb: (child: Node) => readonly T[] | T | > : ^^^^^^^^^^^^ >toArray : { (value: T_1 | T_1[]): T_1[]; (value: T_1 | readonly T_1[]): readonly T_1[]; } > : ^^^^^^^^ ^^ ^^^ ^^^^^^^^ ^^ ^^^ ^^^ ->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 a783ee1e541b5..d979182646582 100644 --- a/tests/baselines/reference/inferenceOfNullableObjectTypesWithCommonBase.types +++ b/tests/baselines/reference/inferenceOfNullableObjectTypesWithCommonBase.types @@ -236,8 +236,8 @@ equal(v as string, v as string & { tag: 'foo' } | undefined); > : ^^^^^^ >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" @@ -248,8 +248,8 @@ equal(v as string & { tag: 'foo' } | undefined, v as string); > : ^^^^ >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" 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 e848f9c6be90c..89d8961027163 100644 --- a/tests/baselines/reference/intersectionAndUnionTypes.types +++ b/tests/baselines/reference/intersectionAndUnionTypes.types @@ -50,8 +50,8 @@ var 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) @@ -92,66 +92,66 @@ 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/intersectionNarrowing.types b/tests/baselines/reference/intersectionNarrowing.types index 69f17ad48e2af..dc9fa0e3efc2c 100644 --- a/tests/baselines/reference/intersectionNarrowing.types +++ b/tests/baselines/reference/intersectionNarrowing.types @@ -4,14 +4,14 @@ // 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 @@ -20,16 +20,16 @@ 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 > : ^^^^^^^^^ @@ -45,18 +45,18 @@ 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" > : ^^^^^^^^ @@ -72,14 +72,14 @@ 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 fdbbccefe153b..ccda95a36e815 100644 --- a/tests/baselines/reference/intersectionOfUnionNarrowing.types +++ b/tests/baselines/reference/intersectionOfUnionNarrowing.types @@ -33,12 +33,12 @@ 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 > : ^^^^^^^^^ diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.types b/tests/baselines/reference/intersectionWithUnionConstraint.types index 43435329a10f4..df3076bdba192 100644 --- a/tests/baselines/reference/intersectionWithUnionConstraint.types +++ b/tests/baselines/reference/intersectionWithUnionConstraint.types @@ -65,8 +65,8 @@ 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/jsdocParseBackquotedParamName.types b/tests/baselines/reference/jsdocParseBackquotedParamName.types index 815b8e258d863..39062a9dbe2b3 100644 --- a/tests/baselines/reference/jsdocParseBackquotedParamName.types +++ b/tests/baselines/reference/jsdocParseBackquotedParamName.types @@ -6,8 +6,8 @@ * @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 91c857fd4c52c..ebe959c4f67aa 100644 --- a/tests/baselines/reference/jsdocPostfixEqualsAddsOptionality.types +++ b/tests/baselines/reference/jsdocPostfixEqualsAddsOptionality.types @@ -60,8 +60,8 @@ 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 > : ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -90,28 +90,28 @@ function g(a) { g() >g() : void > : ^^^^ ->g : (a?: (((((number | null) | null) | null) | null) | null) | undefined) => void -> : ^ ^^^^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^ +>g : (a?: number | null | null | null | null | null | undefined) => void +> : ^ ^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^ g(null) >g(null) : void > : ^^^^ ->g : (a?: (((((number | null) | null) | null) | null) | null) | undefined) => void -> : ^ ^^^^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^ +>g : (a?: number | null | null | null | null | null | undefined) => void +> : ^ ^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^ g(undefined) >g(undefined) : void > : ^^^^ ->g : (a?: (((((number | null) | null) | null) | null) | null) | undefined) => void -> : ^ ^^^^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^ +>g : (a?: number | null | null | null | null | null | undefined) => void +> : ^ ^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^ >undefined : undefined > : ^^^^^^^^^ g(1) >g(1) : void > : ^^^^ ->g : (a?: (((((number | null) | null) | null) | null) | null) | undefined) => void -> : ^ ^^^^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^ +>g : (a?: number | null | null | null | null | null | undefined) => void +> : ^ ^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^ >1 : 1 > : ^ diff --git a/tests/baselines/reference/jsxFragmentFactoryNoUnusedLocals.types b/tests/baselines/reference/jsxFragmentFactoryNoUnusedLocals.types index 3953193d3d6d8..6735af081a429 100644 --- a/tests/baselines/reference/jsxFragmentFactoryNoUnusedLocals.types +++ b/tests/baselines/reference/jsxFragmentFactoryNoUnusedLocals.types @@ -11,8 +11,8 @@ Symbol count: 50,000 import { Fragment, createElement } from "react" >Fragment : import("react").ComponentType<{}> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->createElement : { (type: "input", props?: (import("react").InputHTMLAttributes & import("react").ClassAttributes) | null, ...children: import("react").ReactNode[]): import("react").DetailedReactHTMLElement, HTMLInputElement>;

, T extends HTMLElement>(type: keyof import("react").ReactHTML, props?: (import("react").ClassAttributes & P) | null, ...children: import("react").ReactNode[]): import("react").DetailedReactHTMLElement;

, T extends SVGElement>(type: keyof import("react").ReactSVG, props?: (import("react").ClassAttributes & P) | null, ...children: import("react").ReactNode[]): import("react").ReactSVGElement;

, T extends Element>(type: string, props?: (import("react").ClassAttributes & P) | null, ...children: import("react").ReactNode[]): import("react").DOMElement;

(type: import("react").SFC

, props?: (import("react").Attributes & P) | null, ...children: import("react").ReactNode[]): import("react").SFCElement

;

(type: import("react").ClassType, import("react").ClassicComponentClass

>, props?: (import("react").ClassAttributes> & P) | null, ...children: import("react").ReactNode[]): import("react").CElement>; , C extends import("react").ComponentClass

>(type: import("react").ClassType, props?: (import("react").ClassAttributes & P) | null, ...children: import("react").ReactNode[]): import("react").CElement;

(type: import("react").SFC

| import("react").ComponentClass

| string, props?: (import("react").Attributes & P) | null, ...children: import("react").ReactNode[]): import("react").ReactElement

; } -> : ^^^ ^^ ^^ ^^^^ ^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^^ ^ ^^^^^ ^^ ^^^^^^^ ^^^^^^^^^ ^^^ ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^ ^^ ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^ ^^^^^^^^^ ^^ ^^^^ ^^^^^^^ ^^^^^^^^^^^^^^^ ^ ^^^^^ ^^ ^^^^^^^ ^^^^^^^^^ ^^^ ^^^^^^^ ^^^^^^^^ ^^^ ^^ ^^ ^^^^^^^ ^^^ ^^^^^^^ ^^^^^^^^^^^^^^ ^^ ^^^^ ^^^^^^^ ^^^^^^^^^^ ^ ^^^^^ ^^ ^^^^^^^ ^^^^^^^^^ ^^^ ^^^^^^^ ^^^^^^^^^^^^ ^^^ +>createElement : { (type: "input", props?: import("react").InputHTMLAttributes & import("react").ClassAttributes | null, ...children: import("react").ReactNode[]): import("react").DetailedReactHTMLElement, HTMLInputElement>;

, T extends HTMLElement>(type: keyof import("react").ReactHTML, props?: import("react").ClassAttributes & P | null, ...children: import("react").ReactNode[]): import("react").DetailedReactHTMLElement;

, T extends SVGElement>(type: keyof import("react").ReactSVG, props?: import("react").ClassAttributes & P | null, ...children: import("react").ReactNode[]): import("react").ReactSVGElement;

, T extends Element>(type: string, props?: import("react").ClassAttributes & P | null, ...children: import("react").ReactNode[]): import("react").DOMElement;

(type: import("react").SFC

, props?: import("react").Attributes & P | null, ...children: import("react").ReactNode[]): import("react").SFCElement

;

(type: import("react").ClassType, import("react").ClassicComponentClass

>, props?: import("react").ClassAttributes> & P | null, ...children: import("react").ReactNode[]): import("react").CElement>; , C extends import("react").ComponentClass

>(type: import("react").ClassType, props?: import("react").ClassAttributes & P | null, ...children: import("react").ReactNode[]): import("react").CElement;

(type: import("react").SFC

| import("react").ComponentClass

| string, props?: import("react").Attributes & P | null, ...children: import("react").ReactNode[]): import("react").ReactElement

; } +> : ^^^ ^^ ^^ ^^^ ^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^ ^^ ^^^^^^^ ^^^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 ^^ ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^ ^^ ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^ ^^^^^^^^^ ^^ ^^^ ^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^ ^^ ^^^^^^^ ^^^^^^^^^ ^^^ ^^^^^^^ ^^^^^^^^ ^^^ ^^ ^^ ^^^^^^^ ^^^ ^^^^^^^ ^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^ ^^^^^^^^^^ ^^^^^ ^^ ^^^^^^^ ^^^^^^^^^ ^^^ ^^^^^^^ ^^^^^^^^^^^^ ^^^ type CounterProps = { >CounterProps : CounterProps diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.types b/tests/baselines/reference/keyofAndIndexedAccess2.types index b6b09c85171eb..e2fbfc20e8934 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.types +++ b/tests/baselines/reference/keyofAndIndexedAccess2.types @@ -907,8 +907,8 @@ 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" diff --git a/tests/baselines/reference/literalFreshnessPropagationOnNarrowing.types b/tests/baselines/reference/literalFreshnessPropagationOnNarrowing.types index a2a7572599f0f..6637a0d649b6d 100644 --- a/tests/baselines/reference/literalFreshnessPropagationOnNarrowing.types +++ b/tests/baselines/reference/literalFreshnessPropagationOnNarrowing.types @@ -47,8 +47,8 @@ function f2() { > : ^^^^^ type ElementOrArray = Element | Element[]; ->ElementOrArray : (string | false) | (string | false)[] -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>ElementOrArray : string | false | (string | false)[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ let el: Element = null as any; >el : string | false @@ -63,35 +63,35 @@ function f2() { > : ^^^ 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 @@ -102,8 +102,8 @@ function f2() { > : ^^^^^^^^^^^^^^^^ >isArray : (arg: any) => arg is any[] > : ^ ^^ ^^^^^ ->elOrA : (string | false) | (string | false)[] -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>elOrA : string | false | (string | false)[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >elOrA : (string | false)[] > : ^^^^^^^^^^^^^^^^^^ >[elOrA] : (string | false)[] @@ -115,8 +115,8 @@ 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 @@ -131,8 +131,8 @@ function f2() { > : ^^^^^^^^^^^^^^^^ >isArray : (arg: any) => arg is any[] > : ^ ^^ ^^^^^ ->elOrA : (string | false) | (string | false)[] -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>elOrA : string | false | (string | false)[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >elOrA : (string | false)[] > : ^^^^^^^^^^^^^^^^^^ >[elOrA] : (string | false)[] diff --git a/tests/baselines/reference/mappedTypes4.types b/tests/baselines/reference/mappedTypes4.types index 79c32add1b52a..49697e298f162 100644 --- a/tests/baselines/reference/mappedTypes4.types +++ b/tests/baselines/reference/mappedTypes4.types @@ -41,8 +41,8 @@ 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 ef91b62d22aa9..17aa28b9e39a7 100644 --- a/tests/baselines/reference/narrowingByTypeofInSwitch.types +++ b/tests/baselines/reference/narrowingByTypeofInSwitch.types @@ -878,10 +878,10 @@ 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 +> : ^^^^^^^^^^^^^^^^^^^^^^^ } } @@ -1729,10 +1729,10 @@ 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 963f10069c4c1..125fa04f9fedf 100644 --- a/tests/baselines/reference/narrowingTypeofFunction.types +++ b/tests/baselines/reference/narrowingTypeofFunction.types @@ -12,16 +12,16 @@ 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" > : ^^^^^^^^^^ @@ -37,18 +37,18 @@ 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" > : ^^^^^^^^^^ diff --git a/tests/baselines/reference/narrowingUnionToUnion.types b/tests/baselines/reference/narrowingUnionToUnion.types index f090c9357be17..b48dbb47b676f 100644 --- a/tests/baselines/reference/narrowingUnionToUnion.types +++ b/tests/baselines/reference/narrowingUnionToUnion.types @@ -48,8 +48,8 @@ function fx2(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 +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } } @@ -68,8 +68,8 @@ function fx3(x: T) { > : ^^^^^^^^^^^^^^^ 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 2abdb59f34782..23bc1d5f19cf0 100644 --- a/tests/baselines/reference/nonPrimitiveAndEmptyObject.types +++ b/tests/baselines/reference/nonPrimitiveAndEmptyObject.types @@ -11,8 +11,8 @@ 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 c47665c97faf3..ca2caf60e1991 100644 --- a/tests/baselines/reference/objectLiteralExcessProperties.types +++ b/tests/baselines/reference/objectLiteralExcessProperties.types @@ -218,8 +218,8 @@ 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 diff --git a/tests/baselines/reference/objectSpread.types b/tests/baselines/reference/objectSpread.types index 92ca81fce93ad..af2a8b7cbaa7a 100644 --- a/tests/baselines/reference/objectSpread.types +++ b/tests/baselines/reference/objectSpread.types @@ -1123,10 +1123,10 @@ function genericSpread(t: T, u: U, v: T | U, w: T | { s: string }, obj: { > : ^^^^^ 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; } @@ -1141,40 +1141,40 @@ function genericSpread(t: T, u: U, v: T | U, w: T | { s: string }, obj: { > : ^^^^^^^^^ ^^^ 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; } @@ -1183,10 +1183,10 @@ function genericSpread(t: T, u: U, v: T | U, w: T | { s: string }, obj: { > : ^^^^^ ^^^ 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 diff --git a/tests/baselines/reference/parenthesizedJSDocCastAtReturnStatement.types b/tests/baselines/reference/parenthesizedJSDocCastAtReturnStatement.types index c4836b5981740..bf9864d175fae 100644 --- a/tests/baselines/reference/parenthesizedJSDocCastAtReturnStatement.types +++ b/tests/baselines/reference/parenthesizedJSDocCastAtReturnStatement.types @@ -31,12 +31,12 @@ const getStringGetter = (key) => { > : ^^^^^^ >cache.get(key) : string | Set | undefined > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->cache.get : (key: string) => (string | Set) | undefined -> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>cache.get : (key: string) => string | Set | undefined +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >cache : Map> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->get : (key: string) => (string | Set) | undefined -> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>get : (key: string) => string | Set | undefined +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >key : string > : ^^^^^^ } diff --git a/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types b/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types index 28eed6b23ceaa..74b8b9d8199e7 100644 --- a/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types +++ b/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types @@ -334,8 +334,8 @@ 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) & ((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^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^^^^^^^^ >obj : Partial > : ^^^^^^^^^^^^^^ >k : keyof MyAPI @@ -365,8 +365,8 @@ 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 -> : ^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^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((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 diff --git a/tests/baselines/reference/primitiveUnionDetection.types b/tests/baselines/reference/primitiveUnionDetection.types index 7619f8e94f5ce..4faf698bfbefa 100644 --- a/tests/baselines/reference/primitiveUnionDetection.types +++ b/tests/baselines/reference/primitiveUnionDetection.types @@ -10,8 +10,8 @@ type Kind = "one" | "two" | "three"; declare function getInterfaceFromString(options?: { type?: T } & { type?: Kind }): T; >getInterfaceFromString : (options?: { type?: T; } & { type?: Kind; }) => T > : ^ ^^^^^^^^^ ^^ ^^^ ^^^^^ ->options : ({ type?: T; } & { type?: Kind; }) | undefined -> : ^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ +>options : { type?: T; } & { type?: Kind; } | undefined +> : ^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ >type : T | undefined > : ^^^^^^^^^^^^^ >type : Kind | undefined diff --git a/tests/baselines/reference/restParameterWithBindingPattern3.types b/tests/baselines/reference/restParameterWithBindingPattern3.types index 4f8e4184fd7c5..f37b67a631200 100644 --- a/tests/baselines/reference/restParameterWithBindingPattern3.types +++ b/tests/baselines/reference/restParameterWithBindingPattern3.types @@ -56,6 +56,6 @@ function e(...{0: a = 1, 1: b = true, ...rest: rest}: [boolean, string, number]) > : ^^^^ >rest : any > : ^^^ ->rest : { [n: number]: string | number | boolean; 0: boolean; 1: string; 2: number; length: 3; toString(): string; toLocaleString(): string; pop(): (string | number | boolean) | undefined; push(...items: (string | number | boolean)[]): number; concat(...items: ConcatArray[]): (string | number | boolean)[]; concat(...items: (string | number | boolean | ConcatArray)[]): (string | number | boolean)[]; join(separator?: string): string; reverse(): (string | number | boolean)[]; shift(): (string | number | boolean) | undefined; slice(start?: number, end?: number): (string | number | boolean)[]; sort(compareFn?: (a: string | number | boolean, b: string | number | boolean) => number): [boolean, string, number]; splice(start: number, deleteCount?: number): (string | number | boolean)[]; splice(start: number, deleteCount: number, ...items: (string | number | boolean)[]): (string | number | boolean)[]; unshift(...items: (string | number | boolean)[]): number; indexOf(searchElement: string | number | boolean, fromIndex?: number): number; lastIndexOf(searchElement: string | number | boolean, fromIndex?: number): number; every(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): boolean; some(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => void, thisArg?: any): void; map(callbackfn: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => U, thisArg?: any): U[]; filter(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): (string | number | boolean)[]; reduce(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean): string | number | boolean; reduce(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean, initialValue: string | number | boolean): string | number | boolean; reduce(callbackfn: (previousValue: U, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean): string | number | boolean; reduceRight(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean, initialValue: string | number | boolean): string | number | boolean; reduceRight(callbackfn: (previousValue: U, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => U, initialValue: U): U; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^ 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^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ +>rest : { [n: number]: string | number | boolean; 0: boolean; 1: string; 2: number; length: 3; toString(): string; toLocaleString(): string; pop(): string | number | boolean | undefined; push(...items: (string | number | boolean)[]): number; concat(...items: ConcatArray[]): (string | number | boolean)[]; concat(...items: (string | number | boolean | ConcatArray)[]): (string | number | boolean)[]; join(separator?: string): string; reverse(): (string | number | boolean)[]; shift(): string | number | boolean | undefined; slice(start?: number, end?: number): (string | number | boolean)[]; sort(compareFn?: (a: string | number | boolean, b: string | number | boolean) => number): [boolean, string, number]; splice(start: number, deleteCount?: number): (string | number | boolean)[]; splice(start: number, deleteCount: number, ...items: (string | number | boolean)[]): (string | number | boolean)[]; unshift(...items: (string | number | boolean)[]): number; indexOf(searchElement: string | number | boolean, fromIndex?: number): number; lastIndexOf(searchElement: string | number | boolean, fromIndex?: number): number; every(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): boolean; some(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => void, thisArg?: any): void; map(callbackfn: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => U, thisArg?: any): U[]; filter(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): (string | number | boolean)[]; reduce(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean): string | number | boolean; reduce(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean, initialValue: string | number | boolean): string | number | boolean; reduce(callbackfn: (previousValue: U, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean): string | number | boolean; reduceRight(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean, initialValue: string | number | boolean): string | number | boolean; reduceRight(callbackfn: (previousValue: U, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => U, initialValue: U): U; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ 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 a33ded1d33fb3..b162479bdec7d 100644 --- a/tests/baselines/reference/spreadObjectOrFalsy.types +++ b/tests/baselines/reference/spreadObjectOrFalsy.types @@ -15,16 +15,16 @@ 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 aa664dda40406..4f48b8aa94aa3 100644 --- a/tests/baselines/reference/templateLiteralTypes2.types +++ b/tests/baselines/reference/templateLiteralTypes2.types @@ -633,8 +633,8 @@ 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 > : ^^ diff --git a/tests/baselines/reference/templateLiteralTypes3.types b/tests/baselines/reference/templateLiteralTypes3.types index 655a8cee04933..e38c2996bd96b 100644 --- a/tests/baselines/reference/templateLiteralTypes3.types +++ b/tests/baselines/reference/templateLiteralTypes3.types @@ -936,22 +936,22 @@ function a() { > : ^^^^^^ 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 bc7161335d14a..aae6302157188 100644 --- a/tests/baselines/reference/templateLiteralTypesPatterns.types +++ b/tests/baselines/reference/templateLiteralTypesPatterns.types @@ -973,30 +973,30 @@ 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" -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>conversionTest : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | `${string}Downcast` & {}) => void +> : ^ ^^ ^^^^^^^^^ +>groupName : `${string}Downcast` & {} | "downcast" | "dataDowncast" | "editingDowncast" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conversionTest("testDowncast"); >conversionTest("testDowncast") : void > : ^^^^ ->conversionTest : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | (`${string}Downcast` & {})) => void -> : ^ ^^ ^ ^^^^^^^^^^ +>conversionTest : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | `${string}Downcast` & {}) => 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`) -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>conversionTest2 : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | {} & `${string}Downcast`) => void +> : ^ ^^ ^^^^^^^^^ +>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" > : ^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/thisTypeInObjectLiterals2.types b/tests/baselines/reference/thisTypeInObjectLiterals2.types index 05cb646d4eea8..48c1ac22e26d2 100644 --- a/tests/baselines/reference/thisTypeInObjectLiterals2.types +++ b/tests/baselines/reference/thisTypeInObjectLiterals2.types @@ -634,8 +634,8 @@ type ObjectDescriptor = { > : ^^^^^^^^^^^^^ 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/transpile/declarationFunctionDeclarations.d.ts b/tests/baselines/reference/transpile/declarationFunctionDeclarations.d.ts index 0b63bb9527eb0..14e45830c7caf 100644 --- a/tests/baselines/reference/transpile/declarationFunctionDeclarations.d.ts +++ b/tests/baselines/reference/transpile/declarationFunctionDeclarations.d.ts @@ -47,7 +47,7 @@ export class InClassMethodBad { o(array: T = [], rParam: string): void { } }; //// [fnDecl.d.ts] //// type T = number[]; -export declare function fnDeclBasic1(p: (number[] | string[] | [T]) | undefined, rParam: string): void; +export declare function fnDeclBasic1(p: number[] | string[] | [T] | undefined, rParam: string): void; export declare function fnDeclBasic2(p: ((n: T) => T) | undefined, rParam: string): void; export declare function fnDeclBasic3(p: (new () => any) | undefined, rParam: string): void; export declare function fnDeclBasic4(p: [T] | undefined, rParam: string): void; @@ -55,10 +55,10 @@ export declare function fnDeclBasic5(p: { a: T; } | undefined, rParam: string): void; export declare function fnDeclBasic6(p: `_${string}` | undefined, rParam: string): void; -export declare function fnDeclBasic7(p: ({ +export declare function fnDeclBasic7(p: { a?: string; -} & number[]) | undefined, rParam: string): void; -export declare function fnDeclBasic8(p: ((number[] | string[]) | number) | undefined, rParam: string): void; +} & number[] | undefined, rParam: string): void; +export declare function fnDeclBasic8(p: (number[] | string[]) | number | undefined, rParam: string): void; export declare function fnDeclHasUndefined(p: T | undefined, rParam: string): void; export declare function fnDeclBad(p: T | undefined, rParam: string): void; export declare const fnExprOk1: (array: number[] | undefined, rParam: string) => void; diff --git a/tests/baselines/reference/typeGuardIntersectionTypes.types b/tests/baselines/reference/typeGuardIntersectionTypes.types index 5754943f054f6..245bef3badf92 100644 --- a/tests/baselines/reference/typeGuardIntersectionTypes.types +++ b/tests/baselines/reference/typeGuardIntersectionTypes.types @@ -131,8 +131,8 @@ 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 > : ^ 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 6b263c9f774aa..5a2019ac717b0 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOf.types +++ b/tests/baselines/reference/typeGuardsWithInstanceOf.types @@ -96,8 +96,8 @@ function foo() { > : ^ } 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, @@ -106,8 +106,8 @@ function foo() { if (v.onChanges) { >v.onChanges : any > : ^^^ ->v : C | (Validator & Partial) -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>v : C | Validator & Partial +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >onChanges : any > : ^^^ @@ -116,8 +116,8 @@ function foo() { > : ^^^ >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 9895a5d755d82..2bb3f4eb8fd52 100644 --- a/tests/baselines/reference/uncalledFunctionChecksInConditional2.types +++ b/tests/baselines/reference/uncalledFunctionChecksInConditional2.types @@ -368,8 +368,8 @@ 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" diff --git a/tests/baselines/reference/unionTypeInference.types b/tests/baselines/reference/unionTypeInference.types index b6a3d7f113f2e..f5ab95974ee14 100644 --- a/tests/baselines/reference/unionTypeInference.types +++ b/tests/baselines/reference/unionTypeInference.types @@ -342,10 +342,10 @@ async function fun(deepPromised: DeepPromised) { > : ^^^^^^^^^^^^^^^ for (const value of Object.values(deepPromisedWithIndexer)) { ->value : {} | ({ [containsPromises]?: true; } & {}) | Promise<{ [containsPromises]?: true; } & {}> | null | undefined -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Object.values(deepPromisedWithIndexer) : ({} | ({ [containsPromises]?: true; } & {}) | Promise<{ [containsPromises]?: true; } & {}> | null | undefined)[] -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>value : {} | { [containsPromises]?: true; } & {} | Promise<{ [containsPromises]?: true; } & {}> | null | undefined +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Object.values(deepPromisedWithIndexer) : ({} | { [containsPromises]?: true; } & {} | Promise<{ [containsPromises]?: true; } & {}> | null | undefined)[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Object.values : { (o: { [s: string]: T_1; } | ArrayLike): T_1[]; (o: {}): any[]; } > : ^^^^^^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >Object : ObjectConstructor @@ -356,16 +356,16 @@ async function fun(deepPromised: DeepPromised) { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ const awaitedValue = await value; ->awaitedValue : {} | ({ [containsPromises]?: true; } & {}) | null | undefined -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->await value : {} | ({ [containsPromises]?: true; } & {}) | null | undefined -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->value : {} | ({ [containsPromises]?: true; } & {}) | Promise<{ [containsPromises]?: true; } & {}> | null | undefined -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>awaitedValue : {} | { [containsPromises]?: true; } & {} | null | undefined +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await value : {} | { [containsPromises]?: true; } & {} | null | undefined +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>value : {} | { [containsPromises]?: true; } & {} | Promise<{ [containsPromises]?: true; } & {}> | null | undefined +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ if (awaitedValue) ->awaitedValue : {} | ({ [containsPromises]?: true; } & {}) | null | undefined -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>awaitedValue : {} | { [containsPromises]?: true; } & {} | null | undefined +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ await fun(awaitedValue); >await fun(awaitedValue) : void @@ -374,8 +374,8 @@ async function fun(deepPromised: DeepPromised) { > : ^^^^^^^^^^^^^ >fun : (deepPromised: DeepPromised) => Promise > : ^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ->awaitedValue : {} | ({ [containsPromises]?: true; } & {}) -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ +>awaitedValue : {} | { [containsPromises]?: true; } & {} +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ } } diff --git a/tests/baselines/reference/unknownControlFlow.types b/tests/baselines/reference/unknownControlFlow.types index 2c84aa0d19d3e..fcb4e2f51d102 100644 --- a/tests/baselines/reference/unknownControlFlow.types +++ b/tests/baselines/reference/unknownControlFlow.types @@ -481,8 +481,8 @@ function f23(x: T | undefined | null) { > : ^^^^^^^^^ x; // T & {} | null ->x : (T & {}) | null -> : ^^^^^^^^^^^^^^^ +>x : T & {} | null +> : ^^^^^^^^^^^^^ } if (x !== null) { >x !== null : boolean @@ -491,8 +491,8 @@ function f23(x: T | undefined | null) { > : ^^^^^^^^^^^^^^^^^^^^ x; // T & {} | undefined ->x : (T & {}) | undefined -> : ^^^^^^^^^^^^^^^^^^^^ +>x : T & {} | undefined +> : ^^^^^^^^^^^^^^^^^^ } if (x != undefined) { >x != undefined : boolean @@ -557,8 +557,8 @@ function f31(x: T) { > : ^^^^^^^^ 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 @@ -579,8 +579,8 @@ function f31(x: T) { > : ^^^^^^^^^^ } 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" @@ -589,8 +589,8 @@ function f31(x: T) { > : ^ >"object" : "object" > : ^^^^^^^^ ->x : (T & object) | (T & null) -> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>x : T & object | T & null +> : ^^^^^^^^^^^^^^^^^^^^^ x; // T & object >x : T & object @@ -810,10 +810,10 @@ function f41(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) @@ -824,10 +824,10 @@ function f41(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) @@ -852,10 +852,10 @@ function f41(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 @@ -866,10 +866,10 @@ function f41(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 @@ -880,10 +880,10 @@ function f41(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 @@ -894,10 +894,10 @@ function f41(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 @@ -943,12 +943,12 @@ function deepEquals(a: T, b: T): boolean { > : ^^^^^^^^ >!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 b1f9ed6009be1..7d93f8c66292e 100644 --- a/tests/baselines/reference/voidUndefinedReduction.types +++ b/tests/baselines/reference/voidUndefinedReduction.types @@ -20,8 +20,8 @@ function isDefined(value: T | undefined | null | void): value is T { > : ^^^^^^^^^ >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());` });