New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ts-vue-plugin

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-vue-plugin

TypeScript Language Service Plugin for Vue

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
707
-33.36%
Maintainers
1
Weekly downloads
 
Created
Source

TypeScript Language Service Plugin for Vue

WARNING: This plugin is in an alpha state. For a more polished experience, try the VS Code plugin vetur. This plugin, however, works with the Typescript language service. So you can use it with whatever editor you want.

This plugin does three things for Javascript and Typescript source in a .vue file:

  • It uses vue-template-compiler to parse out the script section of a .vue file.
  • It wraps a default exported object literal in new Vue(...) in order to propagate the Vue contextual type so that no type annotations are needed.
  • It uses the Typescript language service to provide completions.

It also resolves import other from "other.vue"; statements in the same manner. It does not support completions in the template tag. It doesn't even support the template or style tags.

Features left to add

  • Recognise ES5-style module.exports = { ... in addition to ES6 export default { ....
  • Recognise only lang="javascript", lang="typescript" and no lang attribute. Others should not turn on the language service.

Instructions

  • $ npm install ts-vue-plugin
  • Add plugin to tsconfig.
{
  compilerOptions: {
    "allowSyntheticDefaultImports": true,
    "plugins": [{ "name": "ts-vue-plugin" }]
  }
}
  • Run the Select TypeScript version command in VS Code to use the workspace version of TypeScript. You can find more information about managing typescript versions in the VS Code documentation.

For example, in Emacs, add the line:

(add-to-list 'auto-mode-alist '("\\.vue$" . typescript-mode))

If you're Vim user, you can use tsuquyomi-vue.

Now you have typescript support inside the script tags. HTML and CSS support are non-existent right now.

Keywords

typescript

FAQs

Package last updated on 22 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts