Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#1,754 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
android, kotlin, typescript
领域
mobile, tooling

调研方向

从复现中链接的 Kotlin 函数声明开始,并将其输出与 issue 中显示的生成 typings 进行比较。跟踪 Android d.ts Generator 对嵌套 data classes 的处理,并通过在缺少模块大括号的情况下重新生成 typings 来验证其完成情况。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C++
星标
563
派生
144
平均合并
10 小时 46 分钟
30 天内合并 PR
14

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NativeScript/android 的其他 Issue

查看 NativeScript/android 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。