leizongmin / js-xss

Sanitize untrusted HTML (to prevent XSS) with a configuration specified by a Whitelist
http://jsxss.com
Other
5.19k stars 630 forks source link

[Question] How to use typings in browser-targeting code? #229

Closed marekdedic closed 3 years ago

marekdedic commented 3 years ago

Hi, I am using xss in code intended to run in the browser (so no import or require...). I'm trying to get the following to work:

/// <reference types="xss" />
declare function xssOptions(): xss.IFilterXSSOptions;

However, I'm getting error TS2503: Cannot find namespace 'xss'. Is this an issue with the typings? Or am I using it wrong?

Thanks!

leizongmin commented 3 years ago

try use upper case XSS:

declare function xssOptions(): XSS.IFilterXSSOptions;
marekdedic commented 3 years ago

Oh, thanks, that works...