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
Add support for Vue "Generic Components" #15066
Add support for Vue "Generic Components" #15066
Conversation
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.
LGTM, thank you!
textToDoc, | ||
{ | ||
parser: "babel-ts", | ||
__isVueScriptGeneric: true, |
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.
Do you think we should use a better name for this flag? Plugins like prettier-plugin-pug
may use it in future, we'll not able to change it.
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.
Sounds good, something like __isEmbeddedTypescriptGenericParameters
?
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.
Sounds good.
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 pushed this change. Maybe then we should rename printVueScriptGenericAttributeValue
? Because it doesn't contain vue-specific logic. And I guess if somebody in future will use __isEmbeddedTypescriptGenericParameters
, he probably will be required to duplicate at least this statement
return formatAttributeValue(
`type T<${value}> = any`,
textToDoc,
{
parser: "babel-ts",
__isEmbeddedTypescriptGenericParameters: true,
},
shouldHugJsExpression,
);
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.
This file is internal, we can rename it anytime we want, but I'll be fine if you want to rename it.
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.
Okay, if we can rename it after, this is fine! Let's leave it as it is. If I need to fix anything else, let me know :)
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.
One changelog comment
@@ -0,0 +1,24 @@ | |||
#### Add support for Vue "Generic Components" (#15066 by @auvred) | |||
|
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.
Can you add the link to https://blog.vuejs.org/posts/vue-3-3#generic-components ?
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.
Done :)
* add support for vue generic components * add changelog and remove duplicated test case * refactor * rename file + simplify isVueScriptTag usage * __isVueScriptGeneric -> __isEmbeddedTypescriptGenericParameters * add link to blog post to changelog
Description
Closes #14864
Checklist
docs/
directory).changelog_unreleased/*/XXXX.md
file followingchangelog_unreleased/TEMPLATE.md
.✨Try the playground for this PR✨