typescript 开发环境搭建

参考资料

环境搭建参考资料

【工程搭建】从零搭建一个 typescript + express + eslint 工程

typescript 的路径别名问题详解与前世今生

TypeScript 如何在 TypeScript React 项目中使用 eslint import 插件启用绝对路径别名

在TypeScript项目中使用ESLint,看这篇就够了

VS Code下Eslint+Prettier+TypeScript一步到位(规范配置)

IDEA和VS code设置默认换行符为LF

日志配置

Node.js 的日志系统指南

Node.js 日志之winston使用指南

api 文档生成

使用 TypeDoc 自动为 TypeScript 项目生成 API 文档

规范你的Typescript注释,一步一步教你生成API文档

单元测试

TypeScript实战-26-Jest单元测试

代码地址

https://gitee.com/bzrj/thresh-doc/tree/master/thresh-doc-server

效果

debug

image

测试

import { sayHello } from '@/util/greet'

test('sayHello_test', () => {
    expect(sayHello('world')).toEqual('Hello from world')
})
E:\gitee\bzrj\thresh-doc\thresh-doc-server>npm run test

> thresh-doc-server@1.0.0 test
> jest

 PASS  test/greet.test.ts
  √ sayHello_test (11 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        1.116 s, estimated 2 s
Ran all test suites.

E:\gitee\bzrj\thresh-doc\thresh-doc-server>

运行

E:\gitee\bzrj\thresh-doc\thresh-doc-server>npm run dev

> thresh-doc-server@1.0.0 dev
> ts-node -r tsconfig-paths/register --files ./src/main.ts

2024-06-26 21:25:26:2526 info src/main.ts:40 - parse md files
2024-06-26 21:25:26:2526 info src/main.ts:8 - say hello

E:\gitee\bzrj\thresh-doc\thresh-doc-server>
posted @ 2024-06-26 21:26  潼关路边的一只野鬼  阅读(5)  评论(0编辑  收藏  举报