lovely-typed-path-names
v0.3.0
Published
Provides type definitions which can create types to validate string path against any type.
Readme
Lovely Typed Path Names
Provides type definitions which can create types to validate string path against any type.
Installation
npm install lovely-typed-path-namespnpm add lovely-typed-path-namesyarn add lovely-typed-path-namesExample
import { PathOfType, PropertyPathOfType } from "lovely-typed-path-names";
type MyType = {
value: string;
child: {
value: number;
};
};
type names = PathOfType<MyType>;
// names = "value" | "child" | "child.value"
type properties = PropertyPathOfType<MyType>;
// properties = "value" | "child.value"
type stringProperties = PropertyPathOfType<MyType, string>;
// stringProperties = "value"More examples can be found in the tests.
Develop
This is a pnpm project!
pnpm installRun tests:
pnpm testBuild
There is no build run needed. The package just exports types.
