@@ -18,6 +18,12 @@ type DefaultSpokenFormMapDefinition = {
18
18
* become the sole source of truth for our default spoken forms, including the
19
19
* Talon side. Today it is only used on the extension side for testing, and as a
20
20
* fallback when we can't get the custom spoken forms from Talon.
21
+ *
22
+ * In this map, for regular entities, ie ones that are speakable by default, not
23
+ * private, and have only one spoken form, we allow a shorthand of just providing
24
+ * the spoken form as a string. For more complex cases, we can use the
25
+ * {@link isPrivate} or {@link isDisabledByDefault} helper functions to construct
26
+ * {@link DefaultSpokenFormMapEntry} objects, or just construct them manually.
21
27
*/
22
28
const defaultSpokenFormMapCore : DefaultSpokenFormMapDefinition = {
23
29
pairedDelimiter : {
@@ -196,8 +202,12 @@ export type DefaultSpokenFormMap = {
196
202
: Record < SpokenFormMapKeyTypes [ K ] , DefaultSpokenFormMapEntry > ;
197
203
} ;
198
204
199
- // FIXME: Don't cast here; need to make our own mapValues with stronger typing
200
- // using tricks from our object.d.ts
205
+ /**
206
+ * This map contains information about the default spoken forms for all our
207
+ * speakable entities, including scope types, paired delimiters, etc. Note that
208
+ * this map can't be used as a spoken form map. If you want something that can
209
+ * be used as a spoken form map, see {@link defaultSpokenFormMap}.
210
+ */
201
211
export const defaultSpokenFormInfo = mapValues (
202
212
defaultSpokenFormMapCore ,
203
213
( entry ) =>
@@ -210,23 +220,31 @@ export const defaultSpokenFormInfo = mapValues(
210
220
}
211
221
: subEntry ,
212
222
) ,
223
+ // FIXME: Don't cast here; need to make our own mapValues with stronger typing
224
+ // using tricks from our object.d.ts
213
225
) as DefaultSpokenFormMap ;
214
226
215
- // FIXME: Don't cast here; need to make our own mapValues with stronger typing
216
- // using tricks from our object.d.ts
217
- export const defaultSpokenFormMap = mapValues ( defaultSpokenFormInfo , ( entry ) =>
218
- mapValues (
219
- entry ,
220
- ( {
221
- defaultSpokenForms,
222
- isDisabledByDefault,
223
- isSecret,
224
- } ) : SpokenFormMapEntry => ( {
225
- spokenForms : isDisabledByDefault ? [ ] : defaultSpokenForms ,
226
- isCustom : false ,
227
- defaultSpokenForms,
228
- requiresTalonUpdate : false ,
229
- isSecret,
230
- } ) ,
231
- ) ,
227
+ /**
228
+ * A spoken form map constructed from the default spoken forms. It is designed to
229
+ * be used as a fallback when the Talon spoken form map is not available.
230
+ */
231
+ export const defaultSpokenFormMap = mapValues (
232
+ defaultSpokenFormInfo ,
233
+ ( entry ) =>
234
+ mapValues (
235
+ entry ,
236
+ ( {
237
+ defaultSpokenForms,
238
+ isDisabledByDefault,
239
+ isPrivate,
240
+ } ) : SpokenFormMapEntry => ( {
241
+ spokenForms : isDisabledByDefault ? [ ] : defaultSpokenForms ,
242
+ isCustom : false ,
243
+ defaultSpokenForms,
244
+ requiresTalonUpdate : false ,
245
+ isPrivate,
246
+ } ) ,
247
+ ) ,
248
+ // FIXME: Don't cast here; need to make our own mapValues with stronger typing
249
+ // using tricks from our object.d.ts
232
250
) as SpokenFormMap ;
0 commit comments