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

TSL: Missing overload for Fn and incorrect Node typing #1448

Closed
stofi opened this issue Dec 18, 2024 · 1 comment · Fixed by #1463 or #1464
Closed

TSL: Missing overload for Fn and incorrect Node typing #1448

stofi opened this issue Dec 18, 2024 · 1 comment · Fixed by #1463 or #1464

Comments

@stofi
Copy link

stofi commented Dec 18, 2024

Description

Declaring a Fn function without a Node return type throws a TypeScript error:

const computeFn = Fn(() => {}); 
// Error: Argument of type '() => void' is not assignable to parameter of type '() => Node'.

This results in a computeFn having an incorrect type, leading to further type errors when attempting to compute the function:

const computeNode = computeFn().compute();
// Error: Property 'compute' does not exist on type 'Node'.

It seems to only affects the type, the actual code runs without issues.

This issue was also mention on the Three.js discourse forum:
https://discourse.threejs.org/t/are-there-any-up-to-date-webgpu-169-examples/73378

I am willing to work on a pull request to fix this issue.

Environment:

"@types/three": "0.171"
"three": "0.171"
"typescript": "5.6.2"
"vite": "6.0.1"

Reproduction

A minimal reproducible example is available here:
https://github.com/stofi/three-types-tsl-fn-repro

@Methuselah96
Copy link
Contributor

Methuselah96 commented Dec 18, 2024

Feel feel to create a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants