Skip to content

inferred type error happens in commonjs&pnpm project #31

Open
@ryoppippi

Description

@ryoppippi

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions