Getting Started
Installation
Install data-path and configure TypeScript.
Install
npm install data-pathRequirements
- Node
>=20 - TypeScript
>=5.0
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
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.
Next
- Quick Start — a complete working example.
Last updated on