Skip to content

@kitware/vtk-wasm / @kitware/vtk-wasm / JSTypedArrayOf

Type Alias: JSTypedArrayOf<T>

ts
type JSTypedArrayOf<T> = T extends {
  $brands: {
     vtkFloatArray: true;
  };
} ? Float32Array : T extends {
  $brands: {
     vtkDoubleArray: true;
  };
} ? Float64Array : T extends {
  $brands: {
     vtkCharArray: true;
  };
} ? Int8Array : T extends {
  $brands: {
     vtkSignedCharArray: true;
  };
} ? Int8Array : T extends {
  $brands: {
     vtkUnsignedCharArray: true;
  };
} ? Uint8Array : T extends {
  $brands: {
     vtkShortArray: true;
  };
} ? Int16Array : T extends {
  $brands: {
     vtkUnsignedShortArray: true;
  };
} ? Uint16Array : T extends {
  $brands: {
     vtkIntArray: true;
  };
} ? Int32Array : T extends {
  $brands: {
     vtkUnsignedIntArray: ...;
  };
} ? Uint32Array : T extends {
  $brands: ...;
} ? BigInt64Array : ... extends ... ? ... : ...;

Defined in: base.d.ts:214

The JavaScript TypedArray whose element type matches VTK array proxy T.

Discriminates on the generated $brands ancestor chain, so the fixed-width aliases resolve through their concrete base — vtkTypeFloat32Array brands include vtkFloatArray, and both yield Float32Array.

vtkIdTypeArray, vtkLongArray and vtkUnsignedLongArray are deliberately absent: they hold 32-bit values on wasm32 and 64-bit values on wasm64, so no single static type is correct for both. They fall through to the MarshallableTypedArray union and need narrowing at the call site; prefer the vtkTypeInt32Array/vtkTypeInt64Array aliases when the width matters. vtkBitArray is absent because it packs 8 values per byte.

Type Parameters

Type Parameter
T