Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upTypeScript generics are removed incorrectly #5817
Comments
This comment has been minimized.
This comment has been minimized.
Regression from #5799. cc @JamesHenry |
This comment has been minimized.
This comment has been minimized.
@JounQin Sorry for the inconvenience, the temporary workaround (#5818) is released in 1.16.3. Prettier 1.16.3 --parser typescript Input: export default {
load<K, T>(k: K, t: T) {
return {k, t};
}
} Output: export default {
load<K, T>(k: K, t: T) {
return { k, t };
}
};
|
This comment has been minimized.
This comment has been minimized.
Thanks for pushing out a patch @ikatyang, I'm guessing we were just missing coverage for this in the prettier tests? I can work on it and restore the updated version of typescript-estree |
This comment has been minimized.
This comment has been minimized.
Yeah, we probably just need to fix this missing case. It's still the updated version (the OP can be reproduced) on master as I only reverted it in the 1.16 branch. |
This comment has been minimized.
This comment has been minimized.
This is because the parser puts the |
This comment has been minimized.
This comment has been minimized.
That sounds like a parser bug to me; it's not otherwise possible to have any kind of generics on properties But if it works... |
This comment has been minimized.
This comment has been minimized.
@j-f1 Did you not see this? #5817 (comment) I worked on this, just hadn't opened a PR yet. I found the AST oddity yesterday and @armano2 and I agreed that it shouldn't be the case and we need to diverge from babel there (and report it) |
This comment has been minimized.
This comment has been minimized.
Should I close this PR then? |
This comment has been minimized.
This comment has been minimized.
No, it's the same solution, but obviously want to avoid situations where multiple people are doing the same work |
This comment has been minimized.
This comment has been minimized.
Yeah, I didn’t see your comment when I was making the PR. Sorry about that. |
This comment has been minimized.
This comment has been minimized.
All good |
This comment has been minimized.
This comment has been minimized.
looks like there is few more issues here:
|
This comment has been minimized.
This comment has been minimized.
Oh wow, merging the PR on the other repo caused this issue to be closed. I'm guessing it piggybacked my permissions on both repos? Don't think I've ever seen that before |
This comment has been minimized.
This comment has been minimized.
Yeah, that’s one of the features of GitHub that comes in handy every so often. |
resolves the issue with generics in object methods in TypeScript and passes the test proposed in the following PR: prettier#5824 resolves prettier#5817
as proposed by @j-f1 in the following PR: prettier#5824 should validate that prettier#5817 does not reappear Co-authored-by: Jed Fox <git@twopointzero.us> Co-authored-by: Christopher J. Brody <chris@brody.consulting>
This comment has been minimized.
This comment has been minimized.
I think this issue is now resolved by PR #6027 (TS 3.4 update which includes |
This comment has been minimized.
This comment has been minimized.
I think we need merge test before close this to avoid regressions in future |
as proposed by @j-f1 in the following PR: prettier#5824 should validate that issue prettier#5817 does not reappear closes prettier#5817 as resolved and tested Co-authored-by: Jed Fox <git@twopointzero.us> Co-authored-by: Christopher J. Brody <chris@brody.consulting>
This comment has been minimized.
This comment has been minimized.
The commit I proposed in PR #5989 should automatically close this issue as resolved and tested. Thanks @evilebottnawi for your attention:) |
as proposed by @j-f1 in the following PR: prettier#5824 should validate that issue prettier#5817 does not reappear this change closes prettier#5817 as resolved and tested this change closes prettier#5824 (PR prettier#5824) as superseded Co-authored-by: Jed Fox <git@twopointzero.us> Co-authored-by: Christopher J. Brody <chris@brody.consulting>
Prettier 1.16.2
Playground link
Input:
Output:
Expected behavior:
preserve TypeScript generics