You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ManipulationError: Manipulation error: A syntax error was inserted.
module.ts:11:5 - error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
Analysis
I tracked this down to a single line in ClassLikeDeclarationBase.ts, in the insertMethods() method:
structures=structures.map(s=>({ ...s}));
Frankly, I don't understand the point of this line. The spread operator, however, will not enumerate over inherited properties (such as the name getter in my sample class above).
Commenting out this line, every existing test in ts-morph still passes. I assume the line itself is a protection against something... but what?
The text was updated successfully, but these errors were encountered:
ajvincent
changed the title
ClassDeclaration::set() can't take instances of a class with getters safely
ClassDeclaration::set() can't take instances of a class structure with getters among the methods safely
Apr 15, 2024
Without seeing the code, my guess is a naive attempt at cloning in order to not modify the objects the user passed in. Not sure if that actually occurs there though.
Describe the bug
Version: 22.0.0
To Reproduce
Expected behavior
Actual Behavior
Analysis
I tracked this down to a single line in ClassLikeDeclarationBase.ts, in the insertMethods() method:
Frankly, I don't understand the point of this line. The spread operator, however, will not enumerate over inherited properties (such as the name getter in my sample class above).
Commenting out this line, every existing test in ts-morph still passes. I assume the line itself is a protection against something... but what?
The text was updated successfully, but these errors were encountered: