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
An index signature parameter type must be either 'string', 'symbol' or 'number' #292
Comments
Would you be able to submit a PR to fix this? Might be useful to pin dependencies to 6.4.7 until then. 😅 It'd be useful if we could get a PR for TS-specific tests to avoid breaking things like that. |
If you advise me, how to do so =) For me it looks like a straight JS repository (https://github.com/EventEmitter2/EventEmitter2/blob/master/lib/eventemitter2.js), but I have no clue, how you generated that eventemitter2.d.ts file. Maybe I am missing sth, but would like to contribute. Or do you work directly inside that file, since I saw a PR linked to it? |
Indeed we just add changes to the |
Just spent some time regarding the PR. Please advise me, how you want to proceed. Either you define your TS version ^4.4.4 or you use mapped object types by "in" for legacy TS versions. |
Ref: #292 |
I'll revert the change and publish a new patch version to unblock folks while we figure out the best path forward. One sec. |
6.4.9 has reverted the TS changes. Does that unblock your pipeline @sanketnadkarni7 ? |
@rsteinig I think having something that supports legacy versions of TS would be best so that we don't cause too much pain to folks. Would you mind creating a fork, making changes there, then doing a PR from your fork to this repo? I'll take note to release TS changes as major updates going forward just in case. 😅 |
@RangerMauve Yes it is working for us now, pipeline is passing now. Thankyou! |
just to let you know, PR got placed. thanks |
Looks like, there is an issue by the latest 6.4.8 version. An index type can't be of any Uniontype definition. It must be broken down to any simple data type definition. It should be "[key in event]" instead. I use ng12.2.16 and TS 4.3.5.
export type event = (symbol|string);
export type eventNS = string|event[];
export type typeSafeEvents = {
[key: event]: (...args: any[]) => void
}
and
export declare class EventEmitter2<TypeSafeEvents extends typeSafeEvents = { [key: event]: (...args: any[]) => void }>
✖ Compiling with Angular sources in Ivy partial compilation mode.
node_modules/eventemitter2/eventemitter2.d.ts:4:6 - error TS1023: An index signature parameter type must be either 'string' or 'number'.
4 [key: event]: (...args: any[]) => void
~~~
node_modules/eventemitter2/eventemitter2.d.ts:124:79 - error TS1023: An index signature parameter type must be either 'string' or 'number'.
124 export declare class EventEmitter2<TypeSafeEvents extends typeSafeEvents = { [key: event]: (...args: any[]) => void }> {
~~~
The text was updated successfully, but these errors were encountered: