This project now uses TypeScript for better type safety and development experience.
npm install
# Compile TypeScript once
npm run build
# Compile TypeScript and watch for changes
npm run watch
# On Windows
./build.bat
# On macOS/Linux
./build.sh
├── src/ts/ # TypeScript source files
│ └── svg-nearest-point-demos.ts # Main demo TypeScript file
├── assets/js/ # Compiled JavaScript output
│ └── svg-nearest-point-demos.js # Generated from TypeScript
├── tsconfig.json # TypeScript configuration
├── package.json # Node.js dependencies
└── _posts/ # Jekyll blog posts
src/ts/npm run build or npm run watchPoint, Bounds, SearchResult, etc.private, public for encapsulationThe project includes proper typing for SVG elements:
SVGPathElement for path manipulationSVGCircleElement for nearest point indicatorsSVGGElement for grouping elementsTypeScript compilation can help with: