uView Pro X 2.0 Drops UTS: TypeScript Rewrite Follows DCloud's JS-Driven Shift
uView Pro X 2.0 Release: Drops UTS, Fully Supports TypeScript for uni-app x Steam Mode UI Library
Why Drop UTS?
First, a clarification: this is not our own decision. DCloud officially replaced the page driver with a JS recommendation.
In uni-app x's steam mode page driver, DCloud itself switched from strongly-typed UTS to JS. In the official docs, a section title asks directly: "Why change the page driver from strongly-typed UTS to JS? And it's still faster?"
The official reasoning chain:
- UTS was introduced to solve performance issues, mainly cross-language communication overhead.
- When steam mode was first planned, UTS was the original proposal.
- After the rendering engine was done, it measured several times faster than native, which gave headroom to re-evaluate: can we still beat native without a strongly-typed language?
- After optimizing cross-language communication, overhead was reduced to under 5%. With a 2-3x advantage, 5% is almost invisible.
- So they switched to JS-driven. The reason is that JS has advantages in AI familiarity, ease of use, ecosystem richness, dynamic nature, and easier upgrades for existing uni users.
Item 5 puts "AI familiarity" first, not as filler.
More importantly, the official premise: Steam mode's rendering speed comes from the rendering engine, not the language. The template and style compile directly into bytecode, never touching JS, so UI operations don't have back-and-forth JS-Kotlin communication. Whether the logic layer uses UTS or JS doesn't change the multi-fold difference.
So the language swap in 2.0 is not about running faster. It's about freeing "writing code" from a strongly-typed dialect. We're following this official step.
1. What's the difference between UTS and TS?
Both look like JS, but underneath are two different things.
| UTS | TS | |
|---|---|---|
| Logic layer | Compiles to Kotlin/Swift native code | Executed by JS engine |
| Type system | Another static type, rules similar to TS but different | Superset of JS, types exist only at compile time |
| Objects and JSON | UTSJSONObject, get with getString/getNumber/getBoolean, iterate with toMap, serialize with JSON.parseObject/JSON.parseArray |
Normal objects, Record, interface, JSON.parse(text) as T |
| Ecosystem | Little public corpus and third-party libs | Whole JS/TS ecosystem, npm directly |
| Native integration | Logic itself is native code, same language as native plugins | Native capabilities via UTS plugins, page layer doesn't call directly |
The view layer is identical - both compile templates and styles to bytecode; the difference is only in the logic layer.
Strong typing in UTS is not optional but a necessity: to compile logic to Kotlin/Swift, it must know definite types at compile time. TS types are just annotations for humans and editors; at runtime it's still JS.
This difference permeates every value access. Reading a JSON field, in UTS you first judge whether it's a structural type or UTSJSONObject, then decide whether to write .name or getName('name'); in TS, JSON.parse(text) as User then use it directly. A single step doesn't matter, but dozens per page add up to constant friction.
2. UTS? Even AI can't write it correctly
UTS's strong typing has its logic - minimal cross-language overhead, and App-side logic truly compiles to native code. The problem is the cost lands on the developer:
- Two mental models: Once used to TS, in UTS you have to think for each object "Is this a structural type or JSONObject?"
- Thin toolchain:
getStringdoesn't bring up docs,toMapyields no search results; you end up reading source code. - AI writes inaccurately: Not because the model is dumb, but because the corpus is sparse. It mixes TS syntax with fabricated UTS APIs -
JSON.parseObjectwith interface generics,UTSJSONObjectfollowed by an interface,toMap()as a standard method. Such errors appeared almost every generation during 1.x, and the manual backtracking cost ate up much of AI's efficiency gain. - Long compile chain: Changing one line of logic requires Kotlin/Swift compilation and packaging; App side cycles around, while H5 has already changed several versions.
Compilation takes at least 3 minutes:
DCloud did not dodge this in the FAQ, saying the switch to JS-driven "took some time, and is also the reason the Android version was the last to appear."
3. What does official recommendation of JS/TS mean?
uView Pro X's logic layer had little native flavor anyway: theme variable derivation, language pack, request library, utility functions, hooks - all pure JS semantics. Writing them in UTS was like putting a strong-typed shell over regular JS, then using getString, toMap to extract. Switching to TS moves them back to their natural place, without rewriting the logic itself.
Only the boundary needs judgment:
- Native plugins and parts that need to operate native UI in the page continue using UTS. Steam mode retains the ability of UTS plugins to operate UI.
- After switching to JS-driven, DCloud tightened direct native API calls from pages (in Android
uvuepages,utsAndroidis no longer available; it must be moved into a UTS plugin). Our component layer doesn't rely on this pattern, so we didn't hit that line. - 1.x UTS projects don't have to migrate. Pages written in UTS under VDOM mode can run on steam mode via
uts2js; this is the official compatibility path.
Toolchain is also ready: since HBuilderX 5.31, official TypeScript language strategy is provided, and uni-app x projects can write pages and components using standard TS.
II. How to quickly migrate UTS projects to TS
The migration process itself isn't hard; the difficulty is not missing anything. If you used the UTS version of uView Pro X, we've consolidated our migration experience into 8 rules in the 2.0.0 entry of the changelog, which you can hand to an AI assistant as a whole. Here are the key points.
1. Use AI prompt for quick migration
I've prepared an AI prompt for converting uni-app x UTS projects to TS projects:
You can copy and send it directly to an AI assistant to do the changes, then go have tea...
1. All `.uts` scripts in the project changed to `.ts`, including pages, components, root entry `main.uts`, `index.uts`, `types/global.uts`, as well as store, utils, hooks.
2. All `<script setup lang="uts">` in `.uvue` changed to `lang="ts"`; those with only `<script setup>` and no language specified explicitly add it.
3. `UTSJSONObject` replaced with standard TS object types: fixed structure use interface or type, arbitrary keys use `Record<string, any>` (or use the library-exported `JsonObject`, which is an alias for `Record<string, any>`). Reading, assigning, iterating all use standard syntax; `getString` / `getNumber` / `getJSON` / `toMap` are forbidden.
4. `JSON.parseObject` / `JSON.parseArray` all removed, replaced with `JSON.parse(text) as T`, arrays use `as T[]`; handle errors with `try/catch` if needed.
5. Native plugins, native standard components, and their UI remain UTS - do not change the suffix or internal implementation.
6. When native-side parameters are `UTSJSONObject`, TS pages can directly pass ordinary objects; the two sides are equivalent, no need for `toMap` or any wrapping.
7. Import paths, easycom rules, component API, conditional compilation, page routing - all stay unchanged.
8. Self-check: globally search `.uts`, `lang="uts"`, `UTSJSONObject`, `parseObject`, `parseArray`, `toMap` to confirm zero residue on the TS side.
2. Two points that require attention
The following two points are what truly stuck in this migration; the rest is just labor.
The entry must be in sync with the implementation. This is the pit we hit. If you keep main.uts and only change the library to .ts, H5 will white-screen and /main will report Failed to resolve import .../index.uts. The reason is that the UTS compiler forces import path suffixes to normalize to .uts, even if you explicitly write .ts, so the UTS entry can never find the TS implementation. The correct approach is to convert the entry together: change main.uts to main.ts, and change the entry script in index.html to /main.ts, then restart the dev server.
Don't touch native plugins. Native plugins and native standard components are already UTS and are equivalent on their side; they don't need changes. If a .uts file hits during self-check that is inside a native plugin, that's normal.
The difference before and after roughly looks like:
// 1.x (UTS)
const res = JSON.parseObject<UTSJSONObject>(text)
const name = res?.getString('name')
// 2.0 (TS)
type User = { name: string }
const res = JSON.parse(text) as User
const name = res.name
<!-- 1.x -->
<script setup lang="uts">
// 2.0
<script setup lang="ts">
III. What TS version of uView Pro X has
In the first section, we said that steam mode's performance comes from the rendering engine; after switching to JS-driven, DCloud reduced cross-language communication overhead to under 5%. So 2.0's value is not "running faster", but what it's like to write, modify, and maintain. Here are the directly perceivable points.
1. Build and debug loop shortened
TS goes through the standard JS compile chain; the wait from a single line change to page refresh is shorter than "change line → Kotlin compile → package". The App side saves the logic part; templates and styles still need bytecode compilation. The difference is most obvious during H5 development and mini-program preview; after dozens of changes a day, it becomes concrete.
2. Cross-platform semantics unified
H5 and mini-programs always had JS semantics. 2.0 brings App side onto the same set of semantics: the same code for reading, iterating, serializing works across all three platforms, no longer needing branches for "App needs toMap, H5 can't toMap". Such branches are the most mentally draining and error-prone in business projects.
This is more valuable than build speed, at least to me.
3. AI collaboration accuracy returns
Standard TS corpus is abundant; the model basically no longer fabricates getString. This release also includes the 8 upgrade prompt lines; with these rules, AI can complete most mechanical transformations on its own, and humans only need to handle type narrowing and the entry.
4. Steam mode adaptation unchanged
2.0 remains a component library optimized for steam mode. The template layer follows the constraint of no virtual DOM (e.g., the last item's separator line is controlled by the last field in the data layer; the source array index is not read in templates). Migration doesn't change the rendering mode or require you to adjust page structure.
IV. Documentation and skills
When a library changes language, if docs and auxiliary tools don't follow, it's like no change at all. So these three parts arrived together.
1. Documentation site
Chinese and English docs all updated to TS: Quick start uses main.ts, examples uniformly lang="ts", request layer http / useRequest, pinia, custom icon fonts, configuration, theme, dark mode, internationalization all rewritten for 2.0. Version numbers share the same source as changelog; three logs (component library, repo, docs site) have consistent content.
- uView Pro X TS version docs site: https://x.uviewpro.cn/
- uView Pro X UTS version docs site: https://uts.uviewpro.cn/
2. AI skills
Consumer-side skills are split into two: uview-pro-x service 2.0 (TS), uview-pro-x-uts service 1.x (UTS), not interfering.
The skills ship with 70 API cards covering public components, each with properties, events, slots, type definitions, and API fingerprints. They've been fully regenerated for 2.0.0, with --check showing zero drift. Check the card before writing pages; it's faster than digging through source code.
Open source address for skills: https://github.com/uview-pro/skills
V. How to use TS version of uView Pro X in uni-app x projects
Only one prerequisite: HBuilderX 5.31 or above. Lower versions lack TS language strategy; even if installed, they can't compile.
Plugin marketplace addresses:
- uView Pro X TypeScript version: https://ext.dcloud.net.cn/plugin?name=uview-pro-x
- uView Pro X UTS version: https://ext.dcloud.net.cn/plugin?name=uview-pro-x-uts
Full getting-started path:
- Open DCloud plugin marketplace ext.dcloud.net.cn, search uView Pro X, enter TS (2.0.0) version.
- Click "Use HBuilderX to import example project". The example project will be placed locally as a standalone project.
- Click trial, bind the imported example project. Binding is for the encrypted plugin to decrypt properly under that project.
- Run the example project (H5) in HBuilderX, click through pages to confirm component behavior.
After trial binding, you can add 2.0 in your own project the same way: put uni_modules/uview-pro-x in, app.use(uViewProX) in main.ts, and use ux-* components directly in pages.
Some reminders
- 1.x projects have no mandatory reason to upgrade; the UTS version continues to be available in the plugin marketplace, install as needed. Both lines run in parallel.
- 2.0's example project and docs are TS-oriented. If you're still on 1.x, look at 1.x's skills and docs; don't mix.
VI. Conclusion
2.0's work is actually not complicated: refactor the component library from UTS to standard TypeScript throughout, and align docs, skills, API skills together. But this doesn't mean the UTS version is frozen.
uView Pro X now has two component libraries running in parallel: the TS version follows the official steam mode JS-driven path, and the UTS version retains the original route of compiling logic to Kotlin/Swift. Both versions have completely identical APIs; new components, fixes, themes, and hooks update together. Use either one.
How to choose depends on your project's status:
- For new projects, or already on steam mode, use the TS version. The logic layer shares the same semantics as H5 and mini-programs, and AI makes fewer mistakes.
- For existing UTS projects, or those with heavy dependencies on UTS plugins and native calls, continue with the UTS version. A project that runs well doesn't need to be churned for a version number.