跪拜 Guibai
← All articles
Frontend · Uni-app · AI Programming

uView Pro X 2.0 Drops UTS: TypeScript Rewrite Follows DCloud's JS-Driven Shift

By 前端梦工厂 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

For developers building uni-app x apps on steam mode, the TypeScript rewrite removes a significant language barrier: standard TS means faster iteration, fewer AI-generated errors, and code that matches H5 and mini-program semantics. But anyone heavily invested in native plugins or existing UTS projects can stay on the UTS line without forced migration, since both versions remain supported with identical APIs.

Summary

The 2.0 release of uView Pro X replaces UTS with standard TypeScript across its logic layer, a rewrite that mirrors DCloud's own decision to drop UTS for the page driver in uni-app x steam mode. DCloud's engine compiles template and style to bytecode, so rendering speed comes from the engine, not the language; once cross-language communication overhead was trimmed below 5%, the performance rationale for UTS evaporated. The remaining costs of UTS - thin tooling, sparse AI training data, and slow Kotlin/Swift compile chains - made TS the pragmatic choice.

The migration comes with an 8-point AI prompt that automates most mechanical changes, from renaming `.uts` to `.ts` to replacing `UTSJSONObject` with standard TS types. Two pitfalls matter: the entry file must be renamed along with the library or H5 white-screens, and native plugins must stay in UTS. Existing 1.x UTS projects don't have to migrate; both versions run in parallel with identical APIs. The TS version aligns App-side logic with H5 and mini-program semantics, cutting tedious platform branches. Documentation and 70 API cards have been regenerated for TS, and HBuilderX 5.31+ provides the official TypeScript language strategy.

Takeaways
— DCloud replaced the page driver in uni-app x steam mode from UTS to JS, reducing cross-language communication overhead to under 5%, which made UTS's performance rationale moot.
— The rendering engine compiles template and style directly into bytecode, so rendering speed is independent of the logic language.
— uView Pro X 2.0 rewrites its logic layer from UTS to TypeScript, with logic compiled to native code in UTS versus JS-engine execution in TS.
— AI-generated code with UTS frequently mixed TS syntax with fabricated APIs like `JSON.parseObject` with interface generics; TS reduces these errors due to abundant corpus.
— Migration requires renaming all `.uts` files to `.ts` and changing `<script setup lang="uts">` to `lang="ts"`; entry file must also change to `main.ts` to avoid H5 white-screen.
— Native plugins and native standard components remain UTS; the migration does not touch them.
— HBuilderX 5.31 or higher is required for TS language strategy.
— Two versions of uView Pro X now exist: TS 2.0 (steam mode JS-driven) and UTS 1.x (native compilation), with identical APIs and synchronized updates.
— The release includes 70 regenerated API cards for the AI skill, with `--check` showing zero drift.
Conclusions

The decision to abandon UTS shows that strong static typing is worth the friction only when the language itself is essential for performance; once rendering speed comes from the engine, a strongly typed logic layer becomes a tax on developer productivity.

DCloud's ranking of AI familiarity as the top reason for switching to JS reveals that AI-assisted development is now a primary factor in framework design decisions, not an afterthought.

The dual-track release (TS and UTS) is a pragmatic way to avoid forcing existing users to migrate while positioning the library for new projects; it also shows that API stability can be maintained across language rewrites.

Concepts & terms
UTS
A strongly typed language for uni-app x that compiles logic to Kotlin or Swift native code. It requires compile-time type information, leading to more verbose JSON handling and sparse ecosystem/AI training data.
Steam mode
A rendering mode in uni-app x where template and style are compiled directly into bytecode, bypassing JS runtime operations; rendering speed comes from the engine rather than the logic language.
uts2js
A compatibility tool that lets UTS-written pages from VDOM mode run on steam mode, allowing existing UTS projects to migrate without a full rewrite.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗