Skip to content

Commit 0cca179

Browse files
feat: added support for typescript@^6.0.0 (#121)
* feat: added support for typescript@^6.0.0 * Add changes from twoslash/twoslash#86 * pnpm lint:fix
1 parent 7be325c commit 0cca179

5 files changed

Lines changed: 21 additions & 4 deletions

File tree

.changeset/clean-bikes-pump.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@ec-ts/twoslash": patch
3+
"@ec-ts/twoslash-vue": patch
4+
"@ec-ts/vfs": patch
5+
"css-js-gen": patch
6+
"expressive-code-twoslash": patch
7+
---
8+
9+
Added support for typescript@6.0.0

packages/@ec-ts/twoslash/src/core.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ export function createTwoslasher(createOptions: CreateTwoslashOptions = {}): Two
111111
extension = "ts",
112112
options: TwoslashExecuteOptions = {},
113113
): TwoslashReturn {
114+
const tsMajorVersion = Number(ts.versionMajorMinor.split(".")[0]);
114115
const meta: TwoslashReturnMeta = {
115116
extension: typesToExtension(extension),
116117
compilerOptions: {
117118
...defaultCompilerOptions,
118-
baseUrl: fsRoot,
119+
// TypeScript removed the baseUrl option in 6.0
120+
...(tsMajorVersion <= 5 && { baseUrl: fsRoot }),
119121
...createOptions.compilerOptions,
120122
...options.compilerOptions,
121123
},

packages/@ec-ts/twoslash/src/flag-keys.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const flagKeys = [
1111
"alwaysStrict",
1212
"assumeChangesOnlyAffectDirectDependencies",
1313
"baseUrl",
14-
"build",
1514
"charset",
1615
"checkJs",
1716
"composite",
@@ -28,6 +27,7 @@ export const flagKeys = [
2827
"emitBOM",
2928
"emitDeclarationOnly",
3029
"emitDecoratorMetadata",
30+
"erasableSyntaxOnly",
3131
"errors",
3232
"esModuleInterop",
3333
"exactOptionalPropertyTypes",
@@ -46,6 +46,7 @@ export const flagKeys = [
4646
"init",
4747
"inlineSourceMap",
4848
"inlineSources",
49+
"isolatedDeclarations",
4950
"isolatedModules",
5051
"jsx",
5152
"jsxFactory",
@@ -54,6 +55,7 @@ export const flagKeys = [
5455
"keepNotations",
5556
"keyofStringsOnly",
5657
"lib",
58+
"libReplacement",
5759
"listEmittedFiles",
5860
"listFiles",
5961
"listFilesOnly",
@@ -65,6 +67,7 @@ export const flagKeys = [
6567
"moduleResolution",
6668
"moduleSuffixes",
6769
"newLine",
70+
"noCheck",
6871
"noEmit",
6972
"noEmitHelpers",
7073
"noEmitOnError",
@@ -84,6 +87,7 @@ export const flagKeys = [
8487
"noStaticSemanticInfo",
8588
"noStrictGenericChecks",
8689
"noUncheckedIndexedAccess",
90+
"noUncheckedSideEffectImports",
8791
"noUnusedLocals",
8892
"noUnusedParameters",
8993
"out",
@@ -102,6 +106,7 @@ export const flagKeys = [
102106
"resolveJsonModule",
103107
"resolvePackageJsonExports",
104108
"resolvePackageJsonImports",
109+
"rewriteRelativeImportExtensions",
105110
"rootDir",
106111
"rootDirs",
107112
"showConfig",
@@ -113,6 +118,7 @@ export const flagKeys = [
113118
"sourceRoot",
114119
"strict",
115120
"strictBindCallApply",
121+
"strictBuiltinIteratorReturn",
116122
"strictFunctionTypes",
117123
"strictNullChecks",
118124
"strictPropertyInitialization",

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ catalogs:
1717
min:
1818
"@expressive-code/core": ^0.41.7
1919
expressive-code: ^0.41.7
20-
typescript: ^5.5.0
20+
typescript: ^5.5.0 || ^6.0.0
2121
twoslash:
2222
"@vue/language-core": ^3.2.5
2323
twoslash-protocol: ^0.3.6

0 commit comments

Comments
 (0)