Skip to content
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

Add back definite on PrivateProp #4050

Closed
dsherret opened this issue Mar 16, 2022 · 5 comments · Fixed by #4051
Closed

Add back definite on PrivateProp #4050

dsherret opened this issue Mar 16, 2022 · 5 comments · Fixed by #4051
Labels
Milestone

Comments

@dsherret
Copy link
Contributor

dsherret commented Mar 16, 2022

Describe the bug

The definite property was removed, but it's not useless. It's useful for analysis to know if this exists or not.

https://github.com/swc-project/swc/pull/3868/files#diff-7691f705debe5b1726316e17ca0361f9fb546ef8df4a7845474514a22de8f5f4L181

cc @Austaras

Input code

class Test {
  #test!:string;
}

Config

No response

Playground link

https://www.typescriptlang.org/play?ssl=3&ssc=2&pln=1&pc=1#code/MYGwhgzhAEAqCmEAu0DeBYAUNaBiJiSAhAFzIBOAlgHYDmA3FgL5A

Expected behavior

Should have definite.

Actual behavior

No response

Version

swc_ecmascript 0.134.0

Additional context

No response

@Austaras
Copy link
Member

Austaras commented Mar 16, 2022

This is not definite: as private prop is entirely lexical scoped, even an empty private prop would generate an according key, so it's concrete, the ! suffix is only used to mark its type

@dsherret
Copy link
Contributor Author

@Austaras from my understanding, "definite" in this case means is there an ! for TypeScript or not. Since this removal, I don't see a way to tell if there's an ! right now without looking at the source text instead of the AST.

@Austaras
Copy link
Member

Oh you're right. Although I don't know if this is used in anywhere other than type check.

@dsherret
Copy link
Contributor Author

I use it for code formatting.

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 17, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

4 participants