Next.js Discord

Discord Forum

font weight doesnt support 500 and 600 for noto serif next font

Unanswered
phú phùng posted this in #help-forum
Open in Discord
so in my previous project , i want to use noto serif import from next font but it seems to only accept 2 font weight which are 400 and 700 , but i already check this font in google fonts website and it support various of font weights , the list of font weight comes from 100 to 900 , how can i handle this ?

the code : import {
Noto_Serif_Display,
Noto_Serif,
Open_Sans,
Inter,
} from 'next/font/google'

export const noto_serif_display = Noto_Serif_Display({
subsets: ['vietnamese'],
display: 'swap',
variable: '--font-noto-serif-display',
weight: ['400', '600', '700'],
})

export const noto_serif = Noto_Serif({
display: 'swap',
variable: '--font-noto-serif',
weight: ['400','500','600']
subsets: ['vietnamese'],
})

export const open_sans = Open_Sans({
subsets: ['vietnamese'],
display: 'swap',
variable: '--font-open-sans',
weight: ['400', '500', '600', '700'],
})

export const inter = Inter({
subsets: ['vietnamese'],
display: 'swap',
variable: '--font-inter',
})


the error :
Type '("400" | "500" | "600" | "700")[]' is not assignable to type '"400" | "700" | ("400" | "700")[]'.
Type '("400" | "500" | "600" | "700")[]' is not assignable to type '("400" | "700")[]'.
Type '"400" | "500" | "600" | "700"' is not assignable to type '"400" | "700"'.
Type '"500"' is not assignable to type '"400" | "700"'.ts(2322)
index.d.ts(10116, 5): The expected type comes from property 'weight' which is declared here on type '{ weight: "400" | "700" | ("400" | "700")[]; style?: "normal" | "italic" | ("normal" | "italic")[] | undefined; display?: Display | undefined; variable?: "--font-noto-serif" | undefined; preload?: boolean | undefined; fallback?: string[] | undefined; adjustFontFallback?: boolean | undefined; subsets?: ("cyrillic" | ...'
(property) weight: "400" | "700" | ("400" | "700")[]

0 Replies