-
Notifications
You must be signed in to change notification settings - Fork 761
Open
Description
Another issue like #1034 that persists after the fixes there. Unlike #2276, this one reproduces only when using pnpm install.
Steps to reproduce
package.json
{
"type": "module",
"dependencies": {
"@types/express": "4.17.23",
"express": "4.21.2"
}
}
tsconfig.json
{
"compilerOptions": {
"module": "node20",
"moduleResolution": "node16",
"declaration": true
}
}
express.ts
import express from "express";
export const handler = async (req: express.Request, res: express.Response) => {};
Behavior with typescript@5.9
No error.
Behavior with tsgo
express.ts:3:14 - error TS2742: The inferred type of 'handler' cannot be named without a reference to '.pnpm/@types+express-serve-static-core@4.19.7/node_modules/@types/express-serve-static-core'. This is likely not portable. A type annotation is necessary.
3 export const handler = async (req: express.Request, res: express.Response) => {};
~~~~~~~
express.ts:3:14 - error TS2742: The inferred type of 'handler' cannot be named without a reference to '.pnpm/@types+qs@6.14.0/node_modules/@types/qs'. This is likely not portable. A type annotation is necessary.
3 export const handler = async (req: express.Request, res: express.Response) => {};
~~~~~~~
Found 2 errors in the same file, starting at: express.ts:3
Note that these errors do not occur if you install via npm i. It appears to be the pnpm node_modules structure triggering it.
Metadata
Metadata
Assignees
Labels
No labels