Skip to content

Conversation

@ciscorn
Copy link
Contributor

@ciscorn ciscorn commented Dec 18, 2024

related: #14743 #14744 @Rich-Harris

This PR fixes a compilation issue that occurs when esrap 1.3.0 or later is used.

When compiling the following component...

<script lang="ts">
  interface MyInterface {}
  class MyClass implements MyInterface {}
</script>

<p>hello</p>

...the following error occurs:

error during build:
src/routes/Component.svelte (4:26): Expected '{', got 'implements' (Note that you need plugins to import files that are not JavaScript)
file: /***/***/***/src/routes/Component.svelte:4:26

2:   interface MyInterface {}
3: 
4:   class MyClass implements MyInterface {}

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

@changeset-bot
Copy link

changeset-bot bot commented Dec 18, 2024

🦋 Changeset detected

Latest commit: 54ba0bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ciscorn ciscorn force-pushed the remove-ts-implements branch from ca46553 to 88dbb7f Compare December 18, 2024 07:24
@ciscorn ciscorn changed the title fix: remove implements from class declaration fix: remove 'implements' from class declaration Dec 18, 2024
@github-actions
Copy link
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@14749

@paoloricciuti
Copy link
Member

I think it make sense...can you add a test for this?

@ciscorn
Copy link
Contributor Author

ciscorn commented Dec 18, 2024

@paoloricciuti Thanks

Of course, I’d like to add a test, but I can’t figure out the appropriate place for it.
Looks like the preceding hotfix (#14744) didn’t include tests either.

@paoloricciuti
Copy link
Member

@paoloricciuti Thanks

Of course, I’d like to add a test, but I can’t figure out the appropriate place for it. Looks like the preceding hotfix (#14744) didn’t include tests either.

I would just add a "smoke test" in /packages/svelte/tests/runtime-browser/samples/. You can create a new folder, give it a descriptive name and create a

main.svelte

<script lang="ts">
	interface MyInterface {}
	class MyClass implements MyInterface {}
</script>

and
_config.js

import { test } from '../../assert';

export default test({});

this is failing on main and should not in you branch.

@ciscorn
Copy link
Contributor Author

ciscorn commented Dec 18, 2024

@paoloricciuti

Many thanks for your kind guidance! I’ve added the test as suggested.

I’ve also confirmed it fails on the main branch.

@paoloricciuti
Copy link
Member

@paoloricciuti

Many thanks for your kind guidance! I’ve added the test as suggested.

I’ve also confirmed it fails on the main branch.

Great...let's wait on greens! Thanks a lot!

@paoloricciuti paoloricciuti merged commit c79b909 into sveltejs:main Dec 18, 2024
10 checks passed
@github-actions github-actions bot mentioned this pull request Dec 18, 2024
@ciscorn ciscorn deleted the remove-ts-implements branch December 18, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants