mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
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:
@@ -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);
|
||||
@@ -0,0 +1 @@
|
||||
export declare const fail1: import("module").Modifier<<T>(x: T) => T>; // shouldn't be a parse error
|
||||
Reference in New Issue
Block a user