Skip to content

Uncalled-function check misses usage of complex property access #41588

Closed

Description

Code

Based on chrome-app on Definitely Typed:

    var chrome = {
        platformKeys: {
            subtleCrypto() {
                return {
                    sign() {},
                    exportKey() { return true }
                }
            }
        }
    }
    // ok
    if (chrome.platformKeys.subtleCrypto().exportKey) {
        chrome.platformKeys.subtleCrypto().exportKey
    }

Expected behavior:
No error

Actual behavior:
Error: "Did you mean to call 'exportKey'?"

Activity

  1. sandersn commented on Nov 18, 2020

    @sandersn
    MemberAuthor

    Oleksandr Tarasiuk (@a-tarasyuk) you might be interested in this too.

  2. MartinJohns commented on Nov 19, 2020

    @MartinJohns
    Contributor

    This works as expected with TypeScript 4.2.0-dev.20201119. It provides an error with strictNullChecks enabled, and provides no error with strictNullChecks disabled.

  3. sandersn commented on Nov 19, 2020

    @sandersn
    MemberAuthor

    There should be no error under any setting since chrome.platformKeys.subtleCrypto().sign is used in the body of the if.

  4. added a commit that references this issue on Nov 19, 2020
    7265f49
  5. added a commit that references this issue on Nov 30, 2020
    06fb724
  6. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions