Skip to content

Commit

Permalink
fix: Fix typings for eventwebhook.d.ts PublicKey (#1351)
Browse files Browse the repository at this point in the history
Installing @sendgrid/eventwebhook in a project using typescript cannot properly compile because starkbank-ecdsa does not provide any typings and none are available in DefinitelyTyped project either.
Right now the only way to use the module is to ourselves provide a definition of starkbank-ecdsa OR patch-package @sendgrid/eventwebhook

I've decided to change the import statement with a minimal interface of PublicKey which should be enough to use the package properly in a typescript project.

Technically speaking, @types/node is also required because you use Buffer in the types, but a typescript project without it would be weird so I think we can let that one as-is.
  • Loading branch information
Cellule committed Mar 25, 2022
1 parent d684055 commit dd8ddac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/eventwebhook/src/eventwebhook.d.ts
@@ -1,4 +1,10 @@
import {PublicKey} from "starkbank-ecdsa";
// From starkbank-ecdsa, minimal interface of PublicKey
declare class PublicKey {
toString(encode?: boolean): string;
static fromPem(pem: string): PublicKey;
static fromDer(der: string): PublicKey;
static fromString(key: string): PublicKey;
}

declare class EventWebhook {
/**
Expand Down

0 comments on commit dd8ddac

Please sign in to comment.