Better typing for grammars

This commit is contained in:
barsdeveloper
2024-06-06 23:16:21 +02:00
parent ad4ba2c46d
commit 98ebdd78b2
40 changed files with 301 additions and 233 deletions

View File

@@ -16,10 +16,11 @@ export default class KeyBindingEntity extends IEntity {
bCmd: BooleanEntity,
Key: SymbolEntity,
}
/** @type {P<KeyBindingEntity>} */
static grammar = P.alt(
SymbolEntity.grammar.map(identifier => new this({ Key: identifier })),
Grammar.createEntityGrammar(this)
static grammar = /** @type {P<KeyBindingEntity>} */(
P.alt(
SymbolEntity.grammar.map(identifier => new this({ Key: identifier })),
Grammar.createEntityGrammar(this)
)
)
constructor(values) {