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

VideoJsonLd (and probably other components too) isnt typed correctly #1321

Open
laneme opened this issue Nov 11, 2023 · 1 comment
Open

VideoJsonLd (and probably other components too) isnt typed correctly #1321

laneme opened this issue Nov 11, 2023 · 1 comment

Comments

@laneme
Copy link

laneme commented Nov 11, 2023

Describe the bug
<VideoJsonLd /> doesnt give correct autocompletion. Doesnt throw errors on passing any random props either.

image
Screenshot from 2023-11-11 14-23-55

Reproduction
https://stackblitz.com/edit/stackblitz-starters-kebysb?description=The%20React%20framework%20for%20production&file=pages%2Findex.tsx&title=Next.js%20Starter

Additional context
I looked at the next-seo/lib/jsonld/video.d.ts and apparently the reference to type Video wasnt quite right for me.
There was no src dir on my node-modules/next-seo installation. So if I changed the import like below. it worked fine.

// node-modules/next-seo/lib/jsonld/video.d.ts
import React from 'react';
- import { Video } from 'src/types';
+ import { Video } from '../types';
import { JsonLdProps } from './jsonld';

export interface VideoJsonLdProps extends JsonLdProps, Video { }
declare function VideoJsonLd({ type, keyOverride, ...rest }: VideoJsonLdProps): React.JSX.Element;
export default VideoJsonLd;
@laneme
Copy link
Author

laneme commented Nov 11, 2023

Temporary workaround before its fixed

import type { Video } from 'next-seo/lib/types'
import type { JsonLdProps } from 'next-seo/lib/jsonld/jsonld'

declare function VideoJsonLd(props: JsonLdProps & Video): Element

// <VideoJsonLd />  should be typed correctly now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant