-
Notifications
You must be signed in to change notification settings - Fork 17
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
Redefine type always emit Object design:type #31
Comments
Unfortunately, this is a known issue caused by using babel. The pitfall is described in the README. We don't have access to type aliases right now in the babel plugin, so we just emit I've started looking at some solutions, but I'm not sure I could deliver them in fast times since it requires a different approach than what is used right now in this project. |
@leonardfactory Hi, instead of convert into Object, can we throw an error in the babel plugin so we would know this and change that type to something else? And what is your suggestion to manually fix this btw? |
@namnm Throwing would cause an error even with defined types. The problem is exactly that we don't know what The situation is, i.e. the following: import { Uiid } from '...';
@UseEncode(Uuid)
class MyClass { } now Edit: As a solution, I suggest to avoid using aliases in this situations and just fall back to plain strings. Babel TS support is pretty limited in this context. If this issue (and babel-ts flow) starts getting wider adoption, I'll start with a different implementation trying to get over the problem. See #30 |
@leonardfactory Thanks for the suggestion and quick reply. Just one more thing, I came here from the issue in the nestjs repo. I see that in the README this package can work well with Nest and TypeORM. Have you had any experiment project using this package for Nest? Is there any cautions that I need to take if I use this package in production with Nest and TypeORM? |
I've used it exactly with the same setup, but not in production, where we reverted to TypeScript only (no babel, but same toolkit). With TypeORM you should be careful to use |
Hello,
I have an issue, when I define a type like this:
export type Uuid = string;
The emit type is:
Object
The full case:
and my babel config:
I don't know if it's a defect coming from my Babel configuration, or a limitation from
@babel/preset-typescript
.The text was updated successfully, but these errors were encountered: