Allow decorators to be used with declare on class fields#19492
Merged
Conversation
declare on class fields
declare on class fieldsdeclare on class fields
Member
|
@evoactivity Please add removed tests from #19210 back, thank you!
|
✅ Deploy Preview for prettier ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Author
|
@fisker tests have been added back 👍 |
Member
|
Please add a changelog entry for this change. Instructions |
Contributor
Author
|
@fisker Changelog entry added. Let me know if there is anything else I missed. |
declare on class fieldsdeclare on class fields
commit: |
fisker
approved these changes
Jun 29, 2026
fisker
left a comment
Member
There was a problem hiding this comment.
Thank you! Will release a patch version shortly.
fisker
added a commit
that referenced
this pull request
Jun 29, 2026
Co-authored-by: fisker <lionkay@gmail.com>
sys-support
pushed a commit
to 3caravelle/renovate
that referenced
this pull request
Jun 30, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [prettier](https://prettier.io) ([source](https://github.com/prettier/prettier)) | [`3.8.5` → `3.9.4`](https://renovatebot.com/diffs/npm/prettier/3.8.5/3.9.4) |  |  | --- ### Release Notes <details> <summary>prettier/prettier (prettier)</summary> ### [`v3.9.4`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#394) [Compare Source](prettier/prettier@3.9.3...3.9.4) [diff](prettier/prettier@3.9.3...3.9.4) ##### Angular: Format `@content(name)` -> `@content (name)` to align with other block syntax ([#​19499](prettier/prettier#19499) by [@​fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```html <!-- Input --> <FancyButton [label]="title"> @​content (icon) { <span>Icon!</span> } @​content (description) { <span>Description text</span> } <span>Other children</span> </FancyButton> <!-- Prettier 3.9.3 --> <FancyButton [label]="title"> @​content(icon) { <span>Icon!</span> } @​content(description) { <span>Description text</span> } <span>Other children</span> </FancyButton> <!-- Prettier 3.9.4 --> <FancyButton [label]="title"> @​content (icon) { <span>Icon!</span> } @​content (description) { <span>Description text</span> } <span>Other children</span> </FancyButton> ``` ### [`v3.9.3`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#393) [Compare Source](prettier/prettier@3.9.2...3.9.3) [diff](prettier/prettier@3.9.1...3.9.3) ##### Markdown: Fix unexpected removal of characters in liquid syntax ([#​19489](prettier/prettier#19489) by [@​seiyab](https://github.com/seiyab)) <!-- prettier-ignore --> ```md // Input <!-- Input --> {{ page.title }} text <!-- Prettier 3.9.1 --> {{ page.title text <!-- Prettier 3.9.3 --> {{ page.title }} text ``` ##### TypeScript: Allow decorators to be used with declare on class fields ([#​19492](prettier/prettier#19492) by [@​evoactivity](https://github.com/evoactivity)) Extensively used within the Ember ecosystem, decorators with `declare` on class fields will ignore the babel parser error and allow Prettier to format the code without breaking it. <!-- prettier-ignore --> ```ts // Input export default class ProjectStatusComponent extends Component<ProjectStatusSig> { @​service declare server: ServerService; } // Prettier 3.9.1 // SyntaxError: Decorators can't be used with a declare field. (2:3) // 1 | export default class ProjectStatusComponent extends Component<ProjectStatusSig> { //> 2 | @​service declare server: ServerService; // | ^ // 3 | } // Prettier 3.9.3 export default class ProjectStatusComponent extends Component<ProjectStatusSig> { @​service declare server: ServerService; } ``` ### [`v3.9.2`](prettier/prettier@3.9.1...3.9.2) [Compare Source](prettier/prettier@3.9.1...3.9.2) ### [`v3.9.1`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#391) [Compare Source](prettier/prettier@3.9.0...3.9.1) [diff](prettier/prettier@3.9.0...3.9.1) ##### CLI: Fix ignored file has been cached incorrectly ([#​19483](prettier/prettier#19483) by [@​kovsu](https://github.com/kovsu)) Bug details [#​18016](prettier/prettier#18016) ### [`v3.9.0`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#390) [Compare Source](prettier/prettier@3.8.5...3.9.0) [diff](prettier/prettier@3.8.5...3.9.0) 🔗 [Release Notes](https://prettier.io/blog/2026/06/27/3.9.0) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44MS4zIiwidXBkYXRlZEluVmVyIjoiNDIuODEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://git.3caravelle.net/3Caravelle/renovate/pulls/42 Co-authored-by: Renovate Bot <renovate-bot@3caravelle.com> Co-committed-by: Renovate Bot <renovate-bot@3caravelle.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Ember projects regularly use decorators on class fields with
declare, this is a new addition to babel and the babel project makes this same change, as a patch, to test against prettier. The author of the change also suggested prettier should ignoreDecoratorAbstractMethoderrors.Closes #19491
Checklist
docs/directory).changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.