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

fix(types): fixed tryit type #296

Merged
merged 14 commits into from
Jun 27, 2023
Merged

Conversation

DuCanhGH
Copy link
Contributor

@DuCanhGH DuCanhGH commented Apr 22, 2023

Description

This PR fixes tryit's type so that it works with parallel and other functions with generics (I noticed that they weren't automatically resolved, the default behavior was to fallback to type unknown instead) by declaring two generics instead of one (one is for arguments and the other is for return value) and replacing UnwrapPromisify with Typescript's built-in Awaited.

Checklist

  • Changes are covered by tests if behavior has been changed or added
  • Tests have 100% coverage
  • If code changes were made, the version in package.json has been bumped (matching semver)
  • If code changes were made, the yarn build command has been run and to update the cdn directory
  • If code changes were made, the documentation (in the /docs directory) has been updated

Resolves

@vercel
Copy link

vercel bot commented Apr 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
radash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2023 1:36am

@sodiray
Copy link
Owner

sodiray commented Jun 26, 2023

Hey @DuCanhGH thanks for the PR 🙏 and sorry for the delay 🙃

I really like you're changes to the tryit function, I'd love to get that in. I'm less enthusiastic about the eslint and the other stuff. I'm not against it but I'd like to isolate those changes.

If you're still interested in getting this in can you split it into two PRs? One with the tryit changes (which I'd be happy to merge asap) and one with all the other project management type changes.

@DuCanhGH DuCanhGH changed the title Fixed tryit type, replaced deprecated TSLint, updated deps fix(types), chore(deps): fixed tryit type, updated deps Jun 26, 2023
@DuCanhGH
Copy link
Contributor Author

DuCanhGH commented Jun 26, 2023

@rayepps I've done as requested!

Edit: wait, let me revert the dependencies update as well...

Edit: done!

@DuCanhGH DuCanhGH changed the title fix(types), chore(deps): fixed tryit type, updated deps fix(types): fixed tryit type Jun 26, 2023
Copy link
Owner

@sodiray sodiray left a comment

Choose a reason for hiding this comment

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

I see there are still a lot of code changes outside the tryit interface, are these changes you're wanting because they're important to you or is it just left overs from running eslint?

also, some questions :)

@@ -80,7 +80,7 @@ const memoize = <T>(
* is given previously computed values will be checked
* for expiration before being returned.
*/
export const memo = <TFunc extends Function>(
Copy link
Owner

Choose a reason for hiding this comment

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

Why change from Function to (...args: any) => any?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rayepps ah yes, that was ESLint's complaining. I forgot to change that...

Copy link
Contributor Author

@DuCanhGH DuCanhGH Jun 27, 2023

Choose a reason for hiding this comment

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

@rayepps now that I've rechecked that though, I think that it's better that we keep this change to prevent class declarations (due to how we call func - func(...args)). I can revert it if you want though!

.npmignore Outdated
Copy link
Owner

Choose a reason for hiding this comment

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

Why are we deleting this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rayepps we already have the field "files" in package.json, so I figure that this is not needed (when publishing npm will only pick stuffs that match "files" anyway)

@DuCanhGH
Copy link
Contributor Author

@rayepps yeah they mostly are changes that improve type safety (and nice to have in my opinion). Perhaps I can re-edit the title and description to better describe the PR? Or I can revert them if you want :)

Copy link
Owner

@sodiray sodiray left a comment

Choose a reason for hiding this comment

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

Let's do it 💪 I like that

  • you removed the as any cast inside tryit
  • you got rid of the UnwrapProsifify and ArgumentsType generics

@sodiray sodiray merged commit c3c9dac into sodiray:master Jun 27, 2023
6 of 7 checks passed
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