Skip to content

SDK: duplicate priceMath exports — import { PriceMath } breaks under tsc strict (TS2308) #503

Closed as not planned

Description

@RicainvLovemr

Summary

@metadaoproject/programs (0.1.1-alpha.2, built from master) exposes two different priceMath modules through its package entry, which breaks import { PriceMath } from "@metadaoproject/programs" under tsc --strict:

  • sdk/src/priceMath.ts → exports AmmMath (aliased as PriceMath) + liquidity simulation types
  • sdk/src/amm/v0.5/index.ts → re-exports its own ./priceMath.js (simulateSwap, SwapSimulation, ...)

sdk/src/index.ts star-exports both chains (export * from "./priceMath.js" and export * from "./launchpad/index.js" → ./amm/v0.5/index.js), so consumers get conflicting module identities for the same name depending on resolution order.

Error

src/index.ts:1:10 - error TS2308: Module './priceMath.js' has already exported a
member named 'PriceMath'. Consider explicitly re-exporting to resolve the ambiguity.

MCVE

Full reproduction (fresh project, npm i @metadaoproject/programs@alpha, single import, npx tsc --strict) is here:

https://github.com/RicainvLovemr/mcve-programs-sdk/blob/main/mcve_priceMath.ts

(raw: https://raw.githubusercontent.com/RicainvLovemr/mcve-programs-sdk/main/mcve_priceMath.ts )

Expected

A single canonical priceMath surface, or an explicit namespaced re-export (e.g. export * as AmmV05PriceMath from "./amm/v0.5/priceMath.js").

Environment

  • @metadaoproject/programs 0.1.1-alpha.2
  • typescript 5.x, node 22

Happy to open a PR with the namespaced re-export if the maintainers prefer that direction — wanted to check the intended public surface first, since v0.4 does not export priceMath from its index.ts while v0.5 does.

Activity

  1. RicainvLovemr commented on Nov 21, 2026

    @RicainvLovemr
    Author

    Follow-up while preparing the PR: I checked the published tarball of 0.1.1-alpha.2 and both modules are present, so the ambiguity ships to consumers as-is.

    @metapileks you touched the SDK layout most recently (met-454 / the v0.5 restructure) — is the namespaced re-export the direction you would accept? I would rather match the maintainers intended public surface than guess.

    cc @copilot if the repo has triage enabled: the MCVE reproduction is self-contained at https://github.com/RicainvLovemr/mcve-programs-sdk/blob/main/mcve_priceMath.ts — it includes the exact tsc invocation and the expected/actual output for triage.

  2. RicainvLovemr commented on Nov 22, 2026

    @RicainvLovemr
    Author

    Correction for the record (credit to the repo's AI review on #504): the TS2308 I hit does not reproduce against the current branch — my MCVE was resolving a cached tarball of an earlier alpha where the root index re-exported the amm chain. Against master/develop, sdk/src/index.ts does not export from ./amm, so the reported collision does not exist as described.

    The remaining (much smaller) ask in #504 is just the optional namespaced alias for explicitness. Closing this issue as not-a-bug; thanks for the look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions