Skip to content

missing reference when assignment on property of contextual thisΒ #50509

Closed
@gulewei

Description

@gulewei

Bug Report

πŸ”Ž Search Terms

find all references
typechecking difference

πŸ•— Version & Regression Information

⏯ Playground Link

repo

πŸ’» Code

// inferOptions.ts
export declare function inferOptions<D>(
    options: {
        data: () => D;
        created: () => void;
    } & ThisType<D>
): void;
// test.js
import { inferOptions } from "./inferOptions";

inferOptions({
    data() {
        return {
            time: 0, // click `find all references` here output 2 results but expect 3.
        };
    },
    created() {
        this.time = 123; // here is the missing one
        console.log(this.time);
    },
});

πŸ™ Actual behavior

find all references for this.name output 2 results in .js file but 3 results in .ts file.

πŸ™‚ Expected behavior

find all references for this.name output 3 results in both .js and .ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions