File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import type { AnyData } from '../../data/dataTypes.ts';
1010type MapValueToDataType < T > = { [ K in keyof T ] : AnyData } ;
1111
1212interface DualImplOptions < T extends ( ...args : never [ ] ) => unknown > {
13- readonly name : string ;
13+ readonly name : string | undefined ;
1414 readonly normalImpl : T | string ;
1515 readonly codegenImpl : ( ...args : MapValueToSnippet < Parameters < T > > ) => string ;
1616 readonly signature :
@@ -105,7 +105,7 @@ export function dualImpl<T extends (...args: never[]) => unknown>(
105105 } ) as T ;
106106
107107 setName ( impl , options . name ) ;
108- impl . toString = ( ) => options . name ;
108+ impl . toString = ( ) => options . name ?? '<unknown>' ;
109109 Object . defineProperty ( impl , $internal , {
110110 value : {
111111 jsImpl : options . normalImpl ,
Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ function createFn<ImplSchema extends AnyFn>(
218218 } as This ;
219219
220220 const call = dualImpl < InferImplSchema < ImplSchema > > ( {
221- name : 'tgpuFnCall' ,
221+ name : undefined , // the name is forwarded to the core anyway
222222 noComptime : true ,
223223 signature : { argTypes : shell . argTypes , returnType : shell . returnType } ,
224224 normalImpl : ( ...args ) =>
@@ -303,7 +303,7 @@ function createBoundFunction<ImplSchema extends AnyFn>(
303303 } ;
304304
305305 const call = dualImpl < InferImplSchema < ImplSchema > > ( {
306- name : undefined ,
306+ name : undefined , // setting name here would override autonaming
307307 noComptime : true ,
308308 signature : {
309309 argTypes : innerFn . shell . argTypes ,
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export function getName(definition: unknown): string | undefined {
8181 return getMetaData ( definition ) ?. name ;
8282}
8383
84- export function setName ( definition : object , name : string ) : void {
84+ export function setName ( definition : object , name : string | undefined ) : void {
8585 if ( isForwarded ( definition ) ) {
8686 setName ( definition [ $getNameForward ] as object , name ) ;
8787 }
You can’t perform that action at this time.
0 commit comments