Skip to content

fix: Resolve TS2352 type error in MapBuilder for TypeScript 5.6+#373

Merged
kou merged 1 commit into
apache:mainfrom
Divyanshu-s13:fix-mapbuilder-ts2352-error
Feb 4, 2026
Merged

fix: Resolve TS2352 type error in MapBuilder for TypeScript 5.6+#373
kou merged 1 commit into
apache:mainfrom
Divyanshu-s13:fix-mapbuilder-ts2352-error

Conversation

@Divyanshu-s13

@Divyanshu-s13 Divyanshu-s13 commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

What's Changed

Fixed TS2352 type conversion error in MapBuilder.setValue() that occurs with TypeScript 5.6+ due to stricter type checking.

Changes

Updated type assertion in [map.ts] to use intermediate unknown cast (as unknown as MapValue<K, V>) to satisfy TypeScript 5.6+ stricter type narrowing
Removed unnecessary type assertion on pending.get(index) since the type is already inferred correctly

Why
TypeScript 5.6 introduced stricter type conversion rules, causing TS2352 errors when directly casting between incompatible types. The as unknown as T pattern is the recommended approach for these scenarios.

This is a non-breaking change - it only affects compile-time behavior and has no runtime impact.

Closes #49 .

@Divyanshu-s13

Copy link
Copy Markdown
Contributor Author

@kou I’ve fixed the issue. Could you please merge it?

@kou kou changed the title fix(issue:#49): resolve TS2352 type error in MapBuilder for TypeScript 5.6+#49 fix: Resolve TS2352 type error in MapBuilder for TypeScript 5.6+ Feb 3, 2026
@kou
kou requested review from Copilot, domoritz and trxcllnt February 3, 2026 00:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Resolves a TypeScript 5.6+ TS2352 type conversion error in MapBuilder.setValue() caused by stricter casting checks.

Changes:

  • Updates the row type assertion to use an intermediate unknown cast to satisfy TS 5.6+ rules.
  • Removes an unnecessary type assertion on pending.get(index) and relies on inferred typing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Divyanshu-s13

Copy link
Copy Markdown
Contributor Author

Hi @kou ,

Could you please let me know if any changes are required for this issue?

@kou

kou commented Feb 4, 2026

Copy link
Copy Markdown
Member

I was waiting for reviews from Apache Arrow JS maintainers. Now, we have an approval. I merge this.

@kou
kou merged commit 6ee064e into apache:main Feb 4, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypesScript type error in ts/builder/map.ts causes TypeScript compilation to fail

4 participants