Accept new baselines

This commit is contained in:
Anders Hejlsberg
2023-11-18 17:02:00 -08:00
parent e0c3fc632a
commit 5741df41c1
5 changed files with 18 additions and 21 deletions
@@ -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<T extends string> =
>MixD : `${T & { foo: string; }}`
>MixD : `${T}`
`${T & { foo: string }}`
>foo : string
type OriginD = `${MixD<A & { foo: string }> & { foo: string }}`;
>OriginD : `${`${"a" & { foo: string; } & { foo: string; }}` & { foo: string; }}`
>OriginD : "a"
>foo : string
>foo : string
@@ -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;
@@ -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
@@ -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<Path>}`
declare const lowercasePath: Lowercase<`foo/${Path}`>;
>lowercasePath : `foo/${Lowercase<`${Path}`>}`
>lowercasePath : `foo/${Lowercase<string>}`
options1[lowercasePath] = false;
>options1[lowercasePath] = false : false
>options1[lowercasePath] : boolean
>options1 : { prop: number; } & { [k: string]: boolean; }
>lowercasePath : `foo/${Lowercase<`${Path}`>}`
>lowercasePath : `foo/${Lowercase<string>}`
>false : false
@@ -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`) {}