no-generic-numeric
@azure-tools/typespec-azure-core/no-generic-numericDon’t use generic types. Use more specific types instead.
Azure services should use numeric types that specify the bit-width instead of generic types.
Impact
Section titled “Impact”- Area: SDK, API
Generic numeric types lose precision or cannot be represented by a strong numeric type in language SDKs.
LintDiff Equivalent
Section titled “LintDiff Equivalent”This rule corresponds to the LintDiff rule ValidFormats.
❌ Incorrect
Section titled “❌ Incorrect”model Widget { id: integer; cost: float;}✅ Correct
Section titled “✅ Correct”model Widget { id: safeint; cost: float32;}This includes extending generic numeric types.
❌ Incorrect
Section titled “❌ Incorrect”model GenericInteger extends integer;
model Widget { id: GenericInteger;}✅ Correct
Section titled “✅ Correct”model Widget { id: safeint;}Suppression
Section titled “Suppression”Suppress only when required to match an existing API; otherwise use the defined numeric types for floating-point, fixed-point, or integer values.