From b437863f8b0354ad326f2c6905c42961727c444a Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Mon, 15 Jul 2024 14:23:17 +0200 Subject: [PATCH] refactor: deno lint fix `slow-type-missing-explicit-return-type` --- src/contact.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/contact.ts b/src/contact.ts index 4caef4d..905d35c 100644 --- a/src/contact.ts +++ b/src/contact.ts @@ -1,14 +1,16 @@ import accounts from '../config/account.json' with { type: 'json' } import dkim from '../config/dkim.json' with { type: 'json' } +export type AddressString = `${string}@${string}.${string}` + export class Contact { #name: string - #address: `${string}@${string}.${string}` + #address: AddressString constructor( { name, address }: { name: string - address: `${string}@${string}.${string}` + address: AddressString }, ) { this.#name = name @@ -60,18 +62,18 @@ export class Contact { return `${this.#name} <${this.#address}>` } - toJSON() { + toJSON(): { name: string; address: AddressString } { return { name: this.#name, address: this.#address, } as const } - get name() { + get name(): string { return this.#name } - get address() { + get address(): AddressString { return this.#address } }