Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
f3b06b93
Unverified
Commit
f3b06b93
authored
Nov 24, 2024
by
Boaris
Committed by
GitHub
Nov 24, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement metadata types support for `exactOptionalPropertyTypes` (#72936)
parent
28a25af1
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1163 additions
and
401 deletions
+1163
-401
alternative-urls-types.ts
...ges/next/src/lib/metadata/types/alternative-urls-types.ts
+16
-10
extra-types.ts
packages/next/src/lib/metadata/types/extra-types.ts
+54
-50
manifest-types.ts
packages/next/src/lib/metadata/types/manifest-types.ts
+102
-81
metadata-interface.ts
packages/next/src/lib/metadata/types/metadata-interface.ts
+67
-52
metadata-types.ts
packages/next/src/lib/metadata/types/metadata-types.ts
+71
-65
opengraph-types.ts
packages/next/src/lib/metadata/types/opengraph-types.ts
+146
-116
twitter-types.ts
packages/next/src/lib/metadata/types/twitter-types.ts
+29
-27
manifest.ts
...uction/typescript-basic/typechecking/metadata/manifest.ts
+76
-0
metadata.ts
...uction/typescript-basic/typechecking/metadata/metadata.ts
+507
-0
robots.ts
...oduction/typescript-basic/typechecking/metadata/robots.ts
+14
-0
sitemap.ts
...duction/typescript-basic/typechecking/metadata/sitemap.ts
+59
-0
viewport.ts
...uction/typescript-basic/typechecking/metadata/viewport.ts
+22
-0
No files found.
packages/next/src/lib/metadata/types/alternative-urls-types.ts
View file @
f3b06b93
...
...
@@ -427,23 +427,29 @@ type UnmatchedLang = 'x-default'
type
HrefLang
=
LangCode
|
UnmatchedLang
export
type
Languages
<
T
>
=
{
[
s
in
HrefLang
]?:
T
[
s
in
HrefLang
]?:
T
|
undefined
}
export
type
AlternateLinkDescriptor
=
{
title
?:
string
title
?:
string
|
undefined
url
:
string
|
URL
}
export
type
AlternateURLs
=
{
canonical
?:
null
|
string
|
URL
|
AlternateLinkDescriptor
languages
?:
Languages
<
null
|
string
|
URL
|
AlternateLinkDescriptor
[]
>
media
?:
{
canonical
?:
null
|
string
|
URL
|
AlternateLinkDescriptor
|
undefined
languages
?:
|
Languages
<
null
|
string
|
URL
|
AlternateLinkDescriptor
[]
>
|
undefined
media
?:
|
{
[
media
:
string
]:
null
|
string
|
URL
|
AlternateLinkDescriptor
[]
}
types
?:
{
|
undefined
types
?:
|
{
[
types
:
string
]:
null
|
string
|
URL
|
AlternateLinkDescriptor
[]
}
|
undefined
}
export
type
ResolvedAlternateURLs
=
{
...
...
packages/next/src/lib/metadata/types/extra-types.ts
View file @
f3b06b93
...
...
@@ -3,65 +3,69 @@
// ref: https://developers.facebook.com/docs/applinks/metadata-reference
export
type
AppLinks
=
{
ios
?:
AppLinksApple
|
Array
<
AppLinksApple
>
iphone
?:
AppLinksApple
|
Array
<
AppLinksApple
>
ipad
?:
AppLinksApple
|
Array
<
AppLinksApple
>
android
?:
AppLinksAndroid
|
Array
<
AppLinksAndroid
>
windows_phone
?:
AppLinksWindows
|
Array
<
AppLinksWindows
>
windows
?:
AppLinksWindows
|
Array
<
AppLinksWindows
>
windows_universal
?:
AppLinksWindows
|
Array
<
AppLinksWindows
>
web
?:
AppLinksWeb
|
Array
<
AppLinksWeb
>
ios
?:
AppLinksApple
|
Array
<
AppLinksApple
>
|
undefined
iphone
?:
AppLinksApple
|
Array
<
AppLinksApple
>
|
undefined
ipad
?:
AppLinksApple
|
Array
<
AppLinksApple
>
|
undefined
android
?:
AppLinksAndroid
|
Array
<
AppLinksAndroid
>
|
undefined
windows_phone
?:
AppLinksWindows
|
Array
<
AppLinksWindows
>
|
undefined
windows
?:
AppLinksWindows
|
Array
<
AppLinksWindows
>
|
undefined
windows_universal
?:
AppLinksWindows
|
Array
<
AppLinksWindows
>
|
undefined
web
?:
AppLinksWeb
|
Array
<
AppLinksWeb
>
|
undefined
}
export
type
ResolvedAppLinks
=
{
ios
?:
Array
<
AppLinksApple
>
iphone
?:
Array
<
AppLinksApple
>
ipad
?:
Array
<
AppLinksApple
>
android
?:
Array
<
AppLinksAndroid
>
windows_phone
?:
Array
<
AppLinksWindows
>
windows
?:
Array
<
AppLinksWindows
>
windows_universal
?:
Array
<
AppLinksWindows
>
web
?:
Array
<
AppLinksWeb
>
ios
?:
Array
<
AppLinksApple
>
|
undefined
iphone
?:
Array
<
AppLinksApple
>
|
undefined
ipad
?:
Array
<
AppLinksApple
>
|
undefined
android
?:
Array
<
AppLinksAndroid
>
|
undefined
windows_phone
?:
Array
<
AppLinksWindows
>
|
undefined
windows
?:
Array
<
AppLinksWindows
>
|
undefined
windows_universal
?:
Array
<
AppLinksWindows
>
|
undefined
web
?:
Array
<
AppLinksWeb
>
|
undefined
}
export
type
AppLinksApple
=
{
url
:
string
|
URL
app_store_id
?:
string
|
number
app_name
?:
string
app_store_id
?:
string
|
number
|
undefined
app_name
?:
string
|
undefined
}
export
type
AppLinksAndroid
=
{
package
:
string
url
?:
string
|
URL
class
?:
string
app_name
?:
string
url
?:
string
|
URL
|
undefined
class
?:
string
|
undefined
app_name
?:
string
|
undefined
}
export
type
AppLinksWindows
=
{
url
:
string
|
URL
app_id
?:
string
app_name
?:
string
app_id
?:
string
|
undefined
app_name
?:
string
|
undefined
}
export
type
AppLinksWeb
=
{
url
:
string
|
URL
should_fallback
?:
boolean
should_fallback
?:
boolean
|
undefined
}
// Apple Itunes APp
// https://developer.apple.com/documentation/webkit/promoting_apps_with_smart_app_banners
export
type
ItunesApp
=
{
appId
:
string
appArgument
?:
string
appArgument
?:
string
|
undefined
}
// Viewport meta structure
// https://developer.mozilla.org/docs/Web/HTML/Viewport_meta_tag
// intentionally leaving out user-scalable, use a string if you want that behavior
export
type
ViewportLayout
=
{
width
?:
string
|
number
height
?:
string
|
number
initialScale
?:
number
minimumScale
?:
number
maximumScale
?:
number
userScalable
?:
boolean
viewportFit
?:
'auto'
|
'cover'
|
'contain'
interactiveWidget
?:
'resizes-visual'
|
'resizes-content'
|
'overlays-content'
width
?:
string
|
number
|
undefined
height
?:
string
|
number
|
undefined
initialScale
?:
number
|
undefined
minimumScale
?:
number
|
undefined
maximumScale
?:
number
|
undefined
userScalable
?:
boolean
|
undefined
viewportFit
?:
'auto'
|
'cover'
|
'contain'
|
undefined
interactiveWidget
?:
|
'resizes-visual'
|
'resizes-content'
|
'overlays-content'
|
undefined
}
// Apple Web App
...
...
@@ -69,37 +73,37 @@ export type ViewportLayout = {
// https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
export
type
AppleWebApp
=
{
// default true
capable
?:
boolean
title
?:
string
startupImage
?:
AppleImage
|
Array
<
AppleImage
>
capable
?:
boolean
|
undefined
title
?:
string
|
undefined
startupImage
?:
AppleImage
|
Array
<
AppleImage
>
|
undefined
// default "default"
statusBarStyle
?:
'default'
|
'black'
|
'black-translucent'
statusBarStyle
?:
'default'
|
'black'
|
'black-translucent'
|
undefined
}
export
type
AppleImage
=
string
|
AppleImageDescriptor
export
type
AppleImageDescriptor
=
{
url
:
string
media
?:
string
media
?:
string
|
undefined
}
export
type
ResolvedAppleWebApp
=
{
capable
:
boolean
title
?:
string
|
null
startupImage
?:
AppleImageDescriptor
[]
|
null
statusBarStyle
?:
'default'
|
'black'
|
'black-translucent'
title
?:
string
|
null
|
undefined
startupImage
?:
AppleImageDescriptor
[]
|
null
|
undefined
statusBarStyle
?:
'default'
|
'black'
|
'black-translucent'
|
undefined
}
export
type
Facebook
=
FacebookAppId
|
FacebookAdmins
export
type
FacebookAppId
=
{
appId
:
string
admins
?:
never
admins
?:
never
|
undefined
}
export
type
FacebookAdmins
=
{
appId
?:
never
appId
?:
never
|
undefined
admins
:
string
|
string
[]
}
export
type
ResolvedFacebook
=
{
appId
?:
string
admins
?:
string
[]
appId
?:
string
|
undefined
admins
?:
string
[]
|
undefined
}
// Format Detection
...
...
@@ -110,9 +114,9 @@ export type ResolvedFacebook = {
// that can initiate a phone call
// https://www.goodemailcode.com/email-code/template.html
export
type
FormatDetection
=
{
telephone
?:
boolean
date
?:
boolean
address
?:
boolean
email
?:
boolean
url
?:
boolean
telephone
?:
boolean
|
undefined
date
?:
boolean
|
undefined
address
?:
boolean
|
undefined
email
?:
boolean
|
undefined
url
?:
boolean
|
undefined
}
packages/next/src/lib/metadata/types/manifest-types.ts
View file @
f3b06b93
...
...
@@ -11,37 +11,43 @@ type File = {
type
Icon
=
{
src
:
string
type
?:
string
sizes
?:
string
purpose
?:
'any'
|
'maskable'
|
'monochrome'
type
?:
string
|
undefined
sizes
?:
string
|
undefined
purpose
?:
'any'
|
'maskable'
|
'monochrome'
|
undefined
}
export
type
Manifest
=
{
background_color
?:
string
categories
?:
string
[]
description
?:
string
dir
?:
'ltr'
|
'rtl'
|
'auto'
display
?:
'fullscreen'
|
'standalone'
|
'minimal-ui'
|
'browser'
display_override
?:
(
background_color
?:
string
|
undefined
categories
?:
string
[]
|
undefined
description
?:
string
|
undefined
dir
?:
'ltr'
|
'rtl'
|
'auto'
|
undefined
display
?:
'fullscreen'
|
'standalone'
|
'minimal-ui'
|
'browser'
|
undefined
display_override
?:
|
(
|
'fullscreen'
|
'standalone'
|
'minimal-ui'
|
'browser'
|
'window-controls-overlay'
)[]
file_handlers
?:
{
|
undefined
file_handlers
?:
|
{
action
:
string
accept
:
{
[
mimeType
:
string
]:
string
[]
}
}[]
icons
?:
Icon
[]
id
?:
string
lang
?:
string
launch_handler
?:
{
|
undefined
icons
?:
Icon
[]
|
undefined
id
?:
string
|
undefined
lang
?:
string
|
undefined
launch_handler
?:
|
{
client_mode
:
ClientModeEnum
|
ClientModeEnum
[]
}
name
?:
string
|
undefined
name
?:
string
|
undefined
orientation
?:
|
'any'
|
'natural'
...
...
@@ -51,20 +57,26 @@ export type Manifest = {
|
'portrait-secondary'
|
'landscape-primary'
|
'landscape-secondary'
prefer_related_applications
?:
boolean
protocol_handlers
?:
{
|
undefined
prefer_related_applications
?:
boolean
|
undefined
protocol_handlers
?:
|
{
protocol
:
string
url
:
string
}[]
related_applications
?:
{
|
undefined
related_applications
?:
|
{
platform
:
string
url
:
string
id
?:
string
id
?:
string
|
undefined
}[]
scope
?:
string
screenshots
?:
{
form_factor
?:
'narrow'
|
'wide'
label
?:
string
|
undefined
scope
?:
string
|
undefined
screenshots
?:
|
{
form_factor
?:
'narrow'
|
'wide'
|
undefined
label
?:
string
|
undefined
platform
?:
|
'android'
|
'chromeos'
...
...
@@ -79,29 +91,38 @@ export type Manifest = {
|
'microsoft-inbox'
|
'microsoft-store'
|
'play'
|
undefined
src
:
string
type
?:
string
sizes
?:
string
type
?:
string
|
undefined
sizes
?:
string
|
undefined
}[]
share_target
?:
{
|
undefined
share_target
?:
|
{
action
:
string
method
?:
'get'
|
'post'
|
'GET'
|
'POST'
enctype
?:
'application/x-www-form-urlencoded'
|
'multipart/form-data'
method
?:
'get'
|
'post'
|
'GET'
|
'POST'
|
undefined
enctype
?:
|
'application/x-www-form-urlencoded'
|
'multipart/form-data'
|
undefined
params
:
{
title
?:
string
text
?:
string
url
?:
string
files
?:
File
|
File
[]
title
?:
string
|
undefined
text
?:
string
|
undefined
url
?:
string
|
undefined
files
?:
File
|
File
[]
|
undefined
}
}
short_name
?:
string
shortcuts
?:
{
|
undefined
short_name
?:
string
|
undefined
shortcuts
?:
|
{
name
:
string
short_name
?:
string
description
?:
string
short_name
?:
string
|
undefined
description
?:
string
|
undefined
url
:
string
icons
?:
Icon
[]
icons
?:
Icon
[]
|
undefined
}[]
start_url
?:
string
theme_color
?:
string
|
undefined
start_url
?:
string
|
undefined
theme_color
?:
string
|
undefined
}
packages/next/src/lib/metadata/types/metadata-interface.ts
View file @
f3b06b93
...
...
@@ -44,7 +44,7 @@ interface Metadata extends DeprecatedMetadataFields {
/**
* The base path and origin for absolute urls for various metadata links such as OpenGraph images.
*/
metadataBase
?:
null
|
URL
metadataBase
?:
null
|
URL
|
undefined
/**
* The document title.
...
...
@@ -60,7 +60,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <title>My Blog</title>
* ```
*/
title
?:
null
|
string
|
TemplateString
title
?:
null
|
string
|
TemplateString
|
undefined
/**
* The document description, and optionally the OpenGraph and twitter descriptions.
...
...
@@ -70,7 +70,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="description" content="My Blog Description" />
* ```
*/
description
?:
null
|
string
description
?:
null
|
string
|
undefined
// Standard metadata names
// https://developer.mozilla.org/docs/Web/HTML/Element/meta/name
...
...
@@ -83,7 +83,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="application-name" content="My Blog" />
* ```
*/
applicationName
?:
null
|
string
applicationName
?:
null
|
string
|
undefined
/**
* The authors of the document.
...
...
@@ -95,7 +95,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <link rel="author" href="https://nextjs.org" />
* ```
*/
authors
?:
null
|
Author
|
Array
<
Author
>
authors
?:
null
|
Author
|
Array
<
Author
>
|
undefined
/**
* The generator used for the document.
...
...
@@ -106,7 +106,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="generator" content="Next.js" />
* ```
*/
generator
?:
null
|
string
generator
?:
null
|
string
|
undefined
/**
* The keywords for the document. If an array is provided, it will be flattened into a single tag with comma separation.
...
...
@@ -119,7 +119,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="keywords" content="react, server components" />
* ```
*/
keywords
?:
null
|
string
|
Array
<
string
>
keywords
?:
null
|
string
|
Array
<
string
>
|
undefined
/**
* The referrer setting for the document.
...
...
@@ -129,7 +129,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="referrer" content="origin" />
* ```
*/
referrer
?:
null
|
ReferrerEnum
referrer
?:
null
|
ReferrerEnum
|
undefined
/**
* The theme color for the document.
...
...
@@ -151,7 +151,12 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff" />
* ```
*/
themeColor
?:
null
|
string
|
ThemeColorDescriptor
|
ThemeColorDescriptor
[]
themeColor
?:
|
null
|
string
|
ThemeColorDescriptor
|
ThemeColorDescriptor
[]
|
undefined
/**
* The color scheme for the document.
...
...
@@ -163,7 +168,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="color-scheme" content="dark" />
* ```
*/
colorScheme
?:
null
|
ColorSchemeEnum
colorScheme
?:
null
|
ColorSchemeEnum
|
undefined
/**
* The viewport setting for the document.
...
...
@@ -175,7 +180,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="viewport" content="width=device-width, initial-scale=1" />
* ```
*/
viewport
?:
null
|
string
|
ViewportLayout
viewport
?:
null
|
string
|
ViewportLayout
|
undefined
/**
* The creator of the document.
...
...
@@ -185,7 +190,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="creator" content="Next.js Team" />
* ```
*/
creator
?:
null
|
string
creator
?:
null
|
string
|
undefined
/**
* The publisher of the document.
...
...
@@ -196,7 +201,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="publisher" content="Vercel" />
* ```
*/
publisher
?:
null
|
string
publisher
?:
null
|
string
|
undefined
// https://developer.mozilla.org/docs/Web/HTML/Element/meta/name#other_metadata_names
...
...
@@ -213,7 +218,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="robots" content="noindex, nofollow" />
* ```
*/
robots
?:
null
|
string
|
Robots
robots
?:
null
|
string
|
Robots
|
undefined
/**
* The canonical and alternate URLs for the document.
...
...
@@ -243,7 +248,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <link rel="alternate" href="https://example.com/blog/js.rss" type="application/rss+xml" title="js title" />
* ```
*/
alternates
?:
null
|
AlternateURLs
alternates
?:
null
|
AlternateURLs
|
undefined
/**
* The icons for the document. Defaults to rel="icon".
...
...
@@ -263,7 +268,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <link rel="apple-touch-icon" href="https://example.com/apple-icon.png" />
* ```
*/
icons
?:
null
|
IconURL
|
Array
<
Icon
>
|
Icons
icons
?:
null
|
IconURL
|
Array
<
Icon
>
|
Icons
|
undefined
/**
* A web application manifest, as defined in the Web Application Manifest specification.
...
...
@@ -276,7 +281,7 @@ interface Metadata extends DeprecatedMetadataFields {
* ```
*
*/
manifest
?:
null
|
string
|
URL
manifest
?:
null
|
string
|
URL
|
undefined
/**
* The Open Graph metadata for the document.
...
...
@@ -303,7 +308,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta property="og:image" content="https://example.com/og.png" />
* ```
*/
openGraph
?:
null
|
OpenGraph
openGraph
?:
null
|
OpenGraph
|
undefined
/**
* The Twitter metadata for the document.
...
...
@@ -320,7 +325,7 @@ interface Metadata extends DeprecatedMetadataFields {
* ```
*
*/
twitter
?:
null
|
Twitter
twitter
?:
null
|
Twitter
|
undefined
/**
* The Facebook metadata for the document.
...
...
@@ -339,7 +344,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta property="fb:admins" content="12345678" />
* ```
*/
facebook
?:
null
|
Facebook
facebook
?:
null
|
Facebook
|
undefined
/**
* The common verification tokens for the document.
...
...
@@ -351,7 +356,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="me" content="@me" />
* ```
*/
verification
?:
Verification
verification
?:
Verification
|
undefined
/**
* The Apple web app metadata for the document.
...
...
@@ -366,7 +371,7 @@ interface Metadata extends DeprecatedMetadataFields {
* ```
*
*/
appleWebApp
?:
null
|
boolean
|
AppleWebApp
appleWebApp
?:
null
|
boolean
|
AppleWebApp
|
undefined
/**
* Indicates if devices should try to interpret various formats and make actionable links out of them. For example it controles
...
...
@@ -378,7 +383,7 @@ interface Metadata extends DeprecatedMetadataFields {
* ```
*
*/
formatDetection
?:
null
|
FormatDetection
formatDetection
?:
null
|
FormatDetection
|
undefined
/**
* The metadata for the iTunes App.
...
...
@@ -390,7 +395,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="apple-itunes-app" content="app-id=123456789, affiliate-data=123456789, app-arguments=123456789" />
* ```
*/
itunes
?:
null
|
ItunesApp
itunes
?:
null
|
ItunesApp
|
undefined
/**
* A brief description of what this web-page is about. Not recommended, superseded by description.
...
...
@@ -403,7 +408,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="abstract" content="My Website Description" />
* ```
*/
abstract
?:
null
|
string
abstract
?:
null
|
string
|
undefined
/**
* The Facebook AppLinks metadata for the document.
...
...
@@ -417,7 +422,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta property="al:android:url" content="https://example.com" />
* ```
*/
appLinks
?:
null
|
AppLinks
appLinks
?:
null
|
AppLinks
|
undefined
/**
* The archives link rel property.
...
...
@@ -427,7 +432,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <link rel="archives" href="https://example.com/archives" />
* ```
*/
archives
?:
null
|
string
|
Array
<
string
>
archives
?:
null
|
string
|
Array
<
string
>
|
undefined
/**
* The assets link rel property.
...
...
@@ -437,7 +442,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <link rel="assets" href="https://example.com/assets" />
* ```
*/
assets
?:
null
|
string
|
Array
<
string
>
assets
?:
null
|
string
|
Array
<
string
>
|
undefined
/**
* The bookmarks link rel property.
...
...
@@ -447,7 +452,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <link rel="bookmarks" href="https://example.com/bookmarks" />
* ```
*/
bookmarks
?:
null
|
string
|
Array
<
string
>
// This is technically against HTML spec but is used in wild
bookmarks
?:
null
|
string
|
Array
<
string
>
|
undefined
// This is technically against HTML spec but is used in wild
// meta name properties
...
...
@@ -459,7 +464,7 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="category" content="My Category" />
* ```
*/
category
?:
null
|
string
category
?:
null
|
string
|
undefined
/**
* The classification meta name property.
...
...
@@ -469,14 +474,16 @@ interface Metadata extends DeprecatedMetadataFields {
* <meta name="classification" content="My Classification" />
* ```
*/
classification
?:
null
|
string
classification
?:
null
|
string
|
undefined
/**
* Arbitrary name/value pairs for the document.
*/
other
?:
{
other
?:
|
({
[
name
:
string
]:
string
|
number
|
Array
<
string
|
number
>
}
&
DeprecatedMetadataFields
}
&
DeprecatedMetadataFields
)
|
undefined
}
interface
ResolvedMetadata
extends
DeprecatedMetadataFields
{
...
...
@@ -576,25 +583,25 @@ type RobotsFile = {
// Apply rules for all
rules
:
|
{
userAgent
?:
string
|
string
[]
allow
?:
string
|
string
[]
disallow
?:
string
|
string
[]
crawlDelay
?:
number
userAgent
?:
string
|
string
[]
|
undefined
allow
?:
string
|
string
[]
|
undefined
disallow
?:
string
|
string
[]
|
undefined
crawlDelay
?:
number
|
undefined
}
// Apply rules for specific user agents
|
Array
<
{
userAgent
:
string
|
string
[]
allow
?:
string
|
string
[]
disallow
?:
string
|
string
[]
crawlDelay
?:
number
allow
?:
string
|
string
[]
|
undefined
disallow
?:
string
|
string
[]
|
undefined
crawlDelay
?:
number
|
undefined
}
>
sitemap
?:
string
|
string
[]
host
?:
string
sitemap
?:
string
|
string
[]
|
undefined
host
?:
string
|
undefined
}
type
SitemapFile
=
Array
<
{
url
:
string
lastModified
?:
string
|
Date
lastModified
?:
string
|
Date
|
undefined
changeFrequency
?:
|
'always'
|
'hourly'
...
...
@@ -603,12 +610,15 @@ type SitemapFile = Array<{
|
'monthly'
|
'yearly'
|
'never'
priority
?:
number
alternates
?:
{
languages
?:
Languages
<
string
>
|
undefined
priority
?:
number
|
undefined
alternates
?:
|
{
languages
?:
Languages
<
string
>
|
undefined
}
images
?:
string
[]
videos
?:
Videos
[]
|
undefined
images
?:
string
[]
|
undefined
videos
?:
Videos
[]
|
undefined
}
>
type
ResolvingMetadata
=
Promise
<
ResolvedMetadata
>
...
...
@@ -639,7 +649,12 @@ interface Viewport extends ViewportLayout {
* <meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff" />
* ```
*/
themeColor
?:
null
|
string
|
ThemeColorDescriptor
|
ThemeColorDescriptor
[]
themeColor
?:
|
null
|
string
|
ThemeColorDescriptor
|
ThemeColorDescriptor
[]
|
undefined
/**
* The color scheme for the document.
...
...
@@ -650,7 +665,7 @@ interface Viewport extends ViewportLayout {
* <meta name="color-scheme" content="dark" />
* ```
*/
colorScheme
?:
null
|
ColorSchemeEnum
colorScheme
?:
null
|
ColorSchemeEnum
|
undefined
}
type
ResolvingViewport
=
Promise
<
Viewport
>
...
...
packages/next/src/lib/metadata/types/metadata-types.ts
View file @
f3b06b93
...
...
@@ -9,14 +9,14 @@ export interface DeprecatedMetadataFields {
* Deprecated options that have a preferred method
* @deprecated Use appWebApp to configure mobile-web-app-capable which provides
*/
'apple-touch-fullscreen'
?:
never
'apple-touch-fullscreen'
?:
never
|
undefined
/**
* Obsolete since iOS 7.
* @see https://web.dev/apple-touch-icon/
* @deprecated use icons.apple or instead
*/
'apple-touch-icon-precomposed'
?:
never
'apple-touch-icon-precomposed'
?:
never
|
undefined
}
export
type
TemplateString
=
...
...
@@ -37,9 +37,9 @@ export type AbsoluteString = {
export
type
Author
=
{
// renders as <link rel="author"...
url
?:
string
|
URL
url
?:
string
|
URL
|
undefined
// renders as <meta name="author"...
name
?:
string
name
?:
string
|
undefined
}
// does not include "unsafe-URL". to use this users should
...
...
@@ -63,29 +63,29 @@ export type ColorSchemeEnum =
type
RobotsInfo
=
{
// all and none will be inferred from index/follow boolean options
index
?:
boolean
follow
?:
boolean
index
?:
boolean
|
undefined
follow
?:
boolean
|
undefined
/** @deprecated set index to false instead */
noindex
?:
never
noindex
?:
never
|
undefined
/** @deprecated set follow to false instead */
nofollow
?:
never
noarchive
?:
boolean
nosnippet
?:
boolean
noimageindex
?:
boolean
nocache
?:
boolean
notranslate
?:
boolean
indexifembedded
?:
boolean
nositelinkssearchbox
?:
boolean
unavailable_after
?:
string
'max-video-preview'
?:
number
|
string
'max-image-preview'
?:
'none'
|
'standard'
|
'large'
'max-snippet'
?:
number
nofollow
?:
never
|
undefined
noarchive
?:
boolean
|
undefined
nosnippet
?:
boolean
|
undefined
noimageindex
?:
boolean
|
undefined
nocache
?:
boolean
|
undefined
notranslate
?:
boolean
|
undefined
indexifembedded
?:
boolean
|
undefined
nositelinkssearchbox
?:
boolean
|
undefined
unavailable_after
?:
string
|
undefined
'max-video-preview'
?:
number
|
string
|
undefined
'max-image-preview'
?:
'none'
|
'standard'
|
'large'
|
undefined
'max-snippet'
?:
number
|
undefined
}
export
type
Robots
=
RobotsInfo
&
{
// if you want to specify an alternate robots just for google
googleBot
?:
string
|
RobotsInfo
googleBot
?:
string
|
RobotsInfo
|
undefined
}
export
type
ResolvedRobots
=
{
...
...
@@ -97,63 +97,67 @@ export type IconURL = string | URL
export
type
Icon
=
IconURL
|
IconDescriptor
export
type
IconDescriptor
=
{
url
:
string
|
URL
type
?:
string
sizes
?:
string
color
?:
string
type
?:
string
|
undefined
sizes
?:
string
|
undefined
color
?:
string
|
undefined
/** defaults to rel="icon" unless superseded by Icons map */
rel
?:
string
media
?:
string
rel
?:
string
|
undefined
media
?:
string
|
undefined
/**
* @see https://developer.mozilla.org/docs/Web/API/HTMLImageElement/fetchPriority
*/
fetchPriority
?:
'high'
|
'low'
|
'auto'
fetchPriority
?:
'high'
|
'low'
|
'auto'
|
undefined
}
export
type
Icons
=
{
/** rel="icon" */
icon
?:
Icon
|
Icon
[]
icon
?:
Icon
|
Icon
[]
|
undefined
/** rel="shortcut icon" */
shortcut
?:
Icon
|
Icon
[]
shortcut
?:
Icon
|
Icon
[]
|
undefined
/**
* @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
* rel="apple-touch-icon"
*/
apple
?:
Icon
|
Icon
[]
apple
?:
Icon
|
Icon
[]
|
undefined
/** rel inferred from descriptor, defaults to "icon" */
other
?:
IconDescriptor
|
IconDescriptor
[]
other
?:
IconDescriptor
|
IconDescriptor
[]
|
undefined
}
export
type
Verification
=
{
google
?:
null
|
string
|
number
|
(
string
|
number
)[]
yahoo
?:
null
|
string
|
number
|
(
string
|
number
)[]
yandex
?:
null
|
string
|
number
|
(
string
|
number
)[]
me
?:
null
|
string
|
number
|
(
string
|
number
)[]
google
?:
null
|
string
|
number
|
(
string
|
number
)[]
|
undefined
yahoo
?:
null
|
string
|
number
|
(
string
|
number
)[]
|
undefined
yandex
?:
null
|
string
|
number
|
(
string
|
number
)[]
|
undefined
me
?:
null
|
string
|
number
|
(
string
|
number
)[]
|
undefined
// if you ad-hoc additional verification
other
?:
{
other
?:
|
{
[
name
:
string
]:
string
|
number
|
(
string
|
number
)[]
}
|
undefined
}
export
type
ResolvedVerification
=
{
google
?:
null
|
(
string
|
number
)[]
yahoo
?:
null
|
(
string
|
number
)[]
yandex
?:
null
|
(
string
|
number
)[]
me
?:
null
|
(
string
|
number
)[]
other
?:
{
google
?:
null
|
(
string
|
number
)[]
|
undefined
yahoo
?:
null
|
(
string
|
number
)[]
|
undefined
yandex
?:
null
|
(
string
|
number
)[]
|
undefined
me
?:
null
|
(
string
|
number
)[]
|
undefined
other
?:
|
{
[
name
:
string
]:
(
string
|
number
)[]
}
|
undefined
}
export
type
ResolvedIcons
=
{
icon
:
IconDescriptor
[]
apple
:
IconDescriptor
[]
shortcut
?:
IconDescriptor
[]
other
?:
IconDescriptor
[]
shortcut
?:
IconDescriptor
[]
|
undefined
other
?:
IconDescriptor
[]
|
undefined
}
export
type
ThemeColorDescriptor
=
{
color
:
string
media
?:
string
media
?:
string
|
undefined
}
export
type
Restriction
=
{
...
...
@@ -165,21 +169,23 @@ export type Videos = {
title
:
string
thumbnail_loc
:
string
description
:
string
content_loc
?:
string
player_loc
?:
string
duration
?:
number
expiration_date
?:
Date
|
string
rating
?:
number
view_count
?:
number
publication_date
?:
Date
|
string
family_friendly
?:
'yes'
|
'no'
restriction
?:
Restriction
platform
?:
Restriction
requires_subscription
?:
'yes'
|
'no'
uploader
?:
{
info
?:
string
content
?:
string
content_loc
?:
string
|
undefined
player_loc
?:
string
|
undefined
duration
?:
number
|
undefined
expiration_date
?:
Date
|
string
|
undefined
rating
?:
number
|
undefined
view_count
?:
number
|
undefined
publication_date
?:
Date
|
string
|
undefined
family_friendly
?:
'yes'
|
'no'
|
undefined
restriction
?:
Restriction
|
undefined
platform
?:
Restriction
|
undefined
requires_subscription
?:
'yes'
|
'no'
|
undefined
uploader
?:
|
{
info
?:
string
|
undefined
content
?:
string
|
undefined
}
live
?:
'yes'
|
'no'
tag
?:
string
|
undefined
live
?:
'yes'
|
'no'
|
undefined
tag
?:
string
|
undefined
}
packages/next/src/lib/metadata/types/opengraph-types.ts
View file @
f3b06b93
...
...
@@ -33,87 +33,117 @@ export type OpenGraph =
type
Locale
=
string
type
OpenGraphMetadata
=
{
determiner
?:
'a'
|
'an'
|
'the'
|
'auto'
|
''
title
?:
string
|
TemplateString
description
?:
string
emails
?:
string
|
Array
<
string
>
phoneNumbers
?:
string
|
Array
<
string
>
faxNumbers
?:
string
|
Array
<
string
>
siteName
?:
string
locale
?:
Locale
alternateLocale
?:
Locale
|
Array
<
Locale
>
images
?:
OGImage
|
Array
<
OGImage
>
audio
?:
OGAudio
|
Array
<
OGAudio
>
videos
?:
OGVideo
|
Array
<
OGVideo
>
url
?:
string
|
URL
countryName
?:
string
ttl
?:
number
determiner
?:
'a'
|
'an'
|
'the'
|
'auto'
|
''
|
undefined
title
?:
string
|
TemplateString
|
undefined
description
?:
string
|
undefined
emails
?:
string
|
Array
<
string
>
|
undefined
phoneNumbers
?:
string
|
Array
<
string
>
|
undefined
faxNumbers
?:
string
|
Array
<
string
>
|
undefined
siteName
?:
string
|
undefined
locale
?:
Locale
|
undefined
alternateLocale
?:
Locale
|
Array
<
Locale
>
|
undefined
images
?:
OGImage
|
Array
<
OGImage
>
|
undefined
audio
?:
OGAudio
|
Array
<
OGAudio
>
|
undefined
videos
?:
OGVideo
|
Array
<
OGVideo
>
|
undefined
url
?:
string
|
URL
|
undefined
countryName
?:
string
|
undefined
ttl
?:
number
|
undefined
}
type
OpenGraphWebsite
=
OpenGraphMetadata
&
{
type
:
'website'
}
type
OpenGraphArticle
=
OpenGraphMetadata
&
{
type
:
'article'
publishedTime
?:
string
// datetime
modifiedTime
?:
string
// datetime
expirationTime
?:
string
// datetime
authors
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
section
?:
null
|
string
tags
?:
null
|
string
|
Array
<
string
>
publishedTime
?:
string
|
undefined
// datetime
modifiedTime
?:
string
|
undefined
// datetime
expirationTime
?:
string
|
undefined
// datetime
authors
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
section
?:
null
|
string
|
undefined
tags
?:
null
|
string
|
Array
<
string
>
|
undefined
}
type
OpenGraphBook
=
OpenGraphMetadata
&
{
type
:
'book'
isbn
?:
null
|
string
releaseDate
?:
null
|
string
// datetime
authors
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
tags
?:
null
|
string
|
Array
<
string
>
isbn
?:
null
|
string
|
undefined
releaseDate
?:
null
|
string
|
undefined
// datetime
authors
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
tags
?:
null
|
string
|
Array
<
string
>
|
undefined
}
type
OpenGraphProfile
=
OpenGraphMetadata
&
{
type
:
'profile'
firstName
?:
null
|
string
lastName
?:
null
|
string
username
?:
null
|
string
gender
?:
null
|
string
firstName
?:
null
|
string
|
undefined
lastName
?:
null
|
string
|
undefined
username
?:
null
|
string
|
undefined
gender
?:
null
|
string
|
undefined
}
type
OpenGraphMusicSong
=
OpenGraphMetadata
&
{
type
:
'music.song'
duration
?:
null
|
number
albums
?:
null
|
string
|
URL
|
OGAlbum
|
Array
<
string
|
URL
|
OGAlbum
>
musicians
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
duration
?:
null
|
number
|
undefined
albums
?:
|
null
|
string
|
URL
|
OGAlbum
|
Array
<
string
|
URL
|
OGAlbum
>
|
undefined
musicians
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
}
type
OpenGraphMusicAlbum
=
OpenGraphMetadata
&
{
type
:
'music.album'
songs
?:
null
|
string
|
URL
|
OGSong
|
Array
<
string
|
URL
|
OGSong
>
musicians
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
releaseDate
?:
null
|
string
// datetime
songs
?:
|
null
|
string
|
URL
|
OGSong
|
Array
<
string
|
URL
|
OGSong
>
|
undefined
musicians
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
releaseDate
?:
null
|
string
|
undefined
// datetime
}
type
OpenGraphMusicPlaylist
=
OpenGraphMetadata
&
{
type
:
'music.playlist'
songs
?:
null
|
string
|
URL
|
OGSong
|
Array
<
string
|
URL
|
OGSong
>
creators
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
songs
?:
|
null
|
string
|
URL
|
OGSong
|
Array
<
string
|
URL
|
OGSong
>
|
undefined
creators
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
}
type
OpenGraphRadioStation
=
OpenGraphMetadata
&
{
type
:
'music.radio_station'
creators
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
creators
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
}
type
OpenGraphVideoMovie
=
OpenGraphMetadata
&
{
type
:
'video.movie'
actors
?:
null
|
string
|
URL
|
OGActor
|
Array
<
string
|
URL
|
OGActor
>
directors
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
writers
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
duration
?:
null
|
number
releaseDate
?:
null
|
string
// datetime
tags
?:
null
|
string
|
Array
<
string
>
actors
?:
|
null
|
string
|
URL
|
OGActor
|
Array
<
string
|
URL
|
OGActor
>
|
undefined
directors
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
writers
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
duration
?:
null
|
number
|
undefined
releaseDate
?:
null
|
string
|
undefined
// datetime
tags
?:
null
|
string
|
Array
<
string
>
|
undefined
}
type
OpenGraphVideoEpisode
=
OpenGraphMetadata
&
{
type
:
'video.episode'
actors
?:
null
|
string
|
URL
|
OGActor
|
Array
<
string
|
URL
|
OGActor
>
directors
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
writers
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
duration
?:
null
|
number
releaseDate
?:
null
|
string
// datetime
tags
?:
null
|
string
|
Array
<
string
>
series
?:
null
|
string
|
URL
actors
?:
|
null
|
string
|
URL
|
OGActor
|
Array
<
string
|
URL
|
OGActor
>
|
undefined
directors
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
writers
?:
null
|
string
|
URL
|
Array
<
string
|
URL
>
|
undefined
duration
?:
null
|
number
|
undefined
releaseDate
?:
null
|
string
|
undefined
// datetime
tags
?:
null
|
string
|
Array
<
string
>
|
undefined
series
?:
null
|
string
|
URL
|
undefined
}
type
OpenGraphVideoTVShow
=
OpenGraphMetadata
&
{
type
:
'video.tv_show'
...
...
@@ -125,25 +155,25 @@ type OpenGraphVideoOther = OpenGraphMetadata & {
type
OGImage
=
string
|
OGImageDescriptor
|
URL
type
OGImageDescriptor
=
{
url
:
string
|
URL
secureUrl
?:
string
|
URL
alt
?:
string
type
?:
string
width
?:
string
|
number
height
?:
string
|
number
secureUrl
?:
string
|
URL
|
undefined
alt
?:
string
|
undefined
type
?:
string
|
undefined
width
?:
string
|
number
|
undefined
height
?:
string
|
number
|
undefined
}
type
OGAudio
=
string
|
OGAudioDescriptor
|
URL
type
OGAudioDescriptor
=
{
url
:
string
|
URL
secureUrl
?:
string
|
URL
type
?:
string
secureUrl
?:
string
|
URL
|
undefined
type
?:
string
|
undefined
}
type
OGVideo
=
string
|
OGVideoDescriptor
|
URL
type
OGVideoDescriptor
=
{
url
:
string
|
URL
secureUrl
?:
string
|
URL
type
?:
string
width
?:
string
|
number
height
?:
string
|
number
secureUrl
?:
string
|
URL
|
undefined
type
?:
string
|
undefined
width
?:
string
|
number
|
undefined
height
?:
string
|
number
|
undefined
}
export
type
ResolvedOpenGraph
=
...
...
@@ -162,87 +192,87 @@ export type ResolvedOpenGraph =
|
ResolvedOpenGraphMetadata
type
ResolvedOpenGraphMetadata
=
{
determiner
?:
'a'
|
'an'
|
'the'
|
'auto'
|
''
determiner
?:
'a'
|
'an'
|
'the'
|
'auto'
|
''
|
undefined
title
:
AbsoluteTemplateString
description
?:
string
emails
?:
Array
<
string
>
phoneNumbers
?:
Array
<
string
>
faxNumbers
?:
Array
<
string
>
siteName
?:
string
locale
?:
Locale
alternateLocale
?:
Array
<
Locale
>
images
?:
Array
<
OGImage
>
audio
?:
Array
<
OGAudio
>
videos
?:
Array
<
OGVideo
>
description
?:
string
|
undefined
emails
?:
Array
<
string
>
|
undefined
phoneNumbers
?:
Array
<
string
>
|
undefined
faxNumbers
?:
Array
<
string
>
|
undefined
siteName
?:
string
|
undefined
locale
?:
Locale
|
undefined
alternateLocale
?:
Array
<
Locale
>
|
undefined
images
?:
Array
<
OGImage
>
|
undefined
audio
?:
Array
<
OGAudio
>
|
undefined
videos
?:
Array
<
OGVideo
>
|
undefined
url
:
null
|
URL
|
string
countryName
?:
string
ttl
?:
number
countryName
?:
string
|
undefined
ttl
?:
number
|
undefined
}
type
ResolvedOpenGraphWebsite
=
ResolvedOpenGraphMetadata
&
{
type
:
'website'
}
type
ResolvedOpenGraphArticle
=
ResolvedOpenGraphMetadata
&
{
type
:
'article'
publishedTime
?:
string
// datetime
modifiedTime
?:
string
// datetime
expirationTime
?:
string
// datetime
authors
?:
Array
<
string
>
section
?:
string
tags
?:
Array
<
string
>
publishedTime
?:
string
|
undefined
// datetime
modifiedTime
?:
string
|
undefined
// datetime
expirationTime
?:
string
|
undefined
// datetime
authors
?:
Array
<
string
>
|
undefined
section
?:
string
|
undefined
tags
?:
Array
<
string
>
|
undefined
}
type
ResolvedOpenGraphBook
=
ResolvedOpenGraphMetadata
&
{
type
:
'book'
isbn
?:
string
releaseDate
?:
string
// datetime
authors
?:
Array
<
string
>
tags
?:
Array
<
string
>
isbn
?:
string
|
undefined
releaseDate
?:
string
|
undefined
// datetime
authors
?:
Array
<
string
>
|
undefined
tags
?:
Array
<
string
>
|
undefined
}
type
ResolvedOpenGraphProfile
=
ResolvedOpenGraphMetadata
&
{
type
:
'profile'
firstName
?:
string
lastName
?:
string
username
?:
string
gender
?:
string
firstName
?:
string
|
undefined
lastName
?:
string
|
undefined
username
?:
string
|
undefined
gender
?:
string
|
undefined
}
type
ResolvedOpenGraphMusicSong
=
ResolvedOpenGraphMetadata
&
{
type
:
'music.song'
duration
?:
number
albums
?:
Array
<
OGAlbum
>
musicians
?:
Array
<
string
|
URL
>
duration
?:
number
|
undefined
albums
?:
Array
<
OGAlbum
>
|
undefined
musicians
?:
Array
<
string
|
URL
>
|
undefined
}
type
ResolvedOpenGraphMusicAlbum
=
ResolvedOpenGraphMetadata
&
{
type
:
'music.album'
songs
?:
Array
<
string
|
URL
|
OGSong
>
musicians
?:
Array
<
string
|
URL
>
releaseDate
?:
string
// datetime
songs
?:
Array
<
string
|
URL
|
OGSong
>
|
undefined
musicians
?:
Array
<
string
|
URL
>
|
undefined
releaseDate
?:
string
|
undefined
// datetime
}
type
ResolvedOpenGraphMusicPlaylist
=
ResolvedOpenGraphMetadata
&
{
type
:
'music.playlist'
songs
?:
Array
<
string
|
URL
|
OGSong
>
creators
?:
Array
<
string
|
URL
>
songs
?:
Array
<
string
|
URL
|
OGSong
>
|
undefined
creators
?:
Array
<
string
|
URL
>
|
undefined
}
type
ResolvedOpenGraphRadioStation
=
ResolvedOpenGraphMetadata
&
{
type
:
'music.radio_station'
creators
?:
Array
<
string
|
URL
>
creators
?:
Array
<
string
|
URL
>
|
undefined
}
type
ResolvedOpenGraphVideoMovie
=
ResolvedOpenGraphMetadata
&
{
type
:
'video.movie'
actors
?:
Array
<
string
|
URL
|
OGActor
>
directors
?:
Array
<
string
|
URL
>
writers
?:
Array
<
string
|
URL
>
duration
?:
number
releaseDate
?:
string
// datetime
tags
?:
Array
<
string
>
actors
?:
Array
<
string
|
URL
|
OGActor
>
|
undefined
directors
?:
Array
<
string
|
URL
>
|
undefined
writers
?:
Array
<
string
|
URL
>
|
undefined
duration
?:
number
|
undefined
releaseDate
?:
string
|
undefined
// datetime
tags
?:
Array
<
string
>
|
undefined
}
type
ResolvedOpenGraphVideoEpisode
=
ResolvedOpenGraphMetadata
&
{
type
:
'video.episode'
actors
?:
Array
<
string
|
URL
|
OGActor
>
directors
?:
Array
<
string
|
URL
>
writers
?:
Array
<
string
|
URL
>
duration
?:
number
releaseDate
?:
string
// datetime
tags
?:
Array
<
string
>
series
?:
string
|
URL
actors
?:
Array
<
string
|
URL
|
OGActor
>
|
undefined
directors
?:
Array
<
string
|
URL
>
|
undefined
writers
?:
Array
<
string
|
URL
>
|
undefined
duration
?:
number
|
undefined
releaseDate
?:
string
|
undefined
// datetime
tags
?:
Array
<
string
>
|
undefined
series
?:
string
|
URL
|
undefined
}
type
ResolvedOpenGraphVideoTVShow
=
ResolvedOpenGraphMetadata
&
{
type
:
'video.tv_show'
...
...
@@ -253,15 +283,15 @@ type ResolvedOpenGraphVideoOther = ResolvedOpenGraphMetadata & {
type
OGSong
=
{
url
:
string
|
URL
disc
?:
number
track
?:
number
disc
?:
number
|
undefined
track
?:
number
|
undefined
}
type
OGAlbum
=
{
url
:
string
|
URL
disc
?:
number
track
?:
number
disc
?:
number
|
undefined
track
?:
number
|
undefined
}
type
OGActor
=
{
url
:
string
|
URL
role
?:
string
role
?:
string
|
undefined
}
packages/next/src/lib/metadata/types/twitter-types.ts
View file @
f3b06b93
...
...
@@ -11,13 +11,13 @@ export type Twitter =
type
TwitterMetadata
=
{
// defaults to card="summary"
site
?:
string
// username for account associated to the site itself
siteId
?:
string
// id for account associated to the site itself
creator
?:
string
// username for the account associated to the creator of the content on the site
creatorId
?:
string
// id for the account associated to the creator of the content on the site
description
?:
string
title
?:
string
|
TemplateString
images
?:
TwitterImage
|
Array
<
TwitterImage
>
site
?:
string
|
undefined
// username for account associated to the site itself
siteId
?:
string
|
undefined
// id for account associated to the site itself
creator
?:
string
|
undefined
// username for the account associated to the creator of the content on the site
creatorId
?:
string
|
undefined
// id for the account associated to the creator of the content on the site
description
?:
string
|
undefined
title
?:
string
|
TemplateString
|
undefined
images
?:
TwitterImage
|
Array
<
TwitterImage
>
|
undefined
}
type
TwitterSummary
=
TwitterMetadata
&
{
card
:
'summary'
...
...
@@ -35,26 +35,28 @@ type TwitterApp = TwitterMetadata & {
}
export
type
TwitterAppDescriptor
=
{
id
:
{
iphone
?:
string
|
number
ipad
?:
string
|
number
googleplay
?:
string
iphone
?:
string
|
number
|
undefined
ipad
?:
string
|
number
|
undefined
googleplay
?:
string
|
undefined
}
url
?:
{
iphone
?:
string
|
URL
ipad
?:
string
|
URL
googleplay
?:
string
|
URL
url
?:
|
{
iphone
?:
string
|
URL
|
undefined
ipad
?:
string
|
URL
|
undefined
googleplay
?:
string
|
URL
|
undefined
}
name
?:
string
|
undefined
name
?:
string
|
undefined
}
type
TwitterImage
=
string
|
TwitterImageDescriptor
|
URL
type
TwitterImageDescriptor
=
{
url
:
string
|
URL
alt
?:
string
secureUrl
?:
string
|
URL
type
?:
string
width
?:
string
|
number
height
?:
string
|
number
alt
?:
string
|
undefined
secureUrl
?:
string
|
URL
|
undefined
type
?:
string
|
undefined
width
?:
string
|
number
|
undefined
height
?:
string
|
number
|
undefined
}
type
TwitterPlayerDescriptor
=
{
playerUrl
:
string
|
URL
...
...
@@ -65,11 +67,11 @@ type TwitterPlayerDescriptor = {
type
ResolvedTwitterImage
=
{
url
:
string
|
URL
alt
?:
string
secureUrl
?:
string
|
URL
type
?:
string
width
?:
string
|
number
height
?:
string
|
number
alt
?:
string
|
undefined
secureUrl
?:
string
|
URL
|
undefined
type
?:
string
|
undefined
width
?:
string
|
number
|
undefined
height
?:
string
|
number
|
undefined
}
type
ResolvedTwitterSummary
=
{
site
:
string
|
null
...
...
@@ -78,7 +80,7 @@ type ResolvedTwitterSummary = {
creatorId
:
string
|
null
description
:
string
|
null
title
:
AbsoluteTemplateString
images
?:
Array
<
ResolvedTwitterImage
>
images
?:
Array
<
ResolvedTwitterImage
>
|
undefined
}
type
ResolvedTwitterPlayer
=
ResolvedTwitterSummary
&
{
players
:
Array
<
TwitterPlayerDescriptor
>
...
...
test/production/typescript-basic/typechecking/metadata/manifest.ts
0 → 100644
View file @
f3b06b93
import
type
{
MetadataRoute
}
from
'next'
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
;()
=>
{
;({
background_color
:
undefined
,
categories
:
undefined
,
description
:
undefined
,
dir
:
undefined
,
display
:
undefined
,
display_override
:
undefined
,
file_handlers
:
undefined
,
icons
:
undefined
,
id
:
undefined
,
lang
:
undefined
,
launch_handler
:
undefined
,
name
:
undefined
,
orientation
:
undefined
,
prefer_related_applications
:
undefined
,
protocol_handlers
:
undefined
,
related_applications
:
undefined
,
scope
:
undefined
,
screenshots
:
undefined
,
share_target
:
undefined
,
short_name
:
undefined
,
shortcuts
:
undefined
,
start_url
:
undefined
,
theme_color
:
undefined
,
})
satisfies
MetadataRoute
.
Manifest
;({
icons
:
[
{
src
:
''
,
type
:
undefined
,
sizes
:
undefined
,
purpose
:
undefined
,
},
],
related_applications
:
[
{
platform
:
''
,
url
:
''
,
id
:
undefined
,
},
],
screenshots
:
[
{
form_factor
:
undefined
,
label
:
undefined
,
platform
:
undefined
,
src
:
''
,
type
:
undefined
,
sizes
:
undefined
,
},
],
share_target
:
{
action
:
''
,
method
:
undefined
,
enctype
:
undefined
,
params
:
{
title
:
undefined
,
text
:
undefined
,
url
:
undefined
,
files
:
undefined
,
},
},
shortcuts
:
[
{
name
:
''
,
short_name
:
undefined
,
description
:
undefined
,
url
:
''
,
icons
:
undefined
,
},
],
})
satisfies
MetadataRoute
.
Manifest
}
test/production/typescript-basic/typechecking/metadata/metadata.ts
0 → 100644
View file @
f3b06b93
import
type
{
Metadata
}
from
'next'
import
{
ResolvedMetadata
}
from
'next/types'
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
;()
=>
{
;({
'apple-touch-fullscreen'
:
undefined
,
'apple-touch-icon-precomposed'
:
undefined
,
metadataBase
:
undefined
,
title
:
undefined
,
description
:
undefined
,
applicationName
:
undefined
,
authors
:
undefined
,
generator
:
undefined
,
keywords
:
undefined
,
referrer
:
undefined
,
themeColor
:
undefined
,
colorScheme
:
undefined
,
viewport
:
undefined
,
creator
:
undefined
,
publisher
:
undefined
,
robots
:
undefined
,
alternates
:
undefined
,
icons
:
undefined
,
manifest
:
undefined
,
openGraph
:
undefined
,
twitter
:
undefined
,
facebook
:
undefined
,
verification
:
undefined
,
appleWebApp
:
undefined
,
formatDetection
:
undefined
,
itunes
:
undefined
,
abstract
:
undefined
,
appLinks
:
undefined
,
archives
:
undefined
,
assets
:
undefined
,
bookmarks
:
undefined
,
category
:
undefined
,
classification
:
undefined
,
other
:
undefined
,
})
satisfies
Metadata
;({
authors
:
{
url
:
undefined
,
name
:
undefined
,
},
themeColor
:
{
color
:
''
,
media
:
undefined
,
},
viewport
:
{
width
:
undefined
,
height
:
undefined
,
initialScale
:
undefined
,
minimumScale
:
undefined
,
maximumScale
:
undefined
,
userScalable
:
undefined
,
viewportFit
:
undefined
,
interactiveWidget
:
undefined
,
},
robots
:
{
googleBot
:
undefined
,
index
:
undefined
,
follow
:
undefined
,
noindex
:
undefined
,
nofollow
:
undefined
,
noarchive
:
undefined
,
nosnippet
:
undefined
,
noimageindex
:
undefined
,
nocache
:
undefined
,
notranslate
:
undefined
,
indexifembedded
:
undefined
,
nositelinkssearchbox
:
undefined
,
unavailable_after
:
undefined
,
'max-video-preview'
:
undefined
,
'max-image-preview'
:
undefined
,
'max-snippet'
:
undefined
,
},
alternates
:
{
canonical
:
undefined
,
languages
:
undefined
,
media
:
undefined
,
types
:
undefined
,
},
icons
:
{
icon
:
undefined
,
shortcut
:
undefined
,
apple
:
undefined
,
other
:
{
url
:
''
,
type
:
undefined
,
sizes
:
undefined
,
color
:
undefined
,
rel
:
undefined
,
media
:
undefined
,
fetchPriority
:
undefined
,
},
},
verification
:
{
google
:
undefined
,
yahoo
:
undefined
,
yandex
:
undefined
,
me
:
undefined
,
other
:
undefined
,
},
formatDetection
:
{
telephone
:
undefined
,
date
:
undefined
,
address
:
undefined
,
email
:
undefined
,
url
:
undefined
,
},
itunes
:
{
appId
:
''
,
appArgument
:
undefined
,
},
})
satisfies
Metadata
;({
canonical
:
{
title
:
undefined
,
url
:
''
,
},
})
satisfies
Metadata
[
'alternates'
]
;({
type
:
'website'
,
determiner
:
undefined
,
title
:
undefined
,
description
:
undefined
,
emails
:
undefined
,
phoneNumbers
:
undefined
,
faxNumbers
:
undefined
,
siteName
:
undefined
,
locale
:
undefined
,
alternateLocale
:
undefined
,
images
:
undefined
,
audio
:
undefined
,
videos
:
undefined
,
url
:
undefined
,
countryName
:
undefined
,
ttl
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
images
:
{
url
:
''
,
secureUrl
:
undefined
,
alt
:
undefined
,
type
:
undefined
,
width
:
undefined
,
height
:
undefined
,
},
audio
:
{
url
:
''
,
secureUrl
:
undefined
,
type
:
undefined
,
},
videos
:
{
url
:
''
,
secureUrl
:
undefined
,
type
:
undefined
,
width
:
undefined
,
height
:
undefined
,
},
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'article'
,
publishedTime
:
undefined
,
modifiedTime
:
undefined
,
expirationTime
:
undefined
,
authors
:
undefined
,
section
:
undefined
,
tags
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'book'
,
isbn
:
undefined
,
releaseDate
:
undefined
,
authors
:
undefined
,
tags
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'profile'
,
firstName
:
undefined
,
lastName
:
undefined
,
username
:
undefined
,
gender
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'music.song'
,
duration
:
undefined
,
albums
:
undefined
,
musicians
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'music.song'
,
albums
:
{
url
:
''
,
disc
:
undefined
,
track
:
undefined
,
},
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'music.album'
,
songs
:
undefined
,
musicians
:
undefined
,
releaseDate
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'music.album'
,
songs
:
{
url
:
''
,
disc
:
undefined
,
track
:
undefined
,
},
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'music.playlist'
,
songs
:
undefined
,
creators
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'music.radio_station'
,
creators
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'video.movie'
,
actors
:
undefined
,
directors
:
undefined
,
writers
:
undefined
,
duration
:
undefined
,
releaseDate
:
undefined
,
tags
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'video.movie'
,
actors
:
{
url
:
''
,
role
:
undefined
,
},
})
satisfies
Metadata
[
'openGraph'
]
;({
type
:
'video.episode'
,
actors
:
undefined
,
directors
:
undefined
,
writers
:
undefined
,
duration
:
undefined
,
releaseDate
:
undefined
,
tags
:
undefined
,
series
:
undefined
,
})
satisfies
Metadata
[
'openGraph'
]
;({
card
:
'app'
,
site
:
undefined
,
siteId
:
undefined
,
creator
:
undefined
,
creatorId
:
undefined
,
description
:
undefined
,
title
:
undefined
,
images
:
undefined
,
app
:
{
id
:
{},
url
:
undefined
,
name
:
undefined
,
},
})
satisfies
Metadata
[
'twitter'
]
;({
card
:
'app'
,
images
:
{
url
:
''
,
alt
:
undefined
,
secureUrl
:
undefined
,
type
:
undefined
,
width
:
undefined
,
height
:
undefined
,
},
app
:
{
id
:
{
iphone
:
undefined
,
ipad
:
undefined
,
googleplay
:
undefined
,
},
url
:
{
iphone
:
undefined
,
ipad
:
undefined
,
googleplay
:
undefined
,
},
},
})
satisfies
Metadata
[
'twitter'
]
;({
appId
:
''
,
admins
:
undefined
,
})
satisfies
Metadata
[
'facebook'
]
;({
appId
:
undefined
,
admins
:
''
,
})
satisfies
Metadata
[
'facebook'
]
;({
capable
:
undefined
,
title
:
undefined
,
startupImage
:
undefined
,
statusBarStyle
:
undefined
,
})
satisfies
Metadata
[
'appleWebApp'
]
;({
startupImage
:
{
url
:
''
,
media
:
undefined
,
},
})
satisfies
Metadata
[
'appleWebApp'
]
;({
ios
:
undefined
,
iphone
:
undefined
,
ipad
:
undefined
,
android
:
undefined
,
windows_phone
:
undefined
,
windows
:
undefined
,
windows_universal
:
undefined
,
web
:
undefined
,
})
satisfies
Metadata
[
'appLinks'
]
;({
ios
:
{
url
:
''
,
app_store_id
:
undefined
,
app_name
:
undefined
,
},
android
:
{
package
:
''
,
url
:
undefined
,
class
:
undefined
,
app_name
:
undefined
,
},
windows_phone
:
{
url
:
''
,
app_id
:
undefined
,
app_name
:
undefined
,
},
web
:
{
url
:
''
,
should_fallback
:
undefined
,
},
})
satisfies
Metadata
[
'appLinks'
]
;({
icon
:
[],
apple
:
[],
shortcut
:
undefined
,
other
:
undefined
,
})
satisfies
ResolvedMetadata
[
'icons'
]
;({
determiner
:
undefined
,
title
:
{
template
:
null
,
absolute
:
''
},
description
:
undefined
,
emails
:
undefined
,
phoneNumbers
:
undefined
,
faxNumbers
:
undefined
,
siteName
:
undefined
,
locale
:
undefined
,
alternateLocale
:
undefined
,
images
:
undefined
,
audio
:
undefined
,
videos
:
undefined
,
url
:
null
,
countryName
:
undefined
,
ttl
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'article'
,
publishedTime
:
undefined
,
modifiedTime
:
undefined
,
expirationTime
:
undefined
,
authors
:
undefined
,
section
:
undefined
,
tags
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'book'
,
isbn
:
undefined
,
releaseDate
:
undefined
,
authors
:
undefined
,
tags
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'book'
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'profile'
,
firstName
:
undefined
,
lastName
:
undefined
,
username
:
undefined
,
gender
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'music.song'
,
duration
:
undefined
,
albums
:
undefined
,
musicians
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'music.album'
,
songs
:
undefined
,
musicians
:
undefined
,
releaseDate
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'music.playlist'
,
songs
:
undefined
,
creators
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'music.radio_station'
,
creators
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'video.movie'
,
actors
:
undefined
,
directors
:
undefined
,
writers
:
undefined
,
duration
:
undefined
,
releaseDate
:
undefined
,
tags
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
title
:
{
template
:
null
,
absolute
:
''
},
url
:
null
,
type
:
'video.episode'
,
actors
:
undefined
,
directors
:
undefined
,
writers
:
undefined
,
duration
:
undefined
,
releaseDate
:
undefined
,
tags
:
undefined
,
series
:
undefined
,
})
satisfies
ResolvedMetadata
[
'openGraph'
]
;({
card
:
'summary'
,
site
:
null
,
siteId
:
null
,
creator
:
null
,
creatorId
:
null
,
description
:
null
,
title
:
{
template
:
null
,
absolute
:
''
},
images
:
undefined
,
})
satisfies
ResolvedMetadata
[
'twitter'
]
;({
card
:
'summary'
,
site
:
null
,
siteId
:
null
,
creator
:
null
,
creatorId
:
null
,
description
:
null
,
title
:
{
template
:
null
,
absolute
:
''
},
images
:
[
{
url
:
''
,
alt
:
undefined
,
secureUrl
:
undefined
,
type
:
undefined
,
width
:
undefined
,
height
:
undefined
,
},
],
})
satisfies
ResolvedMetadata
[
'twitter'
]
;({
appId
:
undefined
,
admins
:
undefined
,
})
satisfies
ResolvedMetadata
[
'facebook'
]
;({
google
:
undefined
,
yahoo
:
undefined
,
yandex
:
undefined
,
me
:
undefined
,
other
:
undefined
,
})
satisfies
ResolvedMetadata
[
'verification'
]
;({
capable
:
false
,
title
:
undefined
,
startupImage
:
undefined
,
statusBarStyle
:
undefined
,
})
satisfies
ResolvedMetadata
[
'appleWebApp'
]
;({
ios
:
undefined
,
iphone
:
undefined
,
ipad
:
undefined
,
android
:
undefined
,
windows_phone
:
undefined
,
windows
:
undefined
,
windows_universal
:
undefined
,
web
:
undefined
,
})
satisfies
ResolvedMetadata
[
'appLinks'
]
}
test/production/typescript-basic/typechecking/metadata/robots.ts
0 → 100644
View file @
f3b06b93
import
type
{
MetadataRoute
}
from
'next'
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
;()
=>
{
;({
rules
:
{
userAgent
:
undefined
,
allow
:
undefined
,
disallow
:
undefined
,
crawlDelay
:
undefined
,
},
sitemap
:
undefined
,
host
:
undefined
,
})
satisfies
MetadataRoute
.
Robots
}
test/production/typescript-basic/typechecking/metadata/sitemap.ts
0 → 100644
View file @
f3b06b93
import
type
{
MetadataRoute
}
from
'next'
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
;()
=>
{
;({
url
:
''
,
lastModified
:
undefined
,
changeFrequency
:
undefined
,
priority
:
undefined
,
alternates
:
undefined
,
images
:
undefined
,
videos
:
undefined
,
})
satisfies
MetadataRoute
.
Sitemap
[
number
]
;({
url
:
''
,
alternates
:
{
languages
:
undefined
,
},
videos
:
[
{
title
:
''
,
thumbnail_loc
:
''
,
description
:
''
,
content_loc
:
undefined
,
player_loc
:
undefined
,
duration
:
undefined
,
expiration_date
:
undefined
,
rating
:
undefined
,
view_count
:
undefined
,
publication_date
:
undefined
,
family_friendly
:
undefined
,
restriction
:
undefined
,
platform
:
undefined
,
requires_subscription
:
undefined
,
uploader
:
undefined
,
live
:
undefined
,
tag
:
undefined
,
},
],
})
satisfies
MetadataRoute
.
Sitemap
[
number
]
;({
url
:
''
,
alternates
:
{
languages
:
{
en
:
undefined
,
},
},
videos
:
[
{
title
:
''
,
thumbnail_loc
:
''
,
description
:
''
,
uploader
:
{
info
:
undefined
,
content
:
undefined
,
},
},
],
})
satisfies
MetadataRoute
.
Sitemap
[
number
]
}
test/production/typescript-basic/typechecking/metadata/viewport.ts
0 → 100644
View file @
f3b06b93
import
type
{
Viewport
}
from
'next'
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
;()
=>
{
;({
width
:
undefined
,
height
:
undefined
,
initialScale
:
undefined
,
minimumScale
:
undefined
,
maximumScale
:
undefined
,
userScalable
:
undefined
,
viewportFit
:
undefined
,
interactiveWidget
:
undefined
,
themeColor
:
undefined
,
colorScheme
:
undefined
,
})
satisfies
Viewport
;({
themeColor
:
{
color
:
''
,
media
:
undefined
,
},
})
satisfies
Viewport
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment