mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-10 18:53:19 +01:00
Require specific subtype of formatMessage
in timeAgoString
(#33511)
This commit is contained in:
parent
1bf6195763
commit
6b1ea8dd2c
1 changed files with 8 additions and 2 deletions
|
@ -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<IntlShape, 'formatDate' | 'formatMessage'>,
|
||||
intl: {
|
||||
formatDate: IntlShape['formatDate'];
|
||||
formatMessage: (
|
||||
{ id, defaultMessage }: MessageDescriptor,
|
||||
values?: Record<string, PrimitiveType>,
|
||||
) => string;
|
||||
},
|
||||
date: Date,
|
||||
now: number,
|
||||
year: number,
|
||||
|
|
Loading…
Reference in a new issue