software-mansion / TypeGPU

TypeScript library that enhances the WebGPU API, allowing resource management in a type-safe, declarative way.
http://typegpu.com
MIT License
143 stars 2 forks source link

Reworked all callables to not use Function inheritance. #300

Closed iwoplaza closed 1 month ago

reczkok commented 1 month ago

When calling makeVecSchema we no longer need to cast as unknown first.

export const vec2i = makeVecSchema({
  unitType: i32,
  byteAlignment: 8,
  length: 2,
  label: 'vec2i',
  make: (x: number, y: number) => new vec2iImpl(x, y),
  makeFromScalar: (x) => new vec2iImpl(x, x),
-}) as unknown as Vec2i;
+}) as Vec2i;

The same goes for matrices.