Backtestsvuerun-20261013-093701#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 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 playground stops defaulting to `latest` (TS 7).
Patch B pins the exact version '6.0.3'. That is simple and safe, but it will go stale as 6.x patch releases ship. It also gives users no hint that TS 7 is unsupported, which the issue explicitly asked for ('It is helpful to tell that').
Patch A defaults to the bare major '6'. jsDelivr resolves that to the newest 6.x release, so the default keeps up with patch releases. Patch A also:
- Marks TS 7+ entries (and `latest`) in the version dropdown as '(unsupported)' with an explanatory tooltip, which covers the issue's secondary ask.
- Fixes the active-item highlighting so the bare-major default highlights the release it resolves to.
- Moves the logic into a small, testable module.
Patch A's tests exercise real behavior (the default is major 6, support detection, active-version resolution). Some assertions are close to tautological, but the `isActiveVersion` tests are meaningful. Patch B adds no tests.
The main risk in A is relying on a bare major tag being accepted wherever @vue/repl uses the version. This is plausible given jsDelivr semantics, but it is less certain than B's exact pin. On balance, A covers more of the issue, is more robust over time, and is tested.
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 33s
Wall-clock time in the container
Full test suite
No new failures
5 passed · 0 skipped · 5 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
117vs 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..1e4f51acb@@ -0,0 +1,51 @@+import {+ DEFAULT_TS_VERSION,+ filterTypeScriptVersions,+ isActiveVersion,+ isTypeScriptVersionSupported,+} from '../src/typescriptVersion'++describe('sfc-playground: typescript version', () => {+ const versions = filterTypeScriptVersions([+ '7.0.2',+ '7.0.1',+ '7.0.0-dev.20260101',+ '6.1.0-beta',+ '6.0.3',+ '6.0.2',+ '5.9.3',+ ])++ test('defaults to a TypeScript version supported by Vue (not latest/7)', () => {+ expect(DEFAULT_TS_VERSION).not.toBe('latest')+ expect(isTypeScriptVersionSupported(DEFAULT_TS_VERSION)).toBe(true)+ expect(parseInt(DEFAULT_TS_VERSION, 10)).toBe(6)+ })++ test('marks TypeScript 7+ as unsupported', () => {+ expect(isTypeScriptVersionSupported('7.0.2')).toBe(false)+ expect(isTypeScriptVersionSupported('6.0.3')).toBe(true)+ expect(isTypeScriptVersionSupported('5.9.3')).toBe(true)+ expect(isTypeScriptVersionSupported('latest')).toBe(false)+ })++ test('filters out dev builds', () => {+ expect(versions).not.toContain('7.0.0-dev.20260101')+ })++ test('highlights the release the default version resolves to', () => {+ const active = versions.filter(v =>+ isActiveVersion(v, DEFAULT_TS_VERSION, versions),+ )+ expect(active).toEqual(['6.0.3'])+ })++ test('highlights exact and latest versions', () => {+ expect(versions.filter(v => isActiveVersion(v, '5.9.3', versions))).toEqual(+ ['5.9.3'],+ )+ expect(+ versions.filter(v => isActiveVersion(v, 'latest', versions)),+ ).toEqual(['7.0.2'])+ })+})packages-private/sfc-playground/src/App.vueindex 7020211f4..43b212dbc 100644@@ -3,6 +3,7 @@ import Header from './Header.vue' import { Repl, useStore, SFCOptions, useVueImportMap } from '@vue/repl' import Monaco from '@vue/repl/monaco-editor' import { ref, watchEffect, onMounted, computed, watch } from 'vue'+import { DEFAULT_TS_VERSION } from './typescriptVersion' const replRef = ref<InstanceType<typeof Repl>>() @@ -70,6 +71,7 @@ const store = useStore( builtinImportMap: importMap, vueVersion, sfcOptions,+ typescriptVersion: ref(DEFAULT_TS_VERSION), }, hash, )packages-private/sfc-playground/src/VersionSelect.vueindex 57efdb5f6..6b67d2129 100644@@ -1,6 +1,11 @@ <script setup lang="ts"> import { onMounted, ref } from 'vue' import Copy from './icons/Copy.vue'+import {+ filterTypeScriptVersions,+ isActiveVersion,+ isTypeScriptVersionSupported,+} from './typescriptVersion' const expanded = ref(false) const versions = ref<string[]>()@@ -47,7 +52,7 @@ async function fetchVersions(): Promise<string[]> { } return filteredVersions } else if (props.pkg === 'typescript') {- return versions.filter(v => !v.includes('dev') && !v.includes('insiders'))+ return filterTypeScriptVersions(versions) } return versions }@@ -90,10 +95,26 @@ onMounted(() => { v-for="(ver, index) of versions" class="versions-item" :class="{- active: ver === version || (version === 'latest' && index === 0),+ active:+ pkg === 'typescript'+ ? isActiveVersion(ver, version, versions ?? [])+ : ver === version || (version === 'latest' && index === 0), }" >- <a @click="setVersion(ver)">v{{ ver }}</a>+ <a+ @click="setVersion(ver)"+ :title="+ pkg === 'typescript' && !isTypeScriptVersionSupported(ver)+ ? 'Not yet supported by Vue language tools'+ : undefined+ "+ >v{{ ver+ }}{{+ pkg === 'typescript' && !isTypeScriptVersionSupported(ver)+ ? ' (unsupported)'+ : ''+ }}</a+ > <button title="Copy Version" class="version-copy"packages-private/sfc-playground/src/typescriptVersion.tsnew file mode 100644index 000000000..005349be4@@ -0,0 +1,37 @@+// Vue's language tools do not support TypeScript 7+ yet, so the playground+// must not default to the "latest" TypeScript release. A bare major version is+// resolved by jsDelivr to the newest release in that major line.+export const MAX_SUPPORTED_TS_MAJOR = 6+export const DEFAULT_TS_VERSION = String(MAX_SUPPORTED_TS_MAJOR)++export function filterTypeScriptVersions(versions: string[]): string[] {+ return versions.filter(v => !v.includes('dev') && !v.includes('insiders'))+}++export function isTypeScriptVersionSupported(version: string): boolean {+ // `latest` now resolves to TypeScript 7++ if (version === 'latest') return false+ const major = parseInt(version, 10)+ return Number.isNaN(major) || major <= MAX_SUPPORTED_TS_MAJOR+}++/**+ * Whether `ver` (an entry of the version list, sorted newest first) is the+ * one the currently selected `version` resolves to. `version` may be an exact+ * version, `latest`, or a bare major version such as `6`.+ */+export function isActiveVersion(+ ver: string,+ version: unknown,+ versions: string[],+): boolean {+ if (ver === version) return true+ if (version === 'latest') return ver === versions[0]+ if (typeof version === 'string' && /^\d+$/.test(version)) {+ const resolved = versions.find(+ v => v.startsWith(`${version}.`) && !v.includes('-'),+ )+ 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,