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.

Does not compile with TypeScript 4.7 module = nodenext

See original GitHub issue

Description Can’t compile TypeScript project using @master-chief/alpaca with module = nodenext in tsconfig.json.

Expected TypeScript compilation pass.

Reproduction

  1. Install latest TypeScript (4.7.3)
  2. Install latest @master-chief/alpaca (6.3.20): npm i @master-chief/alpaca
  3. Create tsconfig with module=NodeNext:
    "compilerOptions": {
      "target": "es2020",
      "module": "NodeNext",
      "strict": true,
      "allowSyntheticDefaultImports": true,
      "esModuleInterop": true
    },
    
  4. Create index.ts importing alpaca stuff:
    import { AlpacaClient, AlpacaStream } from '@master-chief/alpaca';
    
  5. Try to compile TypeScript: tsc

Logs

error TS7016: Could not find a declaration file for module '@master-chief/alpaca'. '.../node_modules/@master-chief/alpaca/dist/mjs/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/master-chief__alpaca` if it exists or add a new declaration (.d.ts) file containing `declare module '@master-chief/alpaca';`

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:22

github_iconTop GitHub Comments

2reactions
117commented, Jun 23, 2022

i’m going to write a new build script and config which generates the new declarations tomorrow. too tired right now

2reactions
117commented, Jun 14, 2022

Will investigate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - TypeScript 4.7
When a .ts file is compiled as an ES module, ECMAScript import / export ... ES modules, and .cjs files are always CommonJS...
Read more >
"moduleResolution": "NodeNext" throws ESM related errors ...
Install typescript@4.7.4 and pretty-ms. Set tsconfig.json as... ... Basically this code won't work w moduleResolution set to nodenext .
Read more >
Understanding TypeScript 4.7 and ECMAScript module support
In this post we'll test drive that support by attempting to build a simple module in TypeScript using the new ECMAScript modules support....
Read more >
node.js - Why we need "nodenext" typescript compiler option ...
Namely, I have a test package, using TypeScript 4.7.0-beta, with tsconfig.json containing module set to nodenext . A file with .cts is not...
Read more >
tsc-esm-fix - npm
meta is not allowed. esbuild/1043: empty output for interface files that breaks reimport. moduleResolution: nodenext. Nightly build TypeScript ...
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