-
Notifications
You must be signed in to change notification settings - Fork 65
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: Fixed an issue with explicit value assignment due to babel trasp… #21
FIX: Fixed an issue with explicit value assignment due to babel trasp… #21
Conversation
…iler compatiblity Signed-off-by: DenisZ <[email protected]>
This is a bug in the plugin. As you can see on the TypeScript playground, TS itself doesn't emit anything for properties declared with a So I suggest you report this with the project that generates that code incorrectly (or move to another package for this). |
Sorry, I probably missed something. For example, if we run this code below ( without transpiling ) in the browser, we will get
Isn't that what a babel plugin does for us in this case? The claim is that browser does the same as babel while TS does it wrong? |
Yes, the |
Thank you @marijnh for the detailed explanation and all the best. |
After investing time in researching about this problem, I noticed that official typescript documentation has a configuration property. I am aware that the integration of configuration flag is not trivial but Setting that flag would undoubtedly solve the potencial problems in lib. |
How? As I said, I want this to be only on the prototype. |
@marijnh can we So my suggestion is to do this:
instead of:
|
I think a more fundamental question is why you are compiling the TypeScript yourself, rather than using the |
@marijnh The exclamation mark is non-null assertion operator. It is used for saying that the property "is not null", not that "it exists and is defined somwhere else". The This doesn't have anything to do with the packaging/build system limitations in my project. |
Not in this context.
This TypeScript code doesn't exist in the build output of the package, so if it is causing problems in your setup, that does suggest you're doing something odd. |
@marijnh You're right on that part - and I will make changes in my project to use the dist files. But don't you want your TS source to use proper semantics and to be more future-proof regarding this compiler flag? |
@marijnh
This is a continuation of the conversation on this pull request
After a detailed investigation, the cause of the unexpected behavior was discovered if a babel transpiler was used in the stack.
Here is a problem demonstration with an example of code within the
Selection
class constructor with avisible
property using Babel with plugin.This definition of property within the constructor actually overrides the default
true
value and causes unexpected selection behavior in all parts of the application which is demonstrated in attachment within previous PR.The problem was solved by explicitly setting the value (
true
) to thevisible
property in the Selection class.