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

Add TypeScript support and examples #21

Open
rominf opened this issue Jan 7, 2019 · 11 comments
Open

Add TypeScript support and examples #21

rominf opened this issue Jan 7, 2019 · 11 comments

Comments

@rominf
Copy link

rominf commented Jan 7, 2019

I couldn't get it to work in Vue.js TypeScript project.

@assemblethis
Copy link

Nor could I. I'm digging into this issue now. I'm trying to use pouch in a Vue.js PWA/TypeScript project using the new Vue CLI 3.

I'll come back with some more details.

@assemblethis
Copy link

assemblethis commented Jan 16, 2019

I've added a TypeScript example that's working for me. It's probably not great, but it's a start:

https://github.com/assemblethis/pouch-vue/blob/master/README.md

@rominf
Copy link
Author

rominf commented Jan 16, 2019

Nice, thank you! But ignoring tslint errors is not very good...

@assemblethis
Copy link

Are you referring to the @ts-ignore syntax:? I read the following article "Don’t let TypeScript slow you down" (https://medium.com/@vitalyb/dont-let-typescript-slow-you-down-92d394ec8c9f) and it suggested using the @ts-ignore syntax with third party libraries that don't natively support typescript since add-on packages can get out of date and cause further problems. It made an argument that: "If you’re using a library that natively supports TypeScript this shouldn’t concern you. If the library doesn’t, then just use it without types."

@rominf
Copy link
Author

rominf commented Jan 16, 2019

Yes, I'm referring to the @ts-ignore. I think I will use it as you wrote, but I'm waiting for TypeScript support :)

@assemblethis
Copy link

If you improve upon the example, please share. I'm new to TypeScript.

@rominf
Copy link
Author

rominf commented Jan 16, 2019

I'm new to TypeScript too :)

@assemblethis
Copy link

I switched over to the recommended fork of this project at https://github.com/MDSLKTR/pouch-vue

My TypeScript example still works with the fork. Some reason called pouch-vue now instead of vue-pouch.

I'm going to test out authentication this week. I'll let you know how it goes.

@assemblethis
Copy link

Two auth issues uncovered with the fork at https://github.com/MDSLKTR/pouch-vue

  1. Closed: AuthSession cookie not included in all requests to couch db MDSLKTR/pouch-vue#3
  2. Open: AuthSession cookie expiration - does not get renewed MDSLKTR/pouch-vue#4

So far so good, outlook is hopeful that auth will work as needed for my PWA project.

@assemblethis
Copy link

I'm contemplating creating an ES6 module for the fork and including typings for TS.

@assemblethis
Copy link

I've got a pull request to include typescript support for the pouch-vue project which is the successor to this project: MDSLKTR/pouch-vue#9

It might have what you need.

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

No branches or pull requests

2 participants