Binding problems
Closed this issue ยท 1 comments
walking through your fabulous post... using sveltekit@latest
when I got through to /src/routes/+page.server.ts (which doesn't appear to exist in the current repo ๐ค, even though it is documented in your article)
getting a typescript error on fetch
import type { Post } from '$lib/types'
export async function load({ fetch }){
const response = await fetch('api/posts')
const posts: Post[] = await response.json()
return { posts }
}
Binding element 'fetch' implicitly has an 'any' type.
continuing on through to /src/routes/[slug]/+page.ts
getting a similar typescript error, this time on params
import { error } from '@sveltejs/kit'
export async function load({ params }){
try {
const post = await import(`../../posts/${params.slug}.md`)
return {
content: post.default,
meta: post.metadata
}
} catch (e) {
error(404, 'Could not find ${parms.slug}')
}
}
Binding element 'params' implicitly has an 'any' type.
Later came again across typescript error on fetch in /src/routes/rss.xml/+server.ts
import * as config from '$lib/config'
import type { Post } from '$lib/types'
export async function GET({ fetch }) {
const response = await fetch('api/posts')
const posts: Post[] = await response.json()
// ...
}
Binding element 'fetch' implicitly has an 'any' type.
For reference, npm ls of packages and versions:
โโโ @fontsource/jetbrains-mono@5.0.19
โโโ @fontsource/manrope@5.0.19
โโโ @sveltejs/adapter-auto@3.2.0
โโโ @sveltejs/kit@2.5.5
โโโ @sveltejs/vite-plugin-svelte@3.0.2
โโโ @types/eslint@8.56.7
โโโ @typescript-eslint/eslint-plugin@7.5.0
โโโ @typescript-eslint/parser@7.5.0
โโโ eslint-config-prettier@9.1.0
โโโ eslint-plugin-svelte@2.35.1
โโโ eslint@8.57.0
โโโ lucide-svelte@0.364.0
โโโ mdsvex@0.11.0
โโโ open-props@1.7.0
โโโ prettier-plugin-svelte@3.2.2
โโโ prettier@3.2.5
โโโ rehype-slug@6.0.0
โโโ remark-toc@9.0.0
โโโ remark-unwrap-images@4.0.0
โโโ shiki@1.2.4
โโโ svelte-check@3.6.9
โโโ svelte@4.2.12
โโโ tslib@2.6.2
โโโ typescript@5.4.3
โโโ vite@5.2.8
Started over with
npm init svelte@2.5
and after some struggles, it is working, but gonna start adapting for svelte@latest (shown in previous post)