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) {
|
export function FunctionTypeParam(node: Object) {
|
||||||
this.print(node.name, node);
|
this.print(node.name, node);
|
||||||
if (node.optional) this.token("?");
|
if (node.optional) this.token("?");
|
||||||
this.token(":");
|
if (node.name) {
|
||||||
this.space();
|
this.token(":");
|
||||||
|
this.space();
|
||||||
|
}
|
||||||
this.print(node.typeAnnotation, node);
|
this.print(node.typeAnnotation, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,3 +12,5 @@ type overloads =
|
|||||||
& ((x: string) => number)
|
& ((x: string) => number)
|
||||||
& ((x: number) => string)
|
& ((x: number) => string)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
type func = string => string;
|
||||||
|
|||||||
@ -8,3 +8,4 @@ type union = {
|
|||||||
type: "B"
|
type: "B"
|
||||||
};
|
};
|
||||||
type overloads = (x: string) => number & (x: number) => string;
|
type overloads = (x: string) => number & (x: number) => string;
|
||||||
|
type func = (string) => string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user