-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Readonly in declaration files (part 2) #6702
Conversation
👍 |
1 similar comment
👍 |
Readonly in declaration files (part 2)
I'm concerned that this creates As an example, we had a class with some get-only accessors as part of a library we use internally, and we started compiling the library with |
@jkillian would adding an empty setter to the source class be a problem? |
@mhegazy That could be a good work around, or just changing the accessor to a regular method could work for us as well. Really, just wanted to mention this because it was a surprising back-compat issue and I wasn't sure if it was intended or not. |
Thanks @jkillian, this is not the first time we got this feedback, I will bring this up in the next design meeting. |
Sounds good. I think this case would be solved nicely in a way similar to that mentioned here: that is, a "typingsTarget" option of some sort that lets you emit typings that will be compatible with older versions of the compiler. Of course, I don't know the complexity or difficulties of that, I'll happily work with whatever you all decide. |
looping back, we are sorry we did not catch this issue as part of implementing the readonly properties. moving forward we will be more cognizant of adding new syntax to generated .d.ts files for new features. it seems there is no clean solution for this issue, that does not involve yet another compiler flag. we would recommend either adding an empty setter or using a post build script to remove the reference to readonly for now. again sorry for the inconvenience, and we will add dts compat to our new feature checklist in the feature. |
1.9 has a breaking change in the way it generates d.ts files that is not backwards compatible to 1.8. microsoft/TypeScript#6702
Augments #6697 to emit
readonly
modifier in declaration file for get-only accessors in classes.