Skip to content

Commit

Permalink
fix(di): prevent undefined hook instance when class is mocked
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Nov 8, 2024
1 parent 02b15f3 commit f12f56b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/di/src/common/domain/Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class Provider<T = any> implements ProviderOpts<T> {
if (String(propertyKey).startsWith("$")) {
return {
...hooks,
[propertyKey]: (instance: any, ...args: any[]) => instance[propertyKey](...args)
[propertyKey]: (instance: any, ...args: any[]) => instance?.[propertyKey](...args)
};
}
return hooks;
Expand Down

0 comments on commit f12f56b

Please sign in to comment.