question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When dependencies are installed with pnpm, ts-loader behaves differently than tsc

See original GitHub issue

Expected Behaviour

ts-loader should not report TS2305

Actual Behaviour

ts-loader report TS2305 error

Steps to Reproduce the Problem

  1. clone https://github.com/xbtsw/typescript-pnpm
  2. npm i -g pnpm
  3. pnpm install
  4. run npm run tsc and observe that the compilation success
  5. run npm start and observe error

This happens to both Linux and Windows 10 host.

Location of a Minimal Repository that Demonstrates the Issue.

https://github.com/xbtsw/typescript-pnpm

It looks like the type information is not visible to TypeScript when the dependency are symlinked and are compiled via ts-loader. I am willing to look into it but not sure where to start.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
johnnyreillycommented, May 7, 2018
1reaction
weichenswcommented, Apr 25, 2018

Thanks for the insight @zkochan and @pgonzal. The reasoning I have so far is that since tsc works while ts-loader doesn’t. It should be the case that they setup the TypeScript compiler differently, the problem shouldn’t be with the compiler itself, otherwise tsc would fail too.

I compared the compiler setup code in ts-loader and tsc but wasn’t be able to get very far there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ts-loader - npm
The default behavior of ts-loader is to act as a drop-in replacement for the tsc command, so it respects the include , files...
Read more >
Compiling Typescript with dependencies installed with yarn
Yes I ran yarn install. I have done some more research and it seems that tsc is not supporting yarn PnP. using webpack...
Read more >
How to set up a TypeScript project - Medium
It's a world of bewildering complexity, where making a very simple project seems to require installing numerous tools, editing several text ...
Read more >
Best practices for creating a modern npm package - Snyk
The module property indicates to TypeScript which JavaScript module format should be used when compiling your project code. The moduleResolution ...
Read more >
How to set up TypeScript
To do this, run npm install -g typescript . This will install the latest version (currently 4.9). An alternative is to use npx...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found