From 9f2f4e220a67b9fbfd525ca404779aa5ef4af814 Mon Sep 17 00:00:00 2001 From: Yelllodas <50369475+Yellodas@users.noreply.github.com> Date: Mon, 23 Sep 2024 10:08:54 +0800 Subject: [PATCH] Update typescript.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 再按教程学习时,再进行”Hello TypeScript“这一章节的时候,安装了npm install -D typescript ts-node,但是没有创建tsconfig.json,报了一些额外的错误。希望将”了解tsconfig.json“这一章节提到前面,避免这些错误。 --- docs/typescript.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/typescript.md b/docs/typescript.md index 3a3f624..d2d3514 100644 --- a/docs/typescript.md +++ b/docs/typescript.md @@ -93,6 +93,23 @@ npm install -D typescript ts-node } ``` +3. 配置 TypeScript 在编译过程中的一些选项 + +在 hello-node 的根目录下创建一个名为 tsconfig.json 的文件,这是 TypeScript 的配置文件,写入以下内容: + +```json +{ + "compilerOptions": { + "target": "es6", + "module": "es6", + "outDir": "./dist", + "skipLibCheck": true + } +} +``` + +这份配置是将 ts 编译成的 js 文件,可以在 [tsconfig.json](#了解-tsconfig-json) 了解更多。 + 准备工作完毕! :::tip