Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: internal module types not loaded #3394

Closed
1 task
Eomm opened this issue Sep 6, 2021 · 3 comments
Closed
1 task

[Bug?]: internal module types not loaded #3394

Eomm opened this issue Sep 6, 2021 · 3 comments
Labels
bug Something isn't working external bug This issue highlights a bug in another project stale Issues that didn't get attention

Comments

@Eomm
Copy link

Eomm commented Sep 6, 2021

Self-service

  • I'd be willing to implement a fix

Describe the bug

Testing a typescript project with tsd and [email protected]in PnP mode triggers these errors:

➜  yarn-ts-issue yarn run start

  index.test-d.ts:1:27
  ✖  1:27  Cannot find module tsd or its corresponding type declarations.   
  ✖  3:48  Cannot find module http or its corresponding type declarations. 

It works when the linker is node_modules

I would expect if works, because:

-http is included in @types/node

  • the tsd package is shipped with types as well

To reproduce

(cannot use shelock since I must use ts)

tsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "lib": [ "es2015" , "DOM"],
    "module": "commonjs",
    "noEmit": true,
    "strict": true,
  }
}

package.json

{
  "version": "0.59.0",
  "scripts": {
    "start": "tsc && tsd"
  },
  "devDependencies": {
    "@types/node": "^16.7.10",
    "tsd": "^0.17.0",
    "typescript": "~4.3.0"
  }
}

.yarnrc.yml

nodeLinker: pnp
pnpMode: loose
yarnPath: .yarn/releases/yarn-3.0.2.cjs

And a simple test file:

// index.d.ts

declare const concat: {
	(value1: string, value2: string): string;
	(value1: number, value2: number): string;
};

export default concat;


// index.test-d.ts
import { expectType } from 'tsd'
import concat from '.'
import { IncomingMessage, ServerResponse } from 'http'

expectType < string > (concat('foo', 'bar'))
expectType < string > (concat(1, 2))

console.log('run')

Environment

  System:
    OS: macOS 11.5.2
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.6.2 - /private/var/folders/f7/v7q6nhw13jn6v1k50v4ty05r0000gn/T/xfs-6e39b558/node
    Yarn: 3.0.2 - /private/var/folders/f7/v7q6nhw13jn6v1k50v4ty05r0000gn/T/xfs-6e39b558/yarn
    npm: 7.20.3 - ~/.nvm/versions/node/v16.6.2/bin/npm

Additional context

I tried to move the devDependencies to dependencies

@Eomm Eomm added the bug Something isn't working label Sep 6, 2021
@merceyz
Copy link
Member

merceyz commented Sep 7, 2021

tsd is using @tsd/typescript which has a bundled version of TypeScript so PnP wont work there

@merceyz merceyz added the external bug This issue highlights a bug in another project label Sep 7, 2021
@Eomm
Copy link
Author

Eomm commented Sep 7, 2021

Could we suggest to its maintainer to split the module into two separated packages to let it be compatible within PnP mode?

@yarnbot
Copy link
Collaborator

yarnbot commented Oct 10, 2021

Hi! 👋

This issue looks stale, and doesn't feature the reproducible label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).

Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! 😃

If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded label. Thanks for helping us triaging our repository! 🌟

@yarnbot yarnbot added the stale Issues that didn't get attention label Oct 10, 2021
@yarnbot yarnbot closed this as completed Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external bug This issue highlights a bug in another project stale Issues that didn't get attention
Projects
None yet
Development

No branches or pull requests

3 participants