Open ciruz opened 4 months ago
I am facing the same bug,
export const metadata: Metadata = {
title: 'My website',
description: 'My awesome website',
metadataBase: new URL('https://mywebsitecom/images/images/'),
openGraph: {
images: '/opengraph-image.jpg',
},
alternates: {
canonical: 'https://example.com',
hreflang: { 'en-US': 'https://example.com/en-US' },
},
}
Object literal may only specify known properties, and 'hreflang' does not exist in type 'AlternateURLs'.ts(2353)
metadata-interface.d.ts(196, 5): The expected type comes from property 'alternates' which is declared here on type 'Metadata'
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Binaries:
Node: v18.18.0
npm: 9.8.1
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 14.2.3
eslint-config-next: 14.2.3
react: 18.3.1
react-dom: 18.3.1
typescript: 5
Next.js Config:
output: 'export'
Link to the code that reproduces this issue
https://github.com/ciruz/next.js-hreflang
To Reproduce
The
metadata-interface.d.ts
file contains incorrect documentation regarding the structure of the alternates property within the Metadata type. The example provided useshreflang
to define alternate languages, which contradicts the actual interface definition that expects alanguages
property.Current vs. Expected behavior
Show a correct example.
Provide environment information
Which area(s) are affected? (Select all that apply)
TypeScript (plugin, built-in types)
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)
Additional context
No response