From d7083a1f785f54bb260aaca5b98cb3fc1633285d Mon Sep 17 00:00:00 2001 From: Roma Caraus Date: Mon, 16 Mar 2020 17:45:43 +0200 Subject: [PATCH 1/2] Fix issue #275: Unable to app.get(ConfigService) in main.ts with node lts (12.16.0) --- src/decorators/proxy.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/decorators/proxy.ts b/src/decorators/proxy.ts index 934290e..e4ed492 100644 --- a/src/decorators/proxy.ts +++ b/src/decorators/proxy.ts @@ -1,3 +1,5 @@ +import { ConfigService } from '../module'; + /** * @param {string} propertyName * @returns {(constructor: T) => {new(...args: any[]): {}; prototype: {}}} @@ -7,7 +9,7 @@ export const ProxyProperty = (propertyName: string) => function classDecorator( constructor: T, ) { - return class extends constructor { + const decorated = class extends constructor { constructor(...args: any[]) { super(...args); @@ -22,4 +24,9 @@ export const ProxyProperty = (propertyName: string) => }); } }; + /** + * fix for node 12.16.0 issue: https://github.com/microsoft/TypeScript/issues/37157 + * */ + Object.defineProperty(decorated, 'name', { value: constructor.name }); + return decorated; }; From d628b6a6ad7e84ebf2b3d1ef7e2721a6e7ee3334 Mon Sep 17 00:00:00 2001 From: Roma Caraus Date: Mon, 16 Mar 2020 17:50:46 +0200 Subject: [PATCH 2/2] Fix issue #275: Unable to app.get(ConfigService) in main.ts with node lts (12.16.0) (remove unused dependency) --- src/decorators/proxy.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/decorators/proxy.ts b/src/decorators/proxy.ts index e4ed492..417bf97 100644 --- a/src/decorators/proxy.ts +++ b/src/decorators/proxy.ts @@ -1,5 +1,3 @@ -import { ConfigService } from '../module'; - /** * @param {string} propertyName * @returns {(constructor: T) => {new(...args: any[]): {}; prototype: {}}}