Skip to content

Commit

Permalink
fix: pin TypeScript to ~5.3.3 to fix language-tools tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Mar 19, 2024
1 parent 8bebb63 commit da5ec00
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/language-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,19 @@ export async function test(options: RunOptions) {
beforeBuild: 'pnpm dedupe',
build: 'build',
test: 'test',
patchFiles: {
'package.json': (content) => {
const pkg = JSON.parse(content)
// As of 2024-03-19,
// the version of TypeScript in the package.json is latest, which resolves to 5.4.2 if we dedupe it.
// The new feature in TypeScript 5.4,
// [Preserved Narrowing in Closures Following Last Assignments](https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/#preserved-narrowing-in-closures-following-last-assignments),
// would cause a type error at <https://github.com/vuejs/language-tools/blob/58a820281d4b4a8b2d484a7fa2a2eb73e5eb4daf/packages/language-service/lib/plugins/vue-document-drop.ts#L88>.
// There are also other tests broken by TypeScript 5.4.
// So we need to pin the version to ~5.3.3.
pkg.devDependencies.typescript = '~5.3.3'
return JSON.stringify(pkg, null, 2)
},
},
})
}

0 comments on commit da5ec00

Please sign in to comment.