Skip to main content
defineLibraryKey<K>(key): K
Defined in: packages/common/src/library/define-library-key.ts:28 Declares a library’s context key, tying its runtime key to the type-level Context augmentation so the two can’t silently desync.

Type Parameters

K

K extends "app" | "vars" | "assets" | "viewport"

Parameters

key

K

Returns

K

Remarks

Only accepts a key that is already a member of Context at the call site — which means the library’s own declare module "@nanoforge-dev/common" { interface Context { ... } } augmentation must be part of the same compilation unit. As a side effect, two libraries whose augmentations declare the same key with incompatible shapes will fail to compile together, catching accidental key collisions at build time.

Example