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: default to first declaration for getWellKnownSymbolPropertyOfType properties #16

Merged
merged 9 commits into from
Feb 19, 2023

Conversation

JoshuaKGoldberg
Copy link
Owner

PR Checklist

Overview

If prop.valueDeclaration doesn't exist, then we assume prop.getDeclarations() must have at least one entry (something must have indicated the property exists!)_.

I don't know that this assumption is actually 100% correct. But it's at least more correct than how the code was before.

Copy link
Collaborator

@RebeccaStevens RebeccaStevens left a comment

Choose a reason for hiding this comment

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

I don't like the look of those casts.
Do we know for sure that those values are always those types?

src/types/getters.ts Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Feb 15, 2023

Codecov Report

Merging #16 (017a4f0) into main (0c17891) will increase coverage by 2.19%.
The diff coverage is 50.00%.

❗ Current head 017a4f0 differs from pull request most recent head a4664a3. Consider uploading reports for the commit a4664a3 to get more accurate results

@@            Coverage Diff             @@
##             main      #16      +/-   ##
==========================================
+ Coverage   19.74%   21.94%   +2.19%     
==========================================
  Files          15       15              
  Lines         395      401       +6     
  Branches      161      164       +3     
==========================================
+ Hits           78       88      +10     
+ Misses        299      291       -8     
- Partials       18       22       +4     
Impacted Files Coverage Δ
src/types/getters.ts 30.30% <33.33%> (+26.73%) ⬆️
src/nodes/typeGuards/compound.ts 38.09% <100.00%> (+3.09%) ⬆️
src/test/utils.ts 91.66% <100.00%> (ø)
src/nodes/typeGuards/union.ts 1.08% <0.00%> (ø)

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

@JoshuaKGoldberg
Copy link
Owner Author

will re-request

...which I can't do now. The GitHub requests edge cases always confuse me.

@RebeccaStevens RebeccaStevens mentioned this pull request Feb 16, 2023
3 tasks
@RebeccaStevens RebeccaStevens enabled auto-merge (squash) February 19, 2023 07:14
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: getWellKnownSymbolPropertyOfType crashes on a property with no valueDeclaration
2 participants