Typings are silently `any` under moduleResolution node16/nodenext

Đang mở Phù hợp với người mới
#36 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@kyrillWhite đang làm issue này rồi.

Từ ngày 7/8/2026.

  • #37 của @kyrillWhite — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu với các khai báo đã được phát hành trong src/cjs/*.d.ts và tái hiện vấn đề bằng TypeScript 5.9.3 với moduleResolution nodenext và skipLibCheck được bật. Công việc hoàn tất khi các khai báo được phân giải mà không có TS2835 và các import từ ecpair giữ nguyên kiểu của chúng thay vì trở thành any khi kiểm tra strict.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
29
Fork
35
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bitcoinjs/ecpair

Tất cả issue của bitcoinjs/ecpair

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.