From 0406bfea094407d684a88a9e78951a6da84820a5 Mon Sep 17 00:00:00 2001 From: Jake Fineman Date: Thu, 3 Sep 2026 22:46:25 -0400 Subject: [PATCH] fix(types): restore missing src/types/index.ts and fix downstream config typing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/types/index.ts does not exist on origin/main, causing 3 TS2307 errors (device-flow.ts, config/manager.ts, output/index.ts) plus cascading TS18046 'unknown' errors — 5 errors total stemmed from this one gap. Recovered the exact type shapes from an unmerged historical commit (382adee, branch fix/remediation-af8a172e-5f3f12, PR #19 closed unmerged) and verified each field against current call-site usage: - DeviceAuthResponse / TokenResponse match every field device-flow.ts reads (verification_uri, user_code, verification_uri_complete, etc.) - WaveConfig matches waveConfigSchema in config/schema.ts exactly - OutputFormat matches the "table" | "json" | "yaml" union used everywhere Restoring WaveConfig as a real interface (not implicit any) surfaced one genuine new error: src/commands/config/index.ts's getNestedValue/ setNestedValue helpers were typed as Record, which a nominal WaveConfig is not assignable to. Retyped both helpers' parameter as `object` (they already narrow via typeof/instanceof internally) since they are intentionally generic reflection utilities over arbitrary nested config paths — no `any`, no `@ts-ignore`, no loosened tsconfig. Verified: SDK pin bump (2.0.14 -> 2.1.3) was tested separately and does NOT reduce the ~145 API-surface-drift errors (148 -> 152, i.e. it makes things worse by breaking vitest's ambient types) — that group is left untouched pending a dedicated pass against the real 2.0.14 client surface. type-check: 148 -> 142 errors (all 3 TS2307 gone, zero new regressions introduced beyond the one WaveConfig assignability fixed above) build: passes (tsup transpiles without typechecking) test: 4 files / 11 tests passing --- src/commands/config/index.ts | 6 +++--- src/types/index.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 src/types/index.ts diff --git a/src/commands/config/index.ts b/src/commands/config/index.ts index 000f265..bc97e72 100644 --- a/src/commands/config/index.ts +++ b/src/commands/config/index.ts @@ -63,7 +63,7 @@ export function registerConfigCommands(program: Command): void { ); } -function getNestedValue(obj: Record, path: string): unknown { +function getNestedValue(obj: object, path: string): unknown { const keys = path.split("."); let current: unknown = obj; for (const key of keys) { @@ -75,9 +75,9 @@ function getNestedValue(obj: Record, path: string): unknown { return current; } -function setNestedValue(obj: Record, path: string, value: string): void { +function setNestedValue(obj: object, path: string, value: string): void { const keys = path.split("."); - let current: Record = obj; + let current: Record = obj as Record; for (let i = 0; i < keys.length - 1; i++) { const key = keys[i]; if (typeof current[key] !== "object" || current[key] === null) { diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..d714bc7 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,30 @@ +export interface DeviceAuthResponse { + device_code: string; + user_code: string; + verification_uri: string; + verification_uri_complete?: string; + expires_in: number; + interval: number; +} + +export interface TokenResponse { + access_token: string; + token_type?: string; + expires_in?: number; + refresh_token?: string; +} + +export interface WaveConfig { + version: string; + currentProject: string; + projects: Record; + defaults: { outputFormat: OutputFormat; protocol?: string; color: "auto" | "on" | "off" }; + telemetry: { enabled: boolean; errorReporting: boolean }; +} + +export type OutputFormat = "table" | "json" | "yaml";