Skip to content

chore: add TypeScript types for support us button component and updat…#5

Merged
rahul-vyas-dev merged 2 commits into
AOSSIE-Org:mainfrom
rahul-vyas-dev:main
Mar 7, 2026
Merged

chore: add TypeScript types for support us button component and updat…#5
rahul-vyas-dev merged 2 commits into
AOSSIE-Org:mainfrom
rahul-vyas-dev:main

Conversation

@rahul-vyas-dev

@rahul-vyas-dev rahul-vyas-dev commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

This PR adds a TypeScript types file to define the structure for the Sponsors Page component. The types provide a minimal and flexible way to configure key sections such as the hero section, organization information, sponsors, previous sponsors, and the CTA section.

It also includes support for sponsor tiers, reusable image types, background patterns, and predefined themes (including the AOSSIE yellow theme). The goal is to keep the API simple while making the component easier to configure and maintain.

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • Chores

    • Updated React typing and peer dependency constraints for React 18+ compatibility.
  • Tests

    • Added comprehensive TypeScript typings for UI configuration, sponsorship, hero, CTA and related data structures to improve type safety and future development.

@github-actions github-actions Bot added no-issue-linked PR is not linked to any issue configuration Configuration file changes dependencies Dependency file changes javascript JavaScript/TypeScript code changes size/L Large PR (201-500 lines changed) repeat-contributor PR from an external contributor who already had PRs merged pending-coderabbit-review labels Mar 7, 2026
@coderabbitai

coderabbitai Bot commented Mar 7, 2026

Copy link
Copy Markdown

Walkthrough

Adds TypeScript type definitions for the UI (new src/types/index.ts) and updates package.json to include React peerDependencies and @types/react as a devDependency.

Changes

Cohort / File(s) Summary
Package manifest
package.json
Added @types/react as a devDependency and declared react and react-dom as peerDependencies (>=18).
Type definitions
src/types/index.ts
New TypeScript module exporting multiple types and one interface (Theme, ButtonVariant, Image, Hero, projectInformation, organizationInformation, Tier, sponsor, sponsors, sponsorLink, CTASection, Pattern, supportUsButtonProps).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Typescript Lang

Poem

🐰
I hopped through types with nimble paws,
Tucking Props in neat, precise laws.
React peers and typings set in place,
SupportUsButton dons a typed embrace. 🥕

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title describes the main objective of the PR—adding TypeScript types for the support us button component and updating package.json—which aligns with the actual changes in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Around line 47-49: The peerDependencies block currently pins React/ReactDOM to
React 19 only; update package.json peerDependencies to allow React 18 and 19
(for example use "react": "^18 || ^19" and "react-dom": "^18 || ^19") because
the code only requires React.ReactNode (see src/types/index.ts where
React.ReactNode is used), so broaden the range to include React 18 consumers
while keeping React 19 support.

In `@src/types/index.ts`:
- Around line 1-155: The types in src/types/index.ts (e.g.,
supportUsButtonProps, theme, ButtonVariant, sponsorLink, hero,
organizationInformation) are never exported from the package entrypoint and the
package.json/build are not configured to emit/publish .d.ts files; update
src/index.ts to re-export the types (export * from "./types" or explicit exports
for the above symbols), update package.json to add a "types" field pointing to
the built declaration (e.g., dist/index.d.ts), add/adjust "files" to include the
dist output (or src if publishing sources), add a proper build script that runs
tsc to emit declarations (e.g., tsc --emitDeclarationOnly or full compile with
declaration: true), and add an "exports" map for modern resolution pointing to
the compiled entry (e.g., ./dist/index.js and ./dist/index.d.ts) so consumers
can import those types.
- Line 1: The current import brings React in as a runtime value but only a type
is used; replace the value import "import React from 'react'" with a type-only
import "import type { ReactNode } from 'react'" and then update the type
annotation that uses React.ReactNode (referenced as the type on the
props/interface at the previous line 98) to use ReactNode directly so the module
is imported only for types.
- Around line 7-155: The public types and interface use inconsistent casing:
rename types image→Image, hero→Hero, theme→Theme,
projectInformation→ProjectInformation,
organizationInformation→OrganizationInformation, Tier (ok), sponsor→Sponsor,
sponsors→Sponsors, sponsorLink→SponsorLink, CTAsection→CTASection (then use
camelCase property), pattern→Pattern, supportUsButtonProps→SupportUsButtonProps
and ButtonVariant (keep) and update property names in SupportUsButtonProps:
Hero→hero, CTAsection→ctaSection, ButtonVariant→buttonVariant, classNames keys
remain camelCase; update all references/usages across the codebase (imports,
props, consumers) to the new PascalCase type names and camelCase properties to
preserve public API consistency.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4dcbf415-8728-4c0f-8b58-3b4d48e65348

📥 Commits

Reviewing files that changed from the base of the PR and between 592027e and 0f3c96c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • src/types/index.ts

Comment thread package.json Outdated
Comment thread src/types/index.ts Outdated
Comment on lines +1 to +155
import React from "react";

/* =========================
THEME
========================= */

export type theme = "AOSSIE" | "light" | "dark" | "minimal" | "corporate";

/* =========================================================
Button Variant
========================================================= */

export type ButtonVariant = "solid" | "outline" | "ghost" | "gradient";

/* =========================
IMAGE TYPE
========================= */

export type image = {
src?: string;
alt?: string;
};

/* =========================
HERO SECTION
========================= */

export type hero = {
/** Optional hero background image */
image?: image;

title: string;
description: string;

/** Label like: YOU'RE SPONSORING */
sponsorLabel?: string;
};

/* =========================
PROJECT INFORMATION
========================= */

export type projectInformation = {
name: string;
description: string;
};

/* =========================
ORGANIZATION INFORMATION
========================= */

export type organizationInformation = {
name: string;
description: string;

/** Organization logo */
logo?: image | string;

projectInformation: projectInformation;
};

/* =========================
SPONSOR TIERS
========================= */

export type Tier = "Platinum" | "Gold" | "Silver" | "Bronze";

/* =========================
SPONSOR CARD
========================= */

export type sponsor = {
name: string;

/** Sponsor logo or avatar */
logo?: string;

/** Sponsor website */
link?: string;

/** Sponsorship tier */
sponsorshipTier?: Tier;
};

/* =========================
CURRENT SPONSORS
========================= */

export type sponsors = sponsor[];

/* =========================
SPONSOR LINKS (CTA)
========================= */

export type sponsorLink = {
name: string;
url: string;
icon?: React.ReactNode;
className?: string;

/** open link in new tab */
newTab?: boolean;
};

/* =========================
CTA SECTION
========================= */

export type CTAsection = {
title: string;
description: string;
sponsorLink: sponsorLink[];
};

/* =========================
BACKGROUND PATTERNS
========================= */

export type pattern = "dots" | "grid" | "stripes" | "none";

/* =========================
SUPPORT US COMPO PROPS
========================= */

export interface supportUsButtonProps {
// Theme for the button, can be one of "AOSSIE", "light", "dark", "minimal", or "corporate"
theme?: theme;

// Optional background pattern for the button, can be one of "dots", "grid", "stripes", or "none"
pattern?: pattern;

// Information about the hero section, including title, description, sponsor label, and optional background image
Hero: hero;

// Information about the organization, including name, description, logo, and project information
organizationInformation: organizationInformation;

// List of current sponsors, each with name, optional logo, link, and sponsorship tier
sponsors: sponsors;

// Information about the call-to-action section, including title, description, and sponsor links
CTAsection: CTAsection;

// Optional class name for custom styling
classNames?: {
container?: string;
hero?: string;
organizationInformation?: string;
sponsors?: string;
CTAsection?: string;
};

// Optional button variant for styling the call-to-action buttons
ButtonVariant?: ButtonVariant;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that the new types module is exported and publishable.

set -e

echo "== package manifest =="
jq '{main, module, types, exports, files, scripts}' package.json

echo
echo "== candidate entrypoints =="
fd '^index\.(ts|tsx|js|mjs|cjs)$' src . -x sh -c 'echo "== $1 =="; sed -n "1,200p" "$1"; echo' sh {}

echo
echo "== tsconfig files =="
fd '^tsconfig.*\.json$' . -x sh -c 'echo "== $1 =="; cat "$1"; echo' sh {}

echo
echo "== re-exports of the new types module =="
rg -n --type=ts --type=tsx 'export\s+(\*|\{[^}]+\})\s+from\s+["'\''].*types.*["'\'']' src

Repository: AOSSIE-Org/SupportUsButton

Length of output: 297


🏁 Script executed:

#!/bin/bash
# Verify that the new types module is exported and publishable.

echo "== package.json content =="
cat package.json

echo
echo "== candidate entrypoints (index files) =="
find src -maxdepth 2 -name 'index.ts' -o -name 'index.tsx' -o -name 'index.js' | head -10

echo
echo "== tsconfig files =="
find . -maxdepth 2 -name 'tsconfig*.json' -type f

echo
echo "== re-exports of the types module =="
rg -n 'export.*from.*types' src --type ts --type tsx

Repository: AOSSIE-Org/SupportUsButton

Length of output: 1546


🏁 Script executed:

#!/bin/bash

echo "== src/index.ts content =="
cat src/index.ts

echo
echo "== tsconfig.json content =="
cat tsconfig.json

Repository: AOSSIE-Org/SupportUsButton

Length of output: 453


🏁 Script executed:

#!/bin/bash
echo "== All files in src/ =="
find src -type f | sort

echo
echo "== Check for any exports in non-index files =="
rg -l 'export' src --type ts 2>/dev/null || echo "No matches or files found"

Repository: AOSSIE-Org/SupportUsButton

Length of output: 213


The types added in this file are not actually exported or publishable.

The module src/types/index.ts cannot be consumed by consumers because:

  1. The main entry point src/index.ts is empty and does not re-export these types
  2. package.json lacks a types field to point to generated .d.ts files
  3. The files array excludes src/, so source files are not published even if configured
  4. The build script is not configured (currently a no-op)
  5. No exports field is defined for modern package resolution

Re-export these types from src/index.ts and configure the build and package manifest to properly emit and publish .d.ts declaration files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/types/index.ts` around lines 1 - 155, The types in src/types/index.ts
(e.g., supportUsButtonProps, theme, ButtonVariant, sponsorLink, hero,
organizationInformation) are never exported from the package entrypoint and the
package.json/build are not configured to emit/publish .d.ts files; update
src/index.ts to re-export the types (export * from "./types" or explicit exports
for the above symbols), update package.json to add a "types" field pointing to
the built declaration (e.g., dist/index.d.ts), add/adjust "files" to include the
dist output (or src if publishing sources), add a proper build script that runs
tsc to emit declarations (e.g., tsc --emitDeclarationOnly or full compile with
declaration: true), and add an "exports" map for modern resolution pointing to
the compiled entry (e.g., ./dist/index.js and ./dist/index.d.ts) so consumers
can import those types.

Comment thread src/types/index.ts Outdated
Comment thread src/types/index.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
package.json (1)

41-49: ⚠️ Potential issue | 🔴 Critical

These dependency changes still do not make the new types consumable.

Adding @types/react and React peers is incomplete while the package still points main at TypeScript source, has no types/exports entry, and keeps a no-op build. As published, consumers still will not get a stable compiled entrypoint or declaration file for src/types/index.ts.

#!/bin/bash
set -e

echo "== package manifest =="
jq '{main, types, exports, files, scripts}' package.json

echo
echo "== src/index.ts =="
if [ -f src/index.ts ]; then
  cat -n src/index.ts
else
  echo "src/index.ts is missing"
fi

echo
echo "== re-exports from ./types =="
rg -n --type=ts --type=tsx "export\\s+.*from\\s+['\\\"]\\./types['\\\"]" src || true

This verifies whether the new types are re-exported and whether the package manifest exposes built declarations and entrypoints. Expected after the fix: a real build command, a types/exports entry, and a re-export from src/index.ts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 41 - 49, The package.json currently points "main"
at TypeScript source and lacks "types"/"exports" and a real build, so consumers
won't get compiled JS or declarations; update package.json to set "main" to the
compiled entry (e.g. dist/index.js), add "types" pointing to the compiled
declaration (e.g. dist/types/index.d.ts) and an "exports" field for the entry,
add a proper "build" script that emits JS + declaration files (e.g. tsc --build
or similar) and include the output folder in "files", and ensure src/index.ts
re-exports from ./types (src/types/index.ts) so the declarations are exported;
also remove direct publishing of TS source as the primary entry so consumers get
stable compiled entrypoints and .d.ts files.
src/types/index.ts (1)

28-30: 🛠️ Refactor suggestion | 🟠 Major

Finish normalizing the public API casing before release.

This file still exports lowerCamelCase type names (projectInformation, organizationInformation, sponsorLink, supportUsButtonProps) and PascalCase prop keys (Image, Theme, Hero). Because these names are part of the package surface, shipping them now turns the eventual cleanup into a breaking rename for consumers.

Representative rename direction
-export type projectInformation = {
+export type ProjectInformation = {

-export type organizationInformation = {
+export type OrganizationInformation = {

-export type sponsorLink = {
+export type SponsorLink = {

-export interface supportUsButtonProps {
-  Theme?: Theme;
+export interface SupportUsButtonProps {
+  theme?: Theme;
   pattern?: Pattern;
   hero: Hero;
-  organizationInformation: organizationInformation;
+  organizationInformation: OrganizationInformation;
   classNames?: {
     container?: string;
-    Hero?: string;
+    hero?: string;

As per coding guidelines, "Review for significant deviations from Google JavaScript style guide. Minor style issues are not a priority".

Also applies to: 43-59, 72-98, 125-154

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/types/index.ts` around lines 28 - 30, Update the public API casing:
rename the exported type names from lowerCamelCase to PascalCase
(projectInformation -> ProjectInformation, organizationInformation ->
OrganizationInformation, sponsorLink -> SponsorLink, supportUsButtonProps ->
SupportUsButtonProps) and change exported prop keys from PascalCase to
lowerCamelCase (Image -> image, Theme -> theme, Hero -> hero); update the
corresponding type declarations, export statements and every reference/usage of
these symbols in the codebase to the new names so the package surface uses
consistent PascalCase for types and camelCase for object/prop keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Around line 47-49: Update the peerDependencies range to limit accepted React
majors to the tested ones: replace the open-ended ">=18" entries under
peerDependencies for "react" and "react-dom" with a capped range such as
"^18.0.0 || ^19.0.0" (or equivalently ">=18 <20") so the package only allows
validated major versions; ensure both "react" and "react-dom" entries are
changed consistently in package.json.

In `@src/types/index.ts`:
- Around line 89-113: The public types only expose a current sponsors array
(export type sponsors = sponsor[]), so there's no way to model a
previous-sponsors section; update the type surface to explicitly support
previous sponsors (either by adding an exported previousSponsors type e.g.
export type previousSponsors = sponsor[] and/or extend the CTASection to accept
previousSponsorLink or previousSponsors fields) and ensure the existing
sponsor/sponsorLink/CTASection symbols are updated to include the new
previous-sponsors collection so consumers can configure both current and
previous sponsors.

---

Duplicate comments:
In `@package.json`:
- Around line 41-49: The package.json currently points "main" at TypeScript
source and lacks "types"/"exports" and a real build, so consumers won't get
compiled JS or declarations; update package.json to set "main" to the compiled
entry (e.g. dist/index.js), add "types" pointing to the compiled declaration
(e.g. dist/types/index.d.ts) and an "exports" field for the entry, add a proper
"build" script that emits JS + declaration files (e.g. tsc --build or similar)
and include the output folder in "files", and ensure src/index.ts re-exports
from ./types (src/types/index.ts) so the declarations are exported; also remove
direct publishing of TS source as the primary entry so consumers get stable
compiled entrypoints and .d.ts files.

In `@src/types/index.ts`:
- Around line 28-30: Update the public API casing: rename the exported type
names from lowerCamelCase to PascalCase (projectInformation ->
ProjectInformation, organizationInformation -> OrganizationInformation,
sponsorLink -> SponsorLink, supportUsButtonProps -> SupportUsButtonProps) and
change exported prop keys from PascalCase to lowerCamelCase (Image -> image,
Theme -> theme, Hero -> hero); update the corresponding type declarations,
export statements and every reference/usage of these symbols in the codebase to
the new names so the package surface uses consistent PascalCase for types and
camelCase for object/prop keys.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a0eeff02-1d4f-48ab-bbb4-38881fa5e548

📥 Commits

Reviewing files that changed from the base of the PR and between 0f3c96c and 644c106.

📒 Files selected for processing (2)
  • package.json
  • src/types/index.ts

Comment thread package.json
Comment on lines +47 to +49
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

For a published npm library, is an open-ended React peer dependency like ">=18" recommended, or should the range be capped to explicitly tested majors such as "^18.3.0 || ^19.0.0"? Please include the latest stable React major version in the answer.

💡 Result:

For a published npm library, avoid an open-ended React peer dependency like "react": ">=18" because it will also accept future majors (e.g. React 20) that may introduce breaking changes—so users can end up installing an incompatible React version without any peer warning.

Prefer declaring the broadest range you actually support, but cap it to supported majors, e.g.:

  • If you support React 18 and 19: "react": "^18.0.0 || ^19.0.0" (and same for react-dom)
  • Or equivalently: "react": ">=18 <20"

Only raise the minimum (e.g. ^18.3.0) if you truly require APIs/behavior introduced in that minor.

This aligns with the intent of peer dependencies (declare what you’re compatible with, not just what you happened to test once) and avoids npm v7+ peer-resolution conflicts surprising consumers. (nodejs.org)

Latest stable React major: React 19 (current latest line is 19.2.x; e.g. 19.2.4 was released Jan 26, 2026). (react.dev)

Citations:


Cap the React peer range to tested majors.

>=18 will accept React 20+ without evidence that this library has been validated there. Specify the explicit range of tested majors, such as ^18.0.0 || ^19.0.0 (or >=18 <20).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 47 - 49, Update the peerDependencies range to
limit accepted React majors to the tested ones: replace the open-ended ">=18"
entries under peerDependencies for "react" and "react-dom" with a capped range
such as "^18.0.0 || ^19.0.0" (or equivalently ">=18 <20") so the package only
allows validated major versions; ensure both "react" and "react-dom" entries are
changed consistently in package.json.

Comment thread src/types/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration Configuration file changes dependencies Dependency file changes javascript JavaScript/TypeScript code changes no-issue-linked PR is not linked to any issue pending-coderabbit-review repeat-contributor PR from an external contributor who already had PRs merged size/L Large PR (201-500 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant