@alxwlw/tsconfig

中文文档
1.9.2发布于 2026/11/04MIT零依赖构建来源已验证近 30 天下载 2715

TypeScript 7 tsconfig presets for the canon. Each preset is a plain .json file — extend it by package specifier (published consumers) or by path (this repo, which extends its own presets directly from packages/tsconfig/).

原始使用文档
文档目录3 节
  1. Presets
  2. Usage
  3. Sharp edge: .ts -extension imports and bun:test need more t…

@alxwlw/tsconfig

TypeScript 7 tsconfig presets for the canon. Each preset is a plain .json file — extend it by package specifier (published consumers) or by path (this repo, which extends its own presets directly from packages/tsconfig/).

Presets

PresetExtendsUse it for
base.json—Never extended directly by an app. Strict TS7 defaults every other preset builds on: strict, noUncheckedIndexedAccess, verbatimModuleSyntax, declaration.
node.jsonbaseA Node-targeted package or script. Adds lib: ["ES2025"] and types: ["node"].
library.jsonbaseA package that ships compiled output for others to import. emitDeclarationOnly — types out, no .js (a bundler/tsc -p elsewhere produces the runtime file).
react.jsonbaseBrowser/React code. lib: ["ES2025", "DOM", "DOM.Iterable"], jsx: "react-jsx", bundler resolution.
refs.jsonnodeA pnpm+moon project-references monorepo package: composite, incremental, emits only .d.ts into .tsbuild/ — runtime JS comes from Bun/SWC/a bundler, not tsc. The moon-tasks canon typecheck (--noEmit) does not build the references.
nest.jsonrefsA NestJS package on refs.json's project-references discipline: legacy decorators + emitDecoratorMetadata, and verbatimModuleSyntax: false (DI needs the type import to survive erasure — see the preset's own comment).
bun.jsonbaseA Bun-native script or CLI (this repo's own packages/stack uses it): bundler resolution, types: ["bun"], noEmit, allowImportingTsExtensions.

Usage

// tsconfig.json (repo root, or a package's own tsconfig)
{
    "extends": "@alxwlw/tsconfig/node.json",
}

None of these presets declare @types/node or @types/bun as a dependency of this package — you install the one(s) your types array needs yourself. node.json/refs.json/nest.json expect @types/node in your own devDependencies; bun.json (and any project whose tests use bun:test) expects @types/bun. This package's own devDependencies on both are for running ITS tests (presets.test.ts compiles a fixture per preset) — they are not re-exported to consumers, and pnpm's strict linking will not hand them to you for free.

Sharp edge: .ts-extension imports and bun:test need more than node.json

If your source imports with an explicit .ts extension (import { x } from './x.ts' — required for Bun/nodenext ESM to resolve at runtime without a build step) or your tests use bun:test, extending node.json alone is not enough and will fail loudly:

error TS5097: An import path can only end with '.ts' when 'allowImportingTsExtensions' is enabled.

allowImportingTsExtensions requires noEmit (or emitDeclarationOnly) to be set — node.json doesn't set either, because a plain Node package normally compiles its .ts to .js and does not import by .ts extension. If your package is Bun-run and never emits, override on top:

{
    "extends": "@alxwlw/tsconfig/node.json",
    "compilerOptions": {
        "allowImportingTsExtensions": true,
        "noEmit": true,
        "types": ["node", "bun"],
    },
}

(This is exactly what this repo's own root tsconfig.options.json does — bun.json alone doesn't fit either, since it drops types: ["node"], which node:* built-in imports still need.) If you're building a plain Bun CLI/script with no Node-specific typings, bun.json on its own is the simpler fit — reach for the override above only when you need both surfaces at once.

版本与发布记录

@alxwlw/tsconfig 共发布 19 个版本,首次发布于 2026/09/18;过去 12 个月发布了 19 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.9.2latest2026/11/043 天前
1.9.12026/11/035 天前
1.9.02026/10/299 天前
1.8.02026/10/2612 天前
1.7.12026/10/2216 天前
1.7.02026/10/2216 天前

关于 @alxwlw/tsconfig 的常见问题

@alxwlw/tsconfig 是什么?

TypeScript 7 tsconfig presets for the canon. Each preset is a plain .json file — extend it by package specifier (published consumers) or by path (this repo, which extends its own presets directly from packages/tsconfig/).

如何安装 @alxwlw/tsconfig?

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

@alxwlw/tsconfig 支持 TypeScript 吗?

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

@alxwlw/tsconfig 可以商用吗?

@alxwlw/tsconfig 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

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

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

@alxwlw/tsconfig 还在维护吗?

最新版本 1.9.2 发布于 2026/11/04(3 天前);至今共发布 19 个版本,其中过去 12 个月发布了 19 个;首次发布于 2026/09/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。