google / google/closure-compiler
Arguments of `typeof` are not type-checked
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Arguments of `typeof` are not type-checked.
```js
/**
* @type {{ id: string }}
*/
const data = { id: "123" }
const x = data.somethingMadeUp // type-checked
// WARNING - [JSC_INEXISTENT_PROPERTY] Property somethingMadeUp never defined on data
const x = data.somethingMadeUp + 1 // type-checked, same warning
const y = typeof data.somethingMadeUp // not type-checked, no warning
```
Compiler Version: v20221102
Build command:
```
java -jar ./scripts/closureCompiler.jar \
--entry_point=./src/js/index.js \
--js=./src/**.js \
--dependency_mode=PRUNE \
--warning_level=VERBOSE \
--js_output_file=./dist/bundle.js \
--module_resolution=WEBPACK \
--compilation_level=ADVANCED \
--jscomp_error=checkDebuggerStatement \
--jscomp_error=unusedLocalVariables \
--jscomp_error=reportUnknownTypes \
--jscomp_error=strictCheckTypes;
```
Contributor guide
Assessment
This issue has not been assessed yet.