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

Fix .data property in IsomorphicBaseEvent #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

flut1
Copy link
Contributor

@flut1 flut1 commented Feb 19, 2020

Set the .data property again (even though it's already defined in the base class). This is related to this issue the new declaration behavior for class fields.

It seems to be that things are running fine when compiling, but if running in jest or ts-node, the behavior described in useDefineForClassFields will be used instead. This will cause
the specialization of the data property to a sub-type in IsomorphicBaseEvent to actually re-declare the property as undefined.

Note: we could use the declare keyword here as well, but that would require a typescript update to 3.7. This seems to be the most straightforward solution

Closes #50

Check if the .data property is properly set when using
createIsomorphicEventData
Set the .data property again (even though it's already defined
in the base class). This is related to this issue:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier

It seems to be that things are running fine when compiling, but
if running in jest or ts-node, the behavior described in
useDefineForClassFields will be used instead. This will cause
the specialization of the data property to a sub-type in
IsomorphicBaseEvent to actually re-declare the property as
undefined.

Closes #50
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 4072b66 on bug-isomorphic-event-data into 3a07b1a on master.

@flut1 flut1 requested a review from ThaNarie February 19, 2020 12:42
Copy link
Member

@ThaNarie ThaNarie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good option for now, when switching to 3.7+ later we could decide to remove this again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Property .data not properly set on createIsomorphicEventClass()
3 participants