chore: enable noUncheckedIndexedAccess, better type check (#2608)
This commit is contained in:
@@ -44,5 +44,5 @@ export const dayjsLocaleImportMap = {
|
||||
["ko"]: ["ko", () => import("dayjs/locale/ko")],
|
||||
["tr"]: ["tr", () => import("dayjs/locale/tr")],
|
||||
}
|
||||
export const ns = ["common", "lang", "errors"] as const
|
||||
export const ns = ["common", "lang", "errors", "external"] as const
|
||||
export const defaultNS = "external" as const
|
||||
|
||||
@@ -20,7 +20,7 @@ export const GridList: FC<{
|
||||
<Wrapper key={entry.id} href={entry.url || entry.authorUrl || ""}>
|
||||
<div className="relative -mx-1.5 -mt-1.5">
|
||||
<LazyImage
|
||||
src={entry.media?.[0].url}
|
||||
src={entry.media?.[0]!.url}
|
||||
className="aspect-video h-auto w-full shrink-0 rounded-md object-cover"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -49,7 +49,7 @@ const MasonryItemFixedDimensionWrapper = (
|
||||
const style = useMemo(
|
||||
() => ({
|
||||
width: itemWidth,
|
||||
height: itemWidth / stableRadioCtx,
|
||||
height: itemWidth / stableRadioCtx!,
|
||||
}),
|
||||
[itemWidth, stableRadioCtx],
|
||||
)
|
||||
@@ -148,10 +148,10 @@ export const PictureList: FC<{
|
||||
const flattenedItems = []
|
||||
const imageSrcSet = new Set<string>()
|
||||
for (let i = 0; i < entries?.length || 0; i++) {
|
||||
const entry = entries[i]
|
||||
const entry = entries[i]!
|
||||
if (!entry.media) continue
|
||||
for (let j = 0; j < entry.media?.length || 0; j++) {
|
||||
const media = entry.media[j]
|
||||
const media = entry.media[j]!
|
||||
if (imageSrcSet.has(media.url)) continue
|
||||
imageSrcSet.add(media.url)
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ export const fallbackLanguage = "en"
|
||||
export const initI18n = async () => {
|
||||
const i18next = jotaiStore.get(i18nAtom)
|
||||
|
||||
const lang = getGeneralSettings().language
|
||||
const lang = getGeneralSettings().language!
|
||||
|
||||
const mergedResources = {
|
||||
...defaultResources,
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import type { User } from "@auth/core/types"
|
||||
import type { AuthUser } from "@follow/shared/hono"
|
||||
|
||||
import { op } from "./op"
|
||||
|
||||
export const setIntegrationIdentify = async (user: User) => {
|
||||
export const setIntegrationIdentify = async (user: AuthUser) => {
|
||||
op.identify({
|
||||
profileId: user.id,
|
||||
email: user.email,
|
||||
avatar: user.image,
|
||||
avatar: user.image ?? undefined,
|
||||
lastName: user.name,
|
||||
properties: {
|
||||
// @ts-expect-error
|
||||
handle: user.handle,
|
||||
name: user.name,
|
||||
},
|
||||
|
||||
@@ -57,7 +57,7 @@ function RegisterForm() {
|
||||
return signUp.email({
|
||||
email: values.email,
|
||||
password: values.password,
|
||||
name: values.email.split("@")[0],
|
||||
name: values.email.split("@")[0]!,
|
||||
callbackURL: "/",
|
||||
fetchOptions: {
|
||||
onSuccess() {
|
||||
|
||||
@@ -104,7 +104,7 @@ export function Component() {
|
||||
<div className="flex w-full max-w-3xl flex-col gap-4 pb-12 pt-8">
|
||||
{listData!.feedIds
|
||||
?.slice(0, 7)
|
||||
.map((feedId) => <FeedRow feed={feedMap[feedId]} key={feedId} />)}
|
||||
.map((feedId) => <FeedRow feed={feedMap[feedId]!} key={feedId} />)}
|
||||
{"feedCount" in list.data && (
|
||||
<div onClick={handleOpenInFollowApp} className="text-sm text-zinc-500">
|
||||
{t("feed.follow_to_view_all", {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { defineMetadata } from "~/meta-handler"
|
||||
|
||||
export default defineMetadata(async ({ params, apiClient, origin, throwError }) => {
|
||||
const listId = params.id
|
||||
const listId = params.id!
|
||||
const list = await apiClient.lists
|
||||
.$get({ query: { listId } })
|
||||
.catch((e) => throwError(e.response?.status || 500, "List not found"))
|
||||
|
||||
@@ -68,7 +68,7 @@ export const Component = () => {
|
||||
<h3>{category}</h3>
|
||||
</div>
|
||||
<div>
|
||||
{subscriptions.data?.[category].map(
|
||||
{subscriptions.data?.[category]!.map(
|
||||
(subscription) =>
|
||||
"feeds" in subscription && (
|
||||
<div key={subscription.feedId} className="group relative border-b py-5">
|
||||
|
||||
@@ -24,7 +24,7 @@ export const useUserSubscriptionsQuery = (userId: string | undefined) => {
|
||||
if (!groupFolder[subscription.category]) {
|
||||
groupFolder[subscription.category] = []
|
||||
}
|
||||
groupFolder[subscription.category].push(subscription)
|
||||
groupFolder[subscription.category]!.push(subscription)
|
||||
}
|
||||
}
|
||||
return groupFolder
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"build": "cross-env NODE_ENV=production vite build && tsx scripts/prepare-vercel-build.ts && tsup && tsx scripts/cleanup-vercel-build.ts",
|
||||
"dev": "cross-env NODE_ENV=development tsx watch --include \"src/**/*.ts\" --exclude \"./*.ts\" --exclude \"./*.mjs\" index.ts",
|
||||
"meta": "tsx helper/meta-map.ts --watch",
|
||||
"start": "tsx index.ts"
|
||||
"start": "tsx index.ts",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/middie": "9.0.2",
|
||||
|
||||
@@ -73,7 +73,7 @@ export const getTokenFromCookie = (cookie: string) => {
|
||||
.reduce(
|
||||
(acc, item) => {
|
||||
const [key, value] = item.split("=")
|
||||
acc[key] = value
|
||||
acc[key!] = value!
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, string>,
|
||||
|
||||
@@ -21,16 +21,16 @@ export const ogRoute = (app: FastifyInstance) => {
|
||||
|
||||
switch (type) {
|
||||
case "feed": {
|
||||
imageRes = await renderFeedOG(apiClient, id).catch(errorFallback)
|
||||
imageRes = await renderFeedOG(apiClient, id!).catch(errorFallback)
|
||||
|
||||
break
|
||||
}
|
||||
case "user": {
|
||||
imageRes = await renderUserOG(apiClient, id).catch(errorFallback)
|
||||
imageRes = await renderUserOG(apiClient, id!).catch(errorFallback)
|
||||
break
|
||||
}
|
||||
case "list": {
|
||||
imageRes = await renderListOG(apiClient, id).catch(errorFallback)
|
||||
imageRes = await renderListOG(apiClient, id!).catch(errorFallback)
|
||||
break
|
||||
}
|
||||
default: {
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
"noEmit": true,
|
||||
"moduleResolution": "Bundler",
|
||||
"esModuleInterop": true,
|
||||
|
||||
Reference in New Issue
Block a user