Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typescript.md to describe how to use typescript types without module bundler (closes #2042) #2137

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/v2/guide/typescript.md
Expand Up @@ -70,6 +70,18 @@ const Component = {
}
```

To use vue types in environment without module bundler you can create custom type definition file containing declare global (see https://www.typescriptlang.org/docs/handbook/declaration-merging.html)
realmerx marked this conversation as resolved.
Show resolved Hide resolved

``` ts
//global.d.ts - name does not matter
import { VueConstructor } from 'vue'

declare global {
const Vue: VueConstructor
}
```


## Class-Style Vue Components

If you prefer a class-based API when declaring components, you can use the officially maintained [vue-class-component](https://github.com/vuejs/vue-class-component) decorator:
Expand Down