Skip to content
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

Merged
merged 0 commits into from
Dec 5, 2018

Conversation

ktsn
Copy link
Member

@ktsn ktsn commented Mar 29, 2018

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:
I just remembered I wrote vue-template-compiler typings for my own project when seeing component-compiler-utils types 😄
It would be convenient for anyone who writes static analysis / customized compiler / build tools in TypeScript.

@ktsn ktsn changed the title feat: add vue-template-compiler types feat(types): add vue-template-compiler types Mar 29, 2018
static?: boolean;
isComment?: boolean;
// 2.4 ssr optimization
ssrOptimizability?: number;

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;

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

Copy link
Member

@HerringtonDarkholme HerringtonDarkholme left a 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.

@ktsn
Copy link
Member Author

ktsn commented Mar 31, 2018

@HerringtonDarkholme Fixed 🙂

}

interface CompiledResultFunctions {
render: (this: Vue) => VNode;

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!

Copy link
Member Author

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.

@wadetandy
Copy link

@HerringtonDarkholme @blake-newman Any chance we can get this merged soon? Would be a huge help!

@ypresto
Copy link

ypresto commented Aug 29, 2018

I'm depending on type def of complier found in @vue/component-compiler-utils. It has bad cohesion. Hoping this PR to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
2.6
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants