-
-
Notifications
You must be signed in to change notification settings - Fork 597
Closed
Labels
Description
Info
- Platform: macOS
- Vetur version: 0.11.3
- VS Code version: 1.18.1
Problem
I tried to use *.vue
with `<script lang="tsx"> for SFC, and located a bug(may be) in ts-loader, and issued a PR to fix it. Demo for test is running well.
But there has been some of intellisense and highlight issues:
// if use lang=tsx, the "string" type notation is not highlight,
//and this.msg can't be derived to a string type
// if use lang=ts, hightlight and type derivation works well,
// but this.msg alone is still derived as any and cause an error,
// and jsx syntax is not allowed in lang=ts
computed: {
testMsg: function ():string {
return (this as any).msg + ' powered by typescript & tsx'
}
},
And in render function, data
and computed
and maybe others all can't be found on this
.
Another problem is that, I wrote a jsx.d.ts:
// ./src/types/jsx.d.ts
import Vue, { VNode } from 'vue'
declare global {
namespace JSX {
interface Element extends VNode {}
interface ElementClass extends Vue {}
interface ElementAttributesProperty {
$props: {}
}
interface IntrinsicElements {
[elemName: string]: any
}
}
}
But that seems like only take an effect on *.tsx
files, not on *.vue
's <script lant="tsx"> region, I had to write above code again in *.vue
. This may not be a bug on vetur, but I can't figure out a way to resolve it.