ArrayElemKey
Type in Types
Element key of an array key: array<f32,4> → 'f32', array<vec3<f32>> → 'vec3<f32>', and never for a key that is not an array.
import type { ArrayElemKey } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
type ArrayElemKey<K extends string> = K extends `array<${infer Inner}>` ? DropArraySize<Inner> : never;Description
Element key of an array key: array<f32,4> → 'f32', array<vec3<f32>> → 'vec3<f32>',
and never for a key that is not an array. It is the inverse of the array arm of
KeyOf, and it is what lets xs.at(i) know the element type without being told
again — the declaration already said it.
See also
Source
src/core/ir/types.ts, line 920, at commit 26de7be8