@chatie/tsconfig

中文文档
4.9.2发布于 2023/03/07Apache-2.0ESM + CJS近 30 天下载 3707

tsconfig.json inheritance via Node.js packages

原始使用文档
文档目录14 节
  1. USAGE
  2. CAUTION
  3. SEE ALSO
  4. DEPENDENCES
  5. HISTORY
  6. master
  7. v4.9 (Jan 11, 2023)
  8. v4.6 (Nov 27, 2021)
  9. v1.0 (Oct 24, 2021)
  10. v0.10 Apr 2020
  11. v0.6 June 08 2019
  12. v0.4 May 14 2019
  13. AUTHOR
  14. COPYRIGHT & LICENSE

tsconfig

NPM Version npm (tag) Build Status

tsconfig.json

Picture: What is tsconfig.json

Reusable TypeScript configuration files to extend from.

This module enables other module to inheritance tsconfig.json via Node.js packages

USAGE

Extends from @chatie/tsconfig from your tsconfig.json, to have the chatie version of the TypeScript Configuration.

It aim the following goals:

  1. Support the latest esnext ECMAScript
  2. Targeting for ES6
  3. Strict for everything
  4. Aiming for Convenience, including the esModuleInterop and resolveJsonModule etc.

CAUTION

Do not put any directory related configurations into this module. Only put directory related configurations to the consumer of this module.

Because all directory in tsconfig.json is related to the curfrent directory.

SEE ALSO

TypeScript 3.2 now resolves tsconfig.jsons from node_modules. When using a bare path for the "extends" field in tsconfig.json, TypeScript will dive into node_modules packages for us.

{
    "extends": "@my-team/tsconfig-base",
    "include": ["./**/*"]
    "compilerOptions": {
        // Override certain options on a project-by-project basis.
        "strictBindCallApply": false,
    }
}

Here, TypeScript will climb up node_modules folders looking for a @my-team/tsconfig-base package. For each of those packages, TypeScript will first check whether package.json contains a "tsconfig" field, and if it does, TypeScript will try to load a configuration file from that field. If neither exists, TypeScript will try to read from a tsconfig.json at the root. This is similar to the lookup process for .js files in packages that Node uses, and the .d.ts lookup process that TypeScript already uses.

This feature can be extremely useful for bigger organizations, or projects with lots of distributed dependencies.

DEPENDENCES

This module will run a unit test before it could be able to publish to NPM.

The unit test load tsconfig schema from JSON Schema Store and then use is-my-json-valid to validate it.

HISTORY

master

v4.9 (Jan 11, 2023)

  1. Requires Node.js v18 or above
  2. Requires NPM v9 or above
  3. Upgrade to TypeScript 4.9

v4.6 (Nov 27, 2021)

Speed up ts-node with Rust TypeScript runtime.

  1. add ts-node.transpileOnly: true
  2. add ts-node.transpiler: "ts-node/transpilers/swc-experimental"

v1.0 (Oct 24, 2021)

Major changes

  1. Default ES Modules: "module": "es2020"
  2. Default "target": "es2020"
  3. TypeScript version 4.4

Minor changes

  1. Add "isolatedModules": true
  2. Add "importsNotUsedAsValues": "error"
  3. Add "moduleResolution": "node"

See: Intro to the TSConfig Reference:

v0.10 Apr 2020

  1. Add dom to lib in tsconfig.json

v0.6 June 08 2019

  1. Auto generate tsconfig.json in project root directory after install if it not exists.

v0.4 May 14 2019

  1. Only publish tsconfig.json to NPM to prevent strange bugs
  2. Create a tsconfig base setting module for sharing across projects

AUTHOR

Huan LI (李卓桓) [email protected]

Profile of Huan LI (李卓桓) on StackOverflow

  • Code & Docs © 2019 - now Huan LI [email protected]
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons

版本与发布记录

@chatie/tsconfig 共发布 55 个版本,首次发布于 2019/05/12;过去 12 个月发布了 0 个版本。

版本发布日期距今
4.9.2latest2023/03/073 年前
4.9.12023/01/123 年前
4.6.42023/01/123 年前
4.6.32022/03/064 年前
4.6.22021/11/274 年前
4.5.32021/11/214 年前

其他发布通道:next → 4.5.2。

关于 @chatie/tsconfig 的常见问题

@chatie/tsconfig 是什么?

tsconfig.json inheritance via Node.js packages

如何安装 @chatie/tsconfig?

在项目目录运行 npm install @chatie/tsconfig,或使用 pnpm add / yarn add / bun add。

@chatie/tsconfig 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/chatie__tsconfig 是否存在。

@chatie/tsconfig 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@chatie/tsconfig 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@chatie/tsconfig 可以商用吗?

@chatie/tsconfig 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@chatie/tsconfig 的下载量有多少?

根据 npm 官方下载统计,@chatie/tsconfig 在 2026/10/10 – 2026/11/08 这 30 天内被下载 3,707 次,日均约 124 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@chatie/tsconfig 还在维护吗?

最新版本 4.9.2 发布于 2023/03/07(3 年前);至今共发布 55 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/05/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。