I just started to learn typescript and just started converting my nodejs/express application to typescript.
I have successfully got all types for the library using npm i @types/some-lib
only library, I can't find was npm i @types/xss-clean where to find this library
import xss from 'xss-clean' //getting type definition error
app.use(xss())
If the library does not have many TypeScript users, chances are that no published types exist. In that case you can add your own to whatever degree of detail you wish.
You can create a type definition file, eg xss-clean.d.ts
:
declare module 'xss-clean'
{
const value: Function;
export default value;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.