diff --git a/strip-json-comments/strip-json-comments-tests.ts b/strip-json-comments/strip-json-comments-tests.ts new file mode 100644 index 0000000000..3a9e91f3d8 --- /dev/null +++ b/strip-json-comments/strip-json-comments-tests.ts @@ -0,0 +1,11 @@ +// Type definitions for strip-json-comments +// Project: https://github.com/sindresorhus/strip-json-comments +// Definitions by: Dylan R. E. Moonfire +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// +import stripJsonComments = require("strip-json-comments"); + +const json = '{/*rainbows*/"unicorn":"cake"}'; + +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} diff --git a/strip-json-comments/strip-json-comments.d.ts b/strip-json-comments/strip-json-comments.d.ts new file mode 100644 index 0000000000..721b83314d --- /dev/null +++ b/strip-json-comments/strip-json-comments.d.ts @@ -0,0 +1,13 @@ +// Type definitions for strip-json-comments +// Project: https://github.com/sindresorhus/strip-json-comments +// Definitions by: Dylan R. E. Moonfire +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "strip-json-comments" { + interface StripJsonOptions { + whitespace?: boolean; + } + + function stripJsonComments(input: string, opts?: StripJsonOptions): string; + export = stripJsonComments; +}