File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -560,3 +560,10 @@ test("assigning filtered instances works", () => {
560
560
expect ( done . every ( ( t ) => ! isAlive ( t ) ) ) . toBe ( true )
561
561
expect ( notDone . every ( ( t ) => isAlive ( t ) ) ) . toBe ( true )
562
562
} )
563
+
564
+ test ( "#1676 - should accept read-only arrays" , ( ) => {
565
+ const ArrayType = types . array ( types . string )
566
+ const data = [ "foo" , "bar" ] as const
567
+ const instance = ArrayType . create ( data )
568
+ expect ( getSnapshot ( instance ) ) . toEqual ( [ "foo" , "bar" ] )
569
+ } )
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ export interface IMSTArray<IT extends IAnyType> extends IObservableArray<IT["Typ
72
72
73
73
/** @hidden */
74
74
export interface IArrayType < IT extends IAnyType >
75
- extends IType < IT [ "CreationType" ] [ ] | undefined , IT [ "SnapshotType" ] [ ] , IMSTArray < IT > > {
75
+ extends IType < readonly IT [ "CreationType" ] [ ] | undefined , IT [ "SnapshotType" ] [ ] , IMSTArray < IT > > {
76
76
hooks ( hooks : IHooksGetter < IMSTArray < IAnyType > > ) : IArrayType < IT >
77
77
}
78
78
@@ -81,7 +81,7 @@ export interface IArrayType<IT extends IAnyType>
81
81
* @hidden
82
82
*/
83
83
export class ArrayType < IT extends IAnyType > extends ComplexType <
84
- IT [ "CreationType" ] [ ] | undefined ,
84
+ readonly IT [ "CreationType" ] [ ] | undefined ,
85
85
IT [ "SnapshotType" ] [ ] ,
86
86
IMSTArray < IT >
87
87
> {
You can’t perform that action at this time.
0 commit comments