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

Added support for this referencing inside firebase funcs #407

Closed
wants to merge 1 commit into from

Conversation

trickstival
Copy link
Collaborator

@trickstival trickstival commented Sep 28, 2019

The problem

When using typescript, it is not possible to access properties defined in this context. It warns that the defined props are not available in the scope with the message Error: "Property 'nameOfProp' doesn't exist on type Vue".

Proposed solution

I augmented VueConstructor type so it passes default typings around on extend function (which doesn't happen in Vue itself) and passed a CombinedInstance type as this for the firestore and firebase functions.

I'm not sure if that's a good approach, cause it messes up with Vue module definition.
If you know a better way of implementing this, pls share.

Still not fixed

  • I haven't figured out yet how to infer methods, data and computed properties types. For now, it only infers prop types and treats everything else as any

fix #399

@codecov-io
Copy link

codecov-io commented Sep 28, 2019

Codecov Report

Merging #407 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #407   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          14       14           
  Lines         368      368           
  Branches       64       64           
=======================================
  Hits          367      367           
  Misses          1        1
Impacted Files Coverage Δ
packages/vuefire/src/index.ts 100% <ø> (ø) ⬆️
packages/vuefire/src/rtdb.ts 100% <ø> (ø) ⬆️
packages/vuefire/src/firestore.ts 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef15b7e...3321189. Read the comment docs.

@TomKaltz
Copy link

What's the status here?

@trickstival
Copy link
Collaborator Author

I think there's a coverage problem, but I'm still waiting for the review

@posva
Copy link
Member

posva commented Dec 31, 2019

I'm not sure if there is a way to also type the methods and other properties. Maybe using the type of a method in a Vue instance we can infer this correctly. Having a partial type only is not enough

The coverage difference doesn't matter :)

@trickstival
Copy link
Collaborator Author

I'm not sure if I get what you mean by using the type of a method in a Vue instance. The typing code is getting pretty hard to follow.

@posva
Copy link
Member

posva commented Feb 7, 2020

The typing code is getting pretty hard to follow.

yeah, I know...

I mean that doing this.myMethod() should also work but currently it doesn't

@posva
Copy link
Member

posva commented Nov 18, 2022

Thank you for this and sorry I never came back again
This ended up changing quite a lot and this PR isn't relevant anymore. The progress of the latest release can be followed at #1241

@posva posva closed this Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong type of 'this' inside firestore() context
4 participants