Skip to content

Commit

Permalink
type check routes
Browse files Browse the repository at this point in the history
  • Loading branch information
arily committed Jul 25, 2023
1 parent 6272432 commit 16dbac8
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 9 deletions.
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default defineNuxtConfig({
'@nuxtjs/tailwindcss',
'@pinia/nuxt',
'nuxt-icon',
'nuxt-typed-router',
],

alias: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"mysql2": "^3.3.3",
"nuxt-animejs": "^2.0.0",
"nuxt-icon": "^0.4.1",
"nuxt-typed-router": "^3.2.5",
"sass": "^1.62.1",
"typescript": "5.1.3",
"vue-tsc": "^1.8.1"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/article/[...id].vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
const route = useRoute()
const route = useRoute('article-id')
const id = route.params.id
if (!id) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/beatmap/[id].server.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts" async>
const { id } = useRoute().params
const { id } = useRoute('beatmap-id.server').params
if (!id || Array.isArray(id)) {
createError('please provide valid id.')
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/beatmapset/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ definePageMeta({
})
const app$ = useNuxtApp()
const route = useRoute()
const route = useRoute('beatmapset-id')
const config = useAppConfig()
const { supportedModes, supportedRulesets, hasRankingSystem, hasRuleset }
= useAdapterConfig()
Expand Down
2 changes: 1 addition & 1 deletion src/pages/leaderboard/[[mode]].vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { SwitcherPropType } from '~/composables/useSwitcher'
const config = useAppConfig()
const route = useRoute()
const route = useRoute('leaderboard-mode')
const router = useRouter()
const app$ = useNuxtApp()
Expand Down
2 changes: 1 addition & 1 deletion src/pages/score/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { JsonViewer } from 'vue3-json-viewer'
import 'vue3-json-viewer/dist/index.css'
import { Rank } from '~/def'
const route = useRoute()
const route = useRoute('score-id')
const id = route.params.id.toString()
Expand Down
2 changes: 1 addition & 1 deletion src/store/userpage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default defineStore('userpage', () => {

const currentRankingSystem = shallowRef<ReturnType<typeof _computeRankingSystem> | null>(null)

const route = useRoute('user-handle')
async function refresh() {
const route = useRoute()
try {
const u = await app.$client.user.userpage.query({
handle: `${route.params.handle}`,
Expand Down
147 changes: 144 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==

"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13":
"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.15":
version "1.4.15"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
Expand Down Expand Up @@ -990,6 +990,29 @@
unimport "^3.0.10"
untyped "^1.3.2"

"@nuxt/kit@^3.6.1":
version "3.6.5"
resolved "https://registry.yarnpkg.com/@nuxt/kit/-/kit-3.6.5.tgz#208777acdc2a09109fbe4209aad736874eb9a3f5"
integrity sha512-uBI5I2Zx6sk+vRHU+nBmifwxg/nyXCGZ1g5hUKrUfgv1ZfiKB8JkN5T9iRoduDOaqbwM6XSnEl1ja73iloDcrw==
dependencies:
"@nuxt/schema" "3.6.5"
c12 "^1.4.2"
consola "^3.2.3"
defu "^6.1.2"
globby "^13.2.2"
hash-sum "^2.0.0"
ignore "^5.2.4"
jiti "^1.19.1"
knitwork "^1.0.0"
mlly "^1.4.0"
pathe "^1.1.1"
pkg-types "^1.0.3"
scule "^1.0.0"
semver "^7.5.3"
unctx "^2.3.1"
unimport "^3.0.14"
untyped "^1.3.2"

"@nuxt/postcss8@^1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@nuxt/postcss8/-/postcss8-1.1.3.tgz#a7f8f6f2a664430bbdd3b175498eb693e0b1b351"
Expand Down Expand Up @@ -1034,6 +1057,21 @@
unimport "^3.0.10"
untyped "^1.3.2"

"@nuxt/[email protected]":
version "3.6.5"
resolved "https://registry.yarnpkg.com/@nuxt/schema/-/schema-3.6.5.tgz#c66cf331625b41a01d510bd9e0f1227e1ff8664a"
integrity sha512-UPUnMB0W5TZ/Pi1fiF71EqIsPlj8LGZqzhSf8wOeh538KHwxbA9r7cuvEUU92eXRksOZaylbea3fJxZWhOITVw==
dependencies:
defu "^6.1.2"
hookable "^5.5.3"
pathe "^1.1.1"
pkg-types "^1.0.3"
postcss-import-resolver "^2.0.0"
std-env "^3.3.3"
ufo "^1.1.2"
unimport "^3.0.14"
untyped "^1.3.2"

"@nuxt/telemetry@^2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@nuxt/telemetry/-/telemetry-2.2.0.tgz#99b79173f4f2aa6af445b4d6e6e1f30b73cdcd65"
Expand Down Expand Up @@ -2865,6 +2903,11 @@ chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

chalk@^5.0.0, chalk@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385"
integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==

chalk@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3"
Expand Down Expand Up @@ -3171,6 +3214,11 @@ consola@^3.0.1, consola@^3.1.0:
resolved "https://registry.yarnpkg.com/consola/-/consola-3.1.0.tgz#dfdfa62ceb68bc1f06e4a76ad688566bd8813baf"
integrity sha512-rrrJE6rP0qzl/Srg+C9x/AE5Kxfux7reVm1Wh0wCjuXvih6DqZgqDZe8auTD28fzJ9TF0mHlSDrPpWlujQRo1Q==

consola@^3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/consola/-/consola-3.2.3.tgz#0741857aa88cfa0d6fd53f1cff0375136e98502f"
integrity sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==

console-control-strings@^1.0.0, console-control-strings@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
Expand Down Expand Up @@ -4397,6 +4445,17 @@ fast-glob@^3.2.11, fast-glob@^3.2.12, fast-glob@^3.2.7, fast-glob@^3.2.9:
merge2 "^1.3.0"
micromatch "^4.0.4"

fast-glob@^3.3.0:
version "3.3.1"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4"
integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==
dependencies:
"@nodelib/fs.stat" "^2.0.2"
"@nodelib/fs.walk" "^1.2.3"
glob-parent "^5.1.2"
merge2 "^1.3.0"
micromatch "^4.0.4"

fast-json-stable-stringify@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
Expand Down Expand Up @@ -4931,6 +4990,17 @@ globby@^13.1.4, globby@^13.2.0:
merge2 "^1.4.1"
slash "^4.0.0"

globby@^13.2.2:
version "13.2.2"
resolved "https://registry.yarnpkg.com/globby/-/globby-13.2.2.tgz#63b90b1bf68619c2135475cbd4e71e66aa090592"
integrity sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==
dependencies:
dir-glob "^3.0.1"
fast-glob "^3.3.0"
ignore "^5.2.4"
merge2 "^1.4.1"
slash "^4.0.0"

good-listener@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50"
Expand Down Expand Up @@ -5669,7 +5739,7 @@ is-unicode-supported@^0.1.0:
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==

is-unicode-supported@^1.2.0:
is-unicode-supported@^1.1.0, is-unicode-supported@^1.2.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz#d824984b616c292a2e198207d4a609983842f714"
integrity sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==
Expand Down Expand Up @@ -5722,6 +5792,11 @@ jiti@^1.18.2:
resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.18.2.tgz#80c3ef3d486ebf2450d9335122b32d121f2a83cd"
integrity sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg==

jiti@^1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.19.1.tgz#fa99e4b76a23053e0e7cde098efe1704a14c16f1"
integrity sha512-oVhqoRDaBXf7sjkll95LHVS6Myyyb1zaunVwk4Z0+WPSW4gjS0pl01zYKHScTuyEhQsFxV5L4DR5r+YqSyqyyg==

joi@^17.7.0:
version "17.9.2"
resolved "https://registry.yarnpkg.com/joi/-/joi-17.9.2.tgz#8b2e4724188369f55451aebd1d0b1d9482470690"
Expand Down Expand Up @@ -6002,7 +6077,7 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"

lodash-es@latest:
lodash-es@^4.17.21, lodash-es@latest:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
Expand Down Expand Up @@ -6105,6 +6180,14 @@ log-symbols@^4.1.0:
chalk "^4.1.0"
is-unicode-supported "^0.1.0"

log-symbols@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-5.1.0.tgz#a20e3b9a5f53fac6aeb8e2bb22c07cf2c8f16d93"
integrity sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==
dependencies:
chalk "^5.0.0"
is-unicode-supported "^1.1.0"

logform@^2.3.2, logform@^2.4.0:
version "2.5.1"
resolved "https://registry.yarnpkg.com/logform/-/logform-2.5.1.tgz#44c77c34becd71b3a42a3970c77929e52c6ed48b"
Expand Down Expand Up @@ -6189,6 +6272,13 @@ magic-string@^0.30.0:
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.13"

magic-string@^0.30.1:
version "0.30.1"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.1.tgz#ce5cd4b0a81a5d032bd69aab4522299b2166284d"
integrity sha512-mbVKXPmS0z0G4XqFDCTllmDQ6coZzn94aMlb0o/A4HEHJCKcanlDZwYJgwnkmgD3jyWhUgj9VsPrfd972yPffA==
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.15"

magicast@^0.2.8:
version "0.2.9"
resolved "https://registry.yarnpkg.com/magicast/-/magicast-0.2.9.tgz#9b5de1c6ba40b3fa626834017f0f11800a033cbe"
Expand Down Expand Up @@ -6490,6 +6580,11 @@ mkdirp@^1.0.3:
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==

mkdirp@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50"
integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==

mlly@^1.2.0, mlly@^1.2.1, mlly@^1.3.0, mlly@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/mlly/-/mlly-1.4.0.tgz#830c10d63f1f97bd8785377b24dc2a15d972832b"
Expand Down Expand Up @@ -6886,6 +6981,20 @@ nuxt-icon@^0.4.1:
"@iconify/vue" "^4.1.1"
"@nuxt/kit" "^3.5.0"

nuxt-typed-router@^3.2.5:
version "3.2.5"
resolved "https://registry.yarnpkg.com/nuxt-typed-router/-/nuxt-typed-router-3.2.5.tgz#bd640e92e2732b73a7c6671d2b5cf605c4b66464"
integrity sha512-E2CPfEioyzeISaVSlDottH1sV41wog952nfoChAj9tGLAc76NUHpbKeZ2SCGma3HUjozwehiiqffmGq/LTCEJA==
dependencies:
"@nuxt/kit" "^3.6.1"
chalk "^5.3.0"
defu "^6.1.2"
lodash-es "^4.17.21"
log-symbols "^5.1.0"
mkdirp "^3.0.1"
nanoid "^4.0.2"
pathe "1.1.0"

nuxt@^3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/nuxt/-/nuxt-3.5.3.tgz#2997a62b8c1088c4b8eeae358838732f5dad0653"
Expand Down Expand Up @@ -7315,6 +7424,11 @@ path-type@^4.0.0:
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==

[email protected]:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.0.tgz#e2e13f6c62b31a3289af4ba19886c230f295ec03"
integrity sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w==

pathe@^1.0.0, pathe@^1.1.0, pathe@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.1.tgz#1dd31d382b974ba69809adc9a7a347e65d84829a"
Expand Down Expand Up @@ -9305,6 +9419,23 @@ unimport@^3.0.10:
strip-literal "^1.0.1"
unplugin "^1.3.1"

unimport@^3.0.14:
version "3.1.0"
resolved "https://registry.yarnpkg.com/unimport/-/unimport-3.1.0.tgz#161289bc0e4947da3e192f40a1657067cc84a442"
integrity sha512-ybK3NVWh30MdiqSyqakrrQOeiXyu5507tDA0tUf7VJHrsq4DM6S43gR7oAsZaFojM32hzX982Lqw02D3yf2aiA==
dependencies:
"@rollup/pluginutils" "^5.0.2"
escape-string-regexp "^5.0.0"
fast-glob "^3.3.0"
local-pkg "^0.4.3"
magic-string "^0.30.1"
mlly "^1.4.0"
pathe "^1.1.1"
pkg-types "^1.0.3"
scule "^1.0.0"
strip-literal "^1.0.1"
unplugin "^1.4.0"

unimport@^3.0.6, unimport@^3.0.7:
version "3.0.8"
resolved "https://registry.yarnpkg.com/unimport/-/unimport-3.0.8.tgz#f77faa0468f3390844899040849c051570736e3f"
Expand Down Expand Up @@ -9382,6 +9513,16 @@ unplugin@^1.3.1:
webpack-sources "^3.2.3"
webpack-virtual-modules "^0.5.0"

unplugin@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/unplugin/-/unplugin-1.4.0.tgz#b771373aa1bc664f50a044ee8009bd3a7aa04d85"
integrity sha512-5x4eIEL6WgbzqGtF9UV8VEC/ehKptPXDS6L2b0mv4FRMkJxRtjaJfOWDd6a8+kYbqsjklix7yWP0N3SUepjXcg==
dependencies:
acorn "^8.9.0"
chokidar "^3.5.3"
webpack-sources "^3.2.3"
webpack-virtual-modules "^0.5.0"

unstorage@^1.6.0:
version "1.6.1"
resolved "https://registry.yarnpkg.com/unstorage/-/unstorage-1.6.1.tgz#144ea7d36852b69b74009e3bafa947154f6ac2c0"
Expand Down

0 comments on commit 16dbac8

Please sign in to comment.