Skip to content

TS4094 error occurred, even if the parent has a protected member (declaration: true)Β #47186

Closed

Description

@karikera

Bug Report

πŸ”Ž Search Terms

ts4094 parent
ts4094 extends

πŸ•— Version & Regression Information

4.6.0-dev.20211218

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________

⏯ Playground Link

[Playground link with relevant code]

  • The playground doesn't show this error. it needs "declaration": true

πŸ’» Code

class Foo {
    protected a = 0;
}
const a = new class extends Foo {};

πŸ™ Actual behavior

ts4094, Property 'a' of exported class expression may not be private or protected.ts(4094)

πŸ™‚ Expected behavior

no error.
'a' can be accessed by the other child classes.

Activity

  1. MartinJohns commented on Dec 18, 2021

    @MartinJohns
    Contributor

    The playground doesn't show this error. it needs "declaration": true

    It does, when you add // @declaration: true.

  2. MartinJohns commented on Dec 18, 2021

    @MartinJohns
    Contributor

    I don't see any difference to #17293.

  3. fatcerberus commented on Dec 18, 2021

    @fatcerberus

    I believe this could be fixed if #41587 were implemented. Right now it looks like a design limitation, as explained in #17293.

  4. karikera commented on Dec 18, 2021

    @karikera
    Author

    I don't see any difference to #17293.

    I felt it little different but it seems almost same.

  5. locked as resolved and limited conversation to collaborators on Oct 22, 2025
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