Add regression test

This commit is contained in:
Anders Hejlsberg
2017-01-09 09:19:03 -08:00
parent 9441555778
commit 80ef89b822
3 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts(18,7): error TS2322: Type 'string' is not assignable to type '{ important: boolean; }'.
==== tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts (1 errors) ====
// Repro from #13351
type Meta<T, A> = {
readonly[P in keyof T]: {
value: T[P];
also: A;
readonly children: Meta<T[P], A>;
};
}
interface Input {
x: string;
y: number;
}
declare const output: Meta<Input, boolean>;
const shouldFail: { important: boolean } = output.x.children;
~~~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type '{ important: boolean; }'.

View File

@@ -0,0 +1,24 @@
//// [mappedTypeWithCombinedTypeMappers.ts]
// Repro from #13351
type Meta<T, A> = {
readonly[P in keyof T]: {
value: T[P];
also: A;
readonly children: Meta<T[P], A>;
};
}
interface Input {
x: string;
y: number;
}
declare const output: Meta<Input, boolean>;
const shouldFail: { important: boolean } = output.x.children;
//// [mappedTypeWithCombinedTypeMappers.js]
// Repro from #13351
var shouldFail = output.x.children;

View File

@@ -0,0 +1,18 @@
// Repro from #13351
type Meta<T, A> = {
readonly[P in keyof T]: {
value: T[P];
also: A;
readonly children: Meta<T[P], A>;
};
}
interface Input {
x: string;
y: number;
}
declare const output: Meta<Input, boolean>;
const shouldFail: { important: boolean } = output.x.children;