Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2026-01-08 01:50:47 +00:00
parent 6b32c4bd33
commit b163b6707b
4 changed files with 20 additions and 24 deletions

View File

@ -10,8 +10,6 @@ assignmentCompatWithStringIndexer.ts(33,5): error TS2322: Type 'A<Base>' is not
assignmentCompatWithStringIndexer.ts(41,5): error TS2322: Type 'A<Base>' is not assignable to type '{ [x: string]: Derived2; }'.
'string' index signatures are incompatible.
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
assignmentCompatWithStringIndexer.ts(44,9): error TS1184: Modifiers cannot appear here.
assignmentCompatWithStringIndexer.ts(45,9): error TS1184: Modifiers cannot appear here.
assignmentCompatWithStringIndexer.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A<T>'.
'string' index signatures are incompatible.
Type 'Derived' is not assignable to type 'T'.
@ -31,7 +29,7 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A<T>' is not ass
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
==== assignmentCompatWithStringIndexer.ts (11 errors) ====
==== assignmentCompatWithStringIndexer.ts (9 errors) ====
// index signatures must be compatible in assignments
interface Base { foo: string; }
@ -93,12 +91,8 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A<T>' is not ass
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
function foo<T extends Base>() {
declare var b3: { [x: string]: Derived; };
~~~~~~~
!!! error TS1184: Modifiers cannot appear here.
declare var a3: A<T>;
~~~~~~~
!!! error TS1184: Modifiers cannot appear here.
var b3: { [x: string]: Derived; };
var a3: A<T>;
a3 = b3; // error
~~
!!! error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A<T>'.

View File

@ -44,8 +44,8 @@ namespace Generics {
b2 = a1; // error
function foo<T extends Base>() {
declare var b3: { [x: string]: Derived; };
declare var a3: A<T>;
var b3: { [x: string]: Derived; };
var a3: A<T>;
a3 = b3; // error
b3 = a3; // error
@ -107,6 +107,8 @@ var Generics;
a1 = b2; // ok
b2 = a1; // error
function foo() {
var b3;
var a3;
a3 = b3; // error
b3 = a3; // error
a3 = b4; // error

View File

@ -124,23 +124,23 @@ namespace Generics {
>T : Symbol(T, Decl(assignmentCompatWithStringIndexer.ts, 42, 17))
>Base : Symbol(Base, Decl(assignmentCompatWithStringIndexer.ts, 0, 0))
declare var b3: { [x: string]: Derived; };
>b3 : Symbol(b3, Decl(assignmentCompatWithStringIndexer.ts, 43, 19))
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer.ts, 43, 27))
var b3: { [x: string]: Derived; };
>b3 : Symbol(b3, Decl(assignmentCompatWithStringIndexer.ts, 43, 11))
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer.ts, 43, 19))
>Derived : Symbol(Derived, Decl(assignmentCompatWithStringIndexer.ts, 2, 31))
declare var a3: A<T>;
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 19))
var a3: A<T>;
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 11))
>A : Symbol(A, Decl(assignmentCompatWithStringIndexer.ts, 20, 20))
>T : Symbol(T, Decl(assignmentCompatWithStringIndexer.ts, 42, 17))
a3 = b3; // error
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 19))
>b3 : Symbol(b3, Decl(assignmentCompatWithStringIndexer.ts, 43, 19))
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 11))
>b3 : Symbol(b3, Decl(assignmentCompatWithStringIndexer.ts, 43, 11))
b3 = a3; // error
>b3 : Symbol(b3, Decl(assignmentCompatWithStringIndexer.ts, 43, 19))
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 19))
>b3 : Symbol(b3, Decl(assignmentCompatWithStringIndexer.ts, 43, 11))
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 11))
declare var b4: { [x: string]: Derived2; };
>b4 : Symbol(b4, Decl(assignmentCompatWithStringIndexer.ts, 48, 19))
@ -148,11 +148,11 @@ namespace Generics {
>Derived2 : Symbol(Derived2, Decl(assignmentCompatWithStringIndexer.ts, 3, 47))
a3 = b4; // error
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 19))
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 11))
>b4 : Symbol(b4, Decl(assignmentCompatWithStringIndexer.ts, 48, 19))
b4 = a3; // error
>b4 : Symbol(b4, Decl(assignmentCompatWithStringIndexer.ts, 48, 19))
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 19))
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer.ts, 44, 11))
}
}

View File

@ -159,13 +159,13 @@ namespace Generics {
>foo : <T extends Base>() => void
> : ^ ^^^^^^^^^ ^^^^^^^^^^^
declare var b3: { [x: string]: Derived; };
var b3: { [x: string]: Derived; };
>b3 : { [x: string]: Derived; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>x : string
> : ^^^^^^
declare var a3: A<T>;
var a3: A<T>;
>a3 : A<T>
> : ^^^^