ArithArg
On this page

ArithArg

Type in Types

The operand a binary arithmetic method accepts for a receiver of key K.

import type { ArithArg } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

type ArithArg<K extends string> = K extends `vec${number}<${infer E}>`
? ReadonlyNode<K> | ReadonlyNode<KindScalar<E>> | number
: ReadonlyNode<KindScalar<K>> | number;

Description

For a vector receiver: the same vector key, or a scalar of the vector’s element kind (WGSL’s vector-scalar broadcast). For a scalar receiver: the same scalar kind. A vec2 against a vec3, an integer against a float, or an i32 against a u32 is a type error. An f64 receiver (and the scalar broadcast of an f64 vector) also accepts f32, which widens exactly. A JS number is accepted everywhere and lifts to the receiver’s own scalar kind.

Source

src/core/ir/node.ts, line 81, at commit 26de7be8

Edit this page Report a problem