fix: don't write ': ' token when name is null (#7769)
This commit is contained in:
parent
b0e1e84471
commit
1f97b91655
@ -198,8 +198,10 @@ export function FunctionTypeAnnotation(node: Object, parent: Object) {
|
||||
export function FunctionTypeParam(node: Object) {
|
||||
this.print(node.name, node);
|
||||
if (node.optional) this.token("?");
|
||||
this.token(":");
|
||||
this.space();
|
||||
if (node.name) {
|
||||
this.token(":");
|
||||
this.space();
|
||||
}
|
||||
this.print(node.typeAnnotation, node);
|
||||
}
|
||||
|
||||
|
||||
@ -12,3 +12,5 @@ type overloads =
|
||||
& ((x: string) => number)
|
||||
& ((x: number) => string)
|
||||
;
|
||||
|
||||
type func = string => string;
|
||||
|
||||
@ -8,3 +8,4 @@ type union = {
|
||||
type: "B"
|
||||
};
|
||||
type overloads = (x: string) => number & (x: number) => string;
|
||||
type func = (string) => string;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user