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.

Type error differences between `tsc` and `microbundle`

See original GitHub issue

Reproduction:

  • Clone https://github.com/tom-sherman/immurl @ bb2644ecfe1bb4f2098c02df813acf5cf2d5de07
  • npm i
  • npm run typecheck - No type errors
  • npm run build - Type errors from microbundle
  • Uncomment methods from bottom of lib/immurl.ts
  • npm run typecheck - Type errors from tsc
  • npm run build - No type errors

Is this a bug or am I missing some configuration? It looks like microbundle is using different lib definitions to typescript here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marvinhagemeistercommented, Jul 4, 2020

Sure, mentioning it in the README is a good idea! We’re always using the esnext target and ESNext as the module type. This ensures that microbundle works with any future TypeScript version. Happy to review any PRs 👍

0reactions
tom-shermancommented, Jul 4, 2020

@marvinhagemeister

Microbundle overwrites both the module and target compiler options. Those two are the only properties that can’t be overwritten.

This is the part I was missing and isn’t mentioned in the docs and I don’t think many people would say that was obvious. Would you up for reviewing a PR that clarifies this in the README and strongly recommends to match whatever microbundle’s target/module is in the tsconfig?

Read more comments on GitHub >

github_iconTop Results From Across the Web

microbundle vs tsc vs tsdx vs tsup vs typescript-starter | npm trends
Works with React; Human readable error messages (and in VSCode-friendly format); Bundle size snapshots; Opt-in to extract invariant error codes; Jest test ...
Read more >
Wrong typescript emit path if --cwd is used · Issue #643 - GitHub
SHOULD: Types should be emitted into the dist folder xyz/dist of the ... the ts emit path is different but still wrong: dist/main.d.ts ......
Read more >
Options for Publishing TypeScript Libraries | by Jake Ginnivan
This is a bit of a brain dump for myself around the different options out there and some considerations for each.
Read more >
You may not need a bundler for your NPM library
I'd recommend just compiling your code with tsc , no bundler involved. This way, you can develop with typescript, it will output js...
Read more >
Compiling ts libraries - Which Bundler / Compiler : r/typescript
Just wondered since I am working with microbundle and was recently thinking "Why did I choose microbundle over tsc?" and the only answer...
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