Skip to content

fix(ts): fixs the use of @ts-ignore when passing custom hooks#3

Open
ylyra wants to merge 4 commits into
brandonmcconnell:mainfrom
ylyra:fix/typescript-types
Open

fix(ts): fixs the use of @ts-ignore when passing custom hooks#3
ylyra wants to merge 4 commits into
brandonmcconnell:mainfrom
ylyra:fix/typescript-types

Conversation

@ylyra

@ylyra ylyra commented May 25, 2025

Copy link
Copy Markdown

Hi there! First of all, I really loved the project.

Noticed that in the examples, you’re using @ts-ignore because of the custom hooks. This PR address that. It is not be the most elegant solution, but it works well 😬.

@brandonmcconnell brandonmcconnell self-requested a review May 28, 2025 20:11
@brandonmcconnell

Copy link
Copy Markdown
Owner

@ylyra Thanks for the PR 🙂

Could you rework this to use the declared Fn type instead of any?
This should also remove the need for & { length?: never; }

Once that's done, remove that @ts-ignore statement and make sure the package still builds and all tests pass.

Thanks again!

@ylyra

ylyra commented May 29, 2025

Copy link
Copy Markdown
Author

Hi @brandonmcconnell

With the declared Fn, it doesn’t really work right. TypeScript kinda gets lost (like you can see in the screenshot), and the types for each custom function disappear.

image

I tweaked it a bit to still use any, but now it checks if the passed value extends Fn.

Also removed the & { length?: never; } and @ts-ignore

Now
image

Tks

@brandonmcconnell

Copy link
Copy Markdown
Owner

@ylyra Thanks for the update! I'll check this over the weekend. The fix might be fine, but I'm weary of using any anywhere, as it can be a slippery slope for loose-type checking.

@ylyra

ylyra commented May 29, 2025

Copy link
Copy Markdown
Author

Awesome, thanks.

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