Fix TS error in EventFormatter for projects using TS5 #381
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the following error the TS compiler throws when using Echo in our TS5 project:

Because the
namespace
property is initialised without a value and set indirectly via a method call in the constructor, the TS compiler is complaining.This PR proposes the solution to promote the property in the constructor. I have selected private as the access level because I couldn't find any public usages inside the repo, and also can't imagine a use case why anyone would modify this publicly (instead of using the provided
setNamespace
method). It's also an option to promote it to a public property, that would also fix the issue.It's possible this error on occurs in certain TS5 configs. We run TS5 with WebPack (Mix) and some ignored deprecations, so it might not cause issues for TS5 users with a different resolution or config. I don't think this fix has downsides, though.