Skip to content

fix: Add explicit type annotation to constant declarations #1382

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

Merged
merged 3 commits into from
Jun 20, 2025

Conversation

reczkok
Copy link
Contributor

@reczkok reczkok commented Jun 18, 2025

For example if we did:

const nums = tgpu['~unstable'].const(d.arrayOf(d.u32, 4), [1,2,3,4]);

It will get resolved to:

const nums_0 = array(1,2,3,4);

So we get an array of i32 instead. This PR makes the types explicit so we don't have to deal with that.
After:

const nums_0: array<u32, 4> = array(1,2,3,4);

closes #1383

Copy link

github-actions bot commented Jun 18, 2025

pkg.pr.new

packages

pnpm i https://pkg.pr.new/software-mansion/TypeGPU/typegpu@1382
pnpm i https://pkg.pr.new/software-mansion/TypeGPU/typegpu@35185ea4bd6231f6163b4b4179f0f672f170502a

benchmark
view benchmark

commit
view commit

Copy link
Collaborator

@iwoplaza iwoplaza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome change, yes please! 👏

@reczkok reczkok merged commit 4d64cf4 into main Jun 20, 2025
6 checks passed
@reczkok reczkok deleted the fix/const-types branch June 20, 2025 09:18
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

Successfully merging this pull request may close these issues.

fix: Mistyped constants
2 participants