From 32279c97cec35bb02f8076ba7d6abef873af4806 Mon Sep 17 00:00:00 2001 From: Iwo Plaza Date: Wed, 1 Apr 2026 11:47:55 +0200 Subject: [PATCH 1/2] fix: Add a catch-all overload for root.createBuffer --- packages/typegpu/src/core/root/rootTypes.ts | 8 +++++++- packages/typegpu/tests/buffer.test.ts | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/typegpu/src/core/root/rootTypes.ts b/packages/typegpu/src/core/root/rootTypes.ts index e640007ab8..c5b30b6ff9 100644 --- a/packages/typegpu/src/core/root/rootTypes.ts +++ b/packages/typegpu/src/core/root/rootTypes.ts @@ -835,13 +835,19 @@ export interface TgpuRoot extends Unwrapper, WithBinding { */ createBuffer( typeSchema: ValidateBufferSchema, - initializer: (buffer: TgpuBuffer) => void, + // NoInfer is there to infer the schema type just based on the first parameter + initializer: (buffer: TgpuBuffer>) => void, ): TgpuBuffer; createBuffer( typeSchema: ValidateBufferSchema, // NoInfer is there to infer the schema type just based on the first parameter initial?: InferInput>, ): TgpuBuffer; + createBuffer( + typeSchema: ValidateBufferSchema, + // NoInfer is there to infer the schema type just based on the first parameter + initial?: ((buffer: TgpuBuffer>) => void) | InferInput>, + ): TgpuBuffer; /** * Allocates memory on the GPU, allows passing data between host and shader. diff --git a/packages/typegpu/tests/buffer.test.ts b/packages/typegpu/tests/buffer.test.ts index 11b1342c34..7b36edf1b7 100644 --- a/packages/typegpu/tests/buffer.test.ts +++ b/packages/typegpu/tests/buffer.test.ts @@ -727,7 +727,7 @@ describe('TgpuBuffer', () => { // @ts-expect-error: boolean is not allowed in buffer schemas attest(root.createBuffer(boolSchema)).type.errors.snap( - "Argument of type 'WgslStruct<{ a: U32; b: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\"'.", + "No overload matches this call.Overload 1 of 4, '(typeSchema: \"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\", initial?: InferInput>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\"'.\nOverload 2 of 4, '(typeSchema: \"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\"'", ); const nestedBoolSchema = d.struct({ @@ -742,7 +742,7 @@ describe('TgpuBuffer', () => { // @ts-expect-error: boolean is not allowed in buffer schemas attest(root.createBuffer(nestedBoolSchema)).type.errors.snap( - "Argument of type 'WgslStruct<{ a: U32; b: WgslStruct<{ c: F32; d: WgslStruct<{ e: Bool; }>; }>; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — in struct property 'd' — in struct property 'e' — Bool is not host-shareable, use U32 or I32 instead\"'.", + "No overload matches this call.Overload 1 of 4, '(typeSchema: \"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '\"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'.\nOverload 2 of 4, '(typeSchema: \"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '\"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'", ); }); @@ -759,7 +759,7 @@ describe('TgpuBuffer', () => { // @ts-expect-error attest(root.createBuffer(notFine)).type.errors.snap( - "Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '\"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'.", + "No overload matches this call.Overload 1 of 4, '(typeSchema: \"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '\"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'.\nOverload 2 of 4, '(typeSchema: \"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '\"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'", ); const alsoNotFine = d.struct({ @@ -770,7 +770,7 @@ describe('TgpuBuffer', () => { // @ts-expect-error attest(root.createBuffer(alsoNotFine)).type.errors.snap( - "Argument of type 'WgslStruct<{ a: U32; b: WgslArray; c: F32; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'.", + "No overload matches this call.Overload 1 of 4, '(typeSchema: \"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput; c: F32; }>>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: WgslArray; c: F32; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'.\nOverload 2 of 4, '(typeSchema: \"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput; c: F32; }>>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: WgslArray; c: F32; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'", ); }); From a7bbc797acd9178fdbe55dcec2e1b9fafaa2c419 Mon Sep 17 00:00:00 2001 From: Iwo Plaza Date: Wed, 8 Apr 2026 14:22:47 +0200 Subject: [PATCH 2/2] Maybe fix --- packages/typegpu/src/core/root/rootTypes.ts | 21 ++++++++++++--- packages/typegpu/tests/buffer.test.ts | 11 +++++--- .../typegpu/tests/bufferShorthands.test.ts | 27 ++++++++++++------- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/packages/typegpu/src/core/root/rootTypes.ts b/packages/typegpu/src/core/root/rootTypes.ts index c5b30b6ff9..e6c5c8bf66 100644 --- a/packages/typegpu/src/core/root/rootTypes.ts +++ b/packages/typegpu/src/core/root/rootTypes.ts @@ -873,13 +873,18 @@ export interface TgpuRoot extends Unwrapper, WithBinding { */ createUniform( typeSchema: ValidateUniformSchema, - initializer: (buffer: TgpuBuffer) => void, + initializer: (buffer: TgpuBuffer>) => void, ): TgpuUniform; createUniform( typeSchema: ValidateUniformSchema, // NoInfer is there to infer the schema type just based on the first parameter initial?: InferInput>, ): TgpuUniform; + createUniform( + typeSchema: ValidateUniformSchema, + // NoInfer is there to infer the schema type just based on the first parameter + initial?: ((buffer: TgpuBuffer>) => void) | InferInput>, + ): TgpuUniform; /** * Allocates memory on the GPU, allows passing data between host and shader. @@ -904,13 +909,18 @@ export interface TgpuRoot extends Unwrapper, WithBinding { */ createMutable( typeSchema: ValidateStorageSchema, - initializer: (buffer: TgpuBuffer) => void, + initializer: (buffer: TgpuBuffer>) => void, ): TgpuMutable; createMutable( typeSchema: ValidateStorageSchema, // NoInfer is there to infer the schema type just based on the first parameter initial?: InferInput>, ): TgpuMutable; + createMutable( + typeSchema: ValidateStorageSchema, + // NoInfer is there to infer the schema type just based on the first parameter + initial?: ((buffer: TgpuBuffer>) => void) | InferInput>, + ): TgpuMutable; /** * Allocates memory on the GPU, allows passing data between host and shader. @@ -935,13 +945,18 @@ export interface TgpuRoot extends Unwrapper, WithBinding { */ createReadonly( typeSchema: ValidateStorageSchema, - initializer: (buffer: TgpuBuffer) => void, + initializer: (buffer: TgpuBuffer>) => void, ): TgpuReadonly; createReadonly( typeSchema: ValidateStorageSchema, // NoInfer is there to infer the schema type just based on the first parameter initial?: InferInput>, ): TgpuReadonly; + createReadonly( + typeSchema: ValidateStorageSchema, + // NoInfer is there to infer the schema type just based on the first parameter + initial?: ((buffer: TgpuBuffer>) => void) | InferInput>, + ): TgpuReadonly; /** * Allocates memory on the GPU, allows passing data between host and shader. diff --git a/packages/typegpu/tests/buffer.test.ts b/packages/typegpu/tests/buffer.test.ts index 7b36edf1b7..f1938683f4 100644 --- a/packages/typegpu/tests/buffer.test.ts +++ b/packages/typegpu/tests/buffer.test.ts @@ -727,7 +727,7 @@ describe('TgpuBuffer', () => { // @ts-expect-error: boolean is not allowed in buffer schemas attest(root.createBuffer(boolSchema)).type.errors.snap( - "No overload matches this call.Overload 1 of 4, '(typeSchema: \"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\", initial?: InferInput>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\"'.\nOverload 2 of 4, '(typeSchema: \"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\"'", + "No overload matches this call.Overload 1 of 4, '(typeSchema: \"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\", initial?: InferInput>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\"'.\nOverload 2 of 4, '(typeSchema: \"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — Bool is not host-shareable, use U32 or I32 instead\"'.", ); const nestedBoolSchema = d.struct({ @@ -742,7 +742,8 @@ describe('TgpuBuffer', () => { // @ts-expect-error: boolean is not allowed in buffer schemas attest(root.createBuffer(nestedBoolSchema)).type.errors.snap( - "No overload matches this call.Overload 1 of 4, '(typeSchema: \"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '\"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'.\nOverload 2 of 4, '(typeSchema: \"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '\"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) in struct property 'b' — in struct property 'd' — in struct property 'e' — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput; }>>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: WgslStruct<{ c: F32; d: WgslStruct<{ e: Bool; }>; }>; }>' is not assignable to parameter of type '"(Error) in struct property 'b' — in struct property 'd' — in struct property 'e' — Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) in struct property 'b' — in struct property 'd' — in struct property 'e' — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput; }>>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: WgslStruct<{ c: F32; d: WgslStruct<{ e: Bool; }>; }>; }>' is not assignable to parameter of type '"(Error) in struct property 'b' — in struct property 'd' — in struct property 'e' — Bool is not host-shareable, use U32 or I32 instead"'.`, ); }); @@ -759,7 +760,8 @@ describe('TgpuBuffer', () => { // @ts-expect-error attest(root.createBuffer(notFine)).type.errors.snap( - "No overload matches this call.Overload 1 of 4, '(typeSchema: \"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '\"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'.\nOverload 2 of 4, '(typeSchema: \"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '\"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead", initial?: InferInput>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U16; b: U32; }>' is not assignable to parameter of type '"(Error) in struct property 'a' — U16 is only usable inside arrays for index buffers, use U32 or I32 instead"'.`, ); const alsoNotFine = d.struct({ @@ -770,7 +772,8 @@ describe('TgpuBuffer', () => { // @ts-expect-error attest(root.createBuffer(alsoNotFine)).type.errors.snap( - "No overload matches this call.Overload 1 of 4, '(typeSchema: \"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput; c: F32; }>>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: WgslArray; c: F32; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'.\nOverload 2 of 4, '(typeSchema: \"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\", initial?: InferInput; c: F32; }>>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: WgslArray; c: F32; }>' is not assignable to parameter of type '\"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead\"'", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead", initial?: InferInput; c: F32; }>>> | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: WgslArray; c: F32; }>' is not assignable to parameter of type '"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead", initial?: InferInput; c: F32; }>>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuBuffer<...>', gave the following error.Argument of type 'WgslStruct<{ a: U32; b: WgslArray; c: F32; }>' is not assignable to parameter of type '"(Error) in struct property 'b' — in array element — U16 is only usable inside arrays for index buffers, use U32 or I32 instead"'.`, ); }); diff --git a/packages/typegpu/tests/bufferShorthands.test.ts b/packages/typegpu/tests/bufferShorthands.test.ts index c39f080a38..7f0301e963 100644 --- a/packages/typegpu/tests/bufferShorthands.test.ts +++ b/packages/typegpu/tests/bufferShorthands.test.ts @@ -35,17 +35,20 @@ describe('root.createMutable', () => { it('does not accept non-host-shareable schemas', ({ root }) => { // @ts-expect-error: bool is not allowed in mutable schemas attest(() => root.createMutable(d.bool)).type.errors.snap( - "Argument of type 'Bool' is not assignable to parameter of type '\"(Error) Bool is not host-shareable, use U32 or I32 instead\"'.", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput> | undefined): TgpuMutable', gave the following error.Argument of type 'Bool' is not assignable to parameter of type '"(Error) Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput> | ((buffer: TgpuBuffer>) => void) | undefined): TgpuMutable<...>', gave the following error.Argument of type 'Bool' is not assignable to parameter of type '"(Error) Bool is not host-shareable, use U32 or I32 instead"'.`, ); // @ts-expect-error: bool is not allowed in mutable schemas attest(() => root.createMutable(d.arrayOf(d.bool, 16))).type.errors.snap( - "Argument of type 'WgslArray' is not assignable to parameter of type '\"(Error) in array element — Bool is not host-shareable, use U32 or I32 instead\"'.", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) in array element — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | undefined): TgpuMutable<...>', gave the following error.Argument of type 'WgslArray' is not assignable to parameter of type '"(Error) in array element — Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) in array element — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuMutable<...>', gave the following error.Argument of type 'WgslArray' is not assignable to parameter of type '"(Error) in array element — Bool is not host-shareable, use U32 or I32 instead"'.`, ); // @ts-expect-error: bool is not allowed in mutable schemas attest(() => root.createMutable(d.struct({ foo: d.bool }))).type.errors.snap( - "Argument of type 'WgslStruct<{ foo: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead\"'.", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | undefined): TgpuMutable<...>', gave the following error.Argument of type 'WgslStruct<{ foo: Bool; }>' is not assignable to parameter of type '"(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuMutable<...>', gave the following error.Argument of type 'WgslStruct<{ foo: Bool; }>' is not assignable to parameter of type '"(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead"'.`, ); }); }); @@ -74,17 +77,20 @@ describe('root.createReadonly', () => { it('does not accept non-host-shareable schemas', ({ root }) => { // @ts-expect-error: bool is not allowed in readonly schemas attest(() => root.createReadonly(d.bool)).type.errors.snap( - "Argument of type 'Bool' is not assignable to parameter of type '\"(Error) Bool is not host-shareable, use U32 or I32 instead\"'.", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput> | undefined): TgpuReadonly', gave the following error.Argument of type 'Bool' is not assignable to parameter of type '"(Error) Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput> | ((buffer: TgpuBuffer>) => void) | undefined): TgpuReadonly<...>', gave the following error.Argument of type 'Bool' is not assignable to parameter of type '"(Error) Bool is not host-shareable, use U32 or I32 instead"'.`, ); // @ts-expect-error: bool is not allowed in readonly schemas attest(() => root.createReadonly(d.arrayOf(d.bool, 16))).type.errors.snap( - "Argument of type 'WgslArray' is not assignable to parameter of type '\"(Error) in array element — Bool is not host-shareable, use U32 or I32 instead\"'.", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) in array element — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | undefined): TgpuReadonly<...>', gave the following error.Argument of type 'WgslArray' is not assignable to parameter of type '"(Error) in array element — Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) in array element — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuReadonly<...>', gave the following error.Argument of type 'WgslArray' is not assignable to parameter of type '"(Error) in array element — Bool is not host-shareable, use U32 or I32 instead"'.`, ); // @ts-expect-error: bool is not allowed in readonly schemas attest(() => root.createReadonly(d.struct({ foo: d.bool }))).type.errors.snap( - "Argument of type 'WgslStruct<{ foo: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead\"'.", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | undefined): TgpuReadonly<...>', gave the following error.Argument of type 'WgslStruct<{ foo: Bool; }>' is not assignable to parameter of type '"(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuReadonly<...>', gave the following error.Argument of type 'WgslStruct<{ foo: Bool; }>' is not assignable to parameter of type '"(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead"'.`, ); }); }); @@ -113,17 +119,20 @@ describe('root.createUniform', () => { it('does not accept non-host-shareable schemas', ({ root }) => { // @ts-expect-error: bool is not allowed in uniform schemas attest(() => root.createUniform(d.bool)).type.errors.snap( - "Argument of type 'Bool' is not assignable to parameter of type '\"(Error) Bool is not host-shareable, use U32 or I32 instead\"'.", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput> | undefined): TgpuUniform', gave the following error.Argument of type 'Bool' is not assignable to parameter of type '"(Error) Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput> | ((buffer: TgpuBuffer>) => void) | undefined): TgpuUniform<...>', gave the following error.Argument of type 'Bool' is not assignable to parameter of type '"(Error) Bool is not host-shareable, use U32 or I32 instead"'.`, ); // @ts-expect-error: bool is not allowed in uniform schemas attest(() => root.createUniform(d.arrayOf(d.bool, 16))).type.errors.snap( - "Argument of type 'WgslArray' is not assignable to parameter of type '\"(Error) in array element — Bool is not host-shareable, use U32 or I32 instead\"'.", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) in array element — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | undefined): TgpuUniform<...>', gave the following error.Argument of type 'WgslArray' is not assignable to parameter of type '"(Error) in array element — Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) in array element — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuUniform<...>', gave the following error.Argument of type 'WgslArray' is not assignable to parameter of type '"(Error) in array element — Bool is not host-shareable, use U32 or I32 instead"'.`, ); // @ts-expect-error: bool is not allowed in uniform schemas attest(() => root.createUniform(d.struct({ foo: d.bool }))).type.errors.snap( - "Argument of type 'WgslStruct<{ foo: Bool; }>' is not assignable to parameter of type '\"(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead\"'.", + `No overload matches this call.Overload 1 of 4, '(typeSchema: "(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | undefined): TgpuUniform<...>', gave the following error.Argument of type 'WgslStruct<{ foo: Bool; }>' is not assignable to parameter of type '"(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead"'. +Overload 2 of 4, '(typeSchema: "(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead", initial?: InferInput>> | ((buffer: TgpuBuffer<...>) => void) | undefined): TgpuUniform<...>', gave the following error.Argument of type 'WgslStruct<{ foo: Bool; }>' is not assignable to parameter of type '"(Error) in struct property 'foo' — Bool is not host-shareable, use U32 or I32 instead"'.`, ); }); });