-
Notifications
You must be signed in to change notification settings - Fork 622
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
generic type for shaderMaterial, exposing uniform props #1602
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit af564ee:
|
So when I saw failing CI stuff before I couldn't see the actual errors and I wasn't sure if it was to do with actual problems in the actual code vs not running properly because of who I was or something. I realised the thing that was failing was an existing use of So I still think the change I made in the PR is basically a good one - I'd certainly prefer to have this type inferred, and for that to - but there could be user-code that would get broken in a similar way if it got through to a release. I'm also not entirely sure that the way I fixed issues with existing code in my last commit is necessarily the best - still had some niggles with getting it . |
Why
I and at least one other person were having trouble with the type of
shaderMaterial
, as discussed in this StackOverflow question.Actually, as of this writing I'm not really entirely sure what the relationship to
useRef
is, but this seems like the right approach for the returned type ofshaderMaterial
.What
I've added a type parameter to
shaderMaterial
, inferred from the type of theuniforms
argument, and intersected that with the returned material type. As such, the type of the returned value should reflect the fact that each of the uniforms is available as a prop of appropriate type.Checklist