When dependencies are installed with pnpm, ts-loader behaves differently than tsc
See original GitHub issueExpected Behaviour
ts-loader should not report TS2305
Actual Behaviour
ts-loader report TS2305 error
Steps to Reproduce the Problem
- clone https://github.com/xbtsw/typescript-pnpm
npm i -g pnpm
pnpm install
- run
npm run tsc
and observe that the compilation success - 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:
- Created 5 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for your work! Released with https://github.com/TypeStrong/ts-loader/releases/tag/v4.3.0
Thanks for the insight @zkochan and @pgonzal. The reasoning I have so far is that since
tsc
works whilets-loader
doesn’t. It should be the case that they setup the TypeScript compiler differently, the problem shouldn’t be with the compiler itself, otherwisetsc
would fail too.I compared the compiler setup code in
ts-loader
andtsc
but wasn’t be able to get very far there.