mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
47 lines
867 B
TypeScript
47 lines
867 B
TypeScript
//// [tests/cases/compiler/higherOrderMappedIndexLookupInference.ts] ////
|
|
|
|
//// [higherOrderMappedIndexLookupInference.ts]
|
|
// @strict
|
|
|
|
function f1(a: <T>() => keyof T, b: <U>() => keyof U) {
|
|
a = b;
|
|
b = a;
|
|
}
|
|
|
|
function f2(a: <T, K extends keyof T>() => T[K], b: <U, L extends keyof U>() => U[L]) {
|
|
a = b;
|
|
b = a;
|
|
}
|
|
|
|
function f3(a: <T>() => { [K in keyof T]: T[K] }, b: <U>() => { [K in keyof U]: U[K] }) {
|
|
a = b;
|
|
b = a;
|
|
}
|
|
|
|
// Repro from #18338
|
|
|
|
type IdMapped<T> = { [K in keyof T]: T[K] }
|
|
|
|
declare const f: <T>() => IdMapped<T>;
|
|
declare const g: <U>() => { [K in keyof U]: U[K] };
|
|
|
|
const h: typeof g = f;
|
|
|
|
|
|
//// [higherOrderMappedIndexLookupInference.js]
|
|
"use strict";
|
|
// @strict
|
|
function f1(a, b) {
|
|
a = b;
|
|
b = a;
|
|
}
|
|
function f2(a, b) {
|
|
a = b;
|
|
b = a;
|
|
}
|
|
function f3(a, b) {
|
|
a = b;
|
|
b = a;
|
|
}
|
|
const h = f;
|