For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/static_analysis/static_analysis_rules/typescript-code-style/no-inferrable-types.md.
A documentation index is available at /llms.txt.
This product is not supported for your selected Datadog site. ().
Metadata
ID:typescript-code-style/no-inferrable-types
Language: TypeScript
Severity: Notice
Category: Best Practices
Description
When you set an initial primitive value to a TypeScript parameter, property, or variable their respective type can be inferred. Explicitly adding type annotations in some cases can make your code more verbose and prevent TypeScript from inferring a more specific literal type.