defineLibraryKey<Defined in: packages/common/src/library/define-library-key.ts:28 Declares a library’s context key, tying its runtime key to the type-levelK>(key):K
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 ofContext 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.