Skip to content

Commit 5516e05

Browse files
committed
Some TS syntax fixes
1 parent a6a9212 commit 5516e05

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

MyApp.Client/src/components/Files.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ const to = {
3333
function parseFileStructure(ascii:string, indent:number = 2) {
3434
const lines = ascii.split('\n')
3535
const root = { _: [] }
36-
const stack = [root]
36+
const stack: any[] = [root]
3737
3838
for (const line of lines) {
3939
const depth = line.search(/\S/) / indent
4040
const name = line.trim()
41-
const parent:{[name:string]:any} = stack[depth]
41+
const parent:{[name:string]:any} = stack[depth]!
4242
const isDir = name.startsWith('/')
4343
4444
if (isDir) {

MyApp.Client/src/main.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { createHead } from '@unhead/vue/client'
66
import App from './App.vue'
77

88
import ServiceStackVue from "@servicestack/vue"
9-
import { createRouter, createWebHistory } from 'vue-router/auto'
9+
import { createRouter, createWebHistory } from 'vue-router'
10+
import type { RouteLocationNormalized } from 'vue-router'
1011
import { routes } from 'vue-router/auto-routes'
1112
import { setupLayouts } from 'virtual:generated-layouts'
1213
import { createPinia } from "pinia"
@@ -33,7 +34,7 @@ routes.forEach((route:any) => {
3334
export const router = configRouter(createRouter({
3435
history: createWebHistory(),
3536
// Scroll to top on navigation
36-
scrollBehavior(to, _from, savedPosition) {
37+
scrollBehavior(to: RouteLocationNormalized, _from: RouteLocationNormalized, savedPosition: any) {
3738
if (savedPosition) {
3839
return savedPosition
3940
}
@@ -45,7 +46,7 @@ export const router = configRouter(createRouter({
4546
}, 1)
4647
}
4748
},
48-
routes: setupLayouts(routes)
49+
routes: setupLayouts(routes as any)
4950
}))
5051
// handle external links
5152
router.beforeEach((to, _from, next) => {

MyApp.Client/src/pages/blog.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ function authorProfileUrl(name:string) {
165165
}
166166
167167
const posts:Post[] = press.blog.posts
168-
const primaryPost:Post = posts[0]
169-
const postAuthor = primaryPost.author
168+
const primaryPost:Post = posts[0]!
169+
const postAuthor = primaryPost?.author
170170
const gridPosts = posts.slice(1, 7)
171171
const remainingPosts = posts.slice(7, 22)
172172
</script>

MyApp.Client/src/pages/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,6 @@ function authorProfileUrl(name:string) {
132132
}
133133
134134
const posts:Post[] = press.blog.posts
135-
const primaryPost:Post = posts[0]
136-
const postAuthor = primaryPost.author
135+
const primaryPost:Post = posts[0]!
136+
const postAuthor = primaryPost?.author
137137
</script>

0 commit comments

Comments
 (0)