Skip to content
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

子应用中instanceOf无法识别继承自Array的类型实例 #1443

Closed
AdonLee opened this issue Nov 15, 2024 · 3 comments
Closed

子应用中instanceOf无法识别继承自Array的类型实例 #1443

AdonLee opened this issue Nov 15, 2024 · 3 comments
Assignees
Labels
fixed Issue fixed

Comments

@AdonLee
Copy link

AdonLee commented Nov 15, 2024

问题描述

沙箱里instanceOf无法识别继承自Array的类型

复现步骤

在任意子应用中执行此代码

class ArrayEx extends Array {
  unique() {}
}
if ([] instanceof ArrayEx) {
  alert('[] should not be instance of ArrayEx');
}

上传截图

复现仓库

环境信息

  • micro-app版本:1.0.0-rc.8
  • 主应用前端框架&版本:@angular/[email protected]
  • 子应用前端框架&版本:@angular/[email protected]
  • 构建工具&版本:@angular-devkit/build-angular:application
@AdonLee
Copy link
Author

AdonLee commented Nov 15, 2024

临时方案可在instanceOf的劫持方法里增加构造器函数名判断
image

@timhub66
Copy link
Collaborator

@AdonLee ,升级到最新版本试试

@timhub66 timhub66 self-assigned this Dec 25, 2024
@timhub66 timhub66 added the fixed Issue fixed label Dec 25, 2024
Copy link

Hello @AdonLee. The issue you reported has been fixed. This issue will be closed. Thank you for your feedback.
您好 @AdonLee,您反馈的问题已修复,该 issue 将要被关闭,感谢反馈。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Issue fixed
Projects
None yet
Development

No branches or pull requests

2 participants