graphile / crystal-pre-merge

Repository moved
https://github.com/graphile/crystal
39 stars 10 forks source link

graphile-export optimize away constant conditions #425

Open benjie opened 11 months ago

benjie commented 11 months ago

Might be able to borrow something from babel for this?

              step.orderBy({
                codec: attribute.codec,
                fragment: sql`${step.alias}.${sql.identifier(attributeName)}`,
                direction: "DESC",
                ...(undefined != null ? {
                  nulls: undefined ? "LAST" : "FIRST"
                } : null)

Here undefined != null will always be falsy, so we can simplify the parens down to ...(null) which we can then eliminate.