Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: account for mapped types without modifiers in isPropertyReadonlyInType #18

Merged
merged 2 commits into from
Feb 15, 2023

Conversation

JoshuaKGoldberg
Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg commented Feb 6, 2023

PR Checklist

Overview

Checks if type.modifiersType exists before asking isPropertyReadonlyInType(modifiersType, ...).

This is a recreation of ajafff/tsutils#136. Which means 😄:

Co-authored-by: @kirjs

@JoshuaKGoldberg JoshuaKGoldberg changed the title Readonly modifiers check fix: account for mapped types without modifiers in isPropertyReadonlyInType Feb 6, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #18 (d64c9be) into main (34353cc) will increase coverage by 8.57%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##             main      #18      +/-   ##
==========================================
+ Coverage   25.31%   33.89%   +8.57%     
==========================================
  Files          13       13              
  Lines         237      239       +2     
  Branches       98       99       +1     
==========================================
+ Hits           60       81      +21     
+ Misses        174      140      -34     
- Partials        3       18      +15     
Impacted Files Coverage Δ
src/types/utilities.ts 19.44% <66.66%> (+19.44%) ⬆️
src/types/getters.ts 3.57% <0.00%> (+3.57%) ⬆️
src/flags.ts 100.00% <0.00%> (+100.00%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

name,
typeChecker

const { modifiersType } = type as { modifiersType?: ts.Type };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to create a hasModifiersType utility function.
Lets do this in another PR though.

@JoshuaKGoldberg JoshuaKGoldberg merged commit 405c475 into main Feb 15, 2023
@JoshuaKGoldberg JoshuaKGoldberg deleted the readonly-modifiers-check branch February 15, 2023 01:56
@JoshuaKGoldberg
Copy link
Owner Author

@allcontributors add @JoshuaKGoldberg for bug

@allcontributors
Copy link
Contributor

@JoshuaKGoldberg

I've put up a pull request to add @JoshuaKGoldberg! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug: isPropertyReadonlyInType crashes on a mapped type parameter extending any
3 participants