alexlafroscia / use-task

A React hook for running and cancelling asynchronous tasks
https://use-task.now.sh
24 stars 1 forks source link

chore: update tsconfig for type safety in docs #20

Closed poteto closed 5 years ago

poteto commented 5 years ago
Screenshot 2019-04-09 19 41 04
vercel[bot] commented 5 years ago

This pull request is automatically deployed with Now. To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://use-task-git-fork-poteto-lt-update-tsconfigs.alexlafroscia.now.sh

alexlafroscia commented 5 years ago

Previously, the docs site was getting the useTask type definition from the Pika output. Is this a different, more elegant means to the same end?

poteto commented 5 years ago

Before this change, you'd have to build first before it can locate types:

Fresh install:

Screenshot 2019-04-10 10 45 30

After yarn build:

Screenshot 2019-04-10 10 47 18

I don't think it's particularly ergonomic to have to run yarn build (granted, you probably wouldn't be doing it that often, but it'd be easy to forget) when you want to make changes to the docs. The advantage of this change is that it works "out of the box". The sort-of-downside is that the type definitions are tied to src and not the version that was listed in docs/package.json

alexlafroscia commented 5 years ago

Makes sense to me! I want to remove the resolutions in the root level package.json that point into the pkg directory then — that shouldn’t be necessary with this change. I’ll add a commit to the PR to handle that.