Skip to content

type safe for getShape1D and getShape2D #94

Merged
jobo322 merged 6 commits into
mainfrom
avoid-use-exponentiation-in-simple-powers
Jul 9, 2026
Merged

type safe for getShape1D and getShape2D #94
jobo322 merged 6 commits into
mainfrom
avoid-use-exponentiation-in-simple-powers

Conversation

@jobo322

@jobo322 jobo322 commented Jul 8, 2026

Copy link
Copy Markdown
Member

No description provided.

@jobo322 jobo322 requested a review from lpatiny July 8, 2026 14:39
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.36%. Comparing base (1377ac1) to head (4e34be7).

Files with missing lines Patch % Lines
src/shapes/2d/getShape2D.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #94      +/-   ##
==========================================
+ Coverage   93.18%   96.36%   +3.18%     
==========================================
  Files          23       23              
  Lines         968      963       -5     
  Branches      206      213       +7     
==========================================
+ Hits          902      928      +26     
+ Misses         65       34      -31     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@targos

targos commented Jul 8, 2026

Copy link
Copy Markdown
Member

refactor: replace exponentiation with multiplication for performance improvement i

Do you have a benchmark to prove this?

@jobo322 jobo322 requested review from targos and removed request for lpatiny July 8, 2026 15:00
@jobo322

jobo322 commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

refactor: replace exponentiation with multiplication for performance improvement i

Do you have a benchmark to prove this?

right, I just read it, but I run a mitata benchmark and the difference is almost noise. let me revert this change

@jobo322

jobo322 commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@targos is it correct the refactoring of getShape1D? the idea is that typescript know that the returned shape instance has the corresponding instance type instead of an union type. to improve the type safe in the dependents packages like spectra-fitting

@targos

targos commented Jul 9, 2026

Copy link
Copy Markdown
Member

It's OK, but I pushed a simplification to avoid all the workarounds

@jobo322 jobo322 merged commit 58c6c6f into main Jul 9, 2026
9 of 10 checks passed
@jobo322 jobo322 deleted the avoid-use-exponentiation-in-simple-powers branch July 9, 2026 12:55
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.

2 participants