Allow type-only named re-exports along with assigned export in the same file
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- compilers
Hướng nghiên cứu
Issue nêu tên các tệp ví dụ person.ts, person-type.ts, person-value.ts và usage.ts, nhưng không có tệp trình biên dịch hoặc bài kiểm thử nào. Hãy bắt đầu bằng việc xác định cách trình biên dịch xử lý export = cùng với các export có tên chỉ dành cho kiểu, sau đó xác minh rằng ví dụ biên dịch được và các export chỉ dành cho kiểu không làm thay đổi JavaScript được phát ra.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Search Terms
allow export types assigned =
Suggestion
The suggestion is to allow compilation of files that do both export = and export type {}.
Use Cases
For modules that target both TypeScript and CommonJS usage it would allow consolidating all exports for both module systems in one file (albeit with the requirement of esModuleInterop being true).
Currently, in order to do that I would have to utilize @ts-ignore (see parzh/xrange#69 for details).
Examples
/person.ts:
import personValue from "./person-value";
export = personValue;
export type { default as PersonType } from "./person-type";
/person-type.ts:
export default interface Person { name: string; }
/person-value.ts:
export default { name: "John Doe" } as import("./person-type").default;
Usage:
/usage.ts:
import personValue from "./person";
import personValue, { PersonType } from "./person";
import type { PersonType } from "./person";
import personValue = require("./person");
/usage.js:
const personValue = require("./person");
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, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 117
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/TypeScript
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/TypeScript#64322 · 2 bình luận · 1 reaction · 2 người được giao ·
-
Possible Improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/TypeScript#64278 · 1 bình luận · 1 reaction ·
-
Docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
microsoft/TypeScript#64118 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
microsoft/TypeScript#64094 ·
-
Docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microsoft/TypeScript#63959 · 5 bình luận ·
Tất cả issue của microsoft/TypeScript
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
milvus-io/birdwatcher#545 ·
-
kind/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
kubernetes-sigs/prow#953 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
caddyserver/caddy#8046 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
jaegertracing/jaeger#9588 ·