mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 20:37:46 -05:00
Add regression test
This commit is contained in:
@@ -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; }'.
|
||||
|
||||
@@ -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;
|
||||
18
tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts
Normal file
18
tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts
Normal 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;
|
||||
Reference in New Issue
Block a user