Skip to content

Commit

Permalink
Fix issue nestjsx#275: Unable to app.get(ConfigService) in main.ts wi…
Browse files Browse the repository at this point in the history
…th node lts (12.16.0)
  • Loading branch information
romamd committed Mar 16, 2020
1 parent 5453a55 commit d7083a1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/decorators/proxy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ConfigService } from '../module';

/**
* @param {string} propertyName
* @returns {<T extends {new(...args: any[]): {}}>(constructor: T) => {new(...args: any[]): {}; prototype: {}}}
Expand All @@ -7,7 +9,7 @@ export const ProxyProperty = (propertyName: string) =>
function classDecorator<T extends { new (...args: any[]): {} }>(
constructor: T,
) {
return class extends constructor {
const decorated = class extends constructor {
constructor(...args: any[]) {
super(...args);

Expand All @@ -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;
};

0 comments on commit d7083a1

Please sign in to comment.