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

TypeScript support #160

Merged
merged 2 commits into from
Dec 22, 2017
Merged

TypeScript support #160

merged 2 commits into from
Dec 22, 2017

Conversation

joe-re
Copy link
Contributor

@joe-re joe-re commented Dec 1, 2017

Many Vue projects have TypeScript declarations inside itself and support TypeScript.
vue-router, vuex, etc...

I want to support TypeScript on our project too.

I implement typescript declarations and run typed test for this example.
(added yarn run test:types command)

I thought I checked all the APIs, but please let me know if there are missing parts.

@joe-re
Copy link
Contributor Author

joe-re commented Dec 1, 2017

ref: #54

@Akryum
Copy link
Member

Akryum commented Dec 1, 2017

Thanks a lot for your PR! I'll check it out when I have some time. 😉

@salticus
Copy link

salticus commented Dec 20, 2017

@joe-re, thank you!
For the impatient I put these changes in a repository. yarn add https://github.com/salticus/types-vue-apollo#v0.0.1 will hopefully take care of satisfying typescript for vue-apollo (it has for us so far.)

(This is just a temporary hack for those trying to get started quickly; the repository will not be maintained and may well disappear after typescript definitions are included with vue-apollo.)

export class VueApollo implements PluginObject<{}> {
[key: string]: any;
install: PluginFunction<{}>;
constructor (options: {defaultClient: ApolloClient<{}>});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we also need defaultOptions key here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed it. Is this right? 230078a

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just starting to work with Vue Apollo and I'm not really sure what all defaultOptions are. I can't see them in the documentaion. Maybe @Akryum can confirm that.

On the other hand looks like there are more constructor options as mentioned in the docs here and please see the source code here

By the way, great work putting this together! 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Akryum Akryum merged commit 8dcdb92 into vuejs:next Dec 22, 2017
@joe-re joe-re deleted the typescript-support branch December 22, 2017 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants