juliangruber / keypair

Generate a RSA PEM key pair from pure JS
Other
274 stars 51 forks source link

Fix type definition #22

Open jdforsythe opened 2 years ago

jdforsythe commented 2 years ago

The current type definition requires esModuleInterop: true to work. Otherwise you get errors like: TypeError: (0 , keypair_1.default) is not a function

References:

This change uses Declaration Merging and the export = syntax so it works with and without esModuleInterop.

import * as keypair from 'keypair';

const keys: keypair.KeypairResults = keypair();
snowy008 commented 2 years ago

你好,邮件已经收到,我会尽快处理的~~~

juliangruber commented 2 years ago

Could someone with more typescript experience than me please review this?