├── .gitignore ├── .prettierrc ├── .vscode └── settings.json ├── README.md ├── lerna.json ├── package.json ├── packages ├── test │ ├── .babelrc │ ├── index.html │ ├── package.json │ ├── src │ │ ├── index.tsx │ │ ├── store-declaration.d.ts │ │ ├── store.ts │ │ └── storeModule.ts │ ├── tsconfig.json │ ├── webpack.config.js │ └── yarn.lock ├── vue-router │ ├── package.json │ ├── src │ │ └── index.js │ ├── typings │ │ ├── index.d.ts │ │ └── vue.d.ts │ └── yarn.lock ├── vue │ ├── package.json │ ├── src │ │ └── index.js │ ├── typings │ │ └── index.d.ts │ └── yarn.lock ├── vuetify │ ├── package.json │ ├── src │ │ └── index.js │ ├── typings │ │ └── index.d.ts │ └── yarn.lock └── vuex │ ├── package.json │ ├── src │ └── index.js │ ├── typings │ └── index.d.ts │ └── yarn.lock ├── tsconfig.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | 24 | # nyc test coverage 25 | .nyc_output 26 | 27 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 28 | .grunt 29 | 30 | # Bower dependency directory (https://bower.io/) 31 | bower_components 32 | 33 | # node-waf configuration 34 | .lock-wscript 35 | 36 | # Compiled binary addons (https://nodejs.org/api/addons.html) 37 | build/Release 38 | 39 | # Dependency directories 40 | node_modules/ 41 | jspm_packages/ 42 | 43 | # Optional npm cache directory 44 | .npm 45 | 46 | # Optional eslint cache 47 | .eslintcache 48 | 49 | # Optional REPL history 50 | .node_repl_history 51 | 52 | # Output of 'npm pack' 53 | *.tgz 54 | 55 | # Yarn Integrity file 56 | .yarn-integrity 57 | 58 | # dotenv environment variables file 59 | .env 60 | .env.test 61 | 62 | # parcel-bundler cache (https://parceljs.org/) 63 | .cache 64 | 65 | # next.js build output 66 | .next 67 | 68 | # nuxt.js build output 69 | .nuxt 70 | 71 | # vuepress build output 72 | .vuepress/dist 73 | 74 | # Serverless directories 75 | .serverless/ 76 | 77 | # FuseBox cache 78 | .fusebox/ 79 | 80 | # DynamoDB Local files 81 | .dynamodb/ 82 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "printWidth": 120, 5 | "tabWidth": 2, 6 | "useTabs": false, 7 | "semi": false, 8 | "singleQuote": true, 9 | "trailingComma": "all" 10 | } 11 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This Repository aims to add full TSX support to the existing [vuejs/jsx](https://github.com/vuejs/jsx) Babel preset. 2 | 3 | 4 | # Notes 5 | 6 | Keep in mind that this project is currently being developed. 7 | Expect bugs and unexpected behavior. 8 | 9 | DO NOT USE THIS IN PRODUCTION. 10 | 11 | Please feel free to open an Issue if you encounter problems, have a feature request or questions about the future of this project. 12 | 13 | Vue + TSX = ♥️ 14 | 15 | # Installation 16 | 17 | Install the package and babel preset with: 18 | 19 | ```bash 20 | npm install @vue-tsx/vue @vue/babel-preset-jsx 21 | ``` 22 | 23 | Then add the preset to `.babelrc`: 24 | 25 | ```json 26 | { 27 | "presets": ["@vue/babel-preset-jsx"] 28 | } 29 | ``` 30 | 31 | # Getting Started 32 | 33 | - [Mounting your app](#Mounting-your-app) 34 | - [Creating Class Component](#Creating-Class-Component) 35 | - [Define Component Props](#Define-Component-Props) 36 | - [Use Component in TSX](#Use-Component-in-TSX) 37 | - [Watch Method](#Watch-Method) 38 | - [Implement Router](#Implement-Router) 39 | - [Implement Vuex Store](#Implement-Vuex-Store) 40 | - [Use Vuex Store](#Use-Vuex-Store) 41 | 42 | external: 43 | - [syntax information](https://github.com/vuejs/jsx#syntax) 44 | - [difference to react JSX](https://github.com/vuejs/jsx/tree/dev/packages/babel-plugin-transform-vue-jsx#difference-from-react-jsx) 45 | - [component tip](https://github.com/vuejs/jsx/tree/dev/packages/babel-plugin-transform-vue-jsx#jsx-spread) 46 | - [JSX spread information](https://github.com/vuejs/jsx/tree/dev/packages/babel-plugin-transform-vue-jsx#jsx-spread) 47 | - [directives information](https://github.com/vuejs/jsx/tree/dev/packages/babel-plugin-transform-vue-jsx#vue-directives) 48 | 49 | --- 50 | ### Mounting your app 51 | 52 | ```jsx 53 | // import Vue Class 54 | import { Vue } from '@vue-tsx/vue'; 55 | 56 | new Vue({ 57 | // pass root element 58 | el: document.getElementById('app'), 59 | 60 | // implement render method 61 | render() { 62 | return
Hello World
63 | }, 64 | }) 65 | ``` 66 | 67 | --- 68 | ### Creating Class Component 69 | 70 | ```jsx 71 | // import Component Class 72 | import { Component } from '@vue-tsx/vue'; 73 | 74 | // extend Abstract Component 75 | export class Hello extends Component { 76 | 77 | // define data 78 | private text = 'Hello World' 79 | 80 | // implement render method 81 | render() { 82 | return
{JSON.stringify(this.$attrs)}40 | Hello 41 |