google / google/closure-compiler
`Object.getOwnPropertyNames` incorrectly typed
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
`Object.getOwnPropertyNames` accepts any value except `null` and `undefined`—in particular, boolean, number and string values are all valid. Unfortunately [closure-compiler incorrectly rejects those primitives](https://closure-compiler.appspot.com/home#code%3D%252F%252F%2520%253D%253DClosureCompiler%253D%253D%250A%252F%252F%2520%2540compilation_level%2520ADVANCED_OPTIMIZATIONS%250A%252F%252F%2520%2540output_file_name%2520default.js%250A%252F%252F%2520%253D%253D%252FClosureCompiler%253D%253D%250A%250A%252F%252F%2520ADD%2520YOUR%2520CODE%2520HERE%250Avar%2520names%2520%253D%2520Object.getOwnPropertyNames('foo')%253B):
Input:
```JS
var names = Object.getOwnPropertyNames('foo');
```
Output:
```JS
JSC_TYPE_MISMATCH: actual parameter 1 of Object.getOwnPropertyNames does not match formal parameter
found : string
required: Object at line 2 character 39
var names = Object.getOwnPropertyNames('foo');
^
```
Contributor guide
Assessment
This issue has not been assessed yet.