Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining operations in a particular order breaks compilation #2304

Open
sodic opened this issue Sep 24, 2024 · 2 comments
Open

Defining operations in a particular order breaks compilation #2304

sodic opened this issue Sep 24, 2024 · 2 comments
Labels
compiler dx shouldfix We should do/fix this at some point

Comments

@sodic
Copy link
Contributor

sodic commented Sep 24, 2024

The details are described here: #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
Copy link
Member

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?

@Martinsos Martinsos added the shouldfix We should do/fix this at some point label Oct 2, 2024
@sodic
Copy link
Contributor Author

sodic commented Oct 16, 2024

Seems it's not as bad as I thought.

Essentially, the compiler needs to run at least once while the declaration points to a non-existing implementation.

If this were true, then running wasp start on finished projects (like TodoAppTs) would never work. And they do. So it doesn't suck that hard (but still sucks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler dx shouldfix We should do/fix this at some point
Projects
None yet
Development

No branches or pull requests

2 participants