Skip to content

Conversation

@rbuckton
Copy link
Contributor

@rbuckton rbuckton commented Mar 6, 2024

This modifies the checker to report an error when referencing a class name from a decorator in that class when it is used immediately, i.e.:

@dec(C) // error
class C {}

@dec(() => C) // ok
class C {}

@dec((() => C)()) // error (IIFE indicates immediate use)
class C {}

This applies to decorators on all elements.

Fixes #57366

@rbuckton rbuckton requested review from sandersn and weswigham March 6, 2024 19:42
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Mar 6, 2024
@rbuckton rbuckton merged commit 1e982d8 into main Mar 11, 2024
@rbuckton rbuckton deleted the fix57366 branch March 11, 2024 21:12
@rbuckton rbuckton added the Breaking Change Would introduce errors in existing code label Mar 15, 2024
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team Breaking Change Would introduce errors in existing code For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using static members in class decorator

4 participants