8000 this-property assignments should use autoType to get control flow narrowing · Issue #37900 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content
this-property assignments should use autoType to get control flow narrowing #37900
Closed
@sandersn

Description

@sandersn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0