vue-typescript-import-dts

TypeScript declaration file that allows using 'import' with *.vue files
21,718 27
Install
npm install vue-typescript-import-dts
Latest Version:4.0.0
Vue:2
License:MIT
Last Updated:Apr 16, 2018
Links: GitHub  ·  npm
Maintainer: locoslab

vue-typescript-import-dts Build Status npm version

TypeScript declaration file that allows using import with *.vue files. The primary use case is a bundler environment like webpack. The file itself consists of 4 lines; this package is just for convenience.

Usage

This package requires TypeScript 2 and Vue.js 2, which ships with new type definitions in the Vue.js package itself. Both must be installed separately in your project, which allows choosing a suitable version.

  1. Install

    • npm install vue-typescript-import-dts --save-dev
  2. Import (one of):

    • Import this module before the import of a .vue file: import 'vue-typescript-import-dts'
    • ... or include it in the types field of your tsconfig.json to globally allow using import with .vue files in your project:
{
    "compilerOptions": {
        "types": ["vue-typescript-import-dts"],
...

Then, it is possible to import a *.vue file:

  • import Child from './child.vue'

Note: TypeScript will not type check, parse, or even verify the existence of the .vue file: this project only instructs the TypeScript compiler to assume the import of 'something' that ends with .vue succeeds and is a Vue object.

Shameless Plug

If you are using TypeScript 2 together with Vue.js 2, you might also be interested in

  • vue-typescript-jest to test Vue.js components and TypeScript sources using Jest
  • vue-jest-utils to simplify snapshot testing of Vue.js components using Jest and html2jade

License

MIT

Related Packages

omi-vueify

Bridge between omi and vue

31,156 13,277
laravel-elixir-vueify

Laravel Elixir Vueify Support

17,206 153
gulp-vueify

Compile .vue files using vueify

9,069 33
grunt-vueify

Translate `.vue` files to pure JavaScript, without using Browserify.

3,579 10
gulp-vueify2

Compile .vue files using vueify, with Vue2 and extractCSS support

2,714 13

Version History

Version Released License
4.0.0 MIT
3.1.1 MIT
3.1.0 MIT
3.0.1 MIT
3.0.0 MIT