# vue-tsx-helper

> write better tsx for vue

Latest version **0.1.6** (published 2019-02-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-tsx-helper
pnpm add vue-tsx-helper
yarn add vue-tsx-helper
bun add vue-tsx-helper
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2019-02-19 |
| First published | 2018-02-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 32.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 6 |
| Author | wuxueqian |
| Maintainers | thundernet8 |
| Keywords | vue, typescript, jsx |

## Links

- npm: https://www.npmjs.com/package/vue-tsx-helper
- Repository: git@github.com:thundernet8/Vue-TSX-Helper
- npm.io page: https://npm.io/package/vue-tsx-helper

## Dependencies (1)

- [vue](https://npm.io/package/vue.md) ^2.5.13

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.6 (latest) — 2019-02-19
- 0.1.5 — 2019-02-18
- 0.1.3 — 2018-11-16
- 0.1.2 — 2018-02-12
- 0.1.1 — 2018-02-12
- 0.1.0 — 2018-02-12
- 0.0.3 — 2018-02-11
- 0.0.2 — 2018-02-11
- 0.0.1 — 2018-02-11

## README

<div align="center">

## Vue-TSX-Helper

**Write class-based Vue component with TypeScript .**

[![GitHub issues](https://img.shields.io/github/issues/thundernet8/Vue-TSX-Helper.svg)](https://github.com/thundernet8/Vue-TSX-Helper/issues)
[![GitHub forks](https://img.shields.io/github/forks/thundernet8/Vue-TSX-Helper.svg)](https://github.com/thundernet8/Vue-TSX-Helper/network)
[![GitHub stars](https://img.shields.io/github/stars/thundernet8/Vue-TSX-Helper.svg)](https://github.com/thundernet8/Vue-TSX-Helper/stargazers)
[![dependency status](https://img.shields.io/david/thundernet8/Vue-TSX-Helper.svg?maxAge=3600&style=flat)](https://david-dm.org/thundernet8/Vue-TSX-Helper)
[![Build Status](https://travis-ci.org/thundernet8/Vue-TSX-Helper.svg?branch=master)](https://travis-ci.org/thundernet8/Vue-TSX-Helper)
[![GitHub license](https://img.shields.io/github/license/thundernet8/Vue-TSX-Helper.svg)](https://github.com/thundernet8/Vue-TSX-Helper/blob/master/LICENSE)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

</div>

<br>

## Installation

```
npm install vue-tsx-helper
```

## Usage

A class-based Vue component sample

```typescript
// TestComponent.tsx

import { Component, Prop } from "vue-property-decorator";
import { VueComponent } from "vue-tsx-helper";

/**
 * Vue component props types
 */
interface IProps {
    msg: string;
}

const mixin = {
    created() {
        console.log("mixin created");
    }
};

@Component({
    name: "TestComponent",
    mixins: [mixin]
})
export default class TestComponent extends VueComponent<IProps> {
    @Prop() msg;

    created() {
        console.log("created");
    }

    render(h) {
        return <div class="container">{"parent message: " + this.msg}</div>;
    }
}
```

now import `TestComponent` in its parent

```typescript
// WrapTestComponent.tsx
import { Component, Prop } from "vue-property-decorator";
import { VueComponent } from "vue-tsx-helper";
import TestComponent from "./TestComponent";

/**
 * Vue component props types
 */
interface IProps {}

@Component
export default class WrapTestComponent extends VueComponent<IProps> {
    @Prop() msg;

    render(h) {
        return <TestComponent msg="msg from parent" />;
    }
}
```

For components supplied by other libraries, try:

```typescript
@Component
export default class WrapTestComponent extends VueComponent<{}> {
    @Prop() msg;

    render(h) {
        render <anyslot is="router-link" to="/">link</anyslot>
    }
}
```

## Screenshots

![intellisense1](screenshots/intellisense-1.png)

![intellisense2](screenshots/intellisense-2.png)

## Boilerplate

Visit [Vue-TS-Boilerplate](https://github.com/thundernet8/Vue-TS-Boilerplate) for a full demo.

---
_Source: https://npm.io/package/vue-tsx-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
