Remove Record
-based constraints on signature members
#155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, people who have
class MyComponent extends Component<MyArgs>
and are adopting Glint are naturally inclined to change that toComponent<{ Args: MyArgs }>
. Unfortunately, if theMyArgs
type is declared as aninterface
, that change will fail with a confusing error:The underlying reason for this is that TS will infer an index signature for type aliases, but is unwilling to do so for interfaces because that's more unsafe due to the potential for declaration merging. Needing to migrate
interface
s totype
declarations is an annoying adoption papercut, particularly given that it's not apparent from the error message that that's a viable fix.In practice this constraint doesn't provide a whole lot of value over using
object
instead, particularly relative to the number of folks who've already run into this index signature issue. We may consider some type-aware linting in the future, but for now this should remove some real pain for people working to adopt Glint.