fix: Add a catch-all overload for root.createBuffer#2339
Open
fix: Add a catch-all overload for root.createBuffer#2339
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (349 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
There was a problem hiding this comment.
Pull request overview
This PR adds a catch-all overload to the createBuffer method that accepts a union type for the second parameter, allowing either a callback function or raw data to be passed in. This enables better support for union types needed by @typegpu/react.
Changes:
- Added
NoInfer<TData>wrapper to the callback parameter in the firstcreateBufferoverload (line 839) with an explanatory comment - Added a new catch-all overload (lines 846-850) that accepts a union type combining both the callback and data initialization patterns
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4157a6e to
3e9bbee
Compare
3e9bbee to
dd2be7c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows a union type to be passed into
createBuffer, which is something I need for@typegpu/react