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

ref prop missing type for functional ref #427

Closed
5 tasks done
PatrickByrn opened this issue Oct 29, 2023 · 0 comments · Fixed by #428
Closed
5 tasks done

ref prop missing type for functional ref #427

PatrickByrn opened this issue Oct 29, 2023 · 0 comments · Fixed by #428

Comments

@PatrickByrn
Copy link
Contributor

Describe the bug

Current type definitions don't allow for a function to be passed to the ref prop of a component, so any time you use a functional ref you'll run into a type error.

Apologies for not including a reproduction or sample but this should be quick to recreate in any dev environment with the reproduction steps.

Reproduction

/

Steps to reproduce

  1. Install tresjs in any project
  2. Add TresCanvas
  3. Add new ref, and function to populate ref
    const sphereRefs = ref<Object3D[]>([]);
    const setSphereRefs = (el: any) => { if (el && !sphereRefs.value.includes(el)) { sphereRefs.value.push(el); } };
  4. Add TresGroup, TresMesh, etc...
  5. Pass a function to the ref property :ref="(el) => "setSphereRef(el)"
  6. Type error pops up indicating this isn't a valid value for the ref prop despite this being a common use for the ref prop.

System Info

No response

Used Package Manager

yarn

Code of Conduct

PatrickByrn pushed a commit to PatrickByrn/tres that referenced this issue Oct 29, 2023
…add number and symbol

Updated `ref` in VueProps to use `VNodeRef` type from vue, to support using a function ref. Also updated key to accept numbers and symbols

Tresjs#427 Tresjs#427
alvarosabu pushed a commit that referenced this issue Oct 30, 2023
…mber and symbol (#428)

Updated `ref` in VueProps to use `VNodeRef` type from vue, to support using a function ref. Also updated key to accept numbers and symbols

#427 #427

Co-authored-by: Patrick Byrn <[email protected]>
manuel139 pushed a commit to manuel139/tres that referenced this issue Sep 4, 2024
…mber and symbol (#428)

Updated `ref` in VueProps to use `VNodeRef` type from vue, to support using a function ref. Also updated key to accept numbers and symbols

#427 Tresjs/tres#427

Co-authored-by: Patrick Byrn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant