Installation
ts-vat is available as an npm package and can be installed using your preferred package manager.
Package Managers
Choose your package manager of choice:
sh
npm install ts-vat
# or install with TypeScript types
npm install ts-vat @types/ts-vat
sh
bun install ts-vat
sh
pnpm add ts-vat
sh
yarn add ts-vat
TypeScript Configuration
If you're using TypeScript, make sure your tsconfig.json
includes the following settings for the best experience:
json
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"lib": ["ES2020", "DOM"],
"types": ["node"], // or "types": ["bun"]
"resolveJsonModule": true
}
}
Environment Setup
VIES Service Access
ts-vat uses the EU's VIES (VAT Information Exchange System) service for VAT number validation. Make sure your environment has:
- Access to the internet
- No firewall blocking access to
ec.europa.eu
- Proper SSL/TLS support
Timeouts
By default, ts-vat sets a 30-second timeout for VIES service calls. You can configure this in your initialization:
typescript
const calculator = new VatCalculator({
soapTimeout: 15000, // 15 seconds
})
Next Steps
Once installed, you can:
- Check out the Usage Guide for examples
- Review the Configuration Options
- Explore the API Documentation