kleneway / quill

Quill - A Modern SaaS-Platform Built With Next.js 13
0 stars 0 forks source link

Fix DialogPortal className type in dialog.tsx #2

Open jacob-local-kevin[bot] opened 4 months ago

jacob-local-kevin[bot] commented 4 months ago

Fix DialogPortal Type Error in dialog.tsx

Problem Description and Objectives

The TypeScript compiler is throwing an error in the dialog.tsx file because the className property does not exist on the DialogPortalProps type. This error is causing the build to fail. The objective is to resolve this TypeScript error by ensuring that the className property is correctly handled.

Files to Update:

Requirements:

  1. Update the DialogPortal component:

    • Ensure that the className property is correctly typed and passed to the DialogPrimitive.Portal component.
    • If necessary, extend the DialogPortalProps type to include the className property.
  2. Verify the TypeScript types:

    • Ensure that the DialogPortalProps type from the @radix-ui/react-dialog library is correctly extended or modified to include className.
  3. Handle Edge Cases:

    • Ensure that the component works correctly even if the className property is not provided.
    • Verify that the component does not break any existing functionality.

Acceptance Criteria:

Additional Context:

@jacob-ai-bot

Steps to Address Issue: 1. Open src/components/ui/dialog.tsx

  1. Import ComponentPropsWithoutRef from React
  2. Extend DialogPortalProps to include className
  3. Update the DialogPortal component to use the extended type
  4. Verify that the TypeScript error is resolved
  5. Test the component with and without className
  6. Ensure all existing functionality remains intact

Files to Update: src/components/ui/dialog.tsx

task assigned to: @jacob-ai-bot

jacob-local-kevin[bot] commented 4 months ago

JACoB here...

You mentioned me on this issue and I am busy taking a look at it.

I'll continue to comment on this issue with status as I make progress.

jacob-local-kevin[bot] commented 4 months ago

Unfortunately, I ran into trouble working on this.

Here is some error information:

Command failed: __NEXT_TEST_MODE=1 SKIP_ENV_VALIDATION=1 npm run build --verbose && npx tsc --noEmit
npm verbose cli /Users/kleneway/.nvm/versions/node/v20.10.0/bin/node /Users/kleneway/.nvm/versions/node/v20.10.0/bin/npm
npm info using npm@10.8.2
npm info using node@v20.10.0
npm verbose title npm run build
npm verbose argv "run" "build" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:/Users/kleneway/.npm/_logs/2024-07-26T21_14_37_512Z-
npm verbose logfile /Users/kleneway/.npm/_logs/2024-07-26T21_14_37_512Z-debug-0.log

===== TS errors =====

[Test Mode] ./src/components/ui/dialog.tsx:14:3
Type error: Property 'className' does not exist on type 'DialogPortalProps'.

  12 | 
  13 | const DialogPortal = ({
> 14 |   className,
     |   ^
  15 |   ...props
  16 | }: DialogPrimitive.DialogPortalProps) => (
  17 |   <DialogPrimitive.Portal className={cn(className)} {...props} />

[Test Mode] ./src/components/ui/dialog.tsx:17:27
Type error: Type '{ children?: ReactNode; container?: Element | null | undefined; forceMount?: true | undefined; className: string; }' is not assignable to type 'IntrinsicAttributes & DialogPortalProps'.
  Property 'className' does not exist on type 'IntrinsicAttributes & DialogPortalProps'.

  15 |   ...props
  16 | }: DialogPrimitive.DialogPortalProps) => (
> 17 |   <DialogPrimitive.Portal className={cn(className)} {...props} />
     |                           ^
  18 | )
  19 | DialogPortal.displayName = DialogPrimitive.Portal.displayName
  20 | 

===== TS errors =====

Failed to compile.

./src/components/ui/dialog.tsx:14:3
Type error: Property 'className' does not exist on type 'DialogPortalProps'.

  12 | 
  13 | const DialogPortal = ({
> 14 |   className,
     |   ^
  15 |   ...props
  16 | }: DialogPrimitive.DialogPortalProps) => (
  17 |   <DialogPrimitive.Portal className={cn(className)} {...props} />
npm verbose cwd /private/tmp/tmp-34557-wJh403DbwN79
npm verbose os Darwin 23.4.0
npm verbose node v20.10.0
npm verbose npm  v10.8.2
npm verbose exit 1
npm verbose code 1