cleye icon indicating copy to clipboard operation
cleye copied to clipboard

`inferred type` error happens in commonjs&pnpm project

Open ryoppippi opened this issue 6 months ago ā€¢ 0 comments

Bug description

When I create subcommand in commonjs project, it causes type error like this

The inferred type of 'install' cannot be named without a reference to '../../node_modules/.pnpm/[email protected]/node_modules/type-flag/dist'. This is likely not portable. A type annotation is necessary.(2742)

I found that

  • ES Module project is OK.
  • using Bun/npm does not causes this problem

Reproduction

https://stackblitz.com/edit/vitejs-vite-xrg77g?file=src%2Finstall.ts

You can see that install variable has an error.

Node.js package manager

pnpm

Environment

This bug happens not only in my env, but here is the env info.


  System:
    OS: macOS 14.5
    CPU: (11) arm64 Apple M3 Pro
    Memory: 564.69 MB / 36.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.14.0 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/node
    npm: 10.7.0 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/npm
    pnpm: 9.7.0 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/pnpm
    bun: 1.1.21 - ~/.local/share/aquaproj-aqua/bin/bun



### Can you contribute a fix?

- [ ] Iā€™m interested in opening a pull request for this issue.

ryoppippi avatar Aug 15 '24 10:08 ryoppippi