-
Notifications
You must be signed in to change notification settings - Fork 889
Allow const assertions in no-object-literal-type-assertion #4681
Allow const assertions in no-object-literal-type-assertion #4681
Conversation
These are not normal type assertions and asserting that literal objects are immutable is a normal usage pattern.
Thanks for your interest in palantir/tslint, @asmundg! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @asmundg, thanks for sending this PR! Before reviewing rule changes we'll need to see tests that exercise the changed behavior.
@JoshuaKGoldberg this relies on a new utility function added in typescript 3.4. Is it reasonable to bump tslint's typescript dev dependency? |
@JoshuaKGoldberg thanks for the input, I've addressed your change requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
These are not normal type assertions and asserting that literal objects
are immutable is a normal usage pattern.
PR checklist
Overview of change:
Allow const assertions in no-object-literal-type-assertion. These are not equivalent to normal type assertions, and using them on literal objects is expected behavior.
Is there anything you'd like reviewers to focus on?
CHANGELOG.md entry:
[enhancement] Allow const assertions in no-object-literal-type-assertion