-
This is my first time with Deno, and I started writing a small library that I usually use in many projects I own. The problem I have is Deno does not recognize some TypeScript types. This particular case is This is the error message I'm getting: error: TS2304 [ERROR]: Cannot find name 'KeyboardEvent'.
const isEnter = ({ code, key, keyCode, type }: KeyboardEvent): boolean =>
~~~~~~~~~~~~~
at https://raw.githubusercontent.com/davegomez/is-keyboard-event/main/src/is-enter.ts:3:48 I know the type exists because TypeScript compiles the file correctly. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Deno only builds in the type definitions that Deno supports (you can see what these are by doing If you are trying to use code that is written for the web and maybe get it to work under Deno, you will need to supply a TypeScript configuration file with something like this: {
"compilerOptions": {
"lib": [ "esnext", "dom", "dom.iterable", "deno.ns" ]
}
} And then supply it on the command line via the Feel free to join the discussion on Discord which can usually be more interactive on answering these type of questions: https://discord.gg/deno |
Beta Was this translation helpful? Give feedback.
Deno only builds in the type definitions that Deno supports (you can see what these are by doing
deno types
or visiting https://doc.deno.land/builtin/stable. Deno does not support support keyboard events.If you are trying to use code that is written for the web and maybe get it to work under Deno, you will need to supply a TypeScript configuration file with something like this:
And then supply it on the command line via the
--config
option.Feel free to join the discussion on Discord which can usually be more interactive on answering these type of questions: https://discord.gg/deno