Skip to content
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

final appeal for generic on nostrevent #5

Open
antonioconselheiro opened this issue Oct 23, 2024 · 0 comments
Open

final appeal for generic on nostrevent #5

antonioconselheiro opened this issue Oct 23, 2024 · 0 comments

Comments

@antonioconselheiro
Copy link

I would like make a final appeal to include generic support to nostrify NostrEvent.

Continuation of: nbd-wtf/nostr-tools#448

If you know you don't want that you can say just no and ok,
but here are advantages by including this in your library:

  1. default value as number make it retrocompatible to NostrEvent with no generic, no old software will feel the changes;
  2. isKind() was just included to nostr-tools and as I demonstrated it makes the guard type cast except for switch case;
    image
  3. this pr Suggestion: export kinds as named types nbd-wtf/nostr-tools#447 also included use of kinds as a typescript type, so it's possible use like this: NostrEvent<ShortText>
  4. while this code Suggestion: export kinds as named types nbd-wtf/nostr-tools#447 is not published in npm I'm doing this: NostrEvent & { kind: typeof kinds.ShortText }, a complex representation that will be common used to define kind validated events, nostrify can offer a simple symbol NostrEvent<ShortText>
  5. NostrEvent is equal NostrEvent from nostr-tools but with docs, this will make it a best version for use to me.

So, no?

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

No branches or pull requests

1 participant