---
title: "Capabilities: class in Backends, TypeShade API reference"
description: "Capabilities, a class in Backends. The set of capabilities a backend supports, built from its capProfile with Capabilities.fromProfile."
url: https://typeshade.dev/api/capabilities/
language: en
---

# `Capabilities`

Class in Backends

The set of capabilities a backend supports, built from its capProfile with Capabilities.fromProfile.

`import { Capabilities } from 'typeshade'`

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

## Syntax

```ts
class Capabilities
```

## Description

Membership in the profile’s keys is support, so the set and the profile are one fact.

The capability gate that runs before every emit uses it: it derives what a module needs (a storage binding needs `storageBuffer`, a `@compute` entry needs `compute`, a multisampled texture load needs `msaaTextureLoad`, plus whatever the module lists in `enables`), calls `covers(reqs)`, and on a miss calls `missing(reqs)` to name the capabilities the target cannot emit. The thrown [`UnsupportedFeatureError`](https://typeshade.dev/api/unsupportedfeatureerror/) then reads “backend ‘glsl-es300’ cannot emit this module: missing capabilities: compute”, with the whole module as context. The GLSL ES 3.00 `capProfile` has no row for `storageBuffer`, `compute`, or `msaaTextureLoad` yet ([Rule 10.5](https://typeshade.dev/reference/rules/10-5/)): the gate refuses the module before the writer sees it.

## Constructor

**`new Capabilities(private readonly set: ReadonlySet<Capability>)`**

## Instance methods

**`fromProfile` `(profile: CapProfile): Capabilities`**

The capabilities a `capProfile` declares, read from its keys. Build coverage this way so that profile membership and capability coverage stay one fact.

**`has` `(c: Capability): boolean`**

**`covers` `(reqs: Iterable<Capability>): boolean`**

True iff this target supports everything `reqs` needs.

**`missing` `(reqs: Iterable<Capability>): Capability[]`**

## See also

- [`UnsupportedFeatureError`](https://typeshade.dev/api/unsupportedfeatureerror/)

## Source

[`src/core/backend.ts`, line 59](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backend.ts#L59), at commit af54ddad5
