We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I initialize the class with the following code
import EventEmitter from "eventemitter3"; type defaultType = { "test"(): void; }; class subClass< Z extends { [props: string]: (...args: any[]) => any }, > extends EventEmitter<Z & defaultType> { constructor() { super(); let func = () => {}; this.on("test", func); this.emit("test"); this.off("test", func); } }
But, in the following line of code:
this.on("test", func); this.emit("test"); this.off("test", func);
There is an error in the parameters: Argument of type 'string' is not assignable to parameter of type 'EventNames<Z & defaultType>'.typescript(2345)
Argument of type 'string' is not assignable to parameter of type 'EventNames<Z & defaultType>'.typescript(2345)
I don't know why, what will cause this problem? CodeSandbox: URL
The text was updated successfully, but these errors were encountered:
我有相同的问题,这个是 ts 的问题吗,说实话,不知道为什么会抛出这样的 ts 错误
Sorry, something went wrong.
No branches or pull requests
I initialize the class with the following code
But, in the following line of code:
There is an error in the parameters:
Argument of type 'string' is not assignable to parameter of type 'EventNames<Z & defaultType>'.typescript(2345)
I don't know why, what will cause this problem?
CodeSandbox: URL
The text was updated successfully, but these errors were encountered: