Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

this-property assignments should use autoType to get control flow narrowing #37900

Copy link
Copy link
@sandersn

Description

@sandersn
Issue body actions

Based on discussion in #37827, we could further improve typing of this-property assignments if we used autoType whenever we can't tell what type they should have.

This has three open questions:

  1. Performance.
  2. Is there benefit in real code? This only helps if (1) we aren't getting the right type some of time where (2) the auto type would get the right type. This is likely to be when a property is used repeatedly in a long method.
  3. What changes are actually needed. Just returning autoType doesn't work, because control flow narrowing doesn't seem to track this-property assignments as references.
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specificallyDomain: This-TypingThe issue relates to providing types to thisThe issue relates to providing types to thisIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScriptcheckJsRelates to checking JavaScript using TypeScriptRelates to checking JavaScript using TypeScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.