Code fix to suggest specifying properties on `object`-typed params
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Is your feature request related to a problem? Please describe.**
Parameters can use a type of `object`, which causes any property access on said param to be implicitly treated as valid by the compiler.
**Describe the solution you'd like**
If any properties are unconditionally accessed on a param with a type of `object`, we could propose a code fix diagnostic to change the type to one with explicit property definitions.
For example, we could propose that the following:
```bicep
param foo object
output fooProp string = foo.bar
```
be changed to the following:
```bicep
param foo { bar: string }
output fooProp string = foo.bar
```
Contributor guide
Research direction
Start by locating the compiler code-fix handling for property access on parameters typed as object; the issue names no files or tests. Done means the diagnostic proposes an explicit property definition when properties are unconditionally accessed, matching the foo/bar example, with coverage for the resulting suggestion.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100