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
ReadonlyDeep converts Sets and Maps to ReadonlySets and ReadonlyMaps respectively. However, ReadonlySet and ReadonlyMap still have mutable methods. To make these types fully readonly and pass the isTypeReadonly function, the types need to be wrapped in Readonly, e.g. Readonly<ReadonlySet<T>>.
Note: ReadonlyArray doesn't need to be wrapped in Readonly as TypeScript just treats Readonly<ReadonlyArray<T>> the same as ReadonlyArray<T>. i.e. Both have mutable methods. As far as I know there is no way to easily make the methods on an array immutable. The isTypeReadonly function makes an exception for arrays having mutable methods.
The text was updated successfully, but these errors were encountered:
With regard to readonly sets and map, this library's
ReadonlyDeep
type is not consistent with the isTypeReadonly function from @typescript-eslint/type-utils that is used for eslint rules such as @typescript-eslint/prefer-readonly-parameter-types.ReadonlyDeep
convertsSet
s andMap
s toReadonlySet
s andReadonlyMap
s respectively. However,ReadonlySet
andReadonlyMap
still have mutable methods. To make these types fully readonly and pass theisTypeReadonly
function, the types need to be wrapped inReadonly
, e.g.Readonly<ReadonlySet<T>>
.Note:
ReadonlyArray
doesn't need to be wrapped inReadonly
as TypeScript just treatsReadonly<ReadonlyArray<T>>
the same asReadonlyArray<T>
. i.e. Both have mutable methods. As far as I know there is no way to easily make the methods on an array immutable. TheisTypeReadonly
function makes an exception for arrays having mutable methods.The text was updated successfully, but these errors were encountered: