Skip to content

refactor(types): enable noImplicitAny #161

Description

@luojiyin1987

背景

#160 升级 TS 6 时,noImplicitAny 的有效默认值翻转为 true。为了保持升级 PR 零源码 diff,master 留下了临时兼容开关:

// TS 6 flips the effective noImplicitAny default to true. Pinned to keep
// the upgrade diff behavior-preserving ...
"noImplicitAny": false,

注释已把它标记为待清理项。本 issue 偿还这笔债。

范围

  • text-table 补正确类型来源:优先 @types/text-table(0.2.5,2025-08 仍在维护),不手写 declaration
  • 给必要的 callback 参数补具体类型
  • 删除 "noImplicitAny": false

之前看到的 6 个隐式 any 其实是同一个根因:text-table 无类型声明让 table() 返回 any,污染了下游整条 .map()/.replace() 回调链。装上官方 @types 后只剩一个真实错误:align 数组的 "" 不在 DT 收紧的联合类型里。

验证目标

noImplicitAny 重新开启,零运行时行为变化:

  • npm run typecheck
  • npm test -- --runInBand
  • npm run test:package

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions