Installation
Install
Section titled “Install”npm install data-pathRequirements
Section titled “Requirements”- Node
>=20 - TypeScript
>=5.0
TypeScript configuration
Section titled “TypeScript configuration”No special flags are required. A minimal tsconfig.json that works:
{ "compilerOptions": { "target": "ES2020", "module": "ESNext", "moduleResolution": "Bundler", "strict": true }}strict: true is recommended — it enables full inference through lambda parameters. Without it, some path expressions may resolve to unknown instead of the correct leaf type.
Verify the install
Section titled “Verify the install”import { path } from "data-path";
type User = { name: string };const p = path((u: User) => u.name);console.log(p.$); // "name"If this compiles and logs "name", the package is correctly installed.
- Quick Start — a complete working example.