Backtestsvuerun-20261009-161443#15217
The Playground's TS version is set to 7 by default.
Our patch was judged better than the merged fix.
In this judgment, Patch B = our agent, Patch A = the merged fix.
Both patches fix the root cause the same way: they pass a `typescriptVersion` ref into `useStore` so the playground no longer defaults to @vue/repl's 'latest', which now resolves to TS 7. Patch A hardcodes the exact version '6.0.3'. It works today, but it will go stale as new 6.x patch releases ship, and someone has to remember to bump it. It adds no tests and does not explain why the pin exists. Patch B defaults to the major range '6', which the CDN resolves to the newest stable 6.x release, so it keeps tracking TS 6 updates without maintenance. It also handles a consequence of using a range: the version dropdown would otherwise highlight no entry. The new `isActiveVersion` helper in VersionSelect.vue resolves '6' to the newest non-prerelease 6.x entry. It also keeps the existing 'latest' and exact-match behaviour. A comment explains why TS 7 is avoided. Patch B adds a spec. It checks that the default is '6' and resolves to 6.0.3, not 7.0.0 or a 6.1 beta, and it covers the highlighting cases. The test on the default value would fail before the change. The small risk in B is that @vue/repl internals might not handle a range string as well as an exact version, but CDN URLs accept major ranges. The added module is small and focused. On balance, B is the more durable 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
4m 9s
Wall-clock time in the container
Full test suite
No new failures
2 passed · 0 skipped · 2 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
59vs 3 merged
Changed lines, ours vs merged
The issue
View on GitHubVue version
commit(d2c458b)
Link to minimal reproduction
Steps to reproduce
- open Playground: https://play.vuejs.org/
- 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
packages-private/sfc-playground/__tests__/typescriptVersion.spec.tsnew file mode 100644index 000000000..06163a339@@ -0,0 +1,23 @@+import {+ DEFAULT_TYPESCRIPT_VERSION,+ isActiveVersion,+} from '../src/typescriptVersion'++describe('sfc-playground: TypeScript version', () => {+ const versions = ['7.0.0', '6.1.0-beta', '6.0.3', '6.0.2', '5.9.3']+ const active = (v: unknown) =>+ versions.filter(ver => isActiveVersion(ver, v, versions))++ test('defaults to the latest TypeScript 6 release, not TS 7', () => {+ expect(DEFAULT_TYPESCRIPT_VERSION).toBe('6')+ expect(active(DEFAULT_TYPESCRIPT_VERSION)).toEqual(['6.0.3'])+ })++ test('highlights the active version in the version list', () => {+ expect(active('latest')).toEqual(['7.0.0'])+ expect(active('5.9.3')).toEqual(['5.9.3'])+ expect(active('6.1.0-beta')).toEqual(['6.1.0-beta'])+ expect(active('4')).toEqual([])+ expect(isActiveVersion('6.0.3', '6', undefined)).toBe(false)+ })+})packages-private/sfc-playground/src/App.vueindex 7020211f4..8254a5248 100644@@ -2,6 +2,7 @@ import Header from './Header.vue' import { Repl, useStore, SFCOptions, useVueImportMap } from '@vue/repl' import Monaco from '@vue/repl/monaco-editor'+import { DEFAULT_TYPESCRIPT_VERSION } from './typescriptVersion' import { ref, watchEffect, onMounted, computed, watch } from 'vue' const replRef = ref<InstanceType<typeof Repl>>()@@ -70,6 +71,7 @@ const store = useStore( builtinImportMap: importMap, vueVersion, sfcOptions,+ typescriptVersion: ref(DEFAULT_TYPESCRIPT_VERSION), }, hash, )packages-private/sfc-playground/src/VersionSelect.vueindex 57efdb5f6..660d6a892 100644@@ -1,6 +1,7 @@ <script setup lang="ts"> import { onMounted, ref } from 'vue' import Copy from './icons/Copy.vue'+import { isActiveVersion } from './typescriptVersion' const expanded = ref(false) const versions = ref<string[]>()@@ -87,11 +88,9 @@ onMounted(() => { <ul class="versions" :class="{ expanded }"> <li v-if="!versions"><a>loading versions...</a></li> <li- v-for="(ver, index) of versions"+ v-for="ver of versions" class="versions-item"- :class="{- active: ver === version || (version === 'latest' && index === 0),- }"+ :class="{ active: isActiveVersion(ver, version, versions) }" > <a @click="setVersion(ver)">v{{ ver }}</a> <buttonpackages-private/sfc-playground/src/typescriptVersion.tsnew file mode 100644index 000000000..49583bd82@@ -0,0 +1,27 @@+// TypeScript 7 (the native port) is not yet supported by Vue's language+// tooling, so default to the latest TypeScript 6.x release instead of+// @vue/repl's default of 'latest'. The value is a semver range that the CDN+// resolves to the newest matching release.+export const DEFAULT_TYPESCRIPT_VERSION = '6'++/**+ * Whether `ver` (an exact version from the version list, sorted newest first)+ * is the one currently in use given the selected `version`, which may be an+ * exact version, 'latest', or a major-version range like '6'.+ */+export function isActiveVersion(+ ver: string,+ version: unknown,+ versions: readonly string[] | undefined,+): boolean {+ if (ver === version) return true+ if (version === 'latest') return ver === versions?.[0]+ if (typeof version === 'string' && /^\d+$/.test(version)) {+ // same resolution as the CDN: newest stable release of that major+ const resolved = versions?.find(+ v => !v.includes('-') && v.split('.')[0] === version,+ )+ return ver === resolved+ }+ return false+}
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,