Microsoft/TypeScript

Precedence in parsing types

Open

#7.094 geöffnet am 16. Feb. 2016

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
DocsHelp Wanted

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

It looks to me like this should parse, but it doesn't:

var x: number | (string)=>void;

It works with added parens:

var x: number | ((string)=>void);

But if the parser is not too hacky, then maybe it's easy to make the first work?

(FWIW, I ran into this in a rest argument, where it would be nice to avoid the extra parens in

function foo(...xs: (number | ()=>void)[]): void { }

)

Contributor Guide