Repository navigation
fix(Table): fix TS error when colKey is optional - #4676
Merged
Merged
Conversation
getCellKey 的 colKey 形参声明为 string,但 BaseTableCol.colKey 是可选 字段(string | undefined)。消费方开启 strictNullChecks 时(如 uniapp HBuilderX H5 构建)会报 TS2345。 在调用处补 `|| ''` 兜底;由于 getCellKey 内部本来就有 `colPart = colKey || colIndex`,传空串与传 undefined 运行时行为完全一致, 无副作用。
novlan1
requested review from
anlyyao,
betavs,
jarmywang,
jin0209 and
zydemail
as code owners
October 16, 2026 02:49
Contributor
Collaborator
Author
Contributor
|
Size Change: 0 B Total Size: 88.5 kB ℹ️ View Unchanged
|
commit: |
Contributor
|
Size Change: +1 B (0%) Total Size: 586 kB 📦 View Changed
ℹ️ View Unchanged
|
Contributor
|
Size Change: 0 B Total Size: 287 kB ℹ️ View Unchanged
|
Collaborator
TDesign Component Site Preview Open
|
anlyyao
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



getCellKey 的 colKey 形参声明为 string,但 BaseTableCol.colKey 是可选 字段(string | undefined)。消费方开启 strictNullChecks 时(如 uniapp HBuilderX H5 构建)会报 TS2345。
在调用处补
|| ''兜底;由于 getCellKey 内部本来就有colPart = colKey || colIndex,传空串与传 undefined 运行时行为完全一致, 无副作用。🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
📝 更新日志
tdesign-miniprogram
@tdesign/uniapp
@tdesign/uniapp-chat
☑️ 请求合并前的自查清单