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

Vite build fails when using string based typescript enums as parameters #75

Closed
samuba opened this issue Jun 19, 2023 · 5 comments
Closed
Labels
bug 💥 Something isn't working

Comments

@samuba
Copy link
Contributor

samuba commented Jun 19, 2023

Using:

  • telefunc latest
  • vite 4.3.9
  • svelte kit 1.20.4

vite build errors out with: ReferenceError [Error]: t is not defined

The enum:

export enum Attending {
	MAYBE = 'MAYBE',
	ATTENDING = 'ATTENDING',
	NOT_ATTENDING = 'NOT_ATTENDING',
	UNKNOWN = 'UNKNOWN',
}

Looking into the generated file & line we can see that after the first enum value t.const is being used instead of __telefunc_t.const

shield(addGuest, [__telefunc_t.optional(__telefunc_t.string), { name: __telefunc_t.string, attending: __telefunc_t.or(__telefunc_t.const("UNKNOWN"), t.const("NOT_ATTENDING"), t.const("ATTENDING"), t.const("MAYBE")) }], { __autoGenerated: true });

FYI: Works fine for "normal" typescript enums

@brillout
Copy link
Owner

👍 Can you create a reproduction? You can use https://batijs.github.io/ if you want to quickly scaffold a Telefunc app.

@samuba
Copy link
Contributor Author

samuba commented Jun 19, 2023

@brillout
Copy link
Owner

brillout commented Jun 19, 2023

@louwers Any objections with f57cf11?

@samuba I'll release the fix once Bart gives us the green light.

@brillout brillout added the bug 💥 Something isn't working label Jun 20, 2023
@brillout
Copy link
Owner

Fix released in 0.1.57.

@brillout
Copy link
Owner

In case you can convince your employer: https://github.com/sponsors/brillout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 💥 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants