wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.5k stars 1.18k forks source link

Defining operations in a particular order breaks compilation #2304

Open sodic opened 1 week ago

sodic commented 1 week ago

The details are described here: https://github.com/wasp-lang/wasp/issues/969.

In short, we count on the Wasp compiler to tolerate missing operation definitions.

We tell our users to:

  1. First declare it inside the Wasp file (the compiler tolerates the missing implementations and generates the types).
  2. Then define its implementation in TypeScript (and use the generated types).

When users do this out of order (as I often do), wasp compile breaks and stays broken even after all the code is completely valid.

This happens because the compiler didn't get the chance to generate the types before the user mentioned them in the implementation file. Essentially, the compiler needs to run at least once while the declaration points to a non-existing implementation.

This is only fixable by removing types from the implementation file.

A user hit it here: https://discord.com/channels/686873244791210014/1288139584676565022/1288139584676565022

Martinsos commented 1 week ago

Oh man! Yeah this sucks, and nice job on defining this so well, I think we had multiple people hitting this. Any idea on how best we can fix this?