array() and tuple() only define mutable Arrays, not ReadonlyArray
Author: jakubwolnyCreated Apr 1, 2021Updated Jan 17, 2025
Labelsfeature♥ help please
I guess I have similar problem to https://github.com/ianstormtaylor/superstruct/issues/523
I wanted to define a property inside the object which is ReadonlyArray, so I did:
tags: array(string())
but then when I tried to use the that object in other places of the app TS complained, since ReadonlyArray is a subset of Array (does not implement mutation methods).
Is there a way to do that using refine (since it's a generic) or is it necessary to update superstruct code?
btw. I'm sorry if the question is stupid, I'm quite new to the library - but so far I'm in love with it! Definitely the best runtime TS checker I've seen!
Source: ianstormtaylor/superstruct