diff --git a/types/js-roman-numerals/index.d.ts b/types/js-roman-numerals/index.d.ts new file mode 100644 index 0000000000..3127eba388 --- /dev/null +++ b/types/js-roman-numerals/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for js-roman-numerals 1.1 +// Project: https://github.com/bcotrim/roman-numerals +// Definitions by: Ricardo Mello +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.5 + +declare class RomanNumeral { + constructor(value: number | string); + toInt(): number; + toString(): string; +} + +export = RomanNumeral; diff --git a/types/js-roman-numerals/js-roman-numerals-tests.ts b/types/js-roman-numerals/js-roman-numerals-tests.ts new file mode 100644 index 0000000000..bbda7595d8 --- /dev/null +++ b/types/js-roman-numerals/js-roman-numerals-tests.ts @@ -0,0 +1,12 @@ +import RomanNumeral = require('js-roman-numerals'); + +function constructorTests() { + const x = new RomanNumeral(10); // '10' | 'X' + const y = new RomanNumeral('V'); // '5' | 'V' +} + +function functionTests() { + const x = new RomanNumeral(10); + const y: number = x.toInt(); + const z: string = x.toString(); +} diff --git a/types/js-roman-numerals/tsconfig.json b/types/js-roman-numerals/tsconfig.json new file mode 100644 index 0000000000..2852d754ce --- /dev/null +++ b/types/js-roman-numerals/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "js-roman-numerals-tests.ts"] +} diff --git a/types/js-roman-numerals/tslint.json b/types/js-roman-numerals/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/js-roman-numerals/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}