Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: terms page upt #429

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

chore: terms page upt #429

wants to merge 2 commits into from

Conversation

AndlerRL
Copy link
Member

@AndlerRL AndlerRL commented Jan 18, 2025

Summary by Sourcery

Update the terms and conditions page with legal information, including privacy policy, terms of service, cookie policy, data protection, newsletter subscription, and children's privacy. Redirect terms and privacy policy links to /legal/terms. Add a global error boundary.

New Features:

  • Add a new privacy policy page.

Tests:

  • Add a global error boundary component.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a global error handling component to improve user experience during application errors
  • Bug Fixes

    • Updated Content Security Policy to allow object loading from self and Twitter
    • Fixed navigation links for legal pages
  • Documentation

    • Enhanced privacy policy and terms of service content
    • Improved error messaging and recovery mechanism
  • Chores

    • Updated Husky pre-commit hooks
    • Upgraded Husky dependency version
  • Style

    • Added whitespace preservation for paragraph and heading elements

@AndlerRL AndlerRL added documentation Improvements or additions to documentation enhancement New feature or request chore Routinary tasks labels Jan 18, 2025
@AndlerRL AndlerRL self-assigned this Jan 18, 2025
Copy link

vercel bot commented Jan 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bitlauncher ❌ Failed (Inspect) Jan 18, 2025 7:41am
smartsale-faucet ❌ Failed (Inspect) Jan 18, 2025 7:41am

Copy link
Contributor

sourcery-ai bot commented Jan 18, 2025

Reviewer's Guide by Sourcery

This pull request updates the terms and privacy policy page, adds a global error page, and modifies the navigation structure to reflect the new legal page.

Class diagram for content types and structure

classDiagram
    class ContentItem {
        <<interface>>
    }
    class TextContent {
        type: ContentTextType & ContentType
        text: string
    }
    class ListContent {
        type: 'ul'
        items: string[]
    }
    class ImageContent {
        type: 'Image'
        src: string
        alt: string
    }
    ContentItem <|-- TextContent
    ContentItem <|-- ListContent
    ContentItem <|-- ImageContent

    note for ContentItem "Updated to combine ContentTextType & ContentType"
Loading

File-Level Changes

Change Details Files
Updated the terms and privacy policy content.
  • Modified the content of the terms and privacy policy.
  • Added new sections to the terms and privacy policy.
  • Updated the last updated date.
apps/web/dictionaries/en/terms.ts
Updated the middleware to handle the new legal routes.
  • Modified the middleware to not redirect auth callback routes.
  • Added a check to prevent redirecting auth callback routes.
apps/web/middleware.ts
Updated the navigation structure to reflect the new legal page.
  • Updated the footer navigation to link to the new legal page.
  • Changed the href for terms and privacy policy to /legal/terms.
apps/web/components/layout/nav-struct.ts
Updated the content component to handle whitespace.
  • Added whitespace-pre-line to the content component.
  • Updated the content component to handle whitespace.
apps/web/components/shared/content.tsx
Added a new privacy page.
  • Added a new privacy page.
  • Updated the privacy page to use the new content.
apps/web/app/(routes)/[lang]/legal/privacy/page.tsx
Updated the package.json to include husky.
  • Updated the husky version.
  • Added prepare script to run husky.
package.json
Updated the CSP to allow twitter iframes.
  • Updated the CSP to allow twitter iframes.
  • Added twitter to the CSP.
apps/apphub/my-app/next.config.js
Updated the global styles to handle whitespace.
  • Updated the paragraph style to handle whitespace.
  • Added whitespace-pre-line to the paragraph style.
apps/web/app/globals.css
Added a global error page.
  • Added a global error page.
  • Added a global error page to handle errors.
apps/web/app/(routes)/[lang]/global-error.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

coderabbitai bot commented Jan 18, 2025

Walkthrough

This pull request introduces several enhancements across the web application, focusing on error handling, content management, and development workflow improvements. The changes span multiple files, including updates to the pre-commit script, Next.js configuration, error boundaries, content rendering, and dictionary management. The modifications aim to improve code quality, security, and user experience by refining routing, content policies, and error presentation.

Changes

File Change Summary
.husky/pre-commit Added Prettier formatting for staged files, new bun format-and-lint:fix command, dictionary generation script, and index update
apps/apphub/my-app/next.config.js Updated Content-Security-Policy to allow objects from self and Twitter URLs
apps/web/app/(routes)/[lang]/global-error.tsx New client-side error handling component with reset functionality
apps/web/app/(routes)/[lang]/legal/privacy/page.tsx Changed content source from terms to privacy dictionary
apps/web/app/globals.css Added whitespace-pre-line to .paragraph class
apps/web/components/layout/nav-struct.ts Updated legal navigation URLs to use /legal/ path
apps/web/components/shared/content.tsx Enhanced ContentItem type and added whitespace-pre-line to headings
apps/web/dictionaries/en/terms.ts Comprehensive update to policies and terms content
apps/web/middleware.ts Simplified language redirection logic
package.json Updated Husky version and added prepare script

Sequence Diagram

sequenceDiagram
    participant User
    participant App
    participant ErrorHandler
    participant Middleware

    User->>App: Trigger Action
    App->>Middleware: Process Request
    Middleware-->>App: Route/Locale Resolved
    App->>App: Render Content
    alt Error Occurs
        App->>ErrorHandler: Capture Error
        ErrorHandler->>User: Display Error Message
        User->>ErrorHandler: Click Reset
        ErrorHandler->>App: Attempt Recovery
    end
Loading

Poem

🐰 A Rabbit's Commit Tale 🥕

With Husky's bark and Prettier's might,
Our code now dances, clean and bright!
Errors caught, policies refined,
A digital warren, carefully designed.
Hop along, code, with grace and glee! 🚀

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @AndlerRL - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Avoid exposing raw error details in the UI (link)

Overall Comments:

  • The Content Security Policy in next.config.js uses a loose regex pattern (^https://twitter\.com/.*) which could be more strictly defined to improve security. Consider specifying exact Twitter domains and paths needed.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🔴 Security: 1 blocking issue
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

{error.message}
</p>
<code>
{JSON.stringify(error, null, 2)}
Copy link
Contributor

Choose a reason for hiding this comment

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

🚨 issue (security): Avoid exposing raw error details in the UI

For security reasons, only show user-friendly error messages in production. Raw error details could expose sensitive information about your application.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🔭 Outside diff range comments (1)
apps/web/middleware.ts (1)

Update matcher configuration to include the auth callback path

The current matcher configuration excludes the '/auth/callback' path, but the middleware code explicitly checks for this path. This creates a conflict where the middleware's auth callback handling code will never execute.

  • Update the matcher in apps/web/middleware.ts to ensure it doesn't exclude the auth callback path
🔗 Analysis chain

Line range hint 41-45: Verify matcher configuration covers all necessary paths.

The matcher configuration should be reviewed to ensure it properly handles all routes, including the auth callback path.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for all route definitions to ensure matcher covers them
rg -g '*.tsx' -g '*.ts' "export const runtime|export async function|export default function" ./apps/web/app

Length of output: 2405


Script:

#!/bin/bash
# Search for auth-related routes and configurations
rg -g '*.ts' -g '*.tsx' -i "auth.*callback|callback.*url|auth.*config" ./apps/web

Length of output: 707

🧹 Nitpick comments (6)
.husky/pre-commit (1)

2-3: Consider adding error handling for the formatting commands.

The Prettier and format-and-lint commands should include error handling to prevent committing if formatting fails.

-prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown
-bun format-and-lint:fix
+if ! prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown; then
+  echo "❌ Prettier formatting failed"
+  exit 1
+fi
+if ! bun format-and-lint:fix; then
+  echo "❌ Format and lint failed"
+  exit 1
+fi
apps/web/app/(routes)/[lang]/global-error.tsx (2)

12-15: Enhance error logging implementation.

Consider using a proper error logging service instead of just console.error.

 useEffect(() => {
-  // Log the error to an error reporting service
-  console.error(error)
+  // TODO: Integrate with error reporting service (e.g., Sentry)
+  console.error('Global error boundary caught an error:', {
+    message: error.message,
+    stack: error.stack,
+    digest: error.digest
+  })
 }, [error])

17-35: Improve error UI presentation and accessibility.

The error UI lacks styling and accessibility features.

 return (
-  <div>
-    <h2>Something went wrong!</h2>
+  <div role="alert" className="p-4 rounded-lg bg-red-50 text-red-900">
+    <h2 className="text-lg font-semibold mb-2">Something went wrong!</h2>
     <p>
       {error.message}
     </p>
-    <code>
+    <pre className="mt-2 p-2 bg-red-100 rounded overflow-auto">
+      <code>
       {JSON.stringify(error, null, 2)}
-    </code>
+      </code>
+    </pre>
     <button
+      className="mt-4 px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700"
+      aria-label="Attempt to recover from error"
       onClick={
         // Attempt to recover by trying to re-render the segment
         () => reset()
       }
     >
       Try again
     </button>
   </div>
 )
apps/web/middleware.ts (1)

16-16: Consider adding type assertion for response initialization.

The response initialization could benefit from explicit typing, and the auth callback condition could be more robust.

-let response: NextResponse = NextResponse.next()
+let response: NextResponse = NextResponse.next() as NextResponse

-} else if (!pathname.startsWith('/auth/callback')) {
+} else if (!/^\/(?:auth\/callback|_next|api)/.test(pathname)) {
   const lang = getLocale(request)
   request.nextUrl.pathname = `/${lang}${pathname}`
   response = NextResponse.redirect(request.nextUrl)

Also applies to: 20-23

apps/web/dictionaries/en/terms.ts (1)

65-78: Improve content structure with TypeScript enums

The content structure could be improved using TypeScript enums for content types.

Consider this refactor:

enum ContentType {
  Heading1 = 'h1',
  Heading2 = 'h2',
  Paragraph = 'p',
}

const content: ContentItem[] = [
  {
    type: ContentType.Heading1,
    text: "Privacy Policy and Terms of Service for Bitlauncher Participants",
  },
  // ... rest of the content
];
package.json (1)

13-13: Consider pinning the husky version

Using ^ allows minor version updates which could introduce unexpected changes.

Consider pinning the exact version:

-    "husky": "^9.1.7",
+    "husky": "9.1.7",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 574b3fa and 7e8991b.

⛔ Files ignored due to path filters (1)
  • bun.lockb is excluded by !**/bun.lockb
📒 Files selected for processing (10)
  • .husky/pre-commit (1 hunks)
  • apps/apphub/my-app/next.config.js (1 hunks)
  • apps/web/app/(routes)/[lang]/global-error.tsx (1 hunks)
  • apps/web/app/(routes)/[lang]/legal/privacy/page.tsx (1 hunks)
  • apps/web/app/globals.css (1 hunks)
  • apps/web/components/layout/nav-struct.ts (1 hunks)
  • apps/web/components/shared/content.tsx (2 hunks)
  • apps/web/dictionaries/en/terms.ts (1 hunks)
  • apps/web/middleware.ts (1 hunks)
  • package.json (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
apps/web/app/(routes)/[lang]/global-error.tsx

[error] 5-5: Do not shadow the global "Error" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

🔇 Additional comments (4)
apps/web/app/(routes)/[lang]/legal/privacy/page.tsx (1)

10-10: Verify the privacy content structure matches PageContent expectations.

The change from terms.content to privacy.content looks correct, but let's verify the content structure.

package.json (1)

26-26: LGTM: Husky prepare script

The prepare script is correctly configured for husky installation.

apps/web/components/shared/content.tsx (1)

18-18: LGTM! Consistent whitespace handling.

The addition of whitespace-pre-line aligns with the paragraph styling in globals.css, ensuring consistent text formatting across components.

apps/web/app/globals.css (1)

327-327: LGTM! Enhanced text formatting.

The addition of whitespace-pre-line to the paragraph class improves content formatting consistency and provides better control over text presentation.

Comment on lines 4 to 6
cd ./apps/web
bun scripts/generate-cms-dictionaries.ts No newline at end of file
bun scripts/generate-cms-dictionaries.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Verify the working directory change is properly handled.

The script changes directory but doesn't ensure it returns to the original directory, which could affect subsequent commands.

-cd ./apps/web
-bun scripts/generate-cms-dictionaries.ts
+(cd ./apps/web && bun scripts/generate-cms-dictionaries.ts)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cd ./apps/web
bun scripts/generate-cms-dictionaries.ts
\ No newline at end of file
bun scripts/generate-cms-dictionaries.ts
(cd ./apps/web && bun scripts/generate-cms-dictionaries.ts)

Comment on lines +5 to +11
export default function Error({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Rename component to avoid shadowing global Error.

The component name shadows the global Error constructor. Consider a more specific name.

-export default function Error({
+export default function GlobalErrorBoundary({
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export default function Error({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
export default function GlobalErrorBoundary({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 5-5: Do not shadow the global "Error" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

@@ -15,7 +15,7 @@ const nextConfig = {
},
{
key: 'Content-Security-Policy',
value: `object-src 'none';base-uri 'self';script-src 'self' 'report-sample' 'unsafe-inline' 'unsafe-eval' https: http:;`,
value: `object-src 'self' ^https://twitter\.com/.*;base-uri 'self';script-src 'self' 'report-sample' 'unsafe-inline' 'unsafe-eval' https: http:;`,
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Security: Strengthen Content Security Policy

The current CSP configuration has several security concerns:

  1. The Twitter URL pattern is too permissive and incorrectly formatted
  2. Script sources allow both HTTP and HTTPS, which is unsafe
  3. Usage of unsafe-inline/eval should be avoided if possible

Consider applying this more secure configuration:

-            value: `object-src 'self' ^https://twitter\.com/.*;base-uri 'self';script-src 'self' 'report-sample' 'unsafe-inline' 'unsafe-eval' https: http:;`,
+            value: `object-src 'self' https://twitter.com https://*.twitter.com; base-uri 'self'; script-src 'self' 'report-sample' https:; require-trusted-types-for 'script';`,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
value: `object-src 'self' ^https://twitter\.com/.*;base-uri 'self';script-src 'self' 'report-sample' 'unsafe-inline' 'unsafe-eval' https: http:;`,
value: `object-src 'self' https://twitter.com https://*.twitter.com; base-uri 'self'; script-src 'self' 'report-sample' https:; require-trusted-types-for 'script';`,

Comment on lines +8 to +9
title: "Privacy Policy",
content: "Last Updated: January 17, 2025.",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update the last modified date

The last updated date is set to January 17, 2025, which is in the future.

Update to the current date or remove the hard-coded date in favor of a dynamic date that updates when the content changes.

Comment on lines +56 to +58
title: "Contact Us",
content: "If you have questions about this Privacy Policy, please contact us at [email protected].",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Protect email address from scraping

Exposing email addresses directly in the code makes them vulnerable to scraping by bots.

Consider using a contact form or an encoded email address:

-    content: "If you have questions about this Privacy Policy, please contact us at [email protected].",
+    content: "If you have questions about this Privacy Policy, please contact us through our secure contact form.",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
title: "Contact Us",
content: "If you have questions about this Privacy Policy, please contact us at [email protected].",
},
title: "Contact Us",
content: "If you have questions about this Privacy Policy, please contact us through our secure contact form.",
},

Comment on lines 169 to 171
label: 'Privacy Policy',
href: '/terms',
href: '/legal/terms',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incorrect Privacy Policy URL

The Privacy Policy link incorrectly points to /legal/terms instead of /legal/privacy.

Apply this fix:

           label: 'Privacy Policy',
-          href: '/legal/terms',
+          href: '/legal/privacy',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
label: 'Privacy Policy',
href: '/terms',
href: '/legal/terms',
},
label: 'Privacy Policy',
href: '/legal/privacy',
},

@@ -64,7 +64,7 @@ export type ContentType = 'h1' | 'h2' | 'p' | 'ul' | 'Image' | 'hr'
export type ContentTextType = 'h1' | 'h2' | 'p'
// Update the original ContentItem definition to use ContentType
export type ContentItem =
| { type: ContentTextType; text: string }
| { type: ContentTextType & ContentType; text: string }
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix potential type conflict in ContentItem definition.

The intersection type ContentTextType & ContentType could lead to runtime errors since 'Image' and 'hr' exist in ContentType but not in ContentTextType. This means these types would be excluded from the union, despite being used in the switch statement.

Consider this alternative implementation:

-  | { type: ContentTextType & ContentType; text: string }
+  | { type: ContentTextType; text: string }
+  | { type: 'hr'; text: string }

Or update ContentTextType to include all text-based types:

-export type ContentTextType = 'h1' | 'h2' | 'p'
+export type ContentTextType = 'h1' | 'h2' | 'p' | 'hr'

Committable suggestion skipped: line range outside the PR's diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Routinary tasks documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant