@@ -28,12 +28,12 @@ export type DevUser = {
28
28
export type ReactionType = 'unicode_emoji' | 'realm_emoji' | 'zulip_extra_emoji' ;
29
29
30
30
/** An emoji reaction to a message. */
31
- export type Reaction = {
32
- user : {
31
+ export type Reaction = $ReadOnly < { |
32
+ user : $ReadOnly < { |
33
33
email : string ,
34
34
full_name : string ,
35
35
user_id : number ,
36
- } ,
36
+ | } > ,
37
37
emoji_name : string ,
38
38
reaction_type : ReactionType ,
39
39
@@ -45,16 +45,16 @@ export type Reaction = {
45
45
* https://github.com/zulip/zulip/blob/master/zerver/models.py
46
46
*/
47
47
emoji_code : string ,
48
- } ;
48
+ | } > ;
49
49
50
- export type MessageEdit = {
50
+ export type MessageEdit = $ReadOnly < { |
51
51
prev_content ? : string ,
52
52
prev_rendered_content ? : string ,
53
53
prev_rendered_content_version ? : number ,
54
54
prev_subject ? : string ,
55
55
timestamp : number ,
56
56
user_id : number ,
57
- } ;
57
+ | } > ;
58
58
59
59
/**
60
60
* A Zulip message.
@@ -91,7 +91,7 @@ export type MessageEdit = {
91
91
*
92
92
* See also `Outbox`.
93
93
*/
94
- export type Message = {
94
+ export type Message = $ReadOnly < {
95
95
/** Our own flag; if true, really type `Outbox`. */
96
96
isOutbox : false ,
97
97
@@ -115,20 +115,20 @@ export type Message = {
115
115
* * Absent in the Redux `state.messages`; we move the information to a
116
116
* separate subtree `state.flags`.
117
117
*/
118
- flags ?: string [ ] ,
118
+ flags ?: $ReadOnlyArray < string > ,
119
119
120
120
/** The rest are believed to really appear in `message` events. */
121
121
avatar_url : ?string ,
122
122
client : string ,
123
123
content : string ,
124
124
content_type : 'text/html' | 'text/markdown' ,
125
125
display_recipient : $FlowFixMe , // `string` for type stream, else PmRecipientUser[].
126
- edit_history : MessageEdit [ ] ,
126
+ edit_history : $ReadOnlyArray < MessageEdit > ,
127
127
gravatar_hash : string ,
128
128
id : number ,
129
129
is_me_message : boolean ,
130
130
last_edit_timestamp ?: number ,
131
- reactions : Reaction [ ] ,
131
+ reactions : $ReadOnlyArray < Reaction > ,
132
132
recipient_id : number ,
133
133
sender_email : string ,
134
134
sender_full_name : string ,
@@ -137,11 +137,11 @@ export type Message = {
137
137
sender_short_name : string ,
138
138
stream_id : number , // FixMe: actually only for type `stream`, else absent.
139
139
subject : string ,
140
- subject_links : string [ ] ,
141
- submessages : Message [ ] ,
140
+ subject_links : $ReadOnlyArray < string > ,
141
+ submessages : $ReadOnlyArray < Message > ,
142
142
timestamp : number ,
143
143
type : 'stream' | 'private' ,
144
- } ;
144
+ } > ;
145
145
146
146
export type NarrowOperator =
147
147
| 'is'
@@ -154,31 +154,31 @@ export type NarrowOperator =
154
154
| 'pm-with'
155
155
| 'search' ;
156
156
157
- export type NarrowElement = {
157
+ export type NarrowElement = $ReadOnly < { |
158
158
operand : string ,
159
159
operator ?: NarrowOperator , // TODO type: this shouldn't be absent.
160
- } ;
160
+ | } > ;
161
161
162
- export type Narrow = NarrowElement [ ] ;
162
+ export type Narrow = $ReadOnlyArray < NarrowElement > ;
163
163
164
- export type RealmEmojiType = {
165
- author : {
164
+ export type RealmEmojiType = $ReadOnly < { |
165
+ author : $ReadOnly < { |
166
166
email : string ,
167
167
full_name : string ,
168
168
id : number ,
169
- } ,
169
+ | } > ,
170
170
deactivated : boolean ,
171
171
id : number ,
172
172
name : string ,
173
173
source_url : string ,
174
174
// This prevents accidentally using this type as a map.
175
175
// See https://github.com/facebook/flow/issues/4257#issuecomment-321951793
176
176
[ empty ] : mixed ,
177
- } ;
177
+ | } > ;
178
178
179
- export type RealmEmojiState = {
179
+ export type RealmEmojiState = $ReadOnly < {
180
180
[ id : string ] : RealmEmojiType ,
181
- } ;
181
+ } > ;
182
182
183
183
export type RealmFilter = [ string , string , number ] ;
184
184
0 commit comments