diff --git a/types/detect-character-encoding/detect-character-encoding-tests.ts b/types/detect-character-encoding/detect-character-encoding-tests.ts new file mode 100644 index 0000000000..42f21a688e --- /dev/null +++ b/types/detect-character-encoding/detect-character-encoding-tests.ts @@ -0,0 +1,10 @@ +import detectCharacterEncoding = require("detect-character-encoding"); + +const buf: Buffer = null as any; + +const result: detectCharacterEncoding.Result | null = detectCharacterEncoding(buf); + +if (result) { + const str: string = result.encoding; + const num: number = result.confidence; +} diff --git a/types/detect-character-encoding/index.d.ts b/types/detect-character-encoding/index.d.ts new file mode 100644 index 0000000000..123a7659eb --- /dev/null +++ b/types/detect-character-encoding/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for detect-character-encoding 0.7 +// Project: https://github.com/sonicdoe/detect-character-encoding#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export = detectCharacterEncoding; + +declare function detectCharacterEncoding(buf: Buffer): detectCharacterEncoding.Result | null; + +declare namespace detectCharacterEncoding { + interface Result { + encoding: string; + confidence: number; + } +} diff --git a/types/detect-character-encoding/tsconfig.json b/types/detect-character-encoding/tsconfig.json new file mode 100644 index 0000000000..e2adad72dd --- /dev/null +++ b/types/detect-character-encoding/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "detect-character-encoding-tests.ts" + ] +} diff --git a/types/detect-character-encoding/tslint.json b/types/detect-character-encoding/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/detect-character-encoding/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }