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

tsc error on @Event() #2988

Closed
olivier65 opened this issue Aug 2, 2021 · 1 comment
Closed

tsc error on @Event() #2988

olivier65 opened this issue Aug 2, 2021 · 1 comment

Comments

@olivier65
Copy link

olivier65 commented Aug 2, 2021

Stencil version:

 @stencil/core@2.6.0

I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request

Current behavior:
tsc puts "Property 'alarmsUpdated' has no initializer and is not definitely assigned in the constructor." when encountering the @Event() alarmsUpdated: EventEmitter<Alarm[]> declaration.

Expected behavior:
No error.

Steps to reproduce:
See the project files in issues stenciljs/store#73.

@ionitron-bot ionitron-bot bot added the triage label Aug 2, 2021
@olivier65
Copy link
Author

The workaround is to declare the event as @Event() alarmsUpdated: EventEmitter<Alarm[]>! (i.e., with a non-null operator at the end) or turn off strictPropertyInitialization in tsconfig. Props to Mark Cianfrani on Slack for the solution.

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

No branches or pull requests

2 participants