chore: upgrade typescript

This commit is contained in:
Harttle
2021-12-11 20:23:09 +08:00
committed by Harttle
parent 6801552fe6
commit 95fc705b5d
19 changed files with 1045 additions and 1360 deletions
+3 -3
View File
@@ -20,7 +20,7 @@ export class Expression {
public constructor (tokens: IterableIterator<Token>) {
this.postfix = [...toPostfix(tokens)]
}
public * evaluate (ctx: Context, lenient: boolean): any {
public * evaluate (ctx: Context, lenient: boolean): Generator<unknown, unknown, unknown> {
assert(ctx, 'unable to evaluate: context not defined')
const operands: any[] = []
for (const token of this.postfix) {
@@ -51,8 +51,8 @@ function evalPropertyAccessToken (token: PropertyAccessToken, ctx: Context, leni
try {
return ctx.get([token.propertyName, ...props])
} catch (e) {
if (lenient && e.name === 'InternalUndefinedVariableError') return null
throw (new UndefinedVariableError(e, token))
if (lenient && (e as Error).name === 'InternalUndefinedVariableError') return null
throw (new UndefinedVariableError(e as Error, token))
}
}