-
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
Fix Get/Set being enumerable #32264
Fix Get/Set being enumerable #32264
Conversation
Note: I just followed the normal convention of setting @sheetalkamat Let me know what you think, seeing as you have already approved these changes. |
I missed this in 3.7 when I was adding ES-compliant class field emit. However, I think it's better to put it into 3.9 now than to wait any longer. |
@sandersn Thanks for merging from master, I don't know how I missed the notifications on this |
Travis fails because it still thinks that we're using submodules for the user tests. Not sure why. |
Thanks for your patience on this @pathurs |
Does this affect the types for keyof T when T has getters? |
No, this affects emit, not the type system. |
This is a significant breaking change in our case. The UI library we use (Telerik's Kendo) uses property enumerability to convert "plain" objects to the Observable variant it uses within its UI classes. With this change, property definitions are excluded from the conversion and the associated properties are no longer present on objects retrieved from Kendo's containers. I support standards, of course, but it would be nice if there was an option to keep the old behavior. I'd be surprised if the new behavior is as innocuous as its low profile in the changelog seems to suggest. |
I agree with @benpetermorris. This has a massive implication for library using TS |
We have been struggling with this breaking change aswell as we were relying on being able to enumerate over getters. function Enumerable(
target: unknown,
propertyKey: string,
descriptor: PropertyDescriptor
) {
descriptor.enumerable = true;
}; class Testi {
@Enumerable
get prop(): string {
return 'moin';
}
} I guess this is a bit hacky, but the cleanest solution we could come up with. |
This CR updates Typescript to version 4.0.3, @types/node to version 14.11.8, ts-node to version 9.0.0 Also, because of changes in Typescript 3.9.0 (microsoft/TypeScript#32264) the testing becoming failing. The testing (sinon) library uses for stubbing dependencies the enumerable properties of objects. We do not able to use that way if we need to stub some dependency in tests with Typescript 3.9+ versions. The right way is about refactoring code (adding dependency injection, for example), but it's a huge task. Fo resolving that problem, we use the 'tslib 1.13.0' helper module and compile for testing the code with included helpers from that lib. It's at least a working solution until a better way is found. Resolves: OLPEDGE-2315 Signed-off-by: Oleksii Zubko <[email protected]>
This CR updates Typescript to version 4.0.3, @types/node to version 14.11.8, ts-node to version 9.0.0 Also, because of changes in Typescript 3.9.0 (microsoft/TypeScript#32264) the testing becoming failing. The testing (sinon) library uses for stubbing dependencies the enumerable properties of objects. We do not able to use that way if we need to stub some dependency in tests with Typescript 3.9+ versions. The right way is about refactoring code (adding dependency injection, for example), but it's a huge task. Fo resolving that problem, we use the 'tslib 1.13.0' helper module and compile for testing the code with included helpers from that lib. It's at least a working solution until a better way is found. Resolves: OLPEDGE-2315 Signed-off-by: Oleksii Zubko <[email protected]>
This CR updates Typescript to version 4.0.3, @types/node to version 14.11.8, ts-node to version 9.0.0 Also, because of changes in Typescript 3.9.0 (microsoft/TypeScript#32264) the testing becoming failing. The testing (sinon) library uses for stubbing dependencies the enumerable properties of objects. We do not able to use that way if we need to stub some dependency in tests with Typescript 3.9+ versions. The right way is about refactoring code (adding dependency injection, for example), but it's a huge task. Fo resolving that problem, we use the 'tslib 1.13.0' helper module and compile for testing the code with included helpers from that lib. It's at least a working solution until a better way is found. Resolves: OLPEDGE-2315 Signed-off-by: Oleksii Zubko <[email protected]>
Ref microsoft/TypeScript#32264 (comment) We need getters for the ActiveLayout classes to be enumerable so that we can copy them across in the polyfill functions.
Fixes #3610