apache / apache/echarts

[Bug] typeof Map === 'function' 对Map的判断不严谨,导致创建了错误的MAP实例

Open
#21,273 2 comments 0 reactions 0 assignees View on GitHub
bug pending
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.4.1

### Link to Minimal Reproduction

https://codesandbox.io/p/sandbox/5gzlw7

### Steps to Reproduce

1. 自定义Map
`
function Map() {
}
`

2. 第一步创建的Map对象能够通过 typeof Map === 'function' 的验证

Image

### Current Behavior

使用更为严格的方式判断当前作用域的Map是不是原生的Map
`
const isNativeMap = () => typeof Map === 'function' && Map.toString().replaceAll(' ', '').replaceAll('\n', '') === 'functionMap(){[nativecode]}';
`

### Expected Behavior

在全局引入Echarts的情况下,只有当前作用域的Map是原生的Map时,才用 new Map创建实例,其余情况还是用Echarts自带的

### Environment

```markdown
- OS: Mac OS
- Browser: Chrome
- Framework:
```

### Any additional comments?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.