-
-
Notifications
You must be signed in to change notification settings - Fork 393
fix: check if the plugin.constructor exists
#1365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4004,7 +4004,7 @@ export default class Elysia< | |||||||||
| if (plugin instanceof Elysia) | ||||||||||
| return this._use(plugin).compile() | ||||||||||
|
|
||||||||||
| if (plugin.constructor.name === 'Elysia') | ||||||||||
| if (plugin.constructor?.name === 'Elysia') | ||||||||||
| return this._use( | ||||||||||
| plugin as unknown as Elysia | ||||||||||
| ).compile() | ||||||||||
|
|
@@ -4015,10 +4015,10 @@ export default class Elysia< | |||||||||
| if (plugin.default instanceof Elysia) | ||||||||||
| return this._use(plugin.default) | ||||||||||
|
|
||||||||||
| if (plugin.constructor.name === 'Elysia') | ||||||||||
| if (plugin.constructor?.name === 'Elysia') | ||||||||||
| return this._use(plugin.default) | ||||||||||
|
|
||||||||||
| if (plugin.constructor.name === '_Elysia') | ||||||||||
| if (plugin.constructor?.name === '_Elysia') | ||||||||||
| return this._use(plugin.default) | ||||||||||
|
|
||||||||||
|
Comment on lines
+4021
to
4023
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same bug for '_Elysia' branch; also targets the wrong object. This should also read from Apply: - if (plugin.constructor?.name === '_Elysia')
+ if (plugin.default?.constructor?.name === '_Elysia')
return this._use(plugin.default)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| try { | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: checking the module namespace object instead of the default export.
When handling an ES module with a default Elysia instance, this should inspect
plugin.default.constructor?.name, notplugin.constructor?.name.Apply:
📝 Committable suggestion
🤖 Prompt for AI Agents