DEV Community

Discussion on: Write Vue like you write React

Collapse
 
shinigami92 profile image
Shinigami • Edited

I tried this last week myself

Is there a way to get type/variable-name checking within the (j,t)sx part?

import { defineComponent } from '@vue/composition-api';
import type { VNode } from 'vue';

export default defineComponent({
  name: 'ComponentName',
  props: { label: String },
  render(): VNode {
    return <div>{ this.lable }</div>;
  }
});
Enter fullscreen mode Exit fullscreen mode

So in this example I misspelled label in the render function, but TSX doesn't provide me an error for that :(


Collapse
 
shinigami92 profile image
Shinigami

Seems I need at least something like this

interface Data {
  label: string;
}
export default defineComponent<unknown, Data, Data>( //...
Enter fullscreen mode Exit fullscreen mode

Then this.lable is an error