1
0
Fork 1
mirror of https://github.com/thatmattlove/hyperglass.git synced 2026-01-17 08:48:05 +00:00

fix type errors for non-existent hyperglass.json file

This commit is contained in:
thatmattlove 2024-03-01 23:58:55 -05:00
parent 16b4f60aef
commit 125d73d281
2 changed files with 12 additions and 9 deletions

View file

@ -1,18 +1,19 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { Meta, Layout } from '~/components';
import { HyperglassProvider } from '~/context';
import * as config from '../hyperglass.json';
import type { AppProps } from 'next/app';
import { Layout, Meta } from '~/components';
import { HyperglassProvider } from '~/context';
import type { Config } from '~/types';
// Declare imported JSON type to avoid type errors when file is not present (testing).
const config = (await import('../hyperglass.json')) as unknown as Config;
const queryClient = new QueryClient();
const App = (props: AppProps): JSX.Element => {
const { Component, pageProps } = props;
return (
<QueryClientProvider client={queryClient}>
<HyperglassProvider config={config as unknown as Config}>
<HyperglassProvider config={config}>
<Meta />
<Layout>
<Component {...pageProps} />

View file

@ -1,13 +1,15 @@
import fs from 'fs';
import Document, { Html, Head, Main, NextScript } from 'next/document';
import { ColorModeScript } from '@chakra-ui/react';
import { CustomJavascript, CustomHtml, Favicon } from '~/elements';
import Document, { Html, Head, Main, NextScript } from 'next/document';
import { CustomHtml, CustomJavascript, Favicon } from '~/elements';
import { googleFontUrl } from '~/util';
import favicons from '../favicon-formats';
import config from '../hyperglass.json';
import type { DocumentContext, DocumentInitialProps } from 'next/document';
import type { ThemeConfig } from '~/types';
import type { Config, ThemeConfig } from '~/types';
// Declare imported JSON type to avoid type errors when file is not present (testing).
const config = (await import('../hyperglass.json')) as unknown as Config;
interface DocumentExtra
extends DocumentInitialProps,