From 5ed37028932c8fa7d08464ef6dd2b77d41acb3d6 Mon Sep 17 00:00:00 2001 From: realmerx Date: Mon, 22 Apr 2019 17:20:49 +0300 Subject: [PATCH 1/3] Update typescript.md --- src/v2/guide/typescript.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/v2/guide/typescript.md b/src/v2/guide/typescript.md index 26f5fabb48..1637163b12 100644 --- a/src/v2/guide/typescript.md +++ b/src/v2/guide/typescript.md @@ -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) + +``` 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: From b019a7c8928fd2e8a914f1b5a5f87e3c3e8b4bdb Mon Sep 17 00:00:00 2001 From: Phan An Date: Mon, 22 Apr 2019 17:37:49 +0300 Subject: [PATCH 2/3] Update src/v2/guide/typescript.md with info how to use Vue types without module bundler grammar fixes by phanan Co-Authored-By: realmerx --- src/v2/guide/typescript.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/v2/guide/typescript.md b/src/v2/guide/typescript.md index 1637163b12..dc7295a6c3 100644 --- a/src/v2/guide/typescript.md +++ b/src/v2/guide/typescript.md @@ -70,7 +70,8 @@ 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) +To use Vue types in an environment without a module bundler, you can create a custom type definition file containing `declared global` (see [Declaration Merging +](https://www.typescriptlang.org/docs/handbook/declaration-merging.html)). ``` ts //global.d.ts - name does not matter From 6e6891eeb139c6dc712169359677e1bf72dd3c4b Mon Sep 17 00:00:00 2001 From: realmerx Date: Mon, 22 Apr 2019 18:14:33 +0300 Subject: [PATCH 3/3] Update typescript.md --- src/v2/guide/typescript.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/v2/guide/typescript.md b/src/v2/guide/typescript.md index dc7295a6c3..d171b167bd 100644 --- a/src/v2/guide/typescript.md +++ b/src/v2/guide/typescript.md @@ -70,8 +70,7 @@ const Component = { } ``` -To use Vue types in an environment without a module bundler, you can create a custom type definition file containing `declared global` (see [Declaration Merging -](https://www.typescriptlang.org/docs/handbook/declaration-merging.html)). +To use Vue types in an environment without a module bundler, you can create a custom type definition file containing `declare global` (see [Declaration Merging https://www.typescriptlang.org/docs/handbook/declaration-merging.html](https://www.typescriptlang.org/docs/handbook/declaration-merging.html)). ``` ts //global.d.ts - name does not matter