You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/preprocessors/typescript.md
-34
Original file line number
Diff line number
Diff line change
@@ -126,37 +126,3 @@ $: show = !!data.someKey; // <-- `show` now has type `boolean`
126
126
### Can I use TypeScript syntax inside the template/mustache tags?
127
127
128
128
At the moment, you cannot. Only `script`/`style` tags are preprocessed/transpiled. See [this issue](https://github.com/sveltejs/svelte/issues/4701) for more info.
129
-
130
-
### I get weird type errors on my html tags
131
-
132
-
This may be due to some library you are using having installed typings for `react`. These are picked up by the TypeScript compiler. Because we internally transform svelte to jsx, there is a clash and said error occurs.
The underlying [issue in TypeScript](https://github.com/microsoft/TypeScript/issues/18588) is yet to be fixed but in the meantime, one way to work around it is as follows:
137
-
138
-
1. Add a `sink.d.ts` with content `declare module 'react' {}`
139
-
2. Go to your `tsconfig.json`
140
-
3. If you do not have such a setting already, enhance `compilerOptions` with `"baseUrl": "."`
141
-
4. Enhance `compilerOptions` with `"paths": { "react": ["<path to your sink.d.ts, relative to the baseUrl>"] }`
142
-
143
-
`tsconfig.json`
144
-
145
-
```json
146
-
{
147
-
"compilerOptions": {
148
-
"baseUrl": ".",
149
-
"paths": {
150
-
"react": ["sink.d.ts"]
151
-
}
152
-
}
153
-
}
154
-
```
155
-
156
-
`sink.d.ts:`
157
-
158
-
```ts
159
-
declaremodule'react';
160
-
```
161
-
162
-
For more info see [this issue](https://github.com/sveltejs/language-tools/issues/228)
0 commit comments