Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add typescirpt support #327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
24 changes: 24 additions & 0 deletions src/node/index.d.ts
Original file line number Diff line number Diff line change
@@ -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<IfscDetails>;
}
11 changes: 11 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"declaration": true,
"outDir": "dist",
"module": "commonjs",
"target": "es6"
},
"include": [
"src/node/*"
]
}