Skip to content

Commit 891a724

Browse files
committed
Fix short undefined check on number variable
1 parent 35bc916 commit 891a724

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/decorators/OrmRepository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function OrmRepository(entityTypeOrConnectionName?: Function|string, para
123123
}
124124

125125
// if the decorator has been aplied to parameter (constructor injection)
126-
if (index) {
126+
if (index !== undefined) {
127127
const paramTypes: Function[] | undefined = Reflect.getOwnMetadata("design:paramtypes", object, propertyName);
128128
if (!paramTypes || !paramTypes[index]) {
129129
throw new Error(
@@ -158,7 +158,7 @@ export function OrmRepository(entityTypeOrConnectionName?: Function|string, para
158158
if (!entityType) {
159159
throw new Error(
160160
`Missing "entityType" parameter of "@OrmRepository" decorator ` +
161-
index
161+
index !== undefined
162162
? `for a "${propertyName}" method's ${index! + 1}. parameter of ${object.constructor.name} class. `
163163
: `for a property "${propertyName}" of ${object.constructor.name} class. `
164164
+

0 commit comments

Comments
 (0)