react-codemirror2
react-codemirror2 copied to clipboard
Fix kb types
Coverage remained the same at 81.174% when pulling 009154b675a6cc78e8fd51237e2a25ef7fb40746 on andyrichardson:fix-kb-types into a633e7dd673ddf5bdb07e2ed664a03aa47159bfa on scniro:master.
Hey! Not related to the repo but i'm using plain CodeMirror inside a TS/React project and i'm trying to attach a function to the on('keydown') method:
codeMirror.on("keydown", handleKeyDown);
But i'm getting this:
Type 'Event' is missing the following properties from type 'KeyboardEvent': altKey, char, charCode, code, and 16 more.
I used the same interface as you in my handler:
const handleKeyDown: DomEvent<KeyboardEvent> = (instance, event) => {...}
Def:
interface DomEvent<T extends Event = Event> {
(editor: CodeMirror.Editor, event: T): void;
}
This PR was enough for you to fix it? Some ideas on why it's not working for me are going to be highly appreciated 🙏
@gonzarodriguezt this was the same issue I had. This PR fixes it.
@andyrichardson @grdnrt I am a lot shorter on time these days as when I started this project. Codemirror & React APIs are moving to quickly for me to keep atop of for the day-to-day. I am looking for a co-maintainer of this project. Please contact me directly if you are interested. Thank you for understanding.
@andyrichardson do you mind doing a pull from master to resolve conflicts? Then I'll merge this!
For sure, I'll take a quick look some time today