Skip to content

Commit 1fb90d4

Browse files
authored
Merge pull request #1365 from sosukesuzuki/check-for-namespace
fix: check if the `plugin.constructor` exists
2 parents 7d52294 + 7e61c4d commit 1fb90d4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4004,7 +4004,7 @@ export default class Elysia<
40044004
if (plugin instanceof Elysia)
40054005
return this._use(plugin).compile()
40064006

4007-
if (plugin.constructor.name === 'Elysia')
4007+
if (plugin.constructor?.name === 'Elysia')
40084008
return this._use(
40094009
plugin as unknown as Elysia
40104010
).compile()
@@ -4015,10 +4015,10 @@ export default class Elysia<
40154015
if (plugin.default instanceof Elysia)
40164016
return this._use(plugin.default)
40174017

4018-
if (plugin.constructor.name === 'Elysia')
4018+
if (plugin.constructor?.name === 'Elysia')
40194019
return this._use(plugin.default)
40204020

4021-
if (plugin.constructor.name === '_Elysia')
4021+
if (plugin.constructor?.name === '_Elysia')
40224022
return this._use(plugin.default)
40234023

40244024
try {

0 commit comments

Comments
 (0)