Skip to content

Commit

Permalink
Fix lint in test
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Feb 17, 2025
1 parent 8868626 commit d17baf9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/use-intl/src/react/useFormatter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
type DateTimeFormatOptions,
type IntlError,
IntlErrorCode,
type NumberFormatOptions
type NumberFormatOptions,
type RelativeTimeFormatOptions
} from '../core.js';
import IntlProvider from './IntlProvider.js';
import useFormatter from './useFormatter.js';
Expand Down Expand Up @@ -432,13 +433,15 @@ describe('number', () => {
describe('relativeTime', () => {
function renderRelativeTime(
date: Date | number,
nowOrOptions: Parameters<
ReturnType<typeof useFormatter>['relativeTime']
>['1']
nowOrOptions: Date | number | RelativeTimeFormatOptions
) {
function Component() {
const format = useFormatter();
return <>{format.relativeTime(date, nowOrOptions)}</>;
if (nowOrOptions instanceof Date || typeof nowOrOptions === 'number') {
return format.relativeTime(date, nowOrOptions);
} else {
return format.relativeTime(date, nowOrOptions);
}
}

render(
Expand Down

0 comments on commit d17baf9

Please sign in to comment.