File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export const version = '{{SDK_VERSION}}';
88import { ComputeEngine } from './compute-engine/index' ;
99export { 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
1414export type {
Original file line number Diff line number Diff line change @@ -14,8 +14,6 @@ import {
1414 asMachineRational ,
1515 inverse ,
1616 isOne ,
17- machineDenominator ,
18- machineNumerator ,
1917 neg ,
2018 rationalGcd ,
2119 reducedRational ,
Original file line number Diff line number Diff line change 1- import type { BoxedExpression , AssignValue , IComputeEngine } from './global-types' ;
1+ import type {
2+ BoxedExpression ,
3+ AssignValue ,
4+ IComputeEngine ,
5+ } from './global-types' ;
26import 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' ;
411import { factor as factorExpr } from './boxed-expression/factor' ;
512import { compile as compileExpr } from './compilation/compile-expression' ;
613
@@ -61,11 +68,7 @@ export function expand(
6168
6269export 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 ) ;
Original file line number Diff line number Diff line change 99
1010export type * from './types-expression' ;
1111export 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' ;
1338export type * from './types-evaluation' ;
1439export type * from './types-engine' ;
Original file line number Diff line number Diff line change @@ -83,7 +83,6 @@ import {
8383 UNIVARIATE_ROOTS ,
8484} from './boxed-expression/solve' ;
8585import {
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
173172export {
Original file line number Diff line number Diff line change 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 */
99export 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+
1634export function interval ( expr : BoxedExpression ) : Interval | undefined {
1735 if ( expr . operator === 'Interval' && isBoxedFunction ( expr ) ) {
1836 let op1 : BoxedExpression = expr . op1 ;
You can’t perform that action at this time.
0 commit comments