Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Replace all ts-ignore with ts-expect-error

Blue Mousecfbdd5a1a5b6
diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsx
index c54e38be3..b0f909bfe 100644
--- a/web/app/pages/Project/View/ViewProject.tsx
+++ b/web/app/pages/Project/View/ViewProject.tsx
@@ -1290,7 +1290,6 @@ const ViewProject = ({
)
// set chart data
setMainChart(() => {
- // @ts-ignore
const generate = bb.generate(bbSettings)
generate.data.names(dataNames)
return generate
@@ -1365,7 +1364,7 @@ const ViewProject = ({
diff = end.diff(start, 'day')
}
- // @ts-ignore
+ // @ts-expect-error
if (activePeriod?.period === 'custom' ? diffCompare <= diff : diffCompare <= activePeriod?.countDays) {
fromCompare = getFormatDate(dateRangeCompare[0])
toCompare = getFormatDate(dateRangeCompare[1])
@@ -1434,7 +1433,7 @@ const ViewProject = ({
// check if we need to load new data or we have data in redux/localstorage
if (!forced && !_isEmpty(cache[id]) && !_isEmpty(cache[id][key])) {
data = cache[id][key]
- // @ts-ignore
+ // @ts-expect-error
setOverall(data.overall)
} else {
if (period === 'custom' && dateRange) {
@@ -1591,7 +1590,6 @@ const ViewProject = ({
if (activeTab === PROJECT_TABS.traffic) {
setMainChart(() => {
- // @ts-ignore
const generate = bb.generate(bbSettings)
generate.data.names(dataNames)
return generate
@@ -1736,7 +1734,7 @@ const ViewProject = ({
return
}
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const eid = searchParams.get('eid') as string
@@ -1943,7 +1941,7 @@ const ViewProject = ({
diff = end.diff(start, 'day')
}
- // @ts-ignore
+ // @ts-expect-error
if (activePeriod?.period === 'custom' ? diffCompare <= diff : diffCompare <= activePeriod?.countDays) {
fromCompare = getFormatDate(dateRangeCompare[0])
toCompare = getFormatDate(dateRangeCompare[1])
@@ -2021,7 +2019,7 @@ const ViewProject = ({
if (!forced && !_isEmpty(cachePerf[id]) && !_isEmpty(cachePerf[id][key])) {
dataPerf = cachePerf[id][key]
- // @ts-ignore
+ // @ts-expect-error
setOverallPerformance(dataPerf.overall)
} else {
if (period === 'custom' && dateRange) {
@@ -2061,7 +2059,7 @@ const ViewProject = ({
)
}
- // @ts-ignore
+ // @ts-expect-error
dataPerf.overall = rawOverall[id]
setProjectCachePerf(id, dataPerf || {}, key)
@@ -2138,7 +2136,6 @@ const ViewProject = ({
if (activeTab === PROJECT_TABS.performance) {
setMainChart(() => {
- // @ts-ignore
const generate = bb.generate(bbSettings)
generate.data.names(dataNamesPerf)
return generate
@@ -2204,7 +2201,6 @@ const ViewProject = ({
if (activeTab === PROJECT_TABS.funnels) {
setMainChart(() => {
- // @ts-ignore
const generate = bb.generate(bbSettings)
generate.data.names(dataNamesFunnel)
return generate
@@ -2257,7 +2253,7 @@ const ViewProject = ({
if (_find(filtersPerf, (f) => f.filter === filter)) {
newFiltersPerf = _filter(filtersPerf, (f) => f.filter !== filter)
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
url.searchParams.delete(columnPerf)
const { pathname, search } = url
@@ -2278,7 +2274,7 @@ const ViewProject = ({
if (_find(filtersSessions, (f) => f.filter === filter)) {
newFiltersSessions = _filter(filtersSessions, (f) => f.filter !== filter)
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
url.searchParams.delete(columnSessions)
const { pathname, search } = url
@@ -2570,7 +2566,7 @@ const ViewProject = ({
}
// storing exclusive filter in the page URL
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
if (activeTab === PROJECT_TABS.performance) {
@@ -2779,7 +2775,6 @@ const ViewProject = ({
)
setMainChart(() => {
- // @ts-ignore
const generate = bb.generate(bbSettings)
generate.data.names(dataNames)
return generate
@@ -2816,7 +2811,6 @@ const ViewProject = ({
)
setMainChart(() => {
- // @ts-ignore
const generate = bb.generate(bbSettings)
generate.data.names(dataNamesPerf)
return generate
@@ -2839,7 +2833,6 @@ const ViewProject = ({
}
})
- // @ts-ignore
sdk = new SwetrixSDK(
processedExtensions,
{
@@ -2952,7 +2945,7 @@ const ViewProject = ({
// using try/catch because new URL is not supported by browsers like IE, so at least analytics would work without parsing filters
if (activeTab === PROJECT_TABS.performance) {
try {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const initialFilters: any[] = []
@@ -2982,7 +2975,7 @@ const ViewProject = ({
}
} else {
try {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const initialFilters: any[] = []
@@ -3008,7 +3001,7 @@ const ViewProject = ({
useEffect(() => {
try {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const initialFilters: any[] = []
@@ -3042,7 +3035,7 @@ const ViewProject = ({
useEffect(() => {
try {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const initialFilters: any[] = []
@@ -3078,7 +3071,7 @@ const ViewProject = ({
useEffect(() => {
if (arePeriodParsed) {
try {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const intialTimeBucket = searchParams.get('timeBucket')
@@ -3114,7 +3107,7 @@ const ViewProject = ({
// we update url and state
const onRangeDateChange = (dates: Date[], onRender?: boolean) => {
const days = Math.ceil(Math.abs(dates[1].getTime() - dates[0].getTime()) / (1000 * 3600 * 24))
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
// setting allowed time buckets for the specified date range (period)
@@ -3347,7 +3340,7 @@ const ViewProject = ({
const newPeriodFull = _find(periodPairs, (el) => el.period === newPeriod.period)
let tb = timeBucket
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
if (_isEmpty(newPeriodFull)) return
@@ -3382,7 +3375,7 @@ const ViewProject = ({
// updateTimebucket using for update timeBucket also update url
const updateTimebucket = (newTimebucket: string) => {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
url.searchParams.set('timeBucket', newTimebucket)
const { pathname, search } = url
@@ -3413,7 +3406,7 @@ const ViewProject = ({
// parse period from url when page is loaded
useEffect(() => {
try {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const intialPeriod = projectViewPrefs
@@ -3430,9 +3423,9 @@ const ViewProject = ({
}
if (intialPeriod === 'custom') {
- // @ts-ignore
+ // @ts-expect-error
const from = new Date(searchParams.get('from'))
- // @ts-ignore
+ // @ts-expect-error
const to = new Date(searchParams.get('to'))
if (from.getDate() && to.getDate()) {
onRangeDateChange([from, to], true)
@@ -3588,7 +3581,7 @@ const ViewProject = ({
return
}
- // @ts-ignore
+ // @ts-expect-error
const tab = SHORTCUTS_TABS_MAP[key]
if (!tab) {
@@ -3601,14 +3594,14 @@ const ViewProject = ({
// 'General' shortcuts
useHotkeys(SHORTCUTS_GENERAL_LISTENERS, ({ key }) => {
- // @ts-ignore
+ // @ts-expect-error
generalShortcutsActions[key]?.()
})
// 'Timebuckets selection' shortcuts
useHotkeys(SHORTCUTS_TIMEBUCKETS_LISTENERS, ({ key }) => {
const pairs = tbPeriodPairs(t, undefined, undefined, language)
- // @ts-ignore
+ // @ts-expect-error
const pair = _find(pairs, ({ period }) => period === timebucketShortcutsMap[key])
if (!pair) {
@@ -3616,7 +3609,7 @@ const ViewProject = ({
}
if (pair.isCustomDate) {
- // @ts-ignore
+ // @ts-expect-error
refCalendar.current?.openCalendar?.()
return
}
@@ -4385,7 +4378,7 @@ const ViewProject = ({
if (pair.isCustomDate) {
setTimeout(() => {
- // @ts-ignore
+ // @ts-expect-error
refCalendar.current.openCalendar()
}, 100)
} else {
@@ -4413,7 +4406,7 @@ const ViewProject = ({
if (pair.period === PERIOD_PAIRS_COMPARE.CUSTOM) {
setTimeout(() => {
- // @ts-ignore
+ // @ts-expect-error
refCalendarCompare.current.openCalendar()
}, 100)
} else {
@@ -4663,7 +4656,7 @@ const ViewProject = ({
{!_isEmpty(activeError?.params) &&
_map(ERROR_PANELS_ORDER, (type: keyof typeof tnMapping) => {
const panelName = tnMapping[type]
- // @ts-ignore
+ // @ts-expect-error
const panelIcon = panelIconMapping[type]
if (type === 'cc') {
@@ -4699,7 +4692,7 @@ const ViewProject = ({
const rowMapper = (entry: any) => {
const { name: entryName } = entry
- // @ts-ignore
+ // @ts-expect-error
const logoUrl = BROWSER_LOGO_MAP[entryName]
if (!logoUrl) {
@@ -4741,9 +4734,9 @@ const ViewProject = ({
const rowMapper = (entry: any) => {
const { name: entryName } = entry
- // @ts-ignore
+ // @ts-expect-error
const logoPathLight = OS_LOGO_MAP[entryName]
- // @ts-ignore
+ // @ts-expect-error
const logoPathDark = OS_LOGO_MAP_DARK[entryName]
let logoPath = _theme === 'dark' ? logoPathDark : logoPathLight
@@ -4810,7 +4803,6 @@ const ViewProject = ({
id={type}
onFilter={filterHandler}
onFragmentChange={setPgActiveFragment}
- // @ts-ignore
rowMapper={({ name: entryName }) => {
if (!entryName) {
return _toUpper(t('project.redactedPage'))
@@ -4958,7 +4950,7 @@ const ViewProject = ({
{!_isEmpty(panelsData.types) &&
_map(TRAFFIC_PANELS_ORDER, (type: keyof typeof tnMapping) => {
const panelName = tnMapping[type]
- // @ts-ignore
+ // @ts-expect-error
const panelIcon = panelIconMapping[type]
const customTabs = _filter(customPanelTabs, (tab) => tab.panelID === type)
@@ -4998,7 +4990,7 @@ const ViewProject = ({
const rowMapper = (entry: any) => {
const { name: entryName } = entry
- // @ts-ignore
+ // @ts-expect-error
const logoUrl = BROWSER_LOGO_MAP[entryName]
if (!logoUrl) {
@@ -5040,9 +5032,9 @@ const ViewProject = ({
const rowMapper = (entry: any) => {
const { name: entryName } = entry
- // @ts-ignore
+ // @ts-expect-error
const logoPathLight = OS_LOGO_MAP[entryName]
- // @ts-ignore
+ // @ts-expect-error
const logoPathDark = OS_LOGO_MAP_DARK[entryName]
let logoPath = _theme === 'dark' ? logoPathDark : logoPathLight
@@ -5113,7 +5105,6 @@ const ViewProject = ({
activeTab={activeTab}
data={dataSource[type]}
customTabs={customTabs}
- // @ts-ignore
rowMapper={({ name: entryName }) => <RefRow rowName={entryName} />}
/>
)
@@ -5133,7 +5124,6 @@ const ViewProject = ({
name={<UTMDropdown onSelect={setUtmActiveTab} title={ccPanelName} />}
data={dataSource[utmActiveTab]}
customTabs={customTabs}
- // @ts-ignore
rowMapper={({ name: entryName }) => decodeURIComponent(entryName)}
/>
)
@@ -5148,7 +5138,6 @@ const ViewProject = ({
id={type}
onFilter={filterHandler}
onFragmentChange={setPgActiveFragment}
- // @ts-ignore
rowMapper={({ name: entryName }) => {
if (!entryName) {
return _toUpper(t('project.redactedPage'))
@@ -5262,7 +5251,7 @@ const ViewProject = ({
{!_isEmpty(panelsDataPerf.types) &&
_map(PERFORMANCE_PANELS_ORDER, (type: keyof typeof tnMapping) => {
const panelName = tnMapping[type]
- // @ts-ignore
+ // @ts-expect-error
const panelIcon = panelIconMapping[type]
const customTabs = _filter(customPanelTabs, (tab) => tab.panelID === type)
@@ -5291,7 +5280,7 @@ const ViewProject = ({
data={panelsDataPerf.data[countryActiveTab]}
customTabs={customTabs}
rowMapper={rowMapper}
- // @ts-ignore
+ // @ts-expect-error
valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
/>
)
@@ -5309,7 +5298,7 @@ const ViewProject = ({
activeTab={activeTab}
data={panelsDataPerf.data[type]}
customTabs={customTabs}
- // @ts-ignore
+ // @ts-expect-error
valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
capitalize
/>
@@ -5328,9 +5317,8 @@ const ViewProject = ({
name={panelName}
data={panelsDataPerf.data[type]}
customTabs={customTabs}
- // @ts-ignore
+ // @ts-expect-error
valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
- // @ts-ignore
rowMapper={({ name: entryName }) => {
// todo: add uppercase
return entryName || t('project.redactedPage')
@@ -5344,7 +5332,7 @@ const ViewProject = ({
const rowMapper = (entry: any) => {
const { name: entryName } = entry
- // @ts-ignore
+ // @ts-expect-error
const logoUrl = BROWSER_LOGO_MAP[entryName]
if (!logoUrl) {
@@ -5392,7 +5380,7 @@ const ViewProject = ({
name={panelName}
data={panelsDataPerf.data[type]}
customTabs={customTabs}
- // @ts-ignore
+ // @ts-expect-error
valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
/>
)