---
title: "ConstExprDecl: interface in Authoring, TypeShade API"
description: "ConstExprDecl, an interface in Authoring. What constExpr returns: the ConstDecl itself, so it drops straight into module, carrying node…"
url: https://typeshade.dev/api/constexprdecl/
language: en
---

# `ConstExprDecl`

Interface in Authoring

What constExpr returns: the ConstDecl itself, so it drops straight into module, carrying node, the typed reference to read the constant through at call sites.

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

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

## Syntax

```ts
interface ConstExprDecl<T extends ShaderType> extends ConstDecl {
  readonly node: ReadonlyNode<KeyOf<T>>;
}
```

## Description

Reading through `.node` is what makes a rename or a retype of the constant a `tsc` error rather than a `constRef('NAME', someType)` string that agrees with nothing.

`node` is non-enumerable: the declaration is spread, compared and serialized on its way to the emitted module, and it stays exactly the object it was.

## Instance properties

**`node` read only `ReadonlyNode<KeyOf<T>>`**

The typed reference to read the constant through at call sites.

## See also

- [`constExpr`](https://typeshade.dev/api/constexpr/)

## Source

[`src/core/ir/builder.ts`, line 1076](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/builder.ts#L1076), at commit af54ddad5
