Skip to content

Commit 7e105fa

Browse files
authored
Improvement new tsconfig (#63)
* improvement(*): type improvement based on new tsconfig * fix(workflows): update `pnpm` version * fix(test/snapshot): remove unused `CHROMIUM_PATH` * fix(web/proxy): fix `orGet` receive string instead of function
1 parent 7089e7f commit 7e105fa

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
lines changed

.github/workflows/root.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Pnpm
1919
uses: pnpm/action-setup@v4
2020
with:
21-
version: 8
21+
version: 9
2222

2323
- name: Use Node.js ${{ matrix.node-version }}
2424
uses: actions/setup-node@v3

apps/web/pages/_document.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Document, {
88
} from 'next/document';
99

1010
export default class Doc extends Document {
11-
static getInitialProps = async (context: DocumentContext) => {
11+
static override getInitialProps = async (context: DocumentContext) => {
1212
const { renderPage: originalRenderPage } = context;
1313

1414
// Run the React rendering logic synchronously
@@ -29,7 +29,7 @@ export default class Doc extends Document {
2929
return await Document.getInitialProps(context);
3030
};
3131

32-
render = () => {
32+
override render = () => {
3333
return (
3434
<Html lang="en">
3535
<Head>

apps/web/pages/templates/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ const Templates = () => {
460460
const router = useRouter();
461461

462462
const names = decodeURIComponent(
463-
parse(schemas.names, router.query.names ?? '')
463+
parse(schemas.names, router.query['names'] ?? '')
464464
)
465465
.split(delimiter)
466466
.filter(Boolean);

apps/web/src/web/components/error/boundary.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ErrorBoundary extends React.Component<
1616
}>,
1717
State
1818
> {
19-
state: State = {
19+
override state: State = {
2020
error: undefined,
2121
closedAlert: false,
2222
};
@@ -28,12 +28,12 @@ class ErrorBoundary extends React.Component<
2828
};
2929
};
3030

31-
componentDidCatch = (error: Error, errorInfo: React.ErrorInfo) => {
31+
override componentDidCatch = (error: Error, errorInfo: React.ErrorInfo) => {
3232
console.error({ error, errorInfo });
3333
this.setState({ error });
3434
};
3535

36-
render = () => {
36+
override render = () => {
3737
return !this.state.error ? (
3838
this.props.children
3939
) : (

apps/web/src/web/proxy/client.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createTRPCProxyClient, httpLink } from '@trpc/client';
22

33
import superjson from 'superjson';
44

5-
import { isBrowser } from '@poolofdeath20/util';
5+
import { Defined, isBrowser } from '@poolofdeath20/util';
66

77
import type { AppRouter } from '../../api/routes/internal/_app';
88

@@ -11,13 +11,12 @@ const getBaseUrl = () => {
1111
return '';
1212
}
1313

14-
if (process.env.VERCEL_URL) {
15-
// reference for vercel.com
16-
return `https://${process.env.VERCEL_URL}`;
17-
}
18-
19-
// assume localhost
20-
return process.env.NEXT_PUBLIC_ORIGIN;
14+
return Defined.parse(process.env['VERCEL_URL'])
15+
.map((vercelUrl) => {
16+
// reference for vercel.com
17+
return `https://${vercelUrl}`;
18+
})
19+
.orGet(process.env.NEXT_PUBLIC_ORIGIN);
2120
};
2221

2322
const trpcClient = createTRPCProxyClient<AppRouter>({

apps/web/test/snapshot/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const testSnapshot = () => {
1919
headless: true,
2020
defaultViewport: null,
2121
args: ['--start-maximized', '--no-sandbox'],
22-
executablePath: process.env.CHROMIUM_PATH,
2322
});
2423
});
2524
});

0 commit comments

Comments
 (0)