type-flag icon indicating copy to clipboard operation
type-flag copied to clipboard

Types break `cleye`

Open mmkal opened this issue 7 months ago • 0 comments

Problem

Using the output of the latest develop branch with cleye breaks its types. Screenshot below:

image

I used git bisect to find what change broke it (In case you want to try, I didn't do any fancy npm linking, I just copied the dist folder into my local cleye clone. So I just ran this command for each commit git bisect suggested: pnpm i; git checkout pnpm-lock.yaml; pnpm build; rm -rf ../cleye/node_modules/type-flag/dist; rsync -r dist ../cleye/node_modules/type-flag; (cd ../cleye; pnpm build 2> /dev/null). That command succeeded on master, and failed on develop because of the above typescript error.

git bisect result:

5fcb9cc95f4c98f97d73a5b7c61302c8d6a46d51 is the first bad commit commit 5fcb9cc95f4c98f97d73a5b7c61302c8d6a46d51 Author: Hiroki Osame [email protected] Date: Tue Apr 16 23:48:44 2024 +0900

style: remove any
path changes
README.md 6 +-
package.json 6 +-
pnpm-lock.yaml 2345 +++++++++++++++++++++++++++++++++++++------------------
src/get-flag.ts 2 +-
src/types.ts 9 +-
src/utils.ts 9 +-

6 files changed, 1587 insertions(+), 790 deletions(-)


I guess one of the any -> unknown changes broke it the typearg extends condition somehow. I'll try to find to time to dig into which exactly, but commenting in the meantime in case anything springs to mind.

Originally posted by @mmkal in https://github.com/privatenumber/type-flag/issues/27#issuecomment-2190402478

Expected behavior

Output of this library to work with cleye - but maybe this issue would be better solved in the cleye repo, not sure?

Minimal reproduction URL

https://stackblitz.com/~/github.com/mmkal/cleye

Just run pnpm install && pnpm build in the above - I pushed a change to package.json in the cleye repo to install type-flag from github, then cd into node_modules and build type-flag directly before building cleye. https://github.com/mmkal/cleye/commit/cd34e3ae611d3a57e98202fe1af45e00e4247d35

Version

develop

Node.js version

v18.20.3, but not really relevant

Package manager

pnpm, but not really relevant

Operating system

macOS, but not really relevant

Bugs are expected to be fixed by those affected by it

  • [X] I'm interested in working on this issue

Compensating engineering work financially will speed up resolution

  • [X] I'm willing to offer financial support

mmkal avatar Jun 26 '24 02:06 mmkal