Skip to content

Commit

Permalink
@next/font return types (#42753)
Browse files Browse the repository at this point in the history
Currently the return type is the same when you declare a variable and
when you don't.
```tsx
const inter1 = Inter()
const inter2 = Inter({ variable: "--inter-font" })

inter1.variable // string | undefined
inter2.variable // string | undefined
```

With this change you get a type error if you try to access `.variable`
without providing a variable name.
```tsx
const inter1 = Inter()
const inter2 = Inter({ variable: "--inter-font" })

inter1.variable // Property 'variable' does not exist on type 'NextFont'.ts(2339)
inter2.variable // string
```

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
  • Loading branch information
Hannes Bornö committed Nov 10, 2022
1 parent 784d9a7 commit 6ab52ed
Show file tree
Hide file tree
Showing 6 changed files with 7,632 additions and 4,437 deletions.
127 changes: 120 additions & 7 deletions packages/font/src/google/font-data.json
Expand Up @@ -1574,6 +1574,12 @@
],
"styles": ["normal"],
"axes": [
{
"tag": "slnt",
"min": -11,
"max": 11,
"defaultValue": 0
},
{
"tag": "wght",
"min": 200,
Expand Down Expand Up @@ -2760,6 +2766,10 @@
"weights": ["400"],
"styles": ["normal"]
},
"Fragment Mono": {
"weights": ["400"],
"styles": ["normal", "italic"]
},
"Francois One": {
"weights": ["400"],
"styles": ["normal"]
Expand Down Expand Up @@ -3449,6 +3459,10 @@
"weights": ["100", "200", "300", "400", "500", "600", "700"],
"styles": ["normal"]
},
"IBM Plex Sans JP": {
"weights": ["100", "200", "300", "400", "500", "600", "700"],
"styles": ["normal"]
},
"IBM Plex Sans KR": {
"weights": ["100", "200", "300", "400", "500", "600", "700"],
"styles": ["normal"]
Expand Down Expand Up @@ -4780,6 +4794,18 @@
"weights": ["400"],
"styles": ["normal"]
},
"Marhey": {
"weights": ["300", "400", "500", "600", "700", "variable"],
"styles": ["normal"],
"axes": [
{
"tag": "wght",
"min": 300,
"max": 700,
"defaultValue": 400
}
]
},
"Markazi Text": {
"weights": ["400", "500", "600", "700", "variable"],
"styles": ["normal"],
Expand Down Expand Up @@ -4869,8 +4895,16 @@
"styles": ["normal"]
},
"Merienda": {
"weights": ["400", "700"],
"styles": ["normal"]
"weights": ["300", "400", "500", "600", "700", "800", "900", "variable"],
"styles": ["normal"],
"axes": [
{
"tag": "wght",
"min": 300,
"max": 900,
"defaultValue": 400
}
]
},
"Merienda One": {
"weights": ["400"],
Expand Down Expand Up @@ -5547,8 +5581,16 @@
]
},
"Noto Sans Bassa Vah": {
"weights": ["400"],
"styles": ["normal"]
"weights": ["400", "500", "600", "700", "variable"],
"styles": ["normal"],
"axes": [
{
"tag": "wght",
"min": 400,
"max": 700,
"defaultValue": 400
}
]
},
"Noto Sans Batak": {
"weights": ["400"],
Expand Down Expand Up @@ -6106,6 +6148,35 @@
}
]
},
"Noto Sans Lao Looped": {
"weights": [
"100",
"200",
"300",
"400",
"500",
"600",
"700",
"800",
"900",
"variable"
],
"styles": ["normal"],
"axes": [
{
"tag": "wdth",
"min": 62.5,
"max": 100,
"defaultValue": 100
},
{
"tag": "wght",
"min": 100,
"max": 900,
"defaultValue": 400
}
]
},
"Noto Sans Lepcha": {
"weights": ["400"],
"styles": ["normal"]
Expand Down Expand Up @@ -6234,6 +6305,10 @@
}
]
},
"Noto Sans Mende Kikakui": {
"weights": ["400"],
"styles": ["normal"]
},
"Noto Sans Meroitic": {
"weights": ["400"],
"styles": ["normal"]
Expand Down Expand Up @@ -6300,8 +6375,16 @@
"styles": ["normal"]
},
"Noto Sans New Tai Lue": {
"weights": ["400"],
"styles": ["normal"]
"weights": ["400", "500", "600", "700", "variable"],
"styles": ["normal"],
"axes": [
{
"tag": "wght",
"min": 400,
"max": 700,
"defaultValue": 400
}
]
},
"Noto Sans Newa": {
"weights": ["400"],
Expand Down Expand Up @@ -7153,6 +7236,18 @@
}
]
},
"Noto Serif Oriya": {
"weights": ["400", "500", "600", "700", "variable"],
"styles": ["normal"],
"axes": [
{
"tag": "wght",
"min": 400,
"max": 700,
"defaultValue": 400
}
]
},
"Noto Serif SC": {
"weights": ["200", "300", "400", "500", "600", "700", "900"],
"styles": ["normal"]
Expand Down Expand Up @@ -8996,6 +9091,24 @@
"weights": ["400"],
"styles": ["normal"]
},
"Sono": {
"weights": ["200", "300", "400", "500", "600", "700", "800", "variable"],
"styles": ["normal"],
"axes": [
{
"tag": "MONO",
"min": 0,
"max": 1,
"defaultValue": 1
},
{
"tag": "wght",
"min": 200,
"max": 800,
"defaultValue": 400
}
]
},
"Sonsie One": {
"weights": ["400"],
"styles": ["normal"]
Expand Down Expand Up @@ -9985,7 +10098,7 @@
"styles": ["normal"]
},
"Zen Old Mincho": {
"weights": ["400", "700", "900"],
"weights": ["400", "500", "600", "700", "900"],
"styles": ["normal"]
},
"Zen Tokyo Zoo": {
Expand Down

0 comments on commit 6ab52ed

Please sign in to comment.