---
title: "SwizzleKey: type in Types, TypeShade API reference"
description: "SwizzleKey, a type in Types. The key of v.swizzle(S) for a vector key K: the element scalar when S has one character…"
url: https://typeshade.dev/api/swizzlekey/
language: en
---

# `SwizzleKey`

Type in Types

The key of v.swizzle(S) for a vector key K: the element scalar when S has one character, otherwise vecN<elem> with N the length of S.

`import type { SwizzleKey } from 'typeshade'`
`import type { SwizzleKey } from 'typeshade/core/ir'`

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

## Syntax

```ts
type SwizzleKey<K extends string, S extends string> =
  StrLen<S> extends 1 ? ElemKey<K> : `vec${StrLen<S> & number}<${ElemKey<K>}>`;
```

## Source

[`src/core/ir/node.ts`, line 252](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L252), at commit af54ddad5
