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

Arguments of typeof are not type-checked #4034

Open
fingerartur opened this issue Jan 9, 2023 · 0 comments
Open

Arguments of typeof are not type-checked #4034

fingerartur opened this issue Jan 9, 2023 · 0 comments
Labels
triage-done Has been reviewed by someone on triage rotation.

Comments

@fingerartur
Copy link

fingerartur commented Jan 9, 2023

Arguments of typeof are not type-checked.

/**
 * @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;
@rishipal rishipal added the triage-done Has been reviewed by someone on triage rotation. label Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-done Has been reviewed by someone on triage rotation.
Projects
None yet
Development

No branches or pull requests

2 participants