Typings are silently `any` under moduleResolution node16/nodenext

オープン 初心者向け
#36 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@kyrillWhite がすでに取り組んでいます。

2026年8月7日 から。

  • #37 @kyrillWhite による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript
領域
tooling

調査の方向性

src/cjs/*.d.ts に公開されている宣言から始め、moduleResolution nodenext と skipLibCheck を有効にした TypeScript 5.9.3 で問題を再現してください。宣言が TS2835 なしで解決され、strict チェック時に ecpair からのインポートが any になるのではなく型を保持すれば、作業は完了です。

索引モデルが issue の本文から書いたものです。

説明

The published typings in src/cjs/*.d.ts use extensionless relative imports:

// src/cjs/index.d.ts
export { ECPairFactory as default, ECPairFactory, ... } from './ecpair';

The root package.json has "type": "module" and there is no nested package.json in
src/cjs/, so TypeScript treats these .d.ts files as ES modules — and in ESM, relative
imports require explicit file extensions. ./ecpair fails to resolve:

src/cjs/index.d.ts(1,166): error TS2835: Relative import paths need explicit file
extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'.

With skipLibCheck: true (the common setup) the error is suppressed, and everything
imported from ecpair is silently any, even under --strict:

import { ECPairFactory } from 'ecpair';
const x: number = ECPairFactory; // compiles without error

Repro: ecpair 3.0.1, TypeScript 5.9.3, --module nodenext --moduleResolution nodenext,
ESM project.

主要言語
JavaScript
スター
29
フォーク
35
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bitcoinjs/ecpair のほかの issue

bitcoinjs/ecpair の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。