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

@@ -3,9 +3,11 @@ import IEntity from "./IEntity.js"
export default class NullEntity extends IEntity {
// @ts-expect-error
static grammar = P.reg(new RegExp(String.raw`\(${P.whitespaceInlineOpt.getParser().regexp.source}\)`))
.map(v => new this())
static grammar = /** @type {P<NullEntity>} */(
// @ts-expect-error
P.reg(new RegExp(String.raw`\(${P.whitespaceInlineOpt.getParser().regexp.source}\)`))
.map(v => new this())
)
toString(
insideString = false,