DanielXMoore / Civet

A TypeScript superset that favors more types and less typing
https://civet.dev
MIT License
1.33k stars 28 forks source link

Attempted pattern matching ternary #1236

Open bbrk24 opened 1 month ago

bbrk24 commented 1 month ago
undo := => engine = Engine.fromJSON json if json? := history.pop()
const undo = () =>(const json? = history.pop()? engine = Engine.fromJSON(json):void 0)

Workaround: put the function body on the next line

undo := =>
  engine = Engine.fromJSON json if json? := history.pop()
edemaine commented 1 month ago

A workaround for now:

undo := =>
  engine = Engine.fromJSON json if json? := history.pop()

So this is probably specific to the "don't wrap fat arrow in braces if it's a one-line expression" rule.