From 5741df41c14887880ccc8d2a81d4556e8560c0e1 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 18 Nov 2023 17:02:00 -0800 Subject: [PATCH] Accept new baselines --- .../reference/templateLiteralIntersection.types | 10 +++++----- .../reference/templateLiteralIntersection2.errors.txt | 5 +---- .../reference/templateLiteralIntersection2.types | 10 +++++----- .../reference/templateLiteralIntersection3.types | 6 +++--- .../reference/templateLiteralTypesPatterns.types | 8 ++++---- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/tests/baselines/reference/templateLiteralIntersection.types b/tests/baselines/reference/templateLiteralIntersection.types index 8f78e9df181..0ac35ea7070 100644 --- a/tests/baselines/reference/templateLiteralIntersection.types +++ b/tests/baselines/reference/templateLiteralIntersection.types @@ -18,7 +18,7 @@ type OriginA1 = `${A}` >OriginA1 : "a" type OriginA2 = `${MixA}` ->OriginA2 : `${MixA}` +>OriginA2 : "a" type B = `${typeof a}` >B : "a" @@ -32,23 +32,23 @@ type OriginB1 = `${B}` >OriginB1 : "a" type OriginB2 = `${MixB}` ->OriginB2 : `${MixB}` +>OriginB2 : "a" type MixC = { foo: string } & A >MixC : { foo: string; } & "a" >foo : string type OriginC = `${MixC}` ->OriginC : `${MixC}` +>OriginC : "a" type MixD = ->MixD : `${T & { foo: string; }}` +>MixD : `${T}` `${T & { foo: string }}` >foo : string type OriginD = `${MixD & { foo: string }}`; ->OriginD : `${`${"a" & { foo: string; } & { foo: string; }}` & { foo: string; }}` +>OriginD : "a" >foo : string >foo : string diff --git a/tests/baselines/reference/templateLiteralIntersection2.errors.txt b/tests/baselines/reference/templateLiteralIntersection2.errors.txt index 95dfa114177..3e656200726 100644 --- a/tests/baselines/reference/templateLiteralIntersection2.errors.txt +++ b/tests/baselines/reference/templateLiteralIntersection2.errors.txt @@ -1,11 +1,10 @@ -templateLiteralIntersection2.ts(7,12): error TS2345: Argument of type '"foo/bar"' is not assignable to parameter of type '`${Path}/${Path}`'. templateLiteralIntersection2.ts(20,10): error TS2345: Argument of type '""' is not assignable to parameter of type '`a${string}` & `${string}a`'. Type '""' is not assignable to type '`a${string}`'. templateLiteralIntersection2.ts(22,10): error TS2345: Argument of type '"ab"' is not assignable to parameter of type '`a${string}` & `${string}a`'. Type '"ab"' is not assignable to type '`${string}a`'. -==== templateLiteralIntersection2.ts (3 errors) ==== +==== templateLiteralIntersection2.ts (2 errors) ==== type Path = string & { _pathBrand: any }; type JoinedPath = `${Path}/${Path}`; @@ -13,8 +12,6 @@ templateLiteralIntersection2.ts(22,10): error TS2345: Argument of type '"ab"' is declare function joinedPath(p: JoinedPath): void; joinedPath("foo/bar"); - ~~~~~~~~~ -!!! error TS2345: Argument of type '"foo/bar"' is not assignable to parameter of type '`${Path}/${Path}`'. declare const somePath: Path; diff --git a/tests/baselines/reference/templateLiteralIntersection2.types b/tests/baselines/reference/templateLiteralIntersection2.types index e67e43ca3a9..3381e99669e 100644 --- a/tests/baselines/reference/templateLiteralIntersection2.types +++ b/tests/baselines/reference/templateLiteralIntersection2.types @@ -6,15 +6,15 @@ type Path = string & { _pathBrand: any }; >_pathBrand : any type JoinedPath = `${Path}/${Path}`; ->JoinedPath : `${Path}/${Path}` +>JoinedPath : `${string}/${string}` declare function joinedPath(p: JoinedPath): void; >joinedPath : (p: JoinedPath) => void ->p : `${Path}/${Path}` +>p : `${string}/${string}` joinedPath("foo/bar"); >joinedPath("foo/bar") : void ->joinedPath : (p: `${Path}/${Path}`) => void +>joinedPath : (p: `${string}/${string}`) => void >"foo/bar" : "foo/bar" declare const somePath: Path; @@ -22,8 +22,8 @@ declare const somePath: Path; joinedPath(`${somePath}/${somePath}`); >joinedPath(`${somePath}/${somePath}`) : void ->joinedPath : (p: `${Path}/${Path}`) => void ->`${somePath}/${somePath}` : `${Path}/${Path}` +>joinedPath : (p: `${string}/${string}`) => void +>`${somePath}/${somePath}` : `${string}/${string}` >somePath : Path >somePath : Path diff --git a/tests/baselines/reference/templateLiteralIntersection3.types b/tests/baselines/reference/templateLiteralIntersection3.types index d0450950016..9ccf6aea3ee 100644 --- a/tests/baselines/reference/templateLiteralIntersection3.types +++ b/tests/baselines/reference/templateLiteralIntersection3.types @@ -24,19 +24,19 @@ options1[`foo/${path}`] = false; >options1[`foo/${path}`] = false : false >options1[`foo/${path}`] : boolean >options1 : { prop: number; } & { [k: string]: boolean; } ->`foo/${path}` : `foo/${Path}` +>`foo/${path}` : `foo/${string}` >path : Path >false : false // Lowercase<`foo/${Path}`> => `foo/${Lowercase}` declare const lowercasePath: Lowercase<`foo/${Path}`>; ->lowercasePath : `foo/${Lowercase<`${Path}`>}` +>lowercasePath : `foo/${Lowercase}` options1[lowercasePath] = false; >options1[lowercasePath] = false : false >options1[lowercasePath] : boolean >options1 : { prop: number; } & { [k: string]: boolean; } ->lowercasePath : `foo/${Lowercase<`${Path}`>}` +>lowercasePath : `foo/${Lowercase}` >false : false diff --git a/tests/baselines/reference/templateLiteralTypesPatterns.types b/tests/baselines/reference/templateLiteralTypesPatterns.types index d63799df570..617b8c74421 100644 --- a/tests/baselines/reference/templateLiteralTypesPatterns.types +++ b/tests/baselines/reference/templateLiteralTypesPatterns.types @@ -656,20 +656,20 @@ conversionTest2("testDowncast"); function conversionTest3(groupName: | "downcast" | "dataDowncast" | "editingDowncast" | `${string & {}}Downcast`) {} >conversionTest3 : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | `${string & {}}Downcast`) => void ->groupName : "downcast" | `${string & {}}Downcast` +>groupName : `${string}Downcast` | "downcast" conversionTest3("testDowncast"); >conversionTest3("testDowncast") : void ->conversionTest3 : (groupName: "downcast" | `${string & {}}Downcast`) => void +>conversionTest3 : (groupName: `${string}Downcast` | "downcast") => void >"testDowncast" : "testDowncast" function conversionTest4(groupName: | "downcast" | "dataDowncast" | "editingDowncast" | `${{} & string}Downcast`) {} >conversionTest4 : (groupName: "downcast" | "dataDowncast" | "editingDowncast" | `${{} & string}Downcast`) => void ->groupName : "downcast" | `${{} & string}Downcast` +>groupName : `${string}Downcast` | "downcast" conversionTest4("testDowncast"); >conversionTest4("testDowncast") : void ->conversionTest4 : (groupName: "downcast" | `${{} & string}Downcast`) => void +>conversionTest4 : (groupName: `${string}Downcast` | "downcast") => void >"testDowncast" : "testDowncast" function foo(str: `${`a${string}` & `${string}a`}Test`) {}