explicit-types
July 2, 2025 ยท View on GitHub
The {"extends": "solhint:recommended"} property in a configuration file enables this rule.
Description
Forbid or enforce explicit types (like uint256) that have an alias (like uint).
Options
This rule accepts an array of options:
| Index | Description | Default Value |
|---|---|---|
| 0 | Rule severity. Must be one of "error", "warn", "off". | warn |
| 1 | Options need to be one of "explicit", "implicit" | explicit |
Example Config
{
"rules": {
"explicit-types": [
"warn",
"explicit"
]
}
}
Notes
- Solhint allows this rule to automatically fix the code with
--fixoption
Examples
๐ Examples of correct code for this rule
If explicit is selected
uint256 public variableName
If implicit is selected
uint public variableName
If explicit is selected
uint256 public variableName = uint256(5)
๐ Examples of incorrect code for this rule
If explicit is selected
uint public variableName
If implicit is selected
uint256 public variableName
At any setting
uint public variableName = uint256(5)
Version
This rule was introduced in Solhint 5.0.4