Skip to content

Commit

Permalink
fix swap not accepting functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoobes committed Jul 17, 2024
1 parent 5d0260a commit c35337c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/core/ioc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ const dependencyBuilder = (container: Container) => {
* Swap out a preexisting dependency.
*/
swap(key: keyof Dependencies, v: Insertable) {
container.swap(key, v);
if(typeof v !== 'function') {
container.swap(key, v);
} else {
container.swap(key, v(container.deps()));
}
},
};
};
Expand Down
1 change: 0 additions & 1 deletion src/sern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import ready from './handlers/ready';
import messageHandler from './handlers/message';
import interactionHandler from './handlers/interaction';
import { presenceHandler } from './handlers/presence';
import { handleCrash } from './handlers/event-utils';
import { UnpackedDependencies } from './types/utility';
import type { Presence} from './core/presences';
import { registerTasks } from './handlers/tasks';
Expand Down

0 comments on commit c35337c

Please sign in to comment.