diff --git a/.changeset/perfect-cooks-shop.md b/.changeset/perfect-cooks-shop.md
new file mode 100644
index 000000000000..b698e6a648c0
--- /dev/null
+++ b/.changeset/perfect-cooks-shop.md
@@ -0,0 +1,5 @@
+---
+'svelte': patch
+---
+
+fix: error at compile time on unsupported TypeScript language features
diff --git a/packages/svelte/messages/compile-errors/script.md b/packages/svelte/messages/compile-errors/script.md
index 47dbac6eab70..7310749f1bb4 100644
--- a/packages/svelte/messages/compile-errors/script.md
+++ b/packages/svelte/messages/compile-errors/script.md
@@ -159,3 +159,7 @@
> Cannot reference store value outside a `.svelte` file
Using a `$` prefix to refer to the value of a store is only possible inside `.svelte` files, where Svelte can automatically create subscriptions when a component is mounted and unsubscribe when the component is unmounted. Consider migrating to runes instead.
+
+## typescript_invalid_feature
+
+> TypeScript language features like %feature% are not natively supported, and their use is generally discouraged. Outside of `
diff --git a/packages/svelte/tests/validator/samples/ts-unsupported-decorator/errors.json b/packages/svelte/tests/validator/samples/ts-unsupported-decorator/errors.json
new file mode 100644
index 000000000000..427cac76f693
--- /dev/null
+++ b/packages/svelte/tests/validator/samples/ts-unsupported-decorator/errors.json
@@ -0,0 +1,14 @@
+[
+ {
+ "code": "typescript_invalid_feature",
+ "message": "TypeScript language features like decorators (related TSC proposal is not stage 4 yet) are not natively supported, and their use is generally discouraged. Outside of `
diff --git a/packages/svelte/tests/validator/samples/ts-unsupported-enum/errors.json b/packages/svelte/tests/validator/samples/ts-unsupported-enum/errors.json
new file mode 100644
index 000000000000..cd972dd86a95
--- /dev/null
+++ b/packages/svelte/tests/validator/samples/ts-unsupported-enum/errors.json
@@ -0,0 +1,14 @@
+[
+ {
+ "code": "typescript_invalid_feature",
+ "message": "TypeScript language features like enums are not natively supported, and their use is generally discouraged. Outside of `
diff --git a/packages/svelte/tests/validator/samples/ts-unsupported-modifier/errors.json b/packages/svelte/tests/validator/samples/ts-unsupported-modifier/errors.json
new file mode 100644
index 000000000000..803ebdf980a6
--- /dev/null
+++ b/packages/svelte/tests/validator/samples/ts-unsupported-modifier/errors.json
@@ -0,0 +1,14 @@
+[
+ {
+ "code": "typescript_invalid_feature",
+ "message": "TypeScript language features like accessibility modifiers on constructor parameters are not natively supported, and their use is generally discouraged. Outside of `
diff --git a/packages/svelte/tests/validator/samples/ts-unsupported-namespace/errors.json b/packages/svelte/tests/validator/samples/ts-unsupported-namespace/errors.json
new file mode 100644
index 000000000000..c9f45d3a4199
--- /dev/null
+++ b/packages/svelte/tests/validator/samples/ts-unsupported-namespace/errors.json
@@ -0,0 +1,14 @@
+[
+ {
+ "code": "typescript_invalid_feature",
+ "message": "TypeScript language features like namespaces with non-type nodes are not natively supported, and their use is generally discouraged. Outside of `
diff --git a/packages/svelte/tests/validator/test.ts b/packages/svelte/tests/validator/test.ts
index f419c6360d8f..1dcc5a58d5a5 100644
--- a/packages/svelte/tests/validator/test.ts
+++ b/packages/svelte/tests/validator/test.ts
@@ -53,10 +53,20 @@ const { test, run } = suite(async (config, cwd) => {
const expected = expected_errors && expected_errors[0];
if (error && expected) {
- assert.equal(error.code, expected.code);
- assert.equal(error.message, expected.message);
- assert.deepEqual({ line: error.start?.line, column: error.start?.column }, expected.start);
- assert.deepEqual({ line: error.end?.line, column: error.end?.column }, expected.end);
+ assert.deepEqual(
+ {
+ code: error.code,
+ message: error.message,
+ start: { line: error.start?.line, column: error.start?.column },
+ end: { line: error.end?.line, column: error.end?.column }
+ },
+ {
+ code: expected.code,
+ message: expected.message,
+ start: expected.start,
+ end: expected.end
+ }
+ );
} else if (expected) {
throw new Error(`Expected an error: ${expected.message}`);
} else if (error) {