@hexeo/vue-typescript-jsx

Translate React JSX props into Vue VDOM data format at runtime
505 4
Install
npm install @hexeo/vue-typescript-jsx
Latest Version:2.0.2
Vue:2
License:MIT
Last Updated:Mar 28, 2019
Links: GitHub  ·  npm
Maintainer: hexeo

vue-typescript-jsx

Usage

tsconfig.json

{
  "compilerOptions": {
    "jsx": "react",
    "jsxFactory": "h",
  }
}
import Vue from 'vue'
import VueTSX from 'vue-typescript-jsx'

Vue.use(VueTSX)

...

Limitations

Spread/Merge props

Spread and merge of props are not supported by typescript compiler.

<div class="a" {...{class: 'b'}} />

This will not result in

{
  class: {
    a: true,
    b: true
  }
}

but in

{
  class: 'b'
}

input, textarea, options, select literal values

Literal values will be passed to domProps-value.

<input value="some value" />

will generate the following in the VDOM Data

{
  domProps: {
    value: 'some value'
  }
}

h auto-injection

There is no h auto-injection, you should provide it.

render(h: Vue.CreateElement) {
  return <div />
}
get value() {
  const h = this.$createElement
  return <div />
}

Related Packages

vue-tsx-support

TSX (JSX for TypeScript) support library for Vue

99,098 566
vtsx

支持Typescript和JSX的Vue腳手架

1,212
esbuild-plugin-jsx

给esbuild用的vue3的jsx/tsx的解析插件

2,328 0
vue-cli-plugin-tsx-support

Enable TSX support for Vue.js

1,535 6

Version History

Version Released Vue License
2.0.2 ^2.6.10 MIT
2.0.1 ^2.6.10 MIT
2.0.0 ^2.5.17 MIT
1.0.5 ^2.4.2 MIT
1.0.4 ^2.4.2 MIT