Context
bmssp is ESM JavaScript with rich JSDoc but no shipped type declarations. TypeScript consumers currently get any. Types are the single biggest DX ask for an npm library.
Scope
- Provide
.d.ts for the four public exports (BMSSP, Graph, dijkstra, constantDegreeTransform) and the supported BMSSP members (calculateShortestPaths, calculateShortestPathsFrom, bmssp, reconstructPath, getEdges, and the public fields shortestPaths/nodeIDs/hops/preds).
- Options: hand-write
index.d.ts, or generate from the existing JSDoc via tsc --declaration --allowJs --emitDeclarationOnly. Prefer generation if the JSDoc is complete enough, to keep types in lockstep.
- Add the
types (and exports.types) field to package.json; include the .d.ts in the published files.
- Add a type-level test (e.g.
tsd or a // @ts-check sample) so the types are covered in CI.
Constraints
- Types must match the locked public surface (the
test/publicApi.test.mjs contract) — internal members stay untyped/@internal.
- Non-breaking (additive).
Acceptance
- A TypeScript sample importing
bmssp type-checks with no any on the public surface; CI verifies it.
Context
bmsspis ESM JavaScript with rich JSDoc but no shipped type declarations. TypeScript consumers currently getany. Types are the single biggest DX ask for an npm library.Scope
.d.tsfor the four public exports (BMSSP,Graph,dijkstra,constantDegreeTransform) and the supportedBMSSPmembers (calculateShortestPaths,calculateShortestPathsFrom,bmssp,reconstructPath,getEdges, and the public fieldsshortestPaths/nodeIDs/hops/preds).index.d.ts, or generate from the existing JSDoc viatsc --declaration --allowJs --emitDeclarationOnly. Prefer generation if the JSDoc is complete enough, to keep types in lockstep.types(andexports.types) field topackage.json; include the.d.tsin the published files.tsdor a// @ts-checksample) so the types are covered in CI.Constraints
test/publicApi.test.mjscontract) — internal members stay untyped/@internal.Acceptance
bmssptype-checks with noanyon the public surface; CI verifies it.