Skip to content

Commit

Permalink
fix(react-intl): use indexOf instead of includes
Browse files Browse the repository at this point in the history
  • Loading branch information
longlho committed Sep 27, 2021
1 parent 245301f commit aed19a2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/react-intl/examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ ts_project(
declaration_map = True,
extends = "//:tsconfig.json",
out_dir = "lib",
resolve_json_module = True,
tsconfig = "//:tsconfig.esm.json",
resolve_json_module=True,
deps = SRC_DEPS,
)

Expand Down
1 change: 1 addition & 0 deletions packages/react-intl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const FormattedTime: React.FC<
value: string | number | Date | undefined
}
> = createFormattedComponent('formatTime')
// @ts-ignore issue w/ TS Intl types
export const FormattedNumber: React.FC<
NumberFormatOptions &
CustomFormatConfig & {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-intl/src/components/relative.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const INCREMENTABLE_UNITS: RelativeTimeFormatSingularUnit[] = [
function canIncrement(
unit: RelativeTimeFormatSingularUnit = 'second'
): boolean {
return INCREMENTABLE_UNITS.includes(unit)
return INCREMENTABLE_UNITS.indexOf(unit) > -1
}

const SimpleFormattedRelativeTime: React.FC<
Expand Down

0 comments on commit aed19a2

Please sign in to comment.