Accept new baselines

This commit is contained in:
Anders Hejlsberg
2017-01-12 10:50:08 -08:00
parent dafea7f54d
commit 1f8b9f8bbe
2 changed files with 253 additions and 3 deletions
@@ -30,9 +30,24 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(62,5): error TS2
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(67,5): error TS2542: Index signature in type 'Readonly<U>' only permits reading.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(71,5): error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(76,5): error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(126,5): error TS2322: Type 'Partial<U>' is not assignable to type 'Identity<U>'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(142,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
Type 'T[P]' is not assignable to type 'U[P]'.
Type 'T' is not assignable to type 'U'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(147,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'.
Type 'keyof U' is not assignable to type 'keyof T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(152,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'.
Type 'keyof T' is not assignable to type 'K'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(157,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'.
Type 'keyof U' is not assignable to type 'K'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(162,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
Type 'keyof T' is not assignable to type 'K'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'.
Type 'T[P]' is not assignable to type 'U[P]'.
Type 'T' is not assignable to type 'U'.
==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (20 errors) ====
==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (27 errors) ====
function f1<T>(x: T, k: keyof T) {
return x[k];
@@ -190,4 +205,89 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(76,5): error TS2
function f51<T extends ItemMap, K extends keyof T>(obj: T, key: K) {
let item: Item = obj[key];
return obj[key].name;
}
}
type T1<T> = {
[P in keyof T]: T[P];
}
type T2<T> = {
[P in keyof T]: T[P];
}
function f60<U>(x: T1<U>, y: T2<U>) {
x = y;
y = x;
}
type Identity<T> = {
[P in keyof T]: T[P];
}
function f61<U>(x: Identity<U>, y: Partial<U>) {
x = y; // Error
~
!!! error TS2322: Type 'Partial<U>' is not assignable to type 'Identity<U>'.
y = x;
}
function f62<U>(x: Identity<U>, y: Readonly<U>) {
x = y;
y = x;
}
function f70<T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: T[P] }) {
x = y;
y = x;
}
function f71<T, U extends T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: U[P] }) {
x = y;
y = x; // Error
~
!!! error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
!!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
}
function f72<T, U extends T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof U]: U[P] }) {
x = y;
y = x; // Error
~
!!! error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'.
!!! error TS2322: Type 'keyof U' is not assignable to type 'keyof T'.
}
function f73<T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in keyof T]: T[P] }) {
x = y;
y = x; // Error
~
!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'.
!!! error TS2322: Type 'keyof T' is not assignable to type 'K'.
}
function f74<T, U extends T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in keyof U]: U[P] }) {
x = y;
y = x; // Error
~
!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'.
!!! error TS2322: Type 'keyof U' is not assignable to type 'K'.
}
function f75<T, U extends T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in keyof T]: U[P] }) {
x = y;
y = x; // Error
~
!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
!!! error TS2322: Type 'keyof T' is not assignable to type 'K'.
}
function f76<T, U extends T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in K]: U[P] }) {
x = y;
y = x; // Error
~
!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'.
!!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
}
@@ -104,7 +104,70 @@ function f50<T extends ItemMap>(obj: T, key: keyof T) {
function f51<T extends ItemMap, K extends keyof T>(obj: T, key: K) {
let item: Item = obj[key];
return obj[key].name;
}
}
type T1<T> = {
[P in keyof T]: T[P];
}
type T2<T> = {
[P in keyof T]: T[P];
}
function f60<U>(x: T1<U>, y: T2<U>) {
x = y;
y = x;
}
type Identity<T> = {
[P in keyof T]: T[P];
}
function f61<U>(x: Identity<U>, y: Partial<U>) {
x = y; // Error
y = x;
}
function f62<U>(x: Identity<U>, y: Readonly<U>) {
x = y;
y = x;
}
function f70<T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: T[P] }) {
x = y;
y = x;
}
function f71<T, U extends T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: U[P] }) {
x = y;
y = x; // Error
}
function f72<T, U extends T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof U]: U[P] }) {
x = y;
y = x; // Error
}
function f73<T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in keyof T]: T[P] }) {
x = y;
y = x; // Error
}
function f74<T, U extends T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in keyof U]: U[P] }) {
x = y;
y = x; // Error
}
function f75<T, U extends T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in keyof T]: U[P] }) {
x = y;
y = x; // Error
}
function f76<T, U extends T, K extends keyof T>(x: { [P in K]: T[P] }, y: { [P in K]: U[P] }) {
x = y;
y = x; // Error
}
//// [mappedTypeRelationships.js]
function f1(x, k) {
@@ -185,6 +248,46 @@ function f51(obj, key) {
var item = obj[key];
return obj[key].name;
}
function f60(x, y) {
x = y;
y = x;
}
function f61(x, y) {
x = y; // Error
y = x;
}
function f62(x, y) {
x = y;
y = x;
}
function f70(x, y) {
x = y;
y = x;
}
function f71(x, y) {
x = y;
y = x; // Error
}
function f72(x, y) {
x = y;
y = x; // Error
}
function f73(x, y) {
x = y;
y = x; // Error
}
function f74(x, y) {
x = y;
y = x; // Error
}
function f75(x, y) {
x = y;
y = x; // Error
}
function f76(x, y) {
x = y;
y = x; // Error
}
//// [mappedTypeRelationships.d.ts]
@@ -214,3 +317,50 @@ declare type ItemMap = {
};
declare function f50<T extends ItemMap>(obj: T, key: keyof T): string;
declare function f51<T extends ItemMap, K extends keyof T>(obj: T, key: K): string;
declare type T1<T> = {
[P in keyof T]: T[P];
};
declare type T2<T> = {
[P in keyof T]: T[P];
};
declare function f60<U>(x: T1<U>, y: T2<U>): void;
declare type Identity<T> = {
[P in keyof T]: T[P];
};
declare function f61<U>(x: Identity<U>, y: Partial<U>): void;
declare function f62<U>(x: Identity<U>, y: Readonly<U>): void;
declare function f70<T>(x: {
[P in keyof T]: T[P];
}, y: {
[P in keyof T]: T[P];
}): void;
declare function f71<T, U extends T>(x: {
[P in keyof T]: T[P];
}, y: {
[P in keyof T]: U[P];
}): void;
declare function f72<T, U extends T>(x: {
[P in keyof T]: T[P];
}, y: {
[P in keyof U]: U[P];
}): void;
declare function f73<T, K extends keyof T>(x: {
[P in K]: T[P];
}, y: {
[P in keyof T]: T[P];
}): void;
declare function f74<T, U extends T, K extends keyof T>(x: {
[P in K]: T[P];
}, y: {
[P in keyof U]: U[P];
}): void;
declare function f75<T, U extends T, K extends keyof T>(x: {
[P in K]: T[P];
}, y: {
[P in keyof T]: U[P];
}): void;
declare function f76<T, U extends T, K extends keyof T>(x: {
[P in K]: T[P];
}, y: {
[P in K]: U[P];
}): void;