We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi! Thanks as always for your great libraries.
I was trying out discriminated union with the new syntax @tag and faced the following problem.
module Message = { @tag("type") @spice type t = | TEXT({id: string, userKey: string, createdAt: string, text: string}) | IMAGE({id: string, userKey: string, createdAt: string, imageFileId: string}) | RAW_FILE({id: string, userKey: string, createdAt: string, fileId: string}) } @spice type someResponse = { lastMessage: Message.t }
Log
[rewatch] This syntax is not yet implemented by spice
But, define record type, It can compiled.
Like this
module Message = { @spice type text = {id: string, userKey: string, createdAt: string, text: string} @spice type image = {id: string, userKey: string, createdAt: string, imageFileId: string} @spice type rawFile = {id: string, userKey: string, createdAt: string, fileId: string} @tag("type") @spice type t = | TEXT(text) | IMAGE(image) | RAW_FILE(rawFile) } @spice type someResponse = { lastMessage: Message.t }
[7/7] ️✅ Finished Compilation in 0.83s
It would be nice if spice also implemented inline records in variants. 😄
Actually rescript-lang/rescript#6547
If this feature is applied, no additional changes to spice will be required lol.
The text was updated successfully, but these errors were encountered:
#59 Sorry, it was already in the RFC! 😅
Sorry, something went wrong.
No branches or pull requests
Hi! Thanks as always for your great libraries.
I was trying out discriminated union with the new syntax @tag and faced the following problem.
Log
But, define record type, It can compiled.
Like this
It would be nice if spice also implemented inline records in variants. 😄
Actually
rescript-lang/rescript#6547
If this feature is applied, no additional changes to spice will be required lol.
The text was updated successfully, but these errors were encountered: