Skip to content

Rewrite pay_ln_address.js to TypeScript #383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Dunsin-cyber
Copy link
Contributor

This pull request is based on my earlier discussion with @rolznz regarding rewriting each example file in TypeScript and submitting them as individual PRs. The goal is to:


Changes in This PR:

  • Renamed pay_ln_address.jspay_ln_address.ts

  • Rewrote the file in TypeScript, using:

    • Type-safe imports for runtime (index.module.js)
    • Separate type import for LNClient from dist/index.d.ts
  • Preserved existing functionality while improving readability and type safety


Notes:

Since the original .js file was fully rewritten as .ts, Git may detect this as a delete + add. Let me know if you'd prefer a two-step commit (git mv → then content edit) in future PRs for cleaner diff tracking.


@rolznz — starting with this file as the first step. Let me know if the structure, import style, and formatting align with your expectations. I’d be happy to adjust anything as needed so we can use this as the reference approach for the remaining conversions.

Looking forward to your feedback!

import { stdin as input, stdout as output } from "node:process";

// ⚠️ Using locally built SDK for testing — run `pnpm build` before running this example.
import { LN, USD } from "../../dist/index.module.js";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to avoid this as it defeats the whole purpose of moving to typescript. We either need to import the actual typescript files or import from @getalby/sdk and add a package.json to the examples folder.

@Dunsin-cyber
Copy link
Contributor Author

Alright.
Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants