I am developing an application using ASP.NET Webforms and I am having difficulty in using clipboardjs with TypeScript.
What I have tried:
a. Downloaded clipboardjs (https://clipboardjs.com/) and added its reference under script folder.
b. Installed clipboardjs typings using nuget.
c. Installed jquery and its typings and added jquery reference to project.
See the file details below,
Now, when I tried to follow their documentation and put some code, I am getting "Cannot find the name Clipboard" error in typescript.
What am I missing? Any suggestion / help will be greatly appreciated.
If you're on TypeScript 2.0 or later, you can get declaration files for clipboard by running
At that point, if you're not able to just write
new Clipboard
in your file without getting an error, you need to add"clipboard"
to the"types"
field in yourtsconfig.json
:This will tell TypeScript to walk up the directory chain and try to find types for the
clipboard
package in eachnode_modules
folder.