Skip to content

Commit dd8ddac

Browse files
authored
fix: Fix typings for eventwebhook.d.ts PublicKey (#1351)
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.
1 parent d684055 commit dd8ddac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/eventwebhook/src/eventwebhook.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import {PublicKey} from "starkbank-ecdsa";
1+
// From starkbank-ecdsa, minimal interface of PublicKey
2+
declare class PublicKey {
3+
toString(encode?: boolean): string;
4+
static fromPem(pem: string): PublicKey;
5+
static fromDer(der: string): PublicKey;
6+
static fromString(key: string): PublicKey;
7+
}
28

39
declare class EventWebhook {
410
/**

0 commit comments

Comments
 (0)