Skip to content

Commit

Permalink
Merge pull request #127 from tamu-datathon-org/samay-typeerrors
Browse files Browse the repository at this point in the history
Fixed all existing type errors
  • Loading branch information
upadsamay387 authored Mar 2, 2025
2 parents 0ef567b + d25a224 commit ee4e81a
Show file tree
Hide file tree
Showing 34 changed files with 70 additions and 52 deletions.
8 changes: 8 additions & 0 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion my-turborepo/apps/nextjs/src/app/_components/IconList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface IconListProps {
prizeFunc?: (isOpen: boolean) => void;
scheduleFunc?: () => void;
helpQueueFunc?: () => void;
setFocus: (focus: string) => void;
setFocus?: (focus: string) => void;
challengesFunc?: () => void;
}

Expand Down Expand Up @@ -51,6 +51,8 @@ const IconList: React.FC<IconListProps> = ({
setFocus,
}) => {
const router = useRouter();

setFocus = setFocus ?? (() => {});
return (
// className='absolute top-0 grid grid-cols-2 pt-4 gap-1'
<div className={className}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ExitButton, Lines, TAMUy2k, TitleText } from "./preregistration-form";
interface WindowContainerProps {
children: React.ReactNode;
isOpen?: boolean;
openFunc: (isOpen: boolean) => void;
openFunc?: (isOpen: boolean) => void;
borderGradientStart?: string;
borderGradientMiddle?: string;
borderGradientEnd?: string;
Expand All @@ -31,6 +31,8 @@ const WindowContainer: React.FC<WindowContainerProps> = ({
backgroundImage: `linear-gradient(to bottom, ${borderGradientStart}, ${borderGradientMiddle}, ${borderGradientEnd})`,
};

openFunc = openFunc ?? (() => {});

return (
isOpen && (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function LoginButton({
);
} catch (error) {
if (error instanceof AuthError) {
const SIGNIN_ERROR_URL = "/api/auth/error";
return redirect(`${SIGNIN_ERROR_URL}?error=${error.type}`);
}
throw error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
PopoverContent,
PopoverTrigger,
} from "~/components/ui/popover";
import { Asterisk } from "./application-form";
import { Asterisk } from "../apply/application/application-form";

interface DropdownOption {
value: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const columns: ColumnDef<TableData>[] = [
);
},
cell: ({ row }) => {
const createdAt = row.getValue("createdAt");
const createdAt: Date = row.getValue("createdAt");
return <div className="lowercase">{createdAt.toLocaleDateString()}</div>;
},
enableHiding: true,
Expand Down
6 changes: 5 additions & 1 deletion my-turborepo/apps/nextjs/src/app/apply/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export async function ResumeForm() {
return blob;
}
return (
<form action={uploadResume}>
<form
action={(formData: FormData) => {
uploadResume(formData);
}}
>
<label>Upload Resume</label>
<input type="file" name="resume" required />
<button type="submit">Upload</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import "./customCss.scss";
import "../../_components/customCss.scss";

import type { SubmitHandler } from "react-hook-form";
import React, { useState } from "react";
Expand All @@ -19,7 +19,9 @@ import {
FormMessage,
} from "@vanni/ui/form";

import type { ApplicationSchema } from "../apply/validation";
import type { ApplicationSchema } from "../validation";
import schools from "~/app/apply/application/application-data/schools.json";
import schoolsJson from "~/app/apply/application/application-data/schools.json";
import { Button } from "~/components/ui/button";
import { Checkbox } from "~/components/ui/checkbox";
import { Input } from "~/components/ui/input";
Expand All @@ -38,12 +40,10 @@ import {
SHIRT_SIZES,
} from "~/lib/dropdownOptions";
import { api } from "~/trpc/react";
import { applicationSchema } from "../apply/validation";
import schools from "./application-data/schools.json";
import schoolsJson from "./application-data/schools.json";
import GenericCombobox from "./genericCombobox";
import LoadingAnimation from "./loadingAnimation";
import Title from "./title";
import GenericCombobox from "../../_components/genericCombobox";
import LoadingAnimation from "../../_components/loadingAnimation";
import Title from "../../_components/title";
import { applicationSchema } from "../validation";

// Map schools to DropdownOption type
const SCHOOL_OPTIONS = schools.map((school) => ({
Expand Down Expand Up @@ -745,6 +745,7 @@ export function ApplicationForm() {
field.onChange(e);
setDietaryRestrictionCount(e.target.value.length);
}}
value={field.value ?? ""}
/>
</FormControl>
<FormMessage />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Suspense } from "react";
import { redirect } from "next/navigation";

import { ApplicationForm } from "~/app/_components/application-form";
import { ApplicationForm } from "~/app/apply/application/application-form";

// TODO: Replace this variable with an api route that checks the latest event
const appsOpen = false;
Expand Down
2 changes: 1 addition & 1 deletion my-turborepo/apps/nextjs/src/components/ui/debounce.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react";

export default function useDebounce(value: any, delay: number) {
export default function useDebounce<T>(value: T, delay: number) {
const [debouncedValue, setDebouncedValue] = useState(value);
const [isDebouncing, setIsDebouncing] = useState(false);

Expand Down
3 changes: 0 additions & 3 deletions my-turborepo/apps/team-website/.prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions my-turborepo/apps/team-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@vanni/team-website",
"version": "2.0.0",
"private": true,
"type": "module",
"scripts": {
"build": "pnpm with-env next build",
"clean": "git clean -xdf .next .turbo node_modules",
Expand Down
2 changes: 1 addition & 1 deletion my-turborepo/apps/team-website/src/app/blog/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import type React from 'react';

Check failure on line 1 in my-turborepo/apps/team-website/src/app/blog/page.tsx

View workflow job for this annotation

GitHub Actions / linting (20)

This rule requires the `strictNullChecks` compiler option to be turned on to function correctly

Check failure on line 1 in my-turborepo/apps/team-website/src/app/blog/page.tsx

View workflow job for this annotation

GitHub Actions / linting (20)

This rule requires the `strictNullChecks` compiler option to be turned on to function correctly

const BlogPage: React.FC = () => {
return null;
Expand Down
2 changes: 1 addition & 1 deletion my-turborepo/apps/team-website/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ScrollUp from "@/components/Common/ScrollUp";
import Contact from "@/components/Contact";
import Hero from "@/components/Hero";
import Video from "@/components/Video";

Check warning on line 8 in my-turborepo/apps/team-website/src/app/page.tsx

View workflow job for this annotation

GitHub Actions / linting (20)

'Video' is defined but never used. Allowed unused vars must match /^_/u
import { Metadata } from "next";
import type { Metadata } from "next";
import AboutTeam from "../components/AboutTeam/AboutTeam";
import ContactBackground from "../components/Contact/ContactBackground";
import { Suspense } from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import TeamMember, { TeamMemberProps } from "./teamMember";
import type { TeamMemberProps } from "./teamMember";
import TeamMember from "./teamMember";

interface TeamsProps {
teamMembers: TeamMemberProps[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Blog } from "@/types/blog";
import type { Blog } from "@/types/blog";
import Image from "next/image";
import Link from "next/link";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Blog } from "@/types/blog";
import type { Blog } from "@/types/blog";

const blogData: Blog[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useEffect } from "react";

export default function ScrollUp() {
useEffect(() => window.document.scrollingElement?.scrollTo(0, 0), []);
useEffect(() => window.document.scrollingElement.scrollTo(0, 0), []);

return null;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Menu } from "@/types/menu";
import type { Menu } from "@/types/menu";

const menuData: Menu[] = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from "next/link";

import { Metadata } from "next";
import type { Metadata } from "next";

export const metadata: Metadata = {
title: "Error Page | TAMU Datathon",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from "next/link";

import { Metadata } from "next";
import type { Metadata } from "next";

export const metadata: Metadata = {
title: "Sign In Page | TAMU Datathon",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from "next/link";

import { Metadata } from "next";
import type { Metadata } from "next";

export const metadata: Metadata = {
title: "Sign Up Page | TAMU Datathon",
Expand Down
3 changes: 2 additions & 1 deletion my-turborepo/apps/team-website/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import { cva } from "class-variance-authority"
import type {VariantProps} from "class-variance-authority";

import { cn } from "@/lib/utils"

Expand Down
15 changes: 7 additions & 8 deletions my-turborepo/apps/team-website/src/components/ui/carousel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"use client"

import * as React from "react"
import useEmblaCarousel, {
type UseEmblaCarouselType,
} from "embla-carousel-react"
import useEmblaCarousel from "embla-carousel-react"
import type {UseEmblaCarouselType} from "embla-carousel-react";
import { ArrowLeft, ArrowRight } from "lucide-react"

import { cn } from "@/lib/utils"
Expand All @@ -14,7 +13,7 @@ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
type CarouselOptions = UseCarouselParameters[0]
type CarouselPlugin = UseCarouselParameters[1]

type CarouselProps = {
interface CarouselProps {
opts?: CarouselOptions
plugins?: CarouselPlugin
orientation?: "horizontal" | "vertical"
Expand Down Expand Up @@ -78,11 +77,11 @@ const Carousel = React.forwardRef<
}, [])

const scrollPrev = React.useCallback(() => {
api?.scrollPrev()
api.scrollPrev()
}, [api])

const scrollNext = React.useCallback(() => {
api?.scrollNext()
api.scrollNext()
}, [api])

const handleKeyDown = React.useCallback(
Expand Down Expand Up @@ -116,7 +115,7 @@ const Carousel = React.forwardRef<
api.on("select", onSelect)

return () => {
api?.off("select", onSelect)
api.off("select", onSelect)
}
}, [api, onSelect])

Expand All @@ -127,7 +126,7 @@ const Carousel = React.forwardRef<
api: api,
opts,
orientation:
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
orientation || (opts.axis === "y" ? "vertical" : "horizontal"),
scrollPrev,
scrollNext,
canScrollPrev,
Expand Down
2 changes: 1 addition & 1 deletion my-turborepo/apps/team-website/src/hooks/use-toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const reducer = (state: State, action: Action): State => {
}
}

const listeners: Array<(state: State) => void> = []
const listeners: ((state: State) => void)[] = []

let memoryState: State = { toasts: [] }

Expand Down
3 changes: 2 additions & 1 deletion my-turborepo/apps/team-website/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { clsx, type ClassValue } from "clsx"
import { clsx } from "clsx"
import type {ClassValue} from "clsx";
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
Expand Down
8 changes: 4 additions & 4 deletions my-turborepo/apps/team-website/src/types/blog.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
type Author = {
interface Author {
name: string;
image: string;
designation: string;
};
}

export type Blog = {
export interface Blog {
id: number;
title: string;
paragraph: string;
image: string;
author: Author;
tags: string[];
publishDate: string;
};
}
4 changes: 2 additions & 2 deletions my-turborepo/apps/team-website/src/types/brand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type Brand = {
export interface Brand {
id: number;
name: string;
href: string;
image: string;
imageLight?: string;
};
}
4 changes: 2 additions & 2 deletions my-turborepo/apps/team-website/src/types/feature.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type Feature = {
export interface Feature {
id: number;
icon: JSX.Element;
title: string;
paragraph: string;
};
}
4 changes: 2 additions & 2 deletions my-turborepo/apps/team-website/src/types/menu.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type Menu = {
export interface Menu {
id: number;
title: string;
path?: string;
newTab: boolean;
submenu?: Menu[];
};
}
4 changes: 2 additions & 2 deletions my-turborepo/apps/team-website/src/types/testimonial.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export type Testimonial = {
export interface Testimonial {
id: number;
name: string;
designation: string;
content: string;
image: string;
star: number;
};
}
2 changes: 1 addition & 1 deletion my-turborepo/tooling/eslint/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default tseslint.config(
],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
"warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/consistent-type-imports": [
Expand Down

0 comments on commit ee4e81a

Please sign in to comment.