Skip to content

binder: expando declarations don't show up on symbol #313

Open
@sandersn

Description

@sandersn
Member
  • expando on export default missing: declarationEmitDefaultExportWithStaticAssignment
  • expando on interface/const merge missing: declarationEmitExpandoWithGenericConstraint
  • expando on overloaded function missing: declarationEmitFunctionDuplicateNamespace
  • expando with keyword names: declarationEmitFunctionKeywordProp
  • expando with element access expressions: declarationEmitLateBoundAssignments2
  • starting to think expandos just don't work: declarationEmitLateBoundAssignments

Activity

changed the title [-]expando declarations don't show up on symbol[/-] [+]binder: expando declarations don't show up on symbol[/+] on Feb 10, 2025
sandersn

sandersn commented on Feb 19, 2025

@sandersn
MemberAuthor

This is correct, although it differs from Strada and we probably don't want it to differ in the long-term. In the following example, Point only has one declaration in Corsa and two in Strada, because Strada has assignment declarations and therefore treats Point as a namespace declaration containing zero.

function Point() { }
Point.zero = () => 0

The missing feature is transforming Point.zero into a synthetic--JS-only--namespace declaration:

function Point() { }
jsnamespace {
  jsexport var zero
}
Point.zero = () => 0

where the binder will need to allow jsnamespace to merge with other values, and the checker will need to follow the synthetic jsexport var to an original initialiser () => 0 to type check it. Oh, and the language service will need to report the synthetic jsnamespace's original location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: BinderRelated to the binder, symbols

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sandersn@jakebailey

        Issue actions

          binder: expando declarations don't show up on symbol · Issue #313 · microsoft/typescript-go