Skip to content

Actions: expand isInputError to accept unknown#11439

Merged
bholmesdev merged 7 commits intomainfrom
feat/expand-is-input-error-type
Jul 9, 2024
Merged

Actions: expand isInputError to accept unknown#11439
bholmesdev merged 7 commits intomainfrom
feat/expand-is-input-error-type

Conversation

@bholmesdev
Copy link
Copy Markdown
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

@changeset-bot
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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

@matthewp matthewp dismissed their stale review July 9, 2024 19:34

change not needed

@bholmesdev bholmesdev merged commit 08baf56 into main Jul 9, 2024
@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