Skip to content

Commit

Permalink
Improve Metadata JSDoc (#69037)
Browse files Browse the repository at this point in the history
Currently the JSDoc for deprecated metadata fields is too confusing.
`@deprecated` tag is inside the `@example` and it doesn't give any
information about the deprecation.

This fix adds a deprecation message and a link to the correct docs.


![CleanShot-2024-08-18-37v7ShgN@2x](https://github.com/user-attachments/assets/20b33f5c-9608-4244-b321-2e5811b22ce2)
  • Loading branch information
shuding committed Aug 19, 2024
1 parent cc079c8 commit b8165af
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/next/src/lib/metadata/types/metadata-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ interface Metadata extends DeprecatedMetadataFields {

/**
* The theme color for the document.
* @deprecated Use `export const viewport: Viewport = { ... }` instead.
* @see https://nextjs.org/docs/app/api-reference/functions/generate-viewport#the-viewport-object
* @example
* @deprecated
*
* ```tsx
* "#000000"
* <meta name="theme-color" content="#000000" />
Expand All @@ -154,9 +154,9 @@ interface Metadata extends DeprecatedMetadataFields {

/**
* The color scheme for the document.
* @deprecated Use `export const viewport: Viewport = { ... }` instead.
* @see https://nextjs.org/docs/app/api-reference/functions/generate-viewport#the-viewport-object
* @example
* @deprecated
*
* ```tsx
* "dark"
* <meta name="color-scheme" content="dark" />
Expand All @@ -166,11 +166,10 @@ interface Metadata extends DeprecatedMetadataFields {

/**
* The viewport setting for the document.
* @deprecated Use `export const viewport: Viewport = { ... }` instead.
* @see https://nextjs.org/docs/app/api-reference/functions/generate-viewport#the-viewport-object
* @example
* @deprecated
*
* ```tsx
*
* { width: "device-width", initialScale: 1 }
* <meta name="viewport" content="width=device-width, initial-scale=1" />
* ```
Expand Down

0 comments on commit b8165af

Please sign in to comment.