You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not entirely sure if this is an SWC bug , and I think it is sidesteppable but I wanted to report it so others with the same error can check a solution, and if it is indeed a bug it can be fixed.
@drFabio hello, looks like the same one that we just bumped into, also there is another bug that was reported some time ago regarding this issue: #1160
it seems like it requires a full typechecking implementation to be implemented, so not sure when it's going to be fixed...
Asked the author in this other bug.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
I am not entirely sure if this is an SWC bug , and I think it is sidesteppable but I wanted to report it so others with the same error can check a solution, and if it is indeed a bug it can be fixed.
Consider this proof of concept
While trying to use an enum in the context of a TypeORM field the generated code when run results on the error:
"DataTypeNotSupportedError: Data type "undefined" in "SomeEntity.problemField" is not supported by "sqlite" database."
This seems to be caused because the transpiled code, on the code that uses the enum gets generated to:
That confuses typeorm for some reason, the generated code by nest (that works) on the relevant part becomes:
It seems that the type of swc should be String. Whether this is the incorrect behavior or not I do not have enough knowledge to say.
Input code
The example is on the repo here
Config
Playground link
No response
Expected behavior
Generated enums are compatible with both typeOrm and NestJs expectations. (Again not sure if it is "They" that are wrong or swc")
Actual behavior
Generated transpiled enums differ from the ones expected by NestJs or typeorm
Version
1.2.177
Additional context
This behavior could be verified by checking the poc .
Then one could try to run it and ensure it runs:
After that one could try to build and check the result of dist/SomeEntity.js
And finally one could check the transpiled swc and check the result of output/SomeEntity.js
This behavior seems to be easily dealt by explicitly stating types in case of enums. As illustrated by this branch
The text was updated successfully, but these errors were encountered: