chore(deps-dev): bump typescript from 5.9.3 to 6.0.2 in /lightrag_webui#2971
chore(deps-dev): bump typescript from 5.9.3 to 6.0.2 in /lightrag_webui#2971dependabot[bot] wants to merge 1 commit intomainfrom
Conversation
69208a3 to
30cfbc9
Compare
|
@codex 请评估本次版本升级的风险,并根据以下信息仔细审核升级后代码是否会崩掉: TypeScript 5.9.3 至 6.0.2 升级风险评估报告 (React 环境) TypeScript 6.0 是在全面迁移至 Go 原生编译器(TypeScript 7.0)之前的最后一个基于 JavaScript 的过渡版本。从 5.9.3 跨越到 6.0.2 包含了极其激进的默认值更改和底层机制重构。整体来看,本次升级的风险评级为高,不仅会引发大面积的类型报错,还可能需要对构建配置链进行调整。 以下是核心风险项及断崖式变更的详细评估:
TS 6.0 针对泛型调用中的函数表达式(尤其是泛型 JSX 表达式)进行了更严苛的类型检查调整。 潜在破坏: 当你封装复杂的 React 高阶组件,或者处理带有复杂泛型状态的数据结构(例如处理 Yjs 这类强依赖细粒度类型推断的实时协同模型,或是解析由 Prisma 传入前端的深层嵌套数据)时,原先能够隐式推断通过的代码可能会报错。你往往需要在组件调用点显式传递泛型参数。 Hooks 影响: 对无 this 函数的类型推断有所增强,早期写法不够严谨的 useEffect 回调闭包或初始值模糊的 useState,可能会暴露出新的类型不匹配或隐式 any 风险。
6.0 版本抛弃了以往宽容的缺省值,旨在清理历史包袱并向 7.0 靠拢: strict 默认开启: 布尔值默认变为 true。如果旧代码存在非严格模式的角落,升级后会瞬间触发大量类型收窄验证错误。 types 默认为空数组 ([]): TS 不再自动遍历并加载 node_modules/@types 下的所有包。这虽然能将构建时间大幅缩短多达 50%,但会直接导致像 Playwright 这类重度依赖全局自动注入的 E2E 测试框架,或特定的全局环境变量丢失类型提示。你必须手动在配置文件中按需声明引入。 编译目标跃迁: module 默认变为 esnext,target 默认升至 es2025。
废弃 --baseUrl: 这是前端项目迁移的重灾区。在基于 Next.js 搭建 SSR 架构时,经常重度依赖 baseUrl 结合 paths 来实现优雅的绝对路径别名导入。升级后必须彻底剥离 baseUrl 配置,转而完全依靠原生的 Node subpath imports (#/*) 或纯 paths 映射。 废弃 moduleResolution: node: 传统的 Node 解析模式被正式弃用。现代 React 环境需要全面迁移至 "bundler" 或 "nodenext"。这种转变可能会暴露出一些第三方库在 package.json 的 exports 字段定义不规范的问题。
新提案 API: 6.0 原生纳入了 TC39 Stage 4 提案的类型(如旨在替代 Date 的 Temporal API、Map.getOrInsert 等)。 排序稳定性标志: 为了平滑过渡到 7.0 并行架构,6.0 提供了 --stableTypeOrdering 标志。TS 过去依赖解析顺序生成内部类型 ID,现在强制使用基于内容的确定性排序。虽然语义不变,但在输出 .d.ts 声明文件时可能会产生意想不到的 diff 噪音,且开启该标志会带来一定的编译性能损耗。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30cfbc9bbc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "tailwindcss": "^4.2.2", | ||
| "tailwindcss-animate": "^1.0.7", | ||
| "typescript": "~5.9.3", | ||
| "typescript": "~6.0.2", |
There was a problem hiding this comment.
Declare Node ambient types before bumping to TS 6
This major-version bump relies on TypeScript 6.0 defaults, but tsconfig.json does not set compilerOptions.types (it currently includes vite.config.ts and uses Node globals/modules there such as process, __dirname, and path). In TS 6, types defaults to [], so tsc/tsserver will start reporting missing Node identifiers unless we explicitly add Node typings (for example "types": ["node"]), which introduces immediate type-check regressions for local development and any CI job that runs TypeScript checks.
Useful? React with 👍 / 👎.
30cfbc9 to
f90f6b4
Compare
34e1261 to
6e20d18
Compare
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.9.3 to 6.0.2. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Commits](microsoft/TypeScript@v5.9.3...v6.0.2) --- updated-dependencies: - dependency-name: typescript dependency-version: 6.0.2 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
6e20d18 to
9071d55
Compare
Bumps typescript from 5.9.3 to 6.0.2.
Release notes
Sourced from typescript's releases.
Commits
607a22aBump version to 6.0.2 and LKG9e72ab7🤖 Pick PR #63239 (Fix missing lib files in reused pro...) into release-6.0 (#...35ff23d🤖 Pick PR #63163 (Port anyFunctionType subtype fix an...) into release-6.0 (#...e175b69Bump version to 6.0.1-rc and LKGaf4caacUpdate LKG8efd7e8Merge remote-tracking branch 'origin/main' into release-6.0206ed1aDeprecate assert in import() (#63172)e688ac8Update dependencies (#63156)29b300dBump the github-actions group across 1 directory with 2 updates (#63205)0c2c7a3DOM update (#63183)