Skip to content

fix: $derived argument expression to apply correct type information to this #732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 2, 2025

Conversation

ota-meshi
Copy link
Member

fixes #730

Copy link
Contributor

github-actions bot commented Jul 31, 2025

Try the Instant Preview in Online Playground

ESLint Online Playground

Install the Instant Preview to Your Local

npm i https://pkg.pr.new/svelte-eslint-parser@5c8542e

Published Instant Preview Packages:

View Commit

Copy link

changeset-bot bot commented Jul 31, 2025

🦋 Changeset detected

Latest commit: 62302ae

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

This PR includes changesets to release 1 package
Name Type
svelte-eslint-parser 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

@coveralls
Copy link

coveralls commented Jul 31, 2025

Pull Request Test Coverage Report for Build 16687707346

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 35 of 39 (89.74%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 94.671%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/typescript/analyze/index.ts 35 39 89.74%
Totals Coverage Status
Change from base Build 16641081628: -0.03%
Covered Lines: 10579
Relevant Lines: 11050

💛 - Coveralls

@ota-meshi ota-meshi requested a review from baseballyama July 31, 2025 23:30
const expression = derivedCall.arguments[0];
ctx.appendOriginal(expression.range[0]);
ctx.appendVirtualScript(
`(()=>{return ${functionId}();function ${functionId}(){return `,
`(()=>{type ${thisTypeId} = typeof this; return ${functionId}();function ${functionId}(this: ${thisTypeId}){return `,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It think we need to update comment of transformForDollarDerived function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks!

Copy link
Member

@baseballyama baseballyama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I left 1 comment👍

@ota-meshi ota-meshi merged commit 1350734 into main Aug 2, 2025
12 checks passed
@ota-meshi ota-meshi deleted the fix-$derived-within-class branch August 2, 2025 00:21
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.

false positive no-unsafe-member-access when accessing same class fields inside $derived
3 participants