Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

Accessors are preserved in inferred object literal type in declarations #3958

Closed

Description

Steps to reproduce

export const u = {
    get foo(): string | null {
        return ""
    },
    set foo(val: string | null) {
    },
}

Playground Link

Behavior with typescript@6.0

In declarations, the accessor pair is collapsed to a property.

export declare const u: {
    foo: string | null;
};

Behavior with tsgo

Accessor pair is preserved.

export declare const u: {
    get foo(): string | null;
    set foo(val: string | null);
};
``

Activity

  1. jakebailey commented on May 18, 2026

    @jakebailey
    Member

    This is actually an intentional choice, though one we didn't exactly document. Is this causing a problem for you?

  2. dragomirtitian commented on May 18, 2026

    @dragomirtitian
    ContributorAuthor

    This is actually an intentional choice, though one we didn't exactly document. Is this causing a problem for you?

    Not that we noticed. Was more in the category of we noticed it and though we'd report in case you were not aware of it. I'll close the issue since it was intentional.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions