Fix some type errors.

This commit is contained in:
muzam1l
2023-01-11 20:17:21 +05:30
parent a08823a38b
commit 0536e48cfe
2 changed files with 3 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ import { ChatCircleText } from 'phosphor-react'
TimeAgo.setDefaultLocale(en.locale)
TimeAgo.addLocale(en)
function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps<{ session?: any }>) {
const router = useRouter()
const slug = router.query?.slug
const gistId = (Array.isArray(slug) && slug[0]) ?? null

View File

@@ -1,5 +1,5 @@
import { Octokit } from '@octokit/core'
import state, { IFile } from '../index'
import state, { IFile, ILang } from '../index'
import { templateFileIds } from '../constants'
const octokit = new Octokit()
@@ -48,7 +48,7 @@ export const fetchFiles = async (gistId: string) => {
const files: IFile[] = Object.keys(res.data.files).map(filename => ({
name: res.data.files?.[filename]?.filename || 'untitled.c',
language: res.data.files?.[filename]?.language?.toLowerCase() || '',
language: res.data.files?.[filename]?.language?.toLowerCase() as ILang | undefined,
content: res.data.files?.[filename]?.content || ''
}))