microsoft / microsoft/TypeScript

Preserve the jsdoc comments for interface while compiling.

Đang mở
#42,547 2 bình luận 1 reaction 0 người được giao Xem trên GitHub

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

Awaiting More Feedback Suggestion
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

Suggestion

🔍 Search Terms

tsc jsdoc

✅ Viability Checklist

My suggestion meets these guidelines:

  • ✅ This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • ✅ This wouldn't change the runtime behavior of existing JavaScript code
  • ✅ This could be implemented without emitting different JS based on the types of the expressions
  • ✅ This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • ✅ This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

Add a configuraion for preserving the jsdoc comments for interface while compiling.

📃 Motivating Example

Example

My .ts file like this:

// test.ts
/**
 * @typedef {Object} ITest - For test
 * @property {string} a
 */
export interface ITest {
  a: string
}

/**
 * @function print - print ITest
 * @params {ITest} d
 */
export function print (d: ITest): void {
  console.log(d.a)
}

while tsc compiling, the .js like this:

// test.js
/**
 * @typedef {Object} ITest - For test
 * @property {string} a
 */
/**
 * @function print - print ITest
 * @params {ITest} d
 */
export function print(d) {
    console.log(d.a);
}

💻 Use Cases

There are two case as I can see.

  • Preverse comments for files.
  • Use jsdoc comments to mark interfaces or types on .ts and generate doc through jsdoc comments on .js

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Bắt đầu bằng cách chạy tsc trên ví dụ test.ts được cung cấp và so sánh test.js được tạo ra với đầu ra được yêu cầu. Xác định hành vi cấu hình và xác minh rằng các nhận xét JSDoc của interface và type được giữ nguyên mà không thay đổi đầu ra khi chạy.

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

Đánh giá

Công nghệ
javascript, typescript
Lĩnh vực
compilers
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

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.