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

improve getter tools, don't export optional getters #1574

Merged
merged 16 commits into from
Sep 4, 2024

Conversation

turbocrime
Copy link
Contributor

improves legibility of computed result of the Getter type

  • third 'optional' type parameter removed - now simply shows source and target
  • type no longer contains verbose constant conditions
  • now shows undefined as part of the target type, when the target type includes undefined
  • now shows NonNullable as part of the target type, when the target type does not include undefined

getters package no longer exports optional getters. exporting optional getters has the potential to cause confusion. a consumer who wishes to use an optional getter can use the .optional() utility provided on every getter.

.optional() can now be applied at any point in a getter pipe, which affects the pipe in an intuitive way

  • the pipe before the .optional() call will continue to assert results
  • the pipe after the .optional() call may return undefined

Copy link

changeset-bot bot commented Jul 27, 2024

🦋 Changeset detected

Latest commit: cdd01b0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@penumbra-zone/getters Major
minifront Patch
@penumbra-zone/perspective Major
@penumbra-zone/query Major
@penumbra-zone/services Major
@penumbra-zone/storage Major
@penumbra-zone/types Major
@penumbra-zone/ui Patch
node-status Patch
@penumbra-zone/crypto-web Major
@penumbra-zone/wasm Major
@repo/tailwind-config Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Aug 21, 2024

Visit the preview URL for this PR (updated for commit cdd01b0):

https://penumbra-ui-preview--pr1574-turbocrime-getter-re-vys5cpxm.web.app

(expires Tue, 10 Sep 2024 22:30:28 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 709d729610ef7a6369b23f1cb2b820a60cc685b1

@TalDerei TalDerei requested review from a team and removed request for jessepinho September 3, 2024 16:40
@TalDerei
Copy link
Contributor

TalDerei commented Sep 3, 2024

other reviewers would be helpful to sanity check

Copy link
Contributor Author

@turbocrime turbocrime left a comment

Choose a reason for hiding this comment

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

rebased

Copy link
Contributor Author

@turbocrime turbocrime Sep 3, 2024

Choose a reason for hiding this comment

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

GetterMissingValueError uses es2022 'error cause' like other parts of the repository. error cause was previously permitted by this tsconfig, but for some reason downgraded to es2020 at some point.

the many other fields added by a8a5f41 were already present in the configs which are extended, so all of those added fields had no effect.

so it's reverted essentially to abcaab6, plus a newer lib. i can't identify a practical difference aside from the lib option.

{
"compilerOptions": {
"composite": true,
"exactOptionalPropertyTypes": false,
"noEmit": true,
"target": "ESNext"
},
"extends": ["@tsconfig/strictest/tsconfig.json", "@tsconfig/vite-react/tsconfig.json"],
"include": ["components", "lib", "src", "tests-setup.ts"]
}

Copy link
Contributor

@VanishMax VanishMax left a comment

Choose a reason for hiding this comment

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

great DX improvement 👍

@turbocrime turbocrime merged commit a7ed0ab into main Sep 4, 2024
8 checks passed
@turbocrime turbocrime deleted the turbocrime/getter-refactor branch September 4, 2024 15:49
turbocrime added a commit that referenced this pull request Sep 4, 2024
@turbocrime turbocrime restored the turbocrime/getter-refactor branch September 4, 2024 16:03
grod220 pushed a commit that referenced this pull request Sep 4, 2024
turbocrime added a commit that referenced this pull request Sep 4, 2024
* improve getter tools, don't export optional getters

* adapt missed optional use
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.

3 participants