Skip to content

Commit 4636de8

Browse files
authored
fix: Use InferGPU in function shell types (#2295)
1 parent 8ff367f commit 4636de8

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

packages/typegpu/src/core/function/fnTypes.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import type {
2323
Vec4u,
2424
Void,
2525
} from '../../data/wgslTypes.ts';
26-
import type { Infer } from '../../shared/repr.ts';
26+
import type { InferGPU } from '../../shared/repr.ts';
2727

2828
export type AnyFn = (...args: never[]) => unknown;
2929

@@ -41,7 +41,7 @@ export type TranspilationResult = {
4141
};
4242

4343
export type InferArgs<T extends unknown[]> = {
44-
[Idx in keyof T]: Infer<T[Idx]>;
44+
[Idx in keyof T]: InferGPU<T[Idx]>;
4545
};
4646

4747
type InheritTupleValues<T, From> = {
@@ -65,7 +65,7 @@ export type InheritArgNames<T extends AnyFn, From extends AnyFn> = {
6565

6666
export type InferImplSchema<ImplSchema extends AnyFn> = (
6767
...args: InferArgs<Parameters<ImplSchema>>
68-
) => Infer<ReturnType<ImplSchema>>;
68+
) => InferGPU<ReturnType<ImplSchema>>;
6969

7070
export type Implementation<ImplSchema extends AnyFn = AnyFn> = string | InferImplSchema<ImplSchema>;
7171

@@ -101,9 +101,9 @@ export type IOLayout<TElementType extends IOData = IOData> =
101101
| Void;
102102

103103
export type InferIO<T> = T extends { type: string }
104-
? Infer<T>
104+
? InferGPU<T>
105105
: T extends Record<string, unknown>
106-
? { [K in keyof T]: Infer<T[K]> }
106+
? { [K in keyof T]: InferGPU<T[K]> }
107107
: T;
108108

109109
export interface PositionalArgInfo {

packages/typegpu/src/core/function/tgpuFn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { provideInsideTgpuFn } from '../../execMode.ts';
66
import type { TgpuNamable } from '../../shared/meta.ts';
77
import { getName, setName } from '../../shared/meta.ts';
88
import { isMarkedInternal } from '../../shared/symbols.ts';
9-
import type { Infer } from '../../shared/repr.ts';
9+
import type { InferGPU } from '../../shared/repr.ts';
1010
import { $getNameForward, $internal, $providing, $resolve } from '../../shared/symbols.ts';
1111
import type { Prettify } from '../../shared/utilityTypes.ts';
1212
import type { DualFn, ResolutionCtx, SelfResolvable } from '../../types.ts';
@@ -56,7 +56,7 @@ export type TgpuFnShell<Args extends BaseData[], Return extends BaseData> = Tgpu
5656
Args,
5757
Return
5858
> &
59-
(<T extends (...args: InferArgs<Args>) => Infer<Return>>(
59+
(<T extends (...args: InferArgs<Args>) => InferGPU<Return>>(
6060
implementation: T,
6161
) => TgpuFn<Prettify<InheritArgNames<(...args: Args) => Return, T>>['result']>) &
6262
((implementation: string) => TgpuFn<(...args: Args) => Return>) &

0 commit comments

Comments
 (0)