0.3.0 • Published 1 year ago

lovely-typed-path-names v0.3.0

Weekly downloads
-
License
APACHE-2.0
Repository
github
Last release
1 year ago

Lovely Typed Path Names

Provides type definitions which can create types to validate string path against any type.

Installation

npm install lovely-typed-path-names
pnpm add lovely-typed-path-names
yarn add lovely-typed-path-names

Example

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 install

Run tests:

pnpm test

Build

There is no build run needed. The package just exports types.

0.3.0

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago