Closed moltar closed 4 years ago
Thanks for raising the issue @moltar. The problem seems to be with the type definition of CreateDateColumn
. The return type is set as Function
, but it really should be PropertyDecorator
if the authors of TypeORM wanted to be as specific as possible. I would raise an issue with them if you want to fix the root of the problem, but if you need something to work around the issue right away, you have a few options:
@decorate(CreateDateColumn() as PropertyDecorator)
which would be the correct typing@decorate(CreateDateColumn() as any)
if you don't care about typing in this scenario@ts-ignore
but will cause a compiler error when there isn't an error being suppressed. That way you could open the issue with TypeORM (which may take some time to be resolved) and if/when they address the issue, you'll get compiler errors notifying you of the unnecessary @ts-expect-error
comments, and you will be able to get rid of them.
// @ts-expect-error
@decorate(CreateDateColumn())
Another option that I didn't mention is that I could simply relax the typing, but I'd really prefer not to go that route. I think it's almost always better to have stricter typing when possible.
Let me know if there's anything else I can help with!
Thanks for the explanation, I will open an issue at TypeORM repo.
I will close this issue, as I guess there is nothing actionable here at the moment.
Again, thank you for your detailed response.
Getting this with TypeORM decorator:
Any ideas?
Thank you!