New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect removal of parentheses when using an infer
with a constraint in a function predicate
#14279
Conversation
// #14275 | ||
type Test<T> = T extends (( | ||
token: TSESTree.Token | ||
) => token is infer U extends TSESTree.Token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bradzacher Is it possible to be longer/deeper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it can be any deeper. I'm not 100% certain though. You could probably nest more conditionals in place of the TSESTree.Token
- would be worth playing to see what's allowed syntactically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems possible and I don't know how to fix, I'm going to pretend I don't know. ac1aac1
infer
with a constraint in a function predicate
This reverts commit ac1aac1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know this edge case bug!
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [prettier](https://prettier.io) ([source](https://github.com/prettier/prettier)) | devDependencies | patch | [`2.8.3` -> `2.8.4`](https://renovatebot.com/diffs/npm/prettier/2.8.3/2.8.4) | --- ### Release Notes <details> <summary>prettier/prettier</summary> ### [`v2.8.4`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#​284) [Compare Source](prettier/prettier@2.8.3...2.8.4) [diff](prettier/prettier@2.8.3...2.8.4) ##### Fix leading comments in mapped types with `readonly` ([#​13427](prettier/prettier#13427) by [@​thorn0](https://github.com/thorn0), [@​sosukesuzuki](https://github.com/sosukesuzuki)) <!-- prettier-ignore --> ```tsx // Input type Type = { // comment readonly [key in Foo]; }; // Prettier 2.8.3 type Type = { readonly // comment [key in Foo]; }; // Prettier 2.8.4 type Type = { // comment readonly [key in Foo]; }; ``` ##### Group params in opening block statements ([#​14067](prettier/prettier#14067) by [@​jamescdavis](https://github.com/jamescdavis)) This is a follow-up to [#​13930](prettier/prettier#13930) to establish wrapping consistency between opening block statements and else blocks by grouping params in opening blocks. This causes params to break to a new line together and not be split across lines unless the length of params exceeds the print width. This also updates the else block wrapping to behave exactly the same as opening blocks. <!-- prettier-ignore --> ```hbs {{! Input }} {{#block param param param param param param param param param param as |blockParam|}} Hello {{else block param param param param param param param param param param as |blockParam|}} There {{/block}} {{! Prettier 2.8.3 }} {{#block param param param param param param param param param param as |blockParam| }} Hello {{else block param param param param param param param param param param}} There {{/block}} {{! Prettier 2.8.4 }} {{#block param param param param param param param param param param as |blockParam| }} Hello {{else block param param param param param param param param param param as |blockParam| }} There {{/block}} ``` ##### Ignore files in `.sl/` ([#​14206](prettier/prettier#14206) by [@​bolinfest](https://github.com/bolinfest)) In [Sapling SCM](https://sapling-scm.com/), `.sl/` is the folder where it stores its state, analogous to `.git/` in Git. It should be ignored in Prettier like the other SCM folders. ##### Recognize `@satisfies` in Closure-style type casts ([#​14262](prettier/prettier#14262) by [@​fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```jsx // Input const a = /** @​satisfies {Record<string, string>} */ ({hello: 1337}); const b = /** @​type {Record<string, string>} */ ({hello: 1337}); // Prettier 2.8.3 const a = /** @​satisfies {Record<string, string>} */ { hello: 1337 }; const b = /** @​type {Record<string, string>} */ ({ hello: 1337 }); // Prettier 2.8.4 const a = /** @​satisfies {Record<string, string>} */ ({hello: 1337}); const b = /** @​type {Record<string, string>} */ ({hello: 1337}); ``` ##### Fix parens in inferred function return types with `extends` ([#​14279](prettier/prettier#14279) by [@​fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```ts // Input type Foo<T> = T extends ((a) => a is infer R extends string) ? R : never; // Prettier 2.8.3 (First format) type Foo<T> = T extends (a) => a is infer R extends string ? R : never; // Prettier 2.8.3 (Second format) SyntaxError: '?' expected. // Prettier 2.8.4 type Foo<T> = T extends ((a) => a is infer R extends string) ? R : never; ``` </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:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMjUuMSIsInVwZGF0ZWRJblZlciI6IjM0LjEyOC4zIn0=--> Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1775 Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
…straint in a function predicate (prettier#14279)
Description
Fixes #14275
Related #13289
Checklist
docs/
directory).changelog_unreleased/*/XXXX.md
file followingchangelog_unreleased/TEMPLATE.md
.✨Try the playground for this PR✨