web: fix typecheck

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-10-26 21:15:08 +02:00
parent 8a87fff689
commit d8c587ef90
7 changed files with 33 additions and 29 deletions

View File

@@ -8,11 +8,12 @@
"dev": "next dev", "dev": "next dev",
"postinstall": "prisma generate", "postinstall": "prisma generate",
"lint": "next lint", "lint": "next lint",
"typecheck": "tsc --noEmit",
"start": "next start" "start": "next start"
}, },
"dependencies": { "dependencies": {
"@hookform/resolvers": "^3.3.2", "@hookform/resolvers": "^3.3.2",
"@mixan/types": "^0.0.2-alpha", "@mixan/types": "workspace:*",
"@next-auth/prisma-adapter": "^1.0.7", "@next-auth/prisma-adapter": "^1.0.7",
"@prisma/client": "^5.1.1", "@prisma/client": "^5.1.1",
"@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-alert-dialog": "^1.0.5",

View File

@@ -1,8 +1,8 @@
import * as React from "react" import * as React from "react";
import { Slot } from "@radix-ui/react-slot" import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority" import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/utils/cn" import { cn } from "@/utils/cn";
const buttonVariants = cva( const buttonVariants = cva(
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
@@ -30,30 +30,31 @@ const buttonVariants = cva(
variant: "default", variant: "default",
size: "default", size: "default",
}, },
} },
) );
export interface ButtonProps interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>, extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> { VariantProps<typeof buttonVariants> {
asChild?: boolean asChild?: boolean;
} }
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => { ({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button" const Comp = asChild ? Slot : "button";
return ( return (
// @ts-expect-error
<Comp <Comp
className={cn(buttonVariants({ variant, size, className }))} className={cn(buttonVariants({ variant, size, className }))}
ref={ref} ref={ref}
{...props} {...props}
/> />
) );
} },
) );
Button.displayName = "Button" Button.displayName = "Button";
Button.defaultProps = { Button.defaultProps = {
type: 'button' type: "button",
} };
export { Button, buttonVariants } export { Button, buttonVariants };

View File

@@ -8,7 +8,7 @@ export const getServerSideProps = createServerSideProps()
export default function Home() { export default function Home() {
const router = useRouter() const router = useRouter()
const query = api.organization.current.useQuery(); const query = api.organization.first.useQuery();
const organization = query.data ?? null; const organization = query.data ?? null;
useEffect(() => { useEffect(() => {

View File

@@ -20,8 +20,6 @@ declare module "next-auth" {
interface Session extends DefaultSession { interface Session extends DefaultSession {
user: DefaultSession["user"] & { user: DefaultSession["user"] & {
id: string; id: string;
// ...other properties
// role: UserRole;
}; };
} }

View File

@@ -1,5 +1,6 @@
import resolveConfig from "tailwindcss/resolveConfig"; import resolveConfig from "tailwindcss/resolveConfig";
import tailwinConfig from "../../tailwind.config"; import tailwinConfig from "../../tailwind.config";
// @ts-expect-error
const config = resolveConfig(tailwinConfig); const config = resolveConfig(tailwinConfig);
export const theme = config.theme as any; export const theme = config.theme as any;

BIN
bun.lockb

Binary file not shown.

View File

@@ -30,29 +30,32 @@ export type ProfileDecrementPayload = {
// Batching // Batching
export type BatchEvent = { export type BatchEvent = {
type: 'event', type: 'event'
payload: EventPayload payload: EventPayload
} }
export type BatchProfile = { export type BatchProfile = {
type: 'profile', type: 'profile'
payload: ProfilePayload payload: ProfilePayload
} }
export type BatchProfileIncrement = { export type BatchProfileIncrement = {
type: 'profile_increment', type: 'profile_increment'
payload: ProfileIncrementPayload payload: ProfileIncrementPayload
} }
export type BatchProfileDecrement = { export type BatchProfileDecrement = {
type: 'profile_decrement', type: 'profile_decrement'
payload: ProfileDecrementPayload payload: ProfileDecrementPayload
} }
export type BatchItem = BatchEvent | BatchProfile | BatchProfileIncrement | BatchProfileDecrement export type BatchItem =
| BatchEvent
| BatchProfile
| BatchProfileIncrement
| BatchProfileDecrement
export type BatchPayload = Array<BatchItem> export type BatchPayload = Array<BatchItem>
export type MixanIssue = { export type MixanIssue = {
field: string field: string
message: string message: string
@@ -63,11 +66,11 @@ export type MixanErrorResponse = {
status: 'error' status: 'error'
code: number code: number
message: string message: string
issues?: Array<MixanIssue> issues?: Array<MixanIssue> | undefined
stack?: string stack?: string | undefined
} }
export type MixanResponse<T> = { export type MixanResponse<T> = {
result: T result: T
status: 'ok' status: 'ok'
} }