Skip to content

Fix TS error in EventFormatter for projects using TS5 #381

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

Merged
merged 1 commit into from
Jun 15, 2023
Merged

Fix TS error in EventFormatter for projects using TS5 #381

merged 1 commit into from
Jun 15, 2023

Conversation

SanderMuller
Copy link
Contributor

This PR fixes the following error the TS compiler throws when using Echo in our TS5 project:
image

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.

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.

2 participants