build(ci): refine autofix GH action
[poolifier.git] / examples / typescript / smtp-client-pool / src / main.ts
index 70b1cb244cbdc7988d9e038533e354061106288b..4d1f2ea896188b7cfa49aa559dfaaab5f5a28f7c 100644 (file)
@@ -1,8 +1,10 @@
+import type SMTPTransport from 'nodemailer/lib/smtp-transport/index.js'
+
 import { smtpClientPool } from './pool.js'
 
 const tos = ['bar@example.com, baz@example.com']
 
-const smtpClientPoolPromises = new Set<Promise<unknown>>()
+const smtpClientPoolPromises = new Set<Promise<SMTPTransport.SentMessageInfo>>()
 for (const to of tos) {
   smtpClientPoolPromises.add(
     smtpClientPool.execute({
@@ -12,16 +14,16 @@ for (const to of tos) {
         secure: true,
         auth: {
           user: 'REPLACE-WITH-YOUR-ALIAS@DOMAIN.TLD',
-          pass: 'REPLACE-WITH-YOUR-GENERATED-PASSWORD'
-        }
+          pass: 'REPLACE-WITH-YOUR-GENERATED-PASSWORD',
+        },
       },
       mail: {
         from: '"Foo" <foo@domain.tld>',
         to,
         subject: 'Hello',
         text: 'Hello world?',
-        html: '<b>Hello world?</b>'
-      }
+        html: '<b>Hello world?</b>',
+      },
     })
   )
 }
@@ -30,9 +32,9 @@ try {
   await Promise.all(smtpClientPoolPromises)
   const elapsedTime = performance.now() - now
   console.info(
-    `Send in parallel in ${elapsedTime.toFixed(2)}ms ${
-      tos.length
-    } mails with SMTP client pool`
+    `Send in parallel in ${elapsedTime.toFixed(
+      2
+    )}ms ${tos.length.toString()} mails with SMTP client pool`
   )
 } catch (error) {
   console.error(error)