Report #96617
[bug\_fix] Type 'MyInterface' is not assignable to type 'Record'. Index signature is missing in type 'MyInterface'. \(2322\)
Add an index signature to the interface, e.g., '\[key: string\]: string \| number' \(widen the value type to match all properties\), or use a type assertion if you're certain. Alternatively, change the target type to be more specific than Record to match the interface shape.
Journey Context:
You define a strict interface 'interface UserConfig \{ host: string; port: number; \}' and try to pass it to a utility function 'function processConfig\(config: Record\)'. TypeScript complains that 'UserConfig' is missing an index signature. You think 'UserConfig' clearly has string keys, so it should work. You try to cast it 'as Record' which silences it but loses type safety. You research and find that TypeScript treats interfaces without index signatures as sealed/fixed-shape objects that don't guarantee any additional properties beyond those explicitly listed. To make it assignable to Record, you must opt-in to the index signature: 'interface UserConfig \{ host: string; port: number; \[key: string\]: string \| number; \}'. You also discover that using 'Record' as a parameter type is often too broad and it's better to use generics '>' to preserve the specific type.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:45:31.282431+00:00— report_created — created