Backtestsvuerun-20261002-115633#15217

Issue #15217 Merged fix PR #15219 Run 2 Oct 2026 · run-20261002-115633 vuejs/core

The Playground's TS version is set to 7 by default.

Better

Our patch was judged better than the merged fix.

In this judgment, Patch A = our agent, Patch B = the merged fix.

Both patches fix the issue the same way: they pass a `typescriptVersion` ref into `useStore`, so the playground no longer follows `latest` onto TS 7. They differ in where the version string comes from.

Patch A reads the version from the repo's own `typescript` devDependency at build time (`createRequire(...)('typescript/package.json').version`). It injects that value as the `__TS_VERSION__` define and declares the global type. This ties the playground default to the exact TypeScript version Vue is built and type-tested against, which addresses the root cause: the playground should use a TS version Vue supports. The default also stays correct on its own when the repo bumps TypeScript, so nobody has to remember to update the playground.

Patch B hardcodes `'6.0.3'` in App.vue. That fixes the immediate symptom. However, the constant will drift: it needs a manual edit when Vue gains TS 7 support or ships a TS 6.x patch. Nothing in the diff confirms that this exact version is the right or tested one.

On tests, Patch A adds a vite config spec. It checks that the define resolves to the installed TypeScript version and that the value is a concrete semver rather than `latest`. This test is somewhat structural (it mocks plugin-vue and inspects the config object), but it does guard against regressing to `latest`. Patch B adds no tests.

On scope, Patch A is slightly larger, with a define, a global declaration and a test. That is still minimal and consistent with the existing `__COMMIT__` pattern in the same config. Patch B is smaller but more brittle.

Overall, A is the more robust and better-tested fix.

The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.

Solve

8m 55s

Wall-clock time in the container

Full test suite

No new failures

3,675 passed · 6 skipped · 3,681 total

Contamination audit

Clean

No sign the agent saw the real fix

Patch size

33vs 3 merged

Changed lines, ours vs merged

Vue version

commit(d2c458b)

Link to minimal reproduction

https://play.vuejs.org/

Steps to reproduce

  1. open Playground: https://play.vuejs.org/
  2. TS version has been set latest and it's over 7.

What is expected?

It's not friendly for someone new to Vue and they don't know that Vue doesn't support TS7 at this time.
I think this is temporary issue, but until Vue supports TS7, It is helpful to tell that.

Or rather, the TS version should default to TS6, not the latest.

What is actually happening?

Broken type support if TS version is not changed.

<img width="470" height="265" alt="Image" src="https://github.com/user-attachments/assets/a5f13371-1180-4c6f-8714-06f32f7c11c8" />

System Info

Any additional comments?

_No response_

The two patches

Our patch+33 −0
packages-private/global.d.tsindex ebc2367f3..baf1a961e 100644@@ -2,6 +2,7 @@  // Global compile-time constants declare var __COMMIT__: string+declare var __TS_VERSION__: string  declare module 'file-saver' {   export function saveAs(blob: any, name: any): voidpackages-private/sfc-playground/__tests__/viteConfig.spec.tsnew file mode 100644index 000000000..69aa3df1b@@ -0,0 +1,22 @@+import { createRequire } from 'node:module'+import config from '../vite.config'++// the plugin itself is irrelevant here, and the test env aliases `vue` to+// the source entry which the plugin can't load+vi.mock('@vitejs/plugin-vue', () => ({ default: () => ({ name: 'vite:vue' }) }))++describe('sfc-playground vite config', () => {+  test('defaults the TypeScript version to the one Vue is built against', () => {+    const define = (config as { define: Record<string, string> }).define+    const expected = createRequire(import.meta.url)(+      'typescript/package.json',+    ).version++    const tsVersion = JSON.parse(define.__TS_VERSION__)+    expect(tsVersion).toBe(expected)+    // must be a concrete version so the playground doesn't follow `latest`+    // onto a TypeScript major Vue doesn't support yet+    expect(tsVersion).not.toBe('latest')+    expect(tsVersion).toMatch(/^\d+\.\d+\.\d+/)+  })+})packages-private/sfc-playground/src/App.vueindex 7020211f4..78bfe4200 100644@@ -69,6 +69,7 @@ const store = useStore(   {     builtinImportMap: importMap,     vueVersion,+    typescriptVersion: ref(__TS_VERSION__),     sfcOptions,   },   hash,packages-private/sfc-playground/vite.config.tsindex 2e77f1970..0318ec476 100644@@ -3,11 +3,19 @@ import path from 'node:path' import { type Plugin, defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { spawnSync } from 'node:child_process'+import { createRequire } from 'node:module'  const commit = spawnSync('git', ['rev-parse', '--short=7', 'HEAD'])   .stdout.toString()   .trim() +// Default the playground's TypeScript version to the one Vue itself is built+// and type-tested against, instead of always following `latest` (which may be+// a major version Vue's type support isn't compatible with yet).+const typescriptVersion: string = createRequire(import.meta.url)(+  'typescript/package.json',+).version+ export default defineConfig({   plugins: [     vue({@@ -22,6 +30,7 @@ export default defineConfig({   ],   define: {     __COMMIT__: JSON.stringify(commit),+    __TS_VERSION__: JSON.stringify(typescriptVersion),     __VUE_PROD_DEVTOOLS__: JSON.stringify(true),   },   optimizeDeps: { 
Merged fix · PR #15219+3 −0
packages-private/sfc-playground/src/App.vueindex 7020211f4..5a87a1d1d 100644@@ -14,6 +14,8 @@ setVH()  const useSSRMode = ref(false) +const DEFAULT_TYPESCRIPT_VERSION = '6.0.3'+ const AUTO_SAVE_STORAGE_KEY = 'vue-sfc-playground-auto-save' const initAutoSave: boolean = JSON.parse(   localStorage.getItem(AUTO_SAVE_STORAGE_KEY) ?? 'true',@@ -69,6 +71,7 @@ const store = useStore(   {     builtinImportMap: importMap,     vueVersion,+    typescriptVersion: ref(DEFAULT_TYPESCRIPT_VERSION),     sfcOptions,   },   hash,