-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
feat(types): add vue-template-compiler types #7918
Conversation
static?: boolean; | ||
isComment?: boolean; | ||
// 2.4 ssr optimization | ||
ssrOptimizability?: number; |
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.
Is it better to add specific literal type to model optimization? IIRC ssrOptimizability has a enum like constants.
} | ||
|
||
interface CompiledResultFunctions { | ||
render: Function; |
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.
We can provide a more precise type: () => VNode
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.
Thanks! It will be helpful for third party authors to hook Vue compiler!
There are still some improvements we can do before merge. After that it is good to go.
@HerringtonDarkholme Fixed 🙂 |
} | ||
|
||
interface CompiledResultFunctions { | ||
render: (this: Vue) => VNode; |
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 know whether this
annotation will work. I have encountered problem before due to Vue is an invariant generic, which causes assignment problems in strict variance mode. A test case might be good. Or leaving this annotation is also acceptable to me.
Other than this, this pull request looks good to me!
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 agree. I just removed the this type annotation.
@HerringtonDarkholme @blake-newman Any chance we can get this merged soon? Would be a huge help! |
I'm depending on type def of complier found in |
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
dev
branch for v2.x (or to a previous version branch), not themaster
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information:
I just remembered I wrote
vue-template-compiler
typings for my own project when seeingcomponent-compiler-utils
types 😄It would be convenient for anyone who writes static analysis / customized compiler / build tools in TypeScript.