ampproject / ampproject/amphtml

Type checker does not warn when no type inference can be made

Open
#26,750 3 comments 0 reactions 1 assignee Claimed by @samouri View on GitHub
Stale Type: Bug WG: infra
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

https://github.com/ampproject/amphtml/issues/26483

In `amp-auto-lightbox`, the `this.element` does not have a type declaration. The use of `this.element` is therefore not checked against available methods by type checker. Any method in the entire codebase having the same method name would satisfy the type checker.

In case of a refactoring where the method is moved from a class to another, the type checker will pass.

We could look at whether we should generate warning or block the PR when insufficient information is provided (especially in extensions) for the type checker to properly do its jobs.

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.