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

Actions: expand isInputError to accept unknown #11439

Merged
merged 7 commits into from
Jul 9, 2024

Conversation

bholmesdev
Copy link
Contributor

Changes

Expand isInputError to accept unknown as a type, so it can narrow any error object to an ActionInputError. This is per feedback in the RFC.

  • Add type override for unknown
  • Document the purpose of ErrorInferenceObject. The reason for this utility type was unclear originally

Testing

Manually tested that isInputError still type narrows and preserves the error.fields types

Copy link

changeset-bot bot commented Jul 9, 2024

🦋 Changeset detected

Latest commit: ddf1bb0

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

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jul 9, 2024
Copy link
Contributor

@matthewp matthewp left a comment

Choose a reason for hiding this comment

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

lgtm. It can also be nice to still put these in define/it blocks so you can have multiple tests in the same file. Even though it can feel a little weird given that the code doesn't run, it can be nice for organization

@bholmesdev
Copy link
Contributor Author

bholmesdev commented Jul 9, 2024

@matthewp Yeah, I wasn't sure if that would be misleading for new contributors given the tests don't run? I agree the comment separation isn't great. I'll try that since it sounds like you'd prefer it

packages/astro/package.json Show resolved Hide resolved
@matthewp matthewp dismissed their stale review July 9, 2024 19:34

change not needed

@bholmesdev bholmesdev merged commit 08baf56 into main Jul 9, 2024
14 checks passed
@bholmesdev bholmesdev deleted the feat/expand-is-input-error-type branch July 9, 2024 19:54
@astrobot-houston astrobot-houston mentioned this pull request Jul 9, 2024
ematipico pushed a commit that referenced this pull request Jul 18, 2024
* feat: allow type `unknown` on `isInputError`

* chore: move ErrorInferenceObject to internal utils

* chore: changeset

* deps: expect-type

* feat: first types test

* chore: add types test to general test command

* refactor: use describe and it for organization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants