Skip to content

Comments

fix(isolated_declarations): Don't require private method arguments to have type annotations#5874

Closed
MichaelMitchell-at wants to merge 1 commit intooxc-project:mainfrom
MichaelMitchell-at:allow_private_method_arg_missing_type
Closed

fix(isolated_declarations): Don't require private method arguments to have type annotations#5874
MichaelMitchell-at wants to merge 1 commit intooxc-project:mainfrom
MichaelMitchell-at:allow_private_method_arg_missing_type

Conversation

@MichaelMitchell-at
Copy link
Contributor

In #4934 I introduced a regression which caused the following code to begin having an isolated declarations error where it shouldn't:

export class Foo {
  private foo(a): void {}
}

TS playground

@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 19, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added the A-isolated-declarations Isolated Declarations label Sep 19, 2024
}

if method.accessibility.is_some_and(TSAccessibility::is_private) {
self.errors.borrow_mut().truncate(errors_length);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a little bit hacky. I think a less hacky way might be to decouple methods like transform_formal_parameters from generating errors and then move the check for errors after this block, but I wanted to get some feedback before starting to attempt something like that.

Copy link
Member

Choose a reason for hiding this comment

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

I think we can handle the private method early, can you try it?

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 19, 2024

CodSpeed Performance Report

Merging #5874 will not alter performance

Comparing MichaelMitchell-at:allow_private_method_arg_missing_type (a1ce91c) with main (1ccf290)

Summary

✅ 29 untouched benchmarks

@Boshen Boshen requested a review from Dunqing September 19, 2024 03:56
@Dunqing
Copy link
Member

Dunqing commented Sep 19, 2024

Sorry, I didn't see any errors in your case.

The private method will turn into a property without type annotations. The output is

export class Foo {
  private foo;
}

@MichaelMitchell-at
Copy link
Contributor Author

Sorry, I didn't see any errors in your case.

The private method will turn into a property without type annotations.

That's the correct behavior, but currently there is an error when using oxc_isolated_declarations. This PR removes the error. If you pull this branch locally and undo the change I made to class.rs, the snapshot test will begin to fail.

@Dunqing
Copy link
Member

Dunqing commented Sep 20, 2024

That's the correct behavior, but currently there is an error when using oxc_isolated_declarations. This PR removes the error. If you pull this branch locally and undo the change I made to class.rs, the snapshot test will begin to fail.

Ah, you are right. I found our example that doesn't report any isolated declaration errors. Fixes in #5918

@Dunqing
Copy link
Member

Dunqing commented Sep 22, 2024

Fixed in #5964

We are about to release a new version that includes fixes for many incorrect outputs in oxc-isolated-declarations, as well as support for the strip_internal option. Therefore, I will fix all known bugs before the next release. Thank you for trying to fix it.

@MichaelMitchell-at
Copy link
Contributor Author

Thank you!

Boshen pushed a commit that referenced this pull request Sep 22, 2024
…hat has arguments without type annotations (#5964)

close: #5874
@MichaelMitchell-at MichaelMitchell-at deleted the allow_private_method_arg_missing_type branch September 22, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-isolated-declarations Isolated Declarations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants