microsoft / microsoft/AdaptiveCards

[JS] Serialization `toJSON` methods do not type check

Open
#7,777 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Renderers Bug Platform-JavaScript
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

Platform

  • JavaScript

Issue

The toJSON methods within serialization.ts are not properly checking the type of value. The parent class, PropertyDefinition, allows any as the value type, so typescript will allow any type to be passed to the overloaded methods on the child classes.

See this typescript example

Proposed solution:
Allow all methods to accept any for value and do additional checking within the methods.
See this PR (only some portions are relevant): https://github.com/microsoft/AdaptiveCards/pull/7762

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading serialization.ts and reproducing the linked TypeScript example to identify which toJSON overloads accept incompatible values. Done means the affected methods perform the required value checks while preserving valid serialization behavior; verify the relevant TypeScript checks or existing serialization tests if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.