mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
18 lines
954 B
TypeScript
18 lines
954 B
TypeScript
//// [tests/cases/compiler/contextualSignatureInstantiation1.ts] ////
|
|
|
|
//// [contextualSignatureInstantiation1.ts]
|
|
declare function map<S, T>(f: (x: S) => T): (a: S[]) => T[];
|
|
var e = <K>(x: string, y?: K) => x.length;
|
|
var r99 = map(e); // should be {}[] for S since a generic lambda is not inferentially typed
|
|
|
|
declare function map2<S extends { length: number }, T>(f: (x: S) => T): (a: S[]) => T[];
|
|
var e2 = <K>(x: string, y?: K) => x.length;
|
|
var r100 = map2(e2); // type arg inference should fail for S since a generic lambda is not inferentially typed. Falls back to { length: number }
|
|
|
|
//// [contextualSignatureInstantiation1.js]
|
|
"use strict";
|
|
var e = (x, y) => x.length;
|
|
var r99 = map(e); // should be {}[] for S since a generic lambda is not inferentially typed
|
|
var e2 = (x, y) => x.length;
|
|
var r100 = map2(e2); // type arg inference should fail for S since a generic lambda is not inferentially typed. Falls back to { length: number }
|