@sheetxl/primitives 0.8.0-beta.1 → 0.8.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/esm/index.mjs +94 -75
- package/node/esm/index.mjs +104 -83
- package/package.json +3 -4
- package/types/src/ErrorPolicy.d.ts +48 -57
- package/types/src/Flatten.d.ts +6 -3
- package/types/src/FormulaContext.d.ts +30 -7
- package/types/src/IFormulaContext.d.ts +205 -11
- package/types/src/IFunction.d.ts +368 -54
- package/types/src/IFunctionArguments.d.ts +86 -15
- package/types/src/IRange.d.ts +170 -38
- package/types/src/IRangeStats.d.ts +34 -3
- package/types/src/IRuntime.d.ts +24 -1
- package/types/src/Lazy.d.ts +76 -0
- package/types/src/NoFilter.d.ts +34 -0
- package/types/src/NoLift.d.ts +31 -0
- package/types/src/Repeating.d.ts +24 -4
- package/types/src/ReportType.d.ts +42 -0
- package/types/src/Scalar.d.ts +1 -1
- package/types/src/ValueKind.d.ts +43 -0
- package/types/src/Volatile.d.ts +12 -0
- package/types/src/WildCard.d.ts +13 -9
- package/types/src/index.d.ts +6 -1
- package/browser/cjs/index.cjs +0 -1
- package/types/src/Compat.d.ts +0 -77
package/types/src/IFunction.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Scalar } from './Scalar';
|
|
2
2
|
import { ScalarType } from './ScalarType';
|
|
3
|
-
import {
|
|
3
|
+
import { ValueKind } from './ValueKind';
|
|
4
4
|
/**
|
|
5
5
|
* A self-describing, type-safe, executable function.
|
|
6
6
|
*
|
|
@@ -36,6 +36,22 @@ export interface IFunction {
|
|
|
36
36
|
* Indicates whether the function is a built-in function.
|
|
37
37
|
*/
|
|
38
38
|
isBuiltIn(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Indicates whether the function is a `LAMBDA` rather than a built-in or registered function.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Two kinds of function answer `true`:
|
|
44
|
+
*
|
|
45
|
+
* - **A defined name whose body is `LAMBDA(…)`.** It is reachable by name like any other
|
|
46
|
+
* function, so signature help and function lookups can describe it: its parameters are the
|
|
47
|
+
* lambda's, and its summary is the name's comment, or the name's formula when it has no
|
|
48
|
+
* comment. A formula calls it through the NAME, never through {@link execute}, which answers
|
|
49
|
+
* `#CALC!`.
|
|
50
|
+
* - **A `LAMBDA` passed as a value** and received by
|
|
51
|
+
* {@link IFunctionArguments.getFunctionsAt}. It has no name ({@link getName} is `''`), its
|
|
52
|
+
* parameters are the lambda's, and {@link execute} applies it.
|
|
53
|
+
*/
|
|
54
|
+
isLambda(): boolean;
|
|
39
55
|
/**
|
|
40
56
|
* Returns the execution environment this function belongs to.
|
|
41
57
|
*
|
|
@@ -126,17 +142,47 @@ export declare namespace IFunction {
|
|
|
126
142
|
*/
|
|
127
143
|
getName(): string;
|
|
128
144
|
/**
|
|
129
|
-
*
|
|
145
|
+
* True when a BARE error at this parameter — an error instead of a value or a range, `NA()`,
|
|
146
|
+
* `#NAME?`, a union where one rectangle is needed — is delivered to the body RAW rather than
|
|
147
|
+
* propagated: the `AcceptError<T>` marker. A rule, not a type — the engine's auto-reject is
|
|
148
|
+
* off at this slot, and the body narrows with `FormulaError.isError` if it cares.
|
|
130
149
|
*
|
|
131
150
|
* @remarks
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
151
|
+
* The default, and the common case, is that the error propagates with its identity and the
|
|
152
|
+
* body never runs. The marker never looks INSIDE a container: an error member of a range
|
|
153
|
+
* reaches the body either way and is the body's to judge (`IRange.firstError`).
|
|
154
|
+
*
|
|
155
|
+
* @see {@link ParameterTypeJSON.acceptError}
|
|
156
|
+
*/
|
|
157
|
+
isAcceptError(): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* True when a multi-cell REFERENCE at this scalar parameter is `#VALUE!` rather than a
|
|
160
|
+
* broadcast — the `NoLift<T>` marker.
|
|
161
|
+
*
|
|
162
|
+
* @see {@link ParameterTypeJSON.noLift}
|
|
163
|
+
*/
|
|
164
|
+
isNoLift(): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* True when the members reaching this repeating scalar parameter are coerced rather than
|
|
167
|
+
* filtered — the `NoFilter<T>` marker.
|
|
168
|
+
*
|
|
169
|
+
* @see {@link ParameterTypeJSON.noFilter}
|
|
170
|
+
*/
|
|
171
|
+
isNoFilter(): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* True when the argument at this parameter may reach the body UNEVALUATED, as an `ILazy`
|
|
174
|
+
* handle — the `Lazy<T>` marker.
|
|
136
175
|
*
|
|
137
|
-
* @see {@link ParameterTypeJSON.
|
|
176
|
+
* @see {@link ParameterTypeJSON.lazy}
|
|
138
177
|
*/
|
|
139
|
-
|
|
178
|
+
isLazy(): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* True when the parameter takes EITHER a value or a range, decided per argument by its kind —
|
|
181
|
+
* an `IRange | Scalar` union.
|
|
182
|
+
*
|
|
183
|
+
* @see {@link ParameterTypeJSON.valueOrRange}
|
|
184
|
+
*/
|
|
185
|
+
isValueOrRange(): boolean;
|
|
140
186
|
/**
|
|
141
187
|
* Indicates whether the parameter is required.
|
|
142
188
|
*/
|
|
@@ -182,11 +228,60 @@ export declare namespace IFunction {
|
|
|
182
228
|
*/
|
|
183
229
|
isRest(): boolean;
|
|
184
230
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
231
|
+
* The enum the parameter is limited to, or `null` when it takes any value of its type.
|
|
232
|
+
*
|
|
233
|
+
* @remarks
|
|
234
|
+
* Declared by typing the parameter as a TypeScript `enum`, as an alias paired with a same-name
|
|
235
|
+
* `as const` object, or as a union of number or string literals (`0 | 1`).
|
|
236
|
+
*
|
|
237
|
+
* @see {@link IEnum}
|
|
238
|
+
*/
|
|
239
|
+
getEnum(): IFunction.IEnum | null;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* One member of an {@link IEnum}.
|
|
243
|
+
*/
|
|
244
|
+
interface IEnumMember {
|
|
245
|
+
/**
|
|
246
|
+
* The declared member name (`End`). For a union of bare literals, which names nothing, this is
|
|
247
|
+
* the value as text.
|
|
248
|
+
*/
|
|
249
|
+
getName(): string;
|
|
250
|
+
/**
|
|
251
|
+
* The value a formula passes. Typed, and never localized.
|
|
252
|
+
*/
|
|
253
|
+
getValue(): number | string;
|
|
254
|
+
/**
|
|
255
|
+
* Whether the member is declared but not offered, from the member's `@deprecated` tag.
|
|
256
|
+
*
|
|
257
|
+
* @remarks
|
|
258
|
+
* A deprecated member stays in the set, so a formula that passes it is not refused and the
|
|
259
|
+
* function decides what it answers. It is left out of the argument dropdown and the values
|
|
260
|
+
* a warning lists. A string is the tag's label (`Excel desktop only`).
|
|
261
|
+
*/
|
|
262
|
+
isDeprecated(): boolean | string;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* A closed set of values a parameter accepts.
|
|
266
|
+
*
|
|
267
|
+
* @remarks
|
|
268
|
+
* All members are numbers or all are strings; the two never mix. The set is free-form: it does
|
|
269
|
+
* not have to be contiguous or start at zero (`-1 | 0 | 1`).
|
|
270
|
+
*/
|
|
271
|
+
interface IEnum {
|
|
272
|
+
/**
|
|
273
|
+
* The declared type name (`PaymentType`), unique within the module that declares it. For a
|
|
274
|
+
* union of bare literals it is the values joined by `|`.
|
|
188
275
|
*/
|
|
189
|
-
|
|
276
|
+
getId(): string;
|
|
277
|
+
/**
|
|
278
|
+
* Whether the members are numbers or strings.
|
|
279
|
+
*/
|
|
280
|
+
getScalarType(): typeof ScalarType.Number | typeof ScalarType.String;
|
|
281
|
+
/**
|
|
282
|
+
* The members, in declaration order.
|
|
283
|
+
*/
|
|
284
|
+
getMembers(): readonly IFunction.IEnumMember[];
|
|
190
285
|
}
|
|
191
286
|
/**
|
|
192
287
|
* Describes the runtime return behavior of a function, including modifiers like
|
|
@@ -197,6 +292,14 @@ export declare namespace IFunction {
|
|
|
197
292
|
* If none are specified, The value will be returned with no special behavior.
|
|
198
293
|
*/
|
|
199
294
|
interface IReturnType extends IValueType {
|
|
295
|
+
/**
|
|
296
|
+
* The declared {@link ValueKind} of the result — the declared override where one exists, else
|
|
297
|
+
* the kind the type spellings imply — or `null` when the result's kind follows the value
|
|
298
|
+
* itself (`'*'`, an untyped return).
|
|
299
|
+
*
|
|
300
|
+
* @see {@link ReturnTypeJSON.kind}
|
|
301
|
+
*/
|
|
302
|
+
getKind(): ValueKind | null;
|
|
200
303
|
/**
|
|
201
304
|
* Indicates the return value is a Promise or Promise-like (i.e., async).
|
|
202
305
|
* The system will mark the result as pending and re-trigger evaluation once resolved.
|
|
@@ -210,6 +313,17 @@ export declare namespace IFunction {
|
|
|
210
313
|
* @defaultValue `false`
|
|
211
314
|
*/
|
|
212
315
|
isStreaming(): boolean;
|
|
316
|
+
/**
|
|
317
|
+
* True when the result can change with nothing dirty, so a cell naming this function
|
|
318
|
+
* recalculates on every pass — the `Volatile<T>` marker.
|
|
319
|
+
*
|
|
320
|
+
* @remarks
|
|
321
|
+
* STATIC, and read from the formula text at compile time: it is true of the call whether or
|
|
322
|
+
* not the call runs, which is what a lazy argument (and Excel) requires.
|
|
323
|
+
*
|
|
324
|
+
* @see {@link ReturnTypeJSON.volatile}
|
|
325
|
+
*/
|
|
326
|
+
isVolatile(): boolean;
|
|
213
327
|
}
|
|
214
328
|
/**
|
|
215
329
|
* The type-system metadata the engine reads to coerce arguments, apply broadcasting,
|
|
@@ -238,12 +352,32 @@ export declare namespace IFunction {
|
|
|
238
352
|
* If not specified, the function is assumed to be volatile (its output might change even if its inputs haven't).
|
|
239
353
|
*/
|
|
240
354
|
getParameters(): readonly IParameterType[];
|
|
355
|
+
/**
|
|
356
|
+
* The largest number of arguments a call to this function may carry.
|
|
357
|
+
*
|
|
358
|
+
* @remarks
|
|
359
|
+
* Only meaningful for a VARIADIC function; a fixed parameter list is already its own maximum.
|
|
360
|
+
* The number is the whole CALL's argument count, prefix and optional suffix included, and it
|
|
361
|
+
* is refused where Excel refuses it — at entry, before evaluation.
|
|
362
|
+
*
|
|
363
|
+
* @see {@link Repeating}
|
|
364
|
+
*/
|
|
365
|
+
getMaxArguments(): number;
|
|
241
366
|
/**
|
|
242
367
|
* Metadata describing the type and dimensionality of the return value.
|
|
243
368
|
*
|
|
244
369
|
* @defaultValue `{ type: 'void' }`
|
|
245
370
|
*/
|
|
246
371
|
getReturnType(): IReturnType;
|
|
372
|
+
/**
|
|
373
|
+
* Whether the function is left out of function lists, from its `@hidden` or `@deprecated` tag.
|
|
374
|
+
*
|
|
375
|
+
* @remarks
|
|
376
|
+
* A hidden function is still callable from a formula and still found by name. Listing calls
|
|
377
|
+
* leave it out unless asked to include it. {@link IDescriptor.isDeprecated} carries the tag's
|
|
378
|
+
* label, if it has one.
|
|
379
|
+
*/
|
|
380
|
+
isHidden(): boolean;
|
|
247
381
|
}
|
|
248
382
|
/**
|
|
249
383
|
* Locale-specific, user-facing metadata: display name, summary, category, and
|
|
@@ -253,7 +387,11 @@ export declare namespace IFunction {
|
|
|
253
387
|
*/
|
|
254
388
|
interface IDescriptor {
|
|
255
389
|
/**
|
|
256
|
-
*
|
|
390
|
+
* The canonical name of the function, matching {@link IDeclaration.getName}.
|
|
391
|
+
*
|
|
392
|
+
* @remarks
|
|
393
|
+
* A descriptor may override the name; when it does not, this is the name of the function
|
|
394
|
+
* in code. Use {@link getNameLocal} for display.
|
|
257
395
|
*/
|
|
258
396
|
getName(): string;
|
|
259
397
|
/**
|
|
@@ -272,14 +410,11 @@ export declare namespace IFunction {
|
|
|
272
410
|
*/
|
|
273
411
|
getCategory(): string;
|
|
274
412
|
/**
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* @defaultValue 'null'
|
|
413
|
+
* The label of the function's `@hidden` or `@deprecated` tag (`Unimplemented`), `true` for a tag
|
|
414
|
+
* with no label, or `false`.
|
|
279
415
|
*
|
|
280
416
|
* @remarks
|
|
281
|
-
*
|
|
282
|
-
* * This is useful for functions that are in beta or deprecated.
|
|
417
|
+
* Whether the function is listed is {@link IDeclaration.isHidden}; this is the text to show for it.
|
|
283
418
|
*/
|
|
284
419
|
isDeprecated(): boolean | string;
|
|
285
420
|
/**
|
|
@@ -298,6 +433,31 @@ export declare namespace IFunction {
|
|
|
298
433
|
example?: string;
|
|
299
434
|
defaultValue?: Scalar;
|
|
300
435
|
}>>;
|
|
436
|
+
/**
|
|
437
|
+
* Describe each enum the function's parameters are limited to.
|
|
438
|
+
*
|
|
439
|
+
* @remarks
|
|
440
|
+
* The keys are enum ids (see {@link IEnum.getId}), and within one the member names (see
|
|
441
|
+
* {@link IEnumMember.getName}). Every enum a parameter declares has an entry and every member
|
|
442
|
+
* has one within it, so a caller can read a label without checking: `nameLocal` falls back to
|
|
443
|
+
* the declared name. Values are never localized — they are on the declaration.
|
|
444
|
+
*/
|
|
445
|
+
getEnums(): Readonly<Record<string, IFunction.IEnumDescription>>;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* The copy for one enum: what it is, and what each member means.
|
|
449
|
+
*/
|
|
450
|
+
interface IEnumDescription {
|
|
451
|
+
/** The enum's name in the user's language, or its declared name. */
|
|
452
|
+
readonly nameLocal: string;
|
|
453
|
+
/** What the enum controls. */
|
|
454
|
+
readonly summary?: string;
|
|
455
|
+
/** By member name. */
|
|
456
|
+
readonly members: Readonly<Record<string, {
|
|
457
|
+
/** The member's name in the user's language, or its declared name. */
|
|
458
|
+
readonly nameLocal: string;
|
|
459
|
+
readonly description?: string;
|
|
460
|
+
}>>;
|
|
301
461
|
}
|
|
302
462
|
/**
|
|
303
463
|
* Describes the type characteristics of a function parameter or return value.
|
|
@@ -395,7 +555,8 @@ export declare namespace IFunction {
|
|
|
395
555
|
* @remarks
|
|
396
556
|
* Descriptive rather than applied: an absent argument is never pushed, so the initializer
|
|
397
557
|
* supplies the value itself. It is recorded so help text, tooltips and completions can say
|
|
398
|
-
* "defaults to 3" without reading the source.
|
|
558
|
+
* "defaults to 3" without reading the source. The exception is a {@link lazy} slot, which has
|
|
559
|
+
* no initializer to run — `Lazy<T, V>` declares the default here and the engine applies it.
|
|
399
560
|
*
|
|
400
561
|
* Present for a literal initializer only. One computed from another argument
|
|
401
562
|
* (`numberS2: number = numberS`) has no value to record and leaves this undefined.
|
|
@@ -455,28 +616,126 @@ export declare namespace IFunction {
|
|
|
455
616
|
*/
|
|
456
617
|
repeating?: ParameterTypeJSON[];
|
|
457
618
|
/**
|
|
458
|
-
*
|
|
459
|
-
*
|
|
619
|
+
* A BARE error at this parameter — an error instead of a value or a range — is delivered to
|
|
620
|
+
* the body RAW rather than propagated: the engine's auto-reject is off at this slot, and the
|
|
621
|
+
* body narrows if it cares. Generated from the `AcceptError<T>` marker. A failed COERCION to
|
|
622
|
+
* the declared type is delivered the same way, as the `#VALUE!` it would have raised, so a
|
|
623
|
+
* body that rethrows what it receives answers exactly as the engine would have — and one that
|
|
624
|
+
* reads its arguments in its own order can (`IFS(TRUE,1,"x",2)` is 1: the pair is never
|
|
625
|
+
* reached).
|
|
626
|
+
*
|
|
627
|
+
* @remarks
|
|
628
|
+
* OMITTED is the default (ErrorPolicy.ts): the error propagates with its identity (a scalar
|
|
629
|
+
* argument), becomes an error member of the output (a lifted member), or short-circuits on the
|
|
630
|
+
* first error in argument order (a flattened list) — the body never runs. A
|
|
631
|
+
* `FormulaError.Known`-typed parameter receives without the marker, because the type declares
|
|
632
|
+
* it. On a TYPED range (`IRange<number>`) the marker also lets error members ride through the
|
|
633
|
+
* typed read raw — COUNT's profile. Errors INSIDE a range are otherwise never the marker's
|
|
634
|
+
* business: a valid range is handed over whole.
|
|
635
|
+
*/
|
|
636
|
+
acceptError?: boolean;
|
|
637
|
+
/**
|
|
638
|
+
* The argument's subtree may be handed over UNEVALUATED, as an `ILazy` handle the body either
|
|
639
|
+
* returns unread or forces with `getValue()`. Generated from the `Lazy<T>` marker.
|
|
640
|
+
*
|
|
641
|
+
* @remarks
|
|
642
|
+
* A declaration, not a request: the engine defers where it can and DECLINES where it cannot
|
|
643
|
+
* (an absent argument, an async subtree, a lift that needs every arm), handing over a handle
|
|
644
|
+
* that is already full. Either way the body sees a handle and nothing else, which is why the
|
|
645
|
+
* marker is a contract rather than something inferred from what the body happens to read.
|
|
646
|
+
*
|
|
647
|
+
* Only a RESULT position carries it — `IF`'s branches, `CHOOSE`'s arms, `IFERROR`'s fallback.
|
|
648
|
+
* A condition, an index or a case value is eager, so `AND(FALSE,A1)` still reads `A1` and is
|
|
649
|
+
* still a circular reference.
|
|
650
|
+
*
|
|
651
|
+
* {@link defaultValue} is APPLIED at a lazy slot rather than merely recorded: the parameter
|
|
652
|
+
* cannot carry an initializer of its own (`= false` does not typecheck against a handle), so
|
|
653
|
+
* `Lazy<T, V>` declares it and the engine supplies it for an absent argument.
|
|
654
|
+
*
|
|
655
|
+
* @see {@link Lazy}
|
|
656
|
+
*/
|
|
657
|
+
lazy?: boolean;
|
|
658
|
+
/**
|
|
659
|
+
* A multi-cell REFERENCE at this scalar parameter is `#VALUE!` rather than a broadcast.
|
|
660
|
+
* Generated from the `NoLift<T>` marker.
|
|
460
661
|
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
662
|
+
* @remarks
|
|
663
|
+
* Per parameter, because Excel is: `NETWORKDAYS.INTL` refuses a reference at its date slots
|
|
664
|
+
* and lifts one at `weekend`. An ARRAY at the slot still lifts, a one-cell reference is an
|
|
665
|
+
* ordinary argument, and a repeating slot absorbs a container as members, so the marker only
|
|
666
|
+
* ever applies to a non-repeating scalar parameter.
|
|
667
|
+
*/
|
|
668
|
+
noLift?: boolean;
|
|
669
|
+
/**
|
|
670
|
+
* The members reaching this repeating scalar parameter are COERCED rather than filtered, and
|
|
671
|
+
* one that cannot be coerced is `#VALUE!` for the whole call. Generated from the `NoFilter<T>`
|
|
672
|
+
* marker.
|
|
465
673
|
*
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
674
|
+
* @remarks
|
|
675
|
+
* Numeric text parses, a blank inside a multi-cell range reads 0, and a boolean or
|
|
676
|
+
* non-numeric text member refuses — Excel's Analysis-ToolPak reading of a repeating slot,
|
|
677
|
+
* where the native family skips all three (`GCD({6,"8",12})` is 2 where `SUM` would answer
|
|
678
|
+
* over 6 and 12 alone). Only a repeating slot has members, so the marker applies nowhere
|
|
679
|
+
* else; a non-repeating scalar's counterpart is {@link noLift}.
|
|
471
680
|
*/
|
|
472
|
-
|
|
681
|
+
noFilter?: boolean;
|
|
473
682
|
/**
|
|
474
|
-
*
|
|
475
|
-
*
|
|
683
|
+
* The declared type is ADVISORY: the engine delivers it when it can and hands the body the
|
|
684
|
+
* raw argument when it cannot, instead of answering `#VALUE!` at the slot. Generated from the
|
|
685
|
+
* `ReportType<T>` marker.
|
|
476
686
|
*
|
|
477
|
-
* @
|
|
687
|
+
* @remarks
|
|
688
|
+
* The type still reaches the function help, the wizard and the linter — it is what the slot
|
|
689
|
+
* means to a caller. It stops being a gate, so the BODY owns every answer the engine would
|
|
690
|
+
* otherwise have given: a union reaches it as `IRange[]`, a value or an error reaches it as
|
|
691
|
+
* itself. See {@link IFunctionArguments.getKindAt} and
|
|
692
|
+
* {@link IFunctionArguments.getAreaCountAt} for the discriminators.
|
|
693
|
+
*/
|
|
694
|
+
reportType?: boolean;
|
|
695
|
+
/**
|
|
696
|
+
* The parameter takes EITHER a value or a range — declared as a two-member union of a bare
|
|
697
|
+
* range type and a scalar type (`IRange | Scalar`, `IReferenceRange | number`) — and the
|
|
698
|
+
* marshaller picks the arm by the ARGUMENT's kind: a value, a bare error or a one-cell
|
|
699
|
+
* reference is the scalar arm (dereferenced, coerced to {@link scalar}, its fault raised in
|
|
700
|
+
* argument order like any scalar slot's); a multi-cell reference, an array or a reference
|
|
701
|
+
* union is the range arm, handed over whole. The slot never lifts.
|
|
702
|
+
*
|
|
703
|
+
* @remarks
|
|
704
|
+
* Excel reads a one-cell argument at some array slots as THE ARGUMENT rather than as a
|
|
705
|
+
* one-cell container: `SORT(<#N/A cell>,1,1,<#DIV/0! cell>)` is `#N/A` where
|
|
706
|
+
* `TAKE(<#N/A cell>,<#DIV/0! cell>)` is `#DIV/0!`. The engine's default
|
|
707
|
+
* for a range slot is TAKE's; this flag is SORT's. {@link scalar} and {@link range} each carry
|
|
708
|
+
* their arm, a pair that without this flag reads as a TYPED range (`IRange<number>`).
|
|
709
|
+
*/
|
|
710
|
+
valueOrRange?: boolean;
|
|
711
|
+
/**
|
|
712
|
+
* The closed set of values the parameter accepts. Generated from a parameter typed as a
|
|
713
|
+
* TypeScript `enum`, as an alias paired with a same-name `as const` object, or as a union of
|
|
714
|
+
* number or string literals. {@link scalar} carries the members' type.
|
|
715
|
+
*
|
|
716
|
+
* @remarks
|
|
717
|
+
* Parameters that share a declared enum share one `EnumJSON`, by {@link EnumJSON.id}.
|
|
718
|
+
*/
|
|
719
|
+
enum?: EnumJSON;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* The JSON form of an {@link IEnum}.
|
|
723
|
+
*/
|
|
724
|
+
interface EnumJSON {
|
|
725
|
+
/**
|
|
726
|
+
* The declared type name, unique within the declaring module. A union of bare literals has no
|
|
727
|
+
* name, so its id is the values joined by `|`.
|
|
728
|
+
*/
|
|
729
|
+
id: string;
|
|
730
|
+
/**
|
|
731
|
+
* Whether the members are numbers or strings. The two never mix.
|
|
732
|
+
*/
|
|
733
|
+
type: typeof ScalarType.Number | typeof ScalarType.String;
|
|
734
|
+
/**
|
|
735
|
+
* The members, in declaration order. A union of bare literals names nothing, so each name is
|
|
736
|
+
* the value as text.
|
|
478
737
|
*/
|
|
479
|
-
|
|
738
|
+
members: [name: string, value: number | string, deprecated?: string | true][];
|
|
480
739
|
}
|
|
481
740
|
/**
|
|
482
741
|
* Describes the runtime return behavior of a function, including modifiers like
|
|
@@ -486,6 +745,24 @@ export declare namespace IFunction {
|
|
|
486
745
|
* If none are specified, The value will be returned with no special behavior.
|
|
487
746
|
*/
|
|
488
747
|
interface ReturnTypeJSON extends ValueTypeJSON {
|
|
748
|
+
/**
|
|
749
|
+
* The declared {@link ValueKind} of the result, where the inherited type spellings cannot say
|
|
750
|
+
* it. Generated from the `@returnKind` marker.
|
|
751
|
+
*
|
|
752
|
+
* @remarks
|
|
753
|
+
* A return type is a pair — is the call a REFERENCE, and what is its value kind. Both halves
|
|
754
|
+
* usually derive from the type spellings: {@link ValueTypeJSON.range} `'p'` (an
|
|
755
|
+
* `IReferenceRange` return, which a function whose value paths are casts may also use —
|
|
756
|
+
* `XLOOKUP`, `TAKE`) is `Reference`; `'r'`/`'m'` is `Array`; a concrete
|
|
757
|
+
* {@link ValueTypeJSON.scalar} is that scalar kind; `'*'` or an untyped return follows the
|
|
758
|
+
* value itself. This field overrides the derivation for the one spelling that loses it — a
|
|
759
|
+
* union like `number[] | number[][]` (`ROW`) collapses to `'*'`, yet the function's one-cell
|
|
760
|
+
* answer is a SCALAR (`TYPE(ROW(A1))` is 1 where `TYPE(TRANSPOSE({5}))` is 64).
|
|
761
|
+
*
|
|
762
|
+
* The engine applies the kind at the call exit: a one-cell range result whose declared kind
|
|
763
|
+
* is a scalar is its member value downstream.
|
|
764
|
+
*/
|
|
765
|
+
kind?: ValueKind;
|
|
489
766
|
/**
|
|
490
767
|
* Indicates the return value is a Promise or Promise-like (i.e., async).
|
|
491
768
|
* The system will mark the result as pending and re-trigger evaluation once resolved.
|
|
@@ -499,6 +776,20 @@ export declare namespace IFunction {
|
|
|
499
776
|
* @defaultValue `false`
|
|
500
777
|
*/
|
|
501
778
|
stream?: boolean;
|
|
779
|
+
/**
|
|
780
|
+
* The result can change with nothing dirty — a cell naming this function recalculates on
|
|
781
|
+
* every pass. Generated from the `Volatile<T>` marker.
|
|
782
|
+
*
|
|
783
|
+
* @remarks
|
|
784
|
+
* Collected at COMPILE time from the formula text (`CompiledFormula.hasVolatile`), because
|
|
785
|
+
* that is where Excel decides it: `=IF(TRUE,1,RAND())` recalculates on every idle pass though
|
|
786
|
+
* no branch selects the arm, and with lazy arguments the call never happens for the engine to
|
|
787
|
+
* observe. Sits beside {@link async} and {@link stream} because all three are about WHEN a
|
|
788
|
+
* result arrives rather than what it is.
|
|
789
|
+
*
|
|
790
|
+
* @see {@link Volatile}
|
|
791
|
+
*/
|
|
792
|
+
volatile?: boolean;
|
|
502
793
|
}
|
|
503
794
|
/**
|
|
504
795
|
* Contains metadata about a function declaration, including its name, return type, parameters, and additional documentation.
|
|
@@ -510,6 +801,20 @@ export declare namespace IFunction {
|
|
|
510
801
|
returnType?: ReturnTypeJSON;
|
|
511
802
|
/** @inheritdoc IFunction.IDeclaration.getParameters */
|
|
512
803
|
parameters?: ParameterTypeJSON[];
|
|
804
|
+
/**
|
|
805
|
+
* The largest number of arguments a call may carry, from `Repeating<T, Max>` on the variadic
|
|
806
|
+
* parameter. Omitted at the default of 255.
|
|
807
|
+
*
|
|
808
|
+
* @remarks
|
|
809
|
+
* Excel keeps one such number per NAME and compares it against the whole call's argument
|
|
810
|
+
* count in its front end, so a call past it is refused AT ENTRY rather than answered — which
|
|
811
|
+
* is why the cap lives on the declaration and not in a body. It is not derivable from the
|
|
812
|
+
* shape: `STDEV` takes 255 arguments and `STDEV.S`, the same function under its dotted name,
|
|
813
|
+
* takes 254.
|
|
814
|
+
*
|
|
815
|
+
* @defaultValue 255
|
|
816
|
+
*/
|
|
817
|
+
maxArguments?: number;
|
|
513
818
|
/**
|
|
514
819
|
* Describes the execution context required by the function.
|
|
515
820
|
*
|
|
@@ -532,6 +837,14 @@ export declare namespace IFunction {
|
|
|
532
837
|
* * If the context is not `IFunction.Calculation` then the function must return `void` or a cleanup function.
|
|
533
838
|
*/
|
|
534
839
|
context?: string;
|
|
840
|
+
/**
|
|
841
|
+
* Leave the function out of function lists.
|
|
842
|
+
*
|
|
843
|
+
* @defaultValue `false`
|
|
844
|
+
*
|
|
845
|
+
* @see {@link IDeclaration.isHidden}
|
|
846
|
+
*/
|
|
847
|
+
hidden?: boolean;
|
|
535
848
|
/**
|
|
536
849
|
* Additional metadata about the function's behavior or requirements.
|
|
537
850
|
*/
|
|
@@ -566,13 +879,12 @@ export declare namespace IFunction {
|
|
|
566
879
|
*/
|
|
567
880
|
category?: string;
|
|
568
881
|
/**
|
|
569
|
-
*
|
|
882
|
+
* The label of a `@hidden` or `@deprecated` tag, or `true` for a tag with no label.
|
|
570
883
|
*
|
|
571
|
-
* @defaultValue
|
|
884
|
+
* @defaultValue `false`
|
|
572
885
|
*
|
|
573
886
|
* @remarks
|
|
574
|
-
*
|
|
575
|
-
* * This is useful for functions that are in beta or deprecated.
|
|
887
|
+
* Display text only. Whether the function is listed is {@link DeclarationJSON.hidden}.
|
|
576
888
|
*/
|
|
577
889
|
deprecated?: string | boolean;
|
|
578
890
|
/**
|
|
@@ -587,6 +899,22 @@ export declare namespace IFunction {
|
|
|
587
899
|
example?: string;
|
|
588
900
|
defaultValue?: Scalar;
|
|
589
901
|
}>;
|
|
902
|
+
/**
|
|
903
|
+
* Describe each enum the function's parameters are limited to, by enum id.
|
|
904
|
+
*/
|
|
905
|
+
enums?: Record<string, EnumDescriptorJSON>;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* The JSON form of an {@link IEnumDescription}. Every field is optional: an enum with no doc
|
|
909
|
+
* comments has nothing to say, and a language pack may translate any part of one.
|
|
910
|
+
*/
|
|
911
|
+
interface EnumDescriptorJSON {
|
|
912
|
+
nameLocal?: string;
|
|
913
|
+
summary?: string;
|
|
914
|
+
members?: Record<string, {
|
|
915
|
+
nameLocal?: string;
|
|
916
|
+
description?: string;
|
|
917
|
+
}>;
|
|
590
918
|
}
|
|
591
919
|
/**
|
|
592
920
|
* Contains extended metadata about a function that is not be directly inferable from the code itself.
|
|
@@ -604,20 +932,6 @@ export declare namespace IFunction {
|
|
|
604
932
|
* @defaultValue false
|
|
605
933
|
*/
|
|
606
934
|
cancelable?: boolean;
|
|
607
|
-
/**
|
|
608
|
-
* Named engine behaviors this function opts into, from the `@compat` doc tag.
|
|
609
|
-
*
|
|
610
|
-
* @remarks
|
|
611
|
-
* Canonical spellings, deduplicated and in declaration order; a family alias the author wrote
|
|
612
|
-
* (`@compat atp`) has already been expanded to its atomic features. An unknown name never
|
|
613
|
-
* reaches here — the linter fails the build on one, deliberately: a compatibility rule that
|
|
614
|
-
* silently no-ops is the worst failure available, because the fixtures keep passing and the
|
|
615
|
-
* behavior is simply absent.
|
|
616
|
-
*
|
|
617
|
-
* @see {@link CompatFeatures}
|
|
618
|
-
* @see {@link CompatAliases}
|
|
619
|
-
*/
|
|
620
|
-
compat?: CompatFeature[];
|
|
621
935
|
}
|
|
622
936
|
}
|
|
623
937
|
//# sourceMappingURL=IFunction.d.ts.map
|