You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the intended behavior. A regular array is a subtype of a ReadonlyArray (otherwise this hierarchy would not be useful). And if a type guard can't narrow down a type to a subtype (otherwise a type guard would not be useful).
Activity
MartinJohns commentedon Mar 15, 2021
This is most likely intentional. Be aware that readonly does not mean immutable. There is no way to represent immutability in TypeScripts type-system.
See #17002. Found using your search terms.
RyanCavanaugh commentedon Mar 15, 2021
This is the intended behavior. A regular array is a subtype of a ReadonlyArray (otherwise this hierarchy would not be useful). And if a type guard can't narrow down a type to a subtype (otherwise a type guard would not be useful).
typescript-bot commentedon Mar 17, 2021
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.