events: add type check for event name
According to docs only string
/symbol
are allowed but the checks are more relaxed to allow also number
/bigint
as it seems they are used in user land modules.
There were already checks in place in the past and they have been removed have been removed. Another try to add them again was done but never finished (#21007). Therefore I'm not sure if this should be added or not. As I had most of the changes already in place once I noticed this I think it's better to discuss this in a PR.
Fixes: #31331 (closed) Refs: https://github.com/nodejs/node/commit/04688614f70470dba1f7512844fd2c4008d9d8bd Refs: #21007
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Edit: Removed null
as it was removed during review phase.