---
title: "SW12002: Declaration identities unavailable"
description: "The compiler cannot tell which refs or animations a value can hold."
image: "https://stillwind.dev/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://stillwind.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# SW12002: Declaration identities unavailable

This error occurs when the compiler cannot tell which refs, keyframes, or view
transitions a value can hold. When a ref is chosen at runtime, the compiler must
generate CSS for every ref that it can be. A type annotation that widens the type
hides that list.

## Reported

```ts
const card = style.ref("card");
const current: ReturnType<typeof style.ref> = card;
style({ [current("hover")]: "underline" });
```

> SW12002: cannot determine finite declaration identities: Cannot determine a finite set of declaration identities. Preserve the value's inferred type, use an explicit union, or use a generic parameter.
> 
> Source format: Jsx

## Fixed

```ts
const card = style.ref("card");
const current = card;
style({ [current("hover")]: "underline" });
```

## How to fix

- Remove the type annotation, and keep the type that TypeScript infers, as in the
  example.
- When a value can hold several refs, use an explicit union of their types, such
  as `typeof card | typeof panel`, or a generic parameter.
- Make the source modules of the definitions reachable through imports.

If the integration did not provide type information at all, the error is
[SW30001](/docs/errors/SW30001) instead.

Source: https://stillwind.dev/docs/errors/SW12002/index.mdx
