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
Nice work, I was looking for a typescript implementation and found this, thanks.
I've got one issue: I don't get intellisense support for typescript inside the script tags of a .vue file.
Without intellisense, I make too many errors, so this annoyed me.
The vscode team has no plans yet to include support for imported variables, see #15377
I've got a possible solution, but for this we need to create a separate .ts file
Create a separate .ts file to hold your component's typescript code , for example Index.ts @Component({ props: { propMessage: String } }) export default class Index extends Vue { ....
In your Index.vue file make your script tag like this
<script lang="ts">
import Index from './Index.ts'
export default Index
</script>
We can now import this vue file in some other component code or router, just like it would be a single file
Now inside the .ts file, I get my intellisense.
If you've got another suggestion to get intellisense working inside the .vue file, I would be very glad to know.
The text was updated successfully, but these errors were encountered:
I always start with just one file and try to split components in sub components and so on.
By doing so, I have a lot of 'dump' components that actually don't need any backing .ts file at all.
But indeed, when a lot of typescript code pops up, I delegate the code to a dedicated ts file with the technique you suggest as well.
Pragmatism rules :)
Check also this approach without .vue files: https://github.com/ducksoupdev/vue-webpack-typescript
Hi Paul,
Nice work, I was looking for a typescript implementation and found this, thanks.
I've got one issue: I don't get intellisense support for typescript inside the script tags of a .vue file.
Without intellisense, I make too many errors, so this annoyed me.
The vscode team has no plans yet to include support for imported variables, see #15377
I've got a possible solution, but for this we need to create a separate .ts file
@Component({ props: { propMessage: String } }) export default class Index extends Vue { ....
In your Index.vue file make your script tag like this
We can now import this vue file in some other component code or router, just like it would be a single file
Now inside the .ts file, I get my intellisense.
If you've got another suggestion to get intellisense working inside the .vue file, I would be very glad to know.
The text was updated successfully, but these errors were encountered: