software-mansion / software-mansion/TypeGPU

impr: Better error message for mismatched attribute type

Open
#1,114 0 comments 0 reactions 1 assignee View on GitHub

@iwoplaza is already working on this.

Since Apr 8, 2025.

enhancement
Dominant language
TypeScript
Stars
3.2k
Forks
122
Avg merge
3d 5h
Merged PRs (30d)
34

Description

(After merging #1113)

const foo = d.interpolate('flat', d.location(0, d.mat4x4f));

This snippet produces the following error:

No overload matches this call.
  Overload 1 of 2, '(interpolationType: "perspective" | "linear" | "perspective, center" | "perspective, centroid" | "perspective, sample" | "linear, center" | "linear, centroid" | "linear, sample", data: PerspectiveOrLinearInterpolatableData | Decorated<...>): Decorated<...>', gave the following error.
    Argument of type '"flat"' is not assignable to parameter of type '"perspective" | "linear" | "perspective, center" | "perspective, centroid" | "perspective, sample" | "linear, center" | "linear, centroid" | "linear, sample"'.
  Overload 2 of 2, '(interpolationType: "flat", data: FlatInterpolatableData | Decorated<FlatInterpolatableData, unknown[]>): Decorated<FlatInterpolatableData, [...] | [...]>', gave the following error.
    Argument of type 'Decorated<Mat4x4f, [Location<0>]>' is not assignable to parameter of type 'FlatInterpolatableData | Decorated<FlatInterpolatableData, unknown[]>'.
      Type 'Decorated<Mat4x4f, [Location<0>]>' is not assignable to type 'Decorated<FlatInterpolatableData, unknown[]>'.
        Type 'Mat4x4f' is not assignable to type 'FlatInterpolatableData'.
          Type 'Mat4x4f' is not assignable to type 'F32'.
            Types of property 'type' are incompatible.
              Type '"mat4x4f"' is not assignable to type '"f32"'.ts(2769)
attributes.ts(255, 17): The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.