diff --git a/package.json b/package.json index 6ebf5114..b182cf5f 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,16 @@ "version": "2.0.12", "description": "This is part of the IFSC toolset released by Razorpay. You can find more details about the entire release at [ifsc.razorpay.com](https://ifsc.razorpay.com). Includes only a validation library as of now.", "main": "src/node/index.js", + "types": "src/node/index.d.ts", "directories": { "test": "tests" }, "dependencies": { "request": "^2.88.2" }, - "devDependencies": {}, + "devDependencies": { + "typescript": "^5.0.4" + }, "scripts": { "test": "node tests/node/validator_test.js && node tests/node/client_test.js && node tests/node/bank_test.js" }, diff --git a/src/node/index.d.ts b/src/node/index.d.ts new file mode 100644 index 00000000..e9563e9a --- /dev/null +++ b/src/node/index.d.ts @@ -0,0 +1,24 @@ +declare module 'ifsc' { + export interface IfscDetails { + MICR: string; + BRANCH: string; + ADDRESS: string; + STATE: string; + CONTACT: string; + UPI: boolean; + RTGS: boolean; + CITY: string; + CENTRE: string; + DISTRICT: string; + NEFT: boolean; + IMPS: boolean; + SWIFT: string; + BANK: string; + BANKCODE: string; + IFSC: string; + } + + export function validate(ifscCode: string): boolean; + + export function fetchDetails(ifscCode: string): Promise; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..00c45c33 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "declaration": true, + "outDir": "dist", + "module": "commonjs", + "target": "es6" + }, + "include": [ + "src/node/*" + ] +} \ No newline at end of file