Framework - Homebridge
Configure TypeScript for a Homebridge plugin without making every Node.js project inherit Homebridge-specific compiler behavior.
Why Use This Preset?
- Includes DOM types used by Homebridge and plugin configuration interfaces.
- Allows references to the ambient HAP const enums exposed by Homebridge's type declarations.
- Disables verbatim module syntax, which is incompatible with those ambient const enum references in current TypeScript releases.
- Composes with Nova's Node runtime preset while keeping Homebridge behavior in a distinct, reviewable layer.
Usage
Add the preset after the essentials, strict, and Node runtime layers.
tsconfig.json
{
"extends": [
"@cbnventures/nova/presets/tsconfig/dx-essentials.json",
"@cbnventures/nova/presets/tsconfig/dx-strict.json",
"@cbnventures/nova/presets/tsconfig/runtime-node.json",
"@cbnventures/nova/presets/tsconfig/fw-homebridge.json"
],
"compilerOptions": {
"outDir": "./build",
"rootDir": "./src",
"types": [
"@types/node"
]
},
"include": [
"./src/**/*"
],
"exclude": [
"./build/**",
"./node_modules/**"
]
}
What This Preset Configures
| Setting | Value | Description |
|---|---|---|
isolatedModules | false | Permits Homebridge's ambient HAP const enums to be referenced. |
lib | ["DOM", "ESNext"] | Provides browser-facing configuration APIs and current ECMAScript APIs. |
verbatimModuleSyntax | false | Avoids incompatible verbatim handling of ambient const enum references. |
Because TypeScript replaces lib arrays instead of merging them, add project-specific libraries such as DOM.Iterable in your local config when needed. You can also override module and moduleResolution locally when a plugin's bundler requires different resolution behavior.
Related
- Review the layering order in TSConfig Best Practices.
- See the Node foundation in Runtime - Node.js.
- See how presets compose end to end in the Presets Overview.