Parse generic function types in import type argument lists (#31079)

* Parenthesize in import type node factory

* And now parse unparenthesized generic functions so we can handle parsing the older output
This commit is contained in:
Wesley Wigham
2019-04-23 14:48:31 -07:00
committed by GitHub
parent 8fc6640f55
commit d7f03fb0fa
11 changed files with 206 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
// @declaration: true
// @filename: module.d.ts
declare module "module" {
export interface Modifier<T> { }
export function fn<T>(x: T): Modifier<T>;
}
// @filename: index.ts
import { fn } from "module";
export const fail1 = fn(<T>(x: T): T => x);
export const fail2 = fn(function<T>(x: T): T {
return x;
});
export const works1 = fn((x: number) => x);
type MakeItWork = <T>(x: T) => T;
export const works2 = fn<MakeItWork>(x => x);

View File

@@ -0,0 +1 @@
export declare const fail1: import("module").Modifier<<T>(x: T) => T>; // shouldn't be a parse error