NativeScript / NativeScript/android

Android d.ts generator fails to create typings for nested data class

Đang mở
#1,754 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.

Ngôn ngữ chính
C++
Star
563
Fork
144
Merge trung bình
10 giờ 46 phút
Pull request đã merge (30 ngày)
14

Mô tả

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 8.5
  • Cross-platform modules: 8.5.0
  • Android Runtime: 8.5.0
  • Android d.ts Generator : 3.0.0
  • iOS Runtime (if applicable): 8.5.1
  • Plugin(s):

Describe the bug
It seems Android d.ts generator has trouble generating types for data classes declared inside functions.
Generator log output:

Android d.ts Generator Version : 3.0.0
ignoring definitions in missing dependency: android.text.TextWatcher
ignoring definitions in missing dependency: android.view.View$OnFocusChangeListener
Generation of definitions took 712ms.
Typings have been generated in the following directory: ./typings

To Reproduce
This is the kotlin function with class declaration: https://github.com/RedMadRobot/input-mask-android/blob/eee78324eb4cdb4faab3248ef646d5750507b598/inputmask/src/main/kotlin/com/redmadrobot/inputmask/MaskedTextChangedListener.kt#L294

These are the typings generated, you will notice a brace is missing on module pickMask:

export module MaskedTextChangedListener {
	export module pickMask {
	export module ValueListener {
		export class MaskAffinity {
			public static class: java.lang.Class<com.redmadrobot.inputmask.MaskedTextChangedListener.pickMask.MaskAffinity>;
			public component1(): com.redmadrobot.inputmask.helper.Mask;
			public getAffinity(): number;
			public component2(): number;
			public copy(param0: com.redmadrobot.inputmask.helper.Mask, param1: number): com.redmadrobot.inputmask.MaskedTextChangedListener.pickMask.MaskAffinity;
			public hashCode(): number;
			public equals(param0: any): boolean;
			public getMask(): com.redmadrobot.inputmask.helper.Mask;
			public toString(): string;
			public constructor(param0: com.redmadrobot.inputmask.helper.Mask, param1: number);
		}
	}
}

Expected behavior
Typings should be generated without problems.

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 với khai báo hàm Kotlin được liên kết trong phần tái hiện và so sánh output của nó với các typings được tạo hiển thị trong issue. Theo dõi cách Android d.ts Generator xử lý các data classes lồng nhau và xác minh việc hoàn tất bằng cách tạo lại typings mà không có dấu ngoặc nhọn bị thiếu của module.

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

Đánh giá

Công nghệ
android, kotlin, typescript
Lĩnh vực
mobile, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/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.