types.ts: LoopCliConfig.logger docstring says 'VerboseLogger instance' but LoggerSpec accepts any Logger

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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
92/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu trong src/types.ts, tại docstring của LoopCliConfig.logger, sau đó so sánh cách diễn đạt của nó với định nghĩa LoggerSpec trong src/loggers.ts và README hoặc hành vi của createLogger được đề cập trong issue. Cập nhật tài liệu để mô tả mọi triển khai Logger, tùy chọn 'verbose' và undefined; hoàn tất khi comment không còn ngụ ý rằng chỉ VerboseLogger được chấp nhận.

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

Mô tả

bug S4

Observed behavior

The docstring on LoopCliConfig.logger in src/types.ts reads:

/**
 * Controls verbose diagnostic logging to stderr. Accepts a concrete
 * `VerboseLogger` instance, the string `'verbose'` (which creates an
 * enabled logger), or `undefined` (quiet, the default).
 */
readonly logger?: LoggerSpec;

This says the field accepts a VerboseLogger instance. But LoggerSpec in src/loggers.ts is defined as:

export type LoggerSpec = Logger | 'verbose' | undefined;

Any object implementing the Logger interface is accepted, not just VerboseLogger. The README and createLogger implementation both treat the field as Logger | 'verbose' | undefined, so callers writing custom loggers will hit no runtime problem; they just see misleading documentation that suggests they have to use VerboseLogger.

Expected behavior

The docstring should describe the field as accepting any Logger implementation (with VerboseLogger mentioned as the built-in option), the string 'verbose', or undefined.

Minimal reproduction

Open src/types.ts and inspect the comment block on the logger field of LoopCliConfig (around line 103), then compare with the LoggerSpec definition in src/loggers.ts.

Suggested fix

Update the docstring to refer to Logger (the public interface) rather than VerboseLogger. For example:

Controls verbose diagnostic logging to stderr. Accepts a concrete
`Logger` instance, the string `'verbose'` (which creates an enabled
`VerboseLogger`), or `undefined` (quiet, the default).
Ngôn ngữ chính
TypeScript
Star
2
Fork
1
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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 joewalker/loop-the-loop

Tất cả issue của joewalker/loop-the-loop

Issue tương tự

Thêm issue về TypeScript

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.