Skip to content

Commit cd8f3e1

Browse files
committed
chore lint
1 parent 5326afe commit cd8f3e1

6 files changed

Lines changed: 63 additions & 22 deletions

File tree

src/compute-engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const version = '{{SDK_VERSION}}';
88
import { ComputeEngine } from './compute-engine/index';
99
export { ComputeEngine } from './compute-engine/index';
1010

11-
export * from './compute-engine/types';
11+
export type * from './compute-engine/types';
1212

1313
// Export compilation types and classes for advanced users
1414
export type {

src/compute-engine/boxed-expression/arithmetic-mul-div.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import {
1414
asMachineRational,
1515
inverse,
1616
isOne,
17-
machineDenominator,
18-
machineNumerator,
1917
neg,
2018
rationalGcd,
2119
reducedRational,

src/compute-engine/free-functions.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
import type { BoxedExpression, AssignValue, IComputeEngine } from './global-types';
1+
import type {
2+
BoxedExpression,
3+
AssignValue,
4+
IComputeEngine,
5+
} from './global-types';
26
import type { LatexString } from './latex-syntax/types';
3-
import { expand as expandExpr, expandAll as expandAllExpr } from './boxed-expression/expand';
7+
import {
8+
expand as expandExpr,
9+
expandAll as expandAllExpr,
10+
} from './boxed-expression/expand';
411
import { factor as factorExpr } from './boxed-expression/factor';
512
import { compile as compileExpr } from './compilation/compile-expression';
613

@@ -61,11 +68,7 @@ export function expand(
6168

6269
export function solve(
6370
latex: LatexString | BoxedExpression,
64-
vars?:
65-
| string
66-
| Iterable<string>
67-
| BoxedExpression
68-
| Iterable<BoxedExpression>
71+
vars?: string | Iterable<string> | BoxedExpression | Iterable<BoxedExpression>
6972
):
7073
| null
7174
| ReadonlyArray<BoxedExpression>
@@ -84,9 +87,7 @@ export function expandAll(
8487
return expandAllExpr(expr);
8588
}
8689

87-
export function factor(
88-
latex: LatexString | BoxedExpression
89-
): BoxedExpression {
90+
export function factor(latex: LatexString | BoxedExpression): BoxedExpression {
9091
const expr =
9192
typeof latex === 'string' ? getDefaultEngine().parse(latex) : latex;
9293
return factorExpr(expr);

src/compute-engine/global-types.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,31 @@
99

1010
export type * from './types-expression';
1111
export type * from './types-serialization';
12-
export type * from './types-definitions';
12+
export type {
13+
ValueDefinition,
14+
SequenceDefinition,
15+
SequenceStatus,
16+
SequenceInfo,
17+
OEISSequenceInfo,
18+
OEISOptions,
19+
OperatorDefinition,
20+
BaseDefinition,
21+
SimplifyOptions,
22+
SymbolDefinition,
23+
SymbolDefinitions,
24+
LibraryDefinition,
25+
AngularUnit,
26+
Sign,
27+
BaseCollectionHandlers,
28+
IndexedCollectionHandlers,
29+
CollectionHandlers,
30+
TaggedValueDefinition,
31+
TaggedOperatorDefinition,
32+
BoxedDefinition,
33+
BoxedBaseDefinition,
34+
BoxedValueDefinition,
35+
OperatorDefinitionFlags,
36+
BoxedOperatorDefinition,
37+
} from './types-definitions';
1338
export type * from './types-evaluation';
1439
export type * from './types-engine';

src/compute-engine/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ import {
8383
UNIVARIATE_ROOTS,
8484
} from './boxed-expression/solve';
8585
import {
86-
factor,
8786
factorPerfectSquare,
8887
factorDifferenceOfSquares,
8988
factorQuadratic,
@@ -167,7 +166,7 @@ import {
167166
createTypeErrorExpression,
168167
} from './engine-validation-entrypoints';
169168

170-
export * from './global-types';
169+
export type * from './global-types';
171170

172171
// Free functions backed by a lazily-instantiated global engine
173172
export {

src/compute-engine/numerics/interval.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { BoxedExpression } from '../global-types';
2-
import {
3-
isBoxedSymbol,
4-
isBoxedNumber,
5-
isBoxedFunction,
6-
} from '../boxed-expression/type-guards';
1+
import type {
2+
BoxedExpression,
3+
FunctionInterface,
4+
NumberLiteralInterface,
5+
SymbolInterface,
6+
} from '../global-types';
77

88
/** An interval is a continuous set of real numbers */
99
export type Interval = {
@@ -13,6 +13,24 @@ export type Interval = {
1313
openEnd: boolean;
1414
};
1515

16+
function isBoxedNumber(
17+
expr: BoxedExpression | null | undefined
18+
): expr is BoxedExpression & NumberLiteralInterface {
19+
return expr?._kind === 'number';
20+
}
21+
22+
function isBoxedSymbol(
23+
expr: BoxedExpression | null | undefined
24+
): expr is BoxedExpression & SymbolInterface {
25+
return expr?._kind === 'symbol';
26+
}
27+
28+
function isBoxedFunction(
29+
expr: BoxedExpression | null | undefined
30+
): expr is BoxedExpression & FunctionInterface {
31+
return expr?._kind === 'function' || expr?._kind === 'tensor';
32+
}
33+
1634
export function interval(expr: BoxedExpression): Interval | undefined {
1735
if (expr.operator === 'Interval' && isBoxedFunction(expr)) {
1836
let op1: BoxedExpression = expr.op1;

0 commit comments

Comments
 (0)