From 9baf2d293566dd2233ae1f7ef1aaaa4a1d5cbc61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=9D=E6=97=AC?= <1160030724@qq.com> Date: Tue, 12 Sep 2023 06:59:30 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/articles/TypeScript/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/articles/TypeScript/README.md b/docs/articles/TypeScript/README.md index a65107b..6cb0ea4 100644 --- a/docs/articles/TypeScript/README.md +++ b/docs/articles/TypeScript/README.md @@ -1033,6 +1033,26 @@ tom.run(); 任何包含 import 或 export 语句的文件,就是一个模块(module)。 +导入导出的语法和 ES6 一致,使用`export` 导出,使用`import`导入,ES6 支持的 TS 都支持。 + +### 导入 type 和 interface + +```ts +// a.ts export +export interface A { + foo: string; +} +export type B = String; +export const C = 123; +// b.ts import +import { type A, type B, C } from "./aa"; +const a: A = { foo: "12" }; +const b = "34"; +console.log(a, b, C); +``` + +## 装饰器 + ## 其他 ### 定义 window