bad-record-type
@azure-tools/typespec-azure-core/bad-record-typeIdentify bad record definitions.
Use of Record<X> should be limited in Azure services.
- It is recommended to use
Record<string>instead ofRecord<unknown> - Specifying a type with Record and some known properties is also not recommended.
Impact
Section titled “Impact”- Area: SDK, API
Records typed with non-concrete element types cannot be represented cleanly in SDKs and force clients to work with untyped dictionaries.
❌ Incorrect
Section titled “❌ Incorrect”model Pet { data: Record<unknown>;}model Pet is Record<string> { name: string;}✅ Correct
Section titled “✅ Correct”model Pet { tags: Record<string>;}model Pet is Record<string>;Suppression
Section titled “Suppression”Suppress only when an open-ended dictionary is genuinely required; otherwise give the record a concrete element type.