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
How can I make this function work with typescript? async findLibraryById(libraryId: string): Promise<LibraryDto>
Running code like this:
constlibrary=awaitthis.librariesRepository.createQueryBuilder('library').loadRelationCountAndMap('library.bookCount','library.books').where({ id }).getOne();console.log(library.bookCount);// This will not work, Typescript complains that bookCount doesn't exist on Library
Expected Behavior
I expect I'm able to reach the property I selected using loadRelationCountAndMap
Actual Behavior
There is absolutely no way I found to bypass the typescript issue: Property 'bookCount' does not exist on type 'Library'
My Environment
Dependency
Version
Operating System
Node.js version
16.17.0
Typescript version
4.6.4
TypeORM version
0.3.9
Relevant Database Driver(s)
DB Type
Reproducible
aurora-mysql
I don't know
aurora-postgres
I don't know
better-sqlite3
I don't know
cockroachdb
I don't know
cordova
I don't know
expo
I don't know
mongodb
I don't know
mysql
I don't know
nativescript
I don't know
oracle
I don't know
postgres
YES
react-native
I don't know
sap
I don't know
spanner
I don't know
sqlite
I don't know
sqlite-abstract
I don't know
sqljs
I don't know
sqlserver
I don't know
Are you willing to resolve this issue by submitting a Pull Request?
✖️ Yes, I have the time, and I know how to start.
✖️ Yes, I have the time, but I don't know how to start. I would need guidance.
✖️ No, I don’t have the time, but I can support (using donations) development.
✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
The text was updated successfully, but these errors were encountered:
Issue Description
If my entities look like this:
And my Library Dto looks like this:
How can I make this function work with typescript?
async findLibraryById(libraryId: string): Promise<LibraryDto>
Running code like this:
Expected Behavior
I expect I'm able to reach the property I selected using
loadRelationCountAndMap
Actual Behavior
There is absolutely no way I found to bypass the typescript issue:
Property 'bookCount' does not exist on type 'Library'
My Environment
Relevant Database Driver(s)
aurora-mysql
aurora-postgres
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
spanner
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: