fix(provider): make JSONArray readonly to accept readonly arrays#15594
fix(provider): make JSONArray readonly to accept readonly arrays#15594kagura-agent wants to merge 5 commits into
Conversation
|
Friendly ping — this has been open for 6 days. The change makes |
|
Friendly ping — this has been open for a week. Makes |
|
Friendly ping — this PR has been open for 8 days. Happy to address any feedback. 🙏 |
|
Friendly ping — this has been open for 8 days. The fix makes |
|
Friendly ping — this has been open for 9 days. The fix is small (adding |
|
Closing this — it's been open for 9 days with no review activity. The fix (making |
Summary
Makes
JSONArraytypereadonlyso it accepts both mutable and readonly arrays.Closes #15593
Changes
Why
readonly T[]is not assignable toT[]in TypeScript, so passing a readonly array (e.g. fromas constassertions or functions returningreadonlyarrays) to anything typed asJSONValuefails:Making
JSONArray = readonly JSONValue[]fixes this because:T[]extendsreadonly T[]→ mutable arrays still assignable (backward compatible)readonly T[]extendsreadonly T[]→ readonly arrays now acceptedNo runtime behavior change — this is purely a type-level fix.