Skip to content

Commit

Permalink
Fix withReactIntl ts errors
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraya committed Feb 5, 2025
1 parent 4aaa256 commit b487c02
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ import {IntlProvider} from 'react-intl'
import {useQuery} from '@tanstack/react-query'
import {useLocation} from 'react-router-dom'

import type {ApplicationExtensionConfig} from '@salesforce/pwa-kit-extension-sdk/types'

// Local Imports
import {getTargetLocale, fetchTranslations} from '../../utils/locale'
import {isServer} from '../../utils/utils'
import logger from '../../utils/logger-instance'
import useMultiSite from '../../hooks/use-multi-site'
import {useExtensionConfig} from '../../hooks'

// Define a type for the ApplicationExtensionConfig including defaultAppLocale
interface ExtendedApplicationExtensionConfig extends ApplicationExtensionConfig {
defaultAppLocale: string
}

// Define a type for the HOC props
type WithReactIntlProps = React.ComponentPropsWithoutRef<any>

Expand All @@ -25,7 +32,7 @@ const withReactIntl = <P extends object>(WrappedComponent: React.ComponentType<P
const WithReactIntl: React.FC<P> = (props: WithReactIntlProps) => {
const {site, locale} = useMultiSite()
const location = useLocation()
const config = useExtensionConfig()
const config = useExtensionConfig() as ExtendedApplicationExtensionConfig
const targetLocale = getTargetLocale({
getUserPreferredLocales: () => {
// CONFIG: This function should return an array of preferred locales. They can be
Expand Down

0 comments on commit b487c02

Please sign in to comment.