From 6b1ea8dd2c998a5b6fe5f37454e4c04df4863772 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 8 Jan 2025 17:26:54 +0100 Subject: [PATCH] Require specific subtype of `formatMessage` in `timeAgoString` (#33511) --- .../mastodon/components/relative_timestamp.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/components/relative_timestamp.tsx b/app/javascript/mastodon/components/relative_timestamp.tsx index ac385e88c6..6253525091 100644 --- a/app/javascript/mastodon/components/relative_timestamp.tsx +++ b/app/javascript/mastodon/components/relative_timestamp.tsx @@ -1,6 +1,6 @@ import { Component } from 'react'; -import type { IntlShape } from 'react-intl'; +import type { MessageDescriptor, PrimitiveType, IntlShape } from 'react-intl'; import { injectIntl, defineMessages } from 'react-intl'; const messages = defineMessages({ @@ -102,7 +102,13 @@ const getUnitDelay = (units: string) => { }; export const timeAgoString = ( - intl: Pick, + intl: { + formatDate: IntlShape['formatDate']; + formatMessage: ( + { id, defaultMessage }: MessageDescriptor, + values?: Record, + ) => string; + }, date: Date, now: number, year: number,