diff --git a/types/is-svg/index.d.ts b/types/is-svg/index.d.ts index 21e85cd2e2..54ebb84457 100644 --- a/types/is-svg/index.d.ts +++ b/types/is-svg/index.d.ts @@ -1,8 +1,13 @@ -// Type definitions for is-svg 2.1 +// Type definitions for is-svg 3.0 // Project: https://github.com/sindresorhus/is-svg#readme // Definitions by: BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = isSvg; +/// -declare function isSvg(input: string): boolean; +declare function isSvg(input?: string | Buffer | false | null): boolean; + +// So that `import * as X` is possible +declare namespace isSvg {} + +export = isSvg; diff --git a/types/is-svg/is-svg-tests.ts b/types/is-svg/is-svg-tests.ts index d556a944f9..73ba29062c 100644 --- a/types/is-svg/is-svg-tests.ts +++ b/types/is-svg/is-svg-tests.ts @@ -1,3 +1,11 @@ -import isSvg = require('is-svg'); +import * as isSvg from 'is-svg'; -const result: boolean = isSvg(''); +const data = ''; +let result = false; + +result = isSvg(data); +result = isSvg(Buffer.from(data)); +result = isSvg(false); +result = isSvg(null); +result = isSvg(undefined); +result = isSvg();