From a529185e5fd3c4ee19f02abc58f3ff3b7e3d6e2d Mon Sep 17 00:00:00 2001 From: Bharat Parsiya Date: Wed, 12 Apr 2023 12:22:13 +0530 Subject: [PATCH] add typescirpt support --- package.json | 5 ++++- src/node/index.d.ts | 24 ++++++++++++++++++++++++ tsconfig.json | 11 +++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/node/index.d.ts create mode 100644 tsconfig.json 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