Returns the underlying entity, throwing an error if the reference is not initialized.
()
| 198 | |
| 199 | /** Returns the underlying entity, throwing an error if the reference is not initialized. */ |
| 200 | getEntity(): T { |
| 201 | if (!this.isInitialized()) { |
| 202 | throw new Error( |
| 203 | `Reference<${helper(this.entity).__meta.name}> ${helper(this.entity).getPrimaryKey()} not initialized`, |
| 204 | ); |
| 205 | } |
| 206 | |
| 207 | return this.entity; |
| 208 | } |
| 209 | |
| 210 | /** Returns the value of a property on the underlying entity. Throws if the reference is not initialized. */ |
| 211 | getProperty<K extends keyof T>(prop: K): T[K] { |
no test coverage detected