Array
should extend ReadonlyArray
#46394
Labels
Experimentation Needed
Someone needs to try this out to see what happens
Suggestion
An idea for TypeScript
Bug Report
it's annoying how to extend arrays you have to duplicate your property in two interfaces
this seems to be because
Array
only structurally extendsReadonlyArray
, so adding toReadonlyArray
meansArray
no longer extends iti believe the fix is to add this to
Array
🔎 Search Terms
array extends readonlyarray
🕗 Version & Regression Information
4.5.0-dev.20211015
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Array
andReadonlyArray
, resulting in duplicate codeArray<unknown> extends ReadonlyArray<unknown> ? true : false
resolves totrue
even after adding members toReadonlyArray
thatArray
doesn't have🙂 Expected behavior
Array
should explicitly extendReadonlyArray
The text was updated successfully, but these errors were encountered: