Backtestsvuerun-20261005-124535#15217

Issue #15217 Merged fix PR #15219 Run 5 Oct 2026 · run-20261005-124535 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 root cause the same way. They pass an explicit `typescriptVersion` ref to `useStore` so the REPL no longer defaults to `latest`, which resolved to the unsupported TS 7. In both, a version saved in the URL hash still overrides the default.

Patch A derives the default at build time from the TypeScript version installed in the repo (`typescript/package.json`). It injects that value through a Vite `define` (`__TS_VERSION__`) and declares it in `global.d.ts`. The playground therefore defaults to the version Vue itself is type-checked with, which is supported by construction. It also stays correct as the repo upgrades TypeScript, with no manual edit needed.

Patch B hardcodes `'6.0.3'` in App.vue. That works today, but the string can silently go stale. It also depends on someone remembering to bump it, and nothing guards against a typo or a later wrong value.

On tests, Patch A adds a spec checking that the default is a concrete semver string rather than `latest` and that its major version is below 7. The equality check against `package.json` is partly tautological. Still, the `not 'latest'` and `<7` assertions encode the issue's requirement and would catch a regression. Patch B adds no tests.

On scope, Patch A touches a few more files (helper module, Vite config, global declaration). All of it directly supports the fix, follows the existing `__COMMIT__` define convention, and adds little risk. Patch B is more minimal but less robust. Overall, A is the more maintainable 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

6m 56s

Wall-clock time in the container

Full test suite

No new failures

3,676 passed · 6 skipped · 3,682 total

Contamination audit

Clean

No sign the agent saw the real fix

Patch size

39vs 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+39 −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__/typescriptVersion.spec.tsnew file mode 100644index 000000000..72b5493aa@@ -0,0 +1,18 @@+import { createRequire } from 'node:module'+import { getDefaultTypeScriptVersion } from '../typescriptVersion'++const require = createRequire(import.meta.url)++describe('sfc-playground: default TypeScript version', () => {+  test('pins the TypeScript version the repo is type-checked with', () => {+    const version = getDefaultTypeScriptVersion()+    expect(version).not.toBe('latest')+    expect(version).toMatch(/^\d+\.\d+\.\d+/)+    expect(version).toBe(require('typescript/package.json').version)+  })++  test('does not default to an unsupported TypeScript major (7+)', () => {+    const major = parseInt(getDefaultTypeScriptVersion().split('.')[0], 10)+    expect(major).toBeLessThan(7)+  })+})packages-private/sfc-playground/src/App.vueindex 7020211f4..2ac8ec68f 100644@@ -70,6 +70,9 @@ const store = useStore(     builtinImportMap: importMap,     vueVersion,     sfcOptions,+    // don't default to `latest`, which may be a TS major that Vue's language+    // tools don't support yet. Versions saved in the URL hash still win.+    typescriptVersion: ref(__TS_VERSION__),   },   hash, )packages-private/sfc-playground/typescriptVersion.tsnew file mode 100644index 000000000..2539e1806@@ -0,0 +1,15 @@+import { createRequire } from 'node:module'++const require = createRequire(import.meta.url)++/**+ * The TypeScript version the playground's language tools use by default.+ *+ * The REPL would otherwise default to `latest`, which can resolve to a major+ * version Vue's language tools don't support yet (e.g. TypeScript 7), breaking+ * type support out of the box. Use the version this repo is type-checked with+ * instead; users can still pick another version from the dropdown.+ */+export function getDefaultTypeScriptVersion(): string {+  return (require('typescript/package.json') as { version: string }).version+}packages-private/sfc-playground/vite.config.tsindex 2e77f1970..bf6b5066d 100644@@ -3,6 +3,7 @@ import path from 'node:path' import { type Plugin, defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { spawnSync } from 'node:child_process'+import { getDefaultTypeScriptVersion } from './typescriptVersion'  const commit = spawnSync('git', ['rev-parse', '--short=7', 'HEAD'])   .stdout.toString()@@ -22,6 +23,7 @@ export default defineConfig({   ],   define: {     __COMMIT__: JSON.stringify(commit),+    __TS_VERSION__: JSON.stringify(getDefaultTypeScriptVersion()),     __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,