mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Now warns if we `export =` a namespace * `unified-signatures` no longer complains when static and non-static methods share a name * Also change `values` paramters to be of type `Values` rather than `Value`
32 lines
991 B
TypeScript
32 lines
991 B
TypeScript
// Type definitions for expr-eval 1.0
|
|
// Project: https://github.com/silentmatt/expr-eval#readme
|
|
// Definitions by: Connor Peet <https://github.com/connor4312>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
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?: 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;
|
|
}
|