1- import type { DistConfig , DistanceResult , NJConfig , NJEvent , SequenceObject } from "./types/lib_types" ;
1+ import type { DistConfig , DistanceResult , NJConfig , NJEvent , NJResult , SequenceObject } from "./types/lib_types" ;
22
3- export type { DistConfig , DistanceResult , NJConfig , NJEvent , SequenceObject } ;
3+ export type { DistConfig , DistanceResult , NJConfig , NJEvent , NJResult , SequenceObject } ;
44
55export type NJEventCallback = ( event : NJEvent ) => void ;
66
@@ -18,12 +18,16 @@ export type NJEventCallback = (event: NJEvent) => void;
1818 * @param onEvent - Optional callback invoked with a tagged event object at each
1919 * algorithm stage. Use `event.type` to distinguish events. Bootstrap progress
2020 * events have type `"BootstrapProgress"` with `completed` and `total` fields.
21- * @returns A semicolon-terminated Newick string. Bootstrap support values (if
22- * requested) appear as integer percentage labels (0–100) on internal nodes.
21+ * @returns An `NJResult` object. `result.newick` is always present as a
22+ * semicolon-terminated Newick string. Bootstrap support values (if requested)
23+ * appear as integer percentage labels (0–100) on internal nodes.
24+ * `result.distance_matrix` and `result.average_distance` are present when
25+ * the corresponding `return_distance_matrix` / `return_average_distance`
26+ * flags are set in `config`.
2327 * @throws {Error } If the MSA is empty, sequences have unequal or zero length,
2428 * or an incompatible model–alphabet combination is provided.
2529 */
26- export function nj ( config : NJConfig , onEvent ?: NJEventCallback ) : string ;
30+ export function nj ( config : NJConfig , onEvent ?: NJEventCallback ) : NJResult ;
2731
2832/**
2933 * Computes pairwise distances and returns a full symmetric distance matrix.
0 commit comments