@@ -193,14 +193,12 @@ const determiner = checkedSequence(
193
193
) ,
194
194
sequence ( determinerType , optionalNumber . skip ( closeParenthesis ) ) ,
195
195
)
196
- . map ( ( [ [ determiner , plural ] , [ kind , quantity ] ] ) =>
197
- ( {
198
- determiner,
199
- plural,
200
- kind,
201
- quantity : quantity ?? "both" ,
202
- } ) as const
203
- ) ;
196
+ . map ( ( [ [ determiner , plural ] , [ kind , quantity ] ] ) => ( {
197
+ determiner,
198
+ plural,
199
+ kind,
200
+ quantity : quantity ?? "both" ,
201
+ } ) ) ;
204
202
const adjectiveKind = choiceWithCheck (
205
203
checkedSequence ( keyword ( "physical" ) , keyword ( "quality" ) )
206
204
. map ( ( ) => "physical quality" as const ) ,
@@ -244,14 +242,12 @@ const noun = sequence(
244
242
. map ( ( [ adjective , name ] ) => ( { adjective, name } ) ) ,
245
243
) ,
246
244
)
247
- . map ( ( [ determiner , adjective , noun , postAdjective ] ) =>
248
- ( {
249
- ...noun ,
250
- determiner,
251
- adjective,
252
- postAdjective,
253
- } ) as const
254
- ) ;
245
+ . map ( ( [ determiner , adjective , noun , postAdjective ] ) => ( {
246
+ ...noun ,
247
+ determiner,
248
+ adjective,
249
+ postAdjective,
250
+ } ) ) ;
255
251
const checkedNoun = new CheckedParser (
256
252
choiceOnlyOne (
257
253
determiner . check ,
@@ -277,28 +273,26 @@ function checkedSimpleUnitWithTemplate(
277
273
. map ( ( [ word ] ) => word ) ;
278
274
}
279
275
const interjectionDefinition = checkedSimpleUnit ( "i" )
280
- . map ( ( interjection ) => ( { type : "interjection" , interjection } ) as const ) ;
276
+ . map ( ( interjection ) => ( { type : "interjection" , interjection } ) ) ;
281
277
const particleDefinition = checkedSequence (
282
278
word . skip ( openParenthesis ) . skip ( keyword ( "particle" ) ) ,
283
279
sequence ( keyword ( "def" ) , closeParenthesis ) ,
284
280
)
285
- . map ( ( [ definition ] ) =>
286
- ( { type : "particle definition" , definition } ) as const
287
- ) ;
281
+ . map ( ( [ definition ] ) => ( { type : "particle definition" , definition } ) ) ;
288
282
const adverbDefinition = checkedSimpleUnit ( "adv" )
289
- . map ( ( adverb ) => ( { type : "adverb" , adverb } ) as const ) ;
283
+ . map ( ( adverb ) => ( { type : "adverb" , adverb } ) ) ;
290
284
const prepositionDefinition = checkedSimpleUnitWithTemplate (
291
285
"prep" ,
292
286
sequence ( keyword ( "indirect" ) , keyword ( "object" ) ) ,
293
287
)
294
- . map ( ( preposition ) => ( { type : "preposition" , preposition } ) as const ) ;
288
+ . map ( ( preposition ) => ( { type : "preposition" , preposition } ) ) ;
295
289
const numeralDefinition = checkedSimpleUnit ( "num" )
296
290
. mapWithPositionedError ( ( num ) => {
297
291
const numeral = + num ;
298
292
if ( ! Number . isInteger ( numeral ) ) {
299
293
throw `"${ num } " is not a number` ;
300
294
} else {
301
- return { type : "numeral" , numeral } as const ;
295
+ return { type : "numeral" , numeral } ;
302
296
}
303
297
} ) ;
304
298
const fillerDefinition = checkedSequence (
@@ -320,7 +314,7 @@ const fillerDefinition = checkedSequence(
320
314
before : forms [ 0 ] ,
321
315
repeat : "" ,
322
316
after : "" ,
323
- } as const ;
317
+ } ;
324
318
}
325
319
const [ first , ...rest ] = forms ;
326
320
for ( let i = 0 ; i < first . length ; i ++ ) {
@@ -332,7 +326,7 @@ const fillerDefinition = checkedSequence(
332
326
test === `${ before } ${ repeatString . repeat ( i + 2 ) } ${ after } `
333
327
) ;
334
328
if ( passed ) {
335
- return { type : "filler" , before, repeat : repeatString , after } as const ;
329
+ return { type : "filler" , before, repeat : repeatString , after } ;
336
330
}
337
331
}
338
332
throw `"${ forms . join ( "/" ) } " has no repetition pattern found` ;
@@ -349,14 +343,12 @@ const fourFormPersonalPronounDefinition = checkedSequence(
349
343
. map ( ( [
350
344
[ singularSubject , singularObject , pluralSubject , pluralObject ] ,
351
345
perspective ,
352
- ] ) =>
353
- ( {
354
- type : "personal pronoun" ,
355
- singular : { subject : singularSubject , object : singularObject } ,
356
- plural : { subject : pluralSubject , object : pluralObject } ,
357
- perspective,
358
- } ) as const
359
- ) ;
346
+ ] ) => ( {
347
+ type : "personal pronoun" ,
348
+ singular : { subject : singularSubject , object : singularObject } ,
349
+ plural : { subject : pluralSubject , object : pluralObject } ,
350
+ perspective,
351
+ } ) ) ;
360
352
const twoFormPersonalPronounDefinition = checkedSequence (
361
353
sequence (
362
354
word . skip ( slash ) ,
@@ -367,15 +359,13 @@ const twoFormPersonalPronounDefinition = checkedSequence(
367
359
number . skip ( closeParenthesis ) ,
368
360
) ,
369
361
)
370
- . map ( ( [ [ subject , object ] , [ perspective , number ] ] ) =>
371
- ( {
372
- type : "personal pronoun" ,
373
- singular : null ,
374
- plural : null ,
375
- [ number ] : { subject, object } ,
376
- perspective,
377
- } ) as const
378
- ) ;
362
+ . map ( ( [ [ subject , object ] , [ perspective , number ] ] ) => ( {
363
+ type : "personal pronoun" ,
364
+ singular : null ,
365
+ plural : null ,
366
+ [ number ] : { subject, object } ,
367
+ perspective,
368
+ } ) ) ;
379
369
const nounDefinition = new CheckedParser (
380
370
choiceWithCheck (
381
371
new CheckedParser (
@@ -403,8 +393,8 @@ const nounDefinition = new CheckedParser(
403
393
)
404
394
. map ( ( [ noun , preposition ] ) =>
405
395
preposition == null
406
- ? { ...noun , type : "noun" } as const
407
- : { type : "noun preposition" , noun, preposition } as const
396
+ ? { ...noun , type : "noun" }
397
+ : { type : "noun preposition" , noun, preposition }
408
398
) ;
409
399
const compoundAdjectiveDefinition = checkedSequence (
410
400
adjective
@@ -414,7 +404,7 @@ const compoundAdjectiveDefinition = checkedSequence(
414
404
. skip ( keyword ( "c" ) ) ,
415
405
closeParenthesis . with ( adjective . parser ) ,
416
406
)
417
- . map ( ( adjective ) => ( { type : "compound adjective" , adjective } ) as const )
407
+ . map ( ( adjective ) => ( { type : "compound adjective" , adjective } ) )
418
408
. filterWithPositionedError ( ( { adjective } ) =>
419
409
adjective . every ( ( adjective ) => adjective . adverb . length === 0 ) ||
420
410
throwError ( "compound adjective cannot have adverb" )
@@ -434,7 +424,7 @@ const verbDefinition = checkedSequence(
434
424
closeBracket
435
425
. with ( optionalWithCheck (
436
426
checkedSimpleUnitWith ( "prep" , noun )
437
- . map ( ( [ preposition , object ] ) => ( { preposition, object } ) as const ) ,
427
+ . map ( ( [ preposition , object ] ) => ( { preposition, object } ) ) ,
438
428
) )
439
429
. map ( nullableAsArray ) ,
440
430
)
@@ -481,7 +471,7 @@ const verbDefinition = checkedSequence(
481
471
openBracket ,
482
472
sequence ( keyword ( "object" ) , closeBracket ) ,
483
473
)
484
- . map ( ( ) => "template" as const ) ,
474
+ . map ( ( ) => "template" ) ,
485
475
checkedNoun ,
486
476
) ,
487
477
) ,
0 commit comments