Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
test(eslint-plugin): adjust tests to verifyno-unnecessary-type-assertion
doesn't report template literals with expressions#10671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
… template expressions with expressions
Thanks for the PR,@ronami! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint. |
netlifybot commentedJan 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify site configuration. |
nx-cloudbot commentedJan 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
View yourCI Pipeline Execution ↗ for commit27ba6f7.
☁️Nx Cloud last updated this comment at |
no-unnecessary-type-assertion
doesn't throw on template literals with expressionsno-unnecessary-type-assertion
doesn't report template literals with expressionsshould we just use |
ronami commentedJan 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hmm since these two are different types (one is a "fresh literal", the other isn't): // not a "fresh literal"declareconsta:'foo';// is a "fresh literal"constb='foo'; Along with seeing how much complexity there is around "fresh literals", I've changed both tests to use Wdyt? Edit: I manually removed the |
codecovbot commentedJan 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## main #10671 +/- ##======================================= Coverage 87.15% 87.15% ======================================= Files 448 448 Lines 15576 15578 +2 Branches 4551 4551 =======================================+ Hits 13575 13577 +2 Misses 1645 1645 Partials 356 356
Flags with carried forward coverage won't be shown.Click here to find out more. |
609a78f
intotypescript-eslint:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
Overview
I've noticed this while reviewing#10618.
To my understanding, these tests should make sure the ruledoesn't report on template literals with expressions.
It seems that even if this check is removed, these tests still pass. I think it's related to "fresh literals" (more on this here), as is shown below (playground link):
The expression coming from a widened
let
variabledoesn't count as a literal, and it falls back tobeing checked as a non-literal (which always allowsas const
assertions).This PR adjusts the tests to fail if this check is removed or changed incorrectly (this seems correctaccording to the original issue).