Hi Markus,
It did not work for me. I keep getting:
• client
/home/kanmii/projects/sapper-with-ts-sample/src/routes/index.svelte
'title' is not defined
38:
39: <svelte:head>
40: <title>{title}</title>
^
41: </svelte:head>
42:
• server
/home/kanmii/projects/sapper-with-ts-sample/src/routes/index.svelte
'title' is not defined
38:
39: <svelte:head>
40: <title>{title}</title>
^
41: </svelte:head>
Do you have a github repo I can clone demonstrating how to use typescript with svelte?
Is it possible to move the
hellovariable declaration to another typescript file?I tried putting this in
src/hello.ts:But importing from
index.svelte:Produces an error:
But it works fine if I don't use
.tsfile ...What you can do if you want to write your TypeScript code to an extra file:
Add this to your
index.svelte:And in your
src/hello.ts:Hi Markus,
It did not work for me. I keep getting:
Do you have a github repo I can clone demonstrating how to use typescript with svelte?
You can create a
src/components/hello.tsfileAnd import it in
src/routes/index.sveltewithOr in
src/components/hello.ts:with in
src/routes/index.svelte: