Skip to content

Conversation

@ItsHarper
Copy link

@ItsHarper ItsHarper commented Jun 10, 2025

I've based this PR on #207 so that I can actually make sure that all of the tests pass. Merge that before reviewing this. Once you've done that, you may need to push a commit that merges the main branch into this one in order to make the commit from that PR disappear from this one. You have my permission to do that (I've checked "Allow edits by maintainers").

Before, the type system would let you pass in anything as a basis, even things that weren't objects. Now, Basis types must conform to the type Record<string, string> (aliased as BasisType, with a doc comment).

I had to change how the errorBasis test works (it's simpler now).

I would start your review with measure/unitSystem.ts.

This will be a breaking change for anyone wrapping Measure.

`tsconfig.base.json` includes settings that apply to ALL typescript in
the project (including tests and docsgen), while
`tsconfig.src.base.json` includes settings that should only apply to the
source code of the main library.

This fixes the `include` and `exclude` fields intended for library
compilation being applied to the `tests` and `docsgen` folders, which
made those folders actually just compile the library instead of their
actual code.
@ItsHarper ItsHarper force-pushed the feature/basis-type-safety branch from bd185ed to b158d3d Compare June 10, 2025 19:23
@ItsHarper
Copy link
Author

ItsHarper commented Jun 10, 2025

Now that the type tests are working and the examples are being built, I can see that this will be a breaking change for anyone who is wrapping Measure.

@ItsHarper ItsHarper force-pushed the feature/basis-type-safety branch from b158d3d to 0abbd22 Compare June 10, 2025 19:35
@ItsHarper
Copy link
Author

ItsHarper commented Jun 10, 2025

All tests are passing and all examples are compiling.

Edit: That should actually be true now. I'm not sure if I got confused about which branch I was on, or if verify was succeeding when it shouldn't have been.

Before, the type system would let you pass in anything as a basis, even
things that weren't objects. Now, Basis types must conform to the type
Record<string, string> (aliased as BasisType, with a doc comment).

I had to change how the errorBasis test works (it's simpler now).

This is a breaking change for anyone wrapping `Measure`.
@ItsHarper ItsHarper force-pushed the feature/basis-type-safety branch from 0abbd22 to cbc9d00 Compare June 10, 2025 19:44
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.

1 participant