Writing
export type UnaryMinus = { kind: "unary-minus"; expr: Expr; op: "-" };
export function UnaryMinus(expr: Expr): UnaryMinus {
return { kind: "unary-minus", expr, op: "-" };
}
instead of
export class UnaryMinus {
readonly kind = "unary-minus";
readonly op = "-";
constructor(public expr: Expr) {}
}
seems more verbose and wasteful. See if there are tradeoffs and consider switching.
Writing
instead of
seems more verbose and wasteful. See if there are tradeoffs and consider switching.