mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #13914 from DefinitelyTyped/lint_expr_eval
Update expr-eval for new linter
This commit is contained in:
Vendored
+23
-29
@@ -3,35 +3,29 @@
|
||||
// Definitions by: Connor Peet <https://github.com/connor4312>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace exprEval {
|
||||
type Value = number
|
||||
| string
|
||||
| ((...args: Value[]) => Value)
|
||||
| { [propertyName: string]: Value };
|
||||
type Value = number
|
||||
| string
|
||||
| ((...args: Value[]) => Value)
|
||||
| { [propertyName: string]: Value };
|
||||
|
||||
interface Values {
|
||||
[propertyName: string]: Value;
|
||||
}
|
||||
|
||||
export class Parser {
|
||||
constructor(options?: { allowMemberAccess?: boolean });
|
||||
parse(expression: string): Expression;
|
||||
evaluate(expression: string, values?: Value): number;
|
||||
|
||||
// todo(connor4312): tslint is disabled on the following two lines, as
|
||||
// thinks that the above instance methods are overloads for the static methods.
|
||||
static parse(expression: string): Expression; // tslint:disable-line
|
||||
static evaluate(expression: string, values?: Value): number; // tslint:disable-line
|
||||
}
|
||||
|
||||
export interface Expression {
|
||||
simplify(values?: Values): Expression;
|
||||
evaluate(values?: Values): number;
|
||||
substitute(values: Values): Expression;
|
||||
symbols(): string[];
|
||||
variables(): string[];
|
||||
toJSFunction(params: string, values?: Values): (...args: Value[]) => number;
|
||||
}
|
||||
interface Values {
|
||||
[propertyName: string]: Value;
|
||||
}
|
||||
|
||||
export = exprEval;
|
||||
export class Parser {
|
||||
constructor(options?: { allowMemberAccess?: boolean });
|
||||
parse(expression: string): Expression;
|
||||
evaluate(expression: string, values?: Values): number;
|
||||
|
||||
static parse(expression: string): Expression;
|
||||
static evaluate(expression: string, values?: Values): number;
|
||||
}
|
||||
|
||||
export interface Expression {
|
||||
simplify(values?: Values): Expression;
|
||||
evaluate(values?: Values): number;
|
||||
substitute(values: Values): Expression;
|
||||
symbols(): string[];
|
||||
variables(): string[];
|
||||
toJSFunction(params: string, values?: Values): (...args: Value[]) => number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user