This commit is contained in:
Anders Hejlsberg 2022-07-13 09:58:27 -10:00
Родитель 33d819ff37
Коммит e9b71d0c3a
1 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -1,10 +1,14 @@
tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(10,5): error TS2741: Property 'a' is missing in type 'Record<string, string>' but required in type 'Record<"a", string>'.
tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(14,5): error TS2741: Property 'a' is missing in type 'Record2<string, string>' but required in type 'Record2<"a", string>'.
tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(18,5): error TS2741: Property 'a' is missing in type 'Record<string, string>' but required in type 'Record2<"a", string>'.
tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(22,5): error TS2741: Property 'a' is missing in type 'Record2<string, string>' but required in type 'Record<"a", string>'.
tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(26,5): error TS2741: Property 'a' is missing in type 'Record<string, T>' but required in type 'Record<"a", T>'.
tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(30,5): error TS2741: Property 'a' is missing in type 'Record2<string, T>' but required in type 'Record2<"a", T>'.
tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(34,5): error TS2741: Property 'a' is missing in type 'Record<string, T>' but required in type 'Record2<"a", T>'.
tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(38,5): error TS2741: Property 'a' is missing in type 'Record2<string, T>' but required in type 'Record<"a", T>'.
==== tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts (4 errors) ====
==== tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts (8 errors) ====
// TODO: FIXME: All the below cases labeled `no error` _should be an error_, and are only prevented from so being
// by incorrect variance-based relationships
// Ref: https://github.com/Microsoft/TypeScript/issues/29698
@ -15,10 +19,14 @@ tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(38,5): error TS2
function defaultRecord(x: Record<'a', string>, y: Record<string, string>) {
x = y; // no error, but error expected.
~
!!! error TS2741: Property 'a' is missing in type 'Record<string, string>' but required in type 'Record<"a", string>'.
}
function customRecord(x: Record2<'a', string>, y: Record2<string, string>) {
x = y; // no error, but error expected.
~
!!! error TS2741: Property 'a' is missing in type 'Record2<string, string>' but required in type 'Record2<"a", string>'.
}
function mixed1(x: Record2<'a', string>, y: Record<string, string>) {
@ -35,10 +43,14 @@ tests/cases/compiler/consistentAliasVsNonAliasRecordBehavior.ts(38,5): error TS2
function defaultRecord2<T>(x: Record<'a', T>, y: Record<string, T>) {
x = y; // no error, but error expected.
~
!!! error TS2741: Property 'a' is missing in type 'Record<string, T>' but required in type 'Record<"a", T>'.
}
function customRecord2<T>(x: Record2<'a', T>, y: Record2<string, T>) {
x = y; // no error, but error expected.
~
!!! error TS2741: Property 'a' is missing in type 'Record2<string, T>' but required in type 'Record2<"a", T>'.
}
function mixed3<T>(x: Record2<'a', T>, y: Record<string, T>) {