ts-uni
v1.0.0-beta.10
Published
Typescript utilities
Downloads
43
Readme
[!WARNING]
This package is still in development, so it may not be stable yet. Please use it with caution. And the documentation may not be complete yet.
Overview
ts-uni
package to help you to work with typescript type easier.
Installation
# npm
npm install ts-uni
# yarn
yarn add ts-uni
# pnpm
pnpm install ts-uni
Basic Usage
Import and use a simple utility type
import { Chain } from "ts-uni";
const obj = {
a: {
b: {
c: 1,
},
},
};
type Result = Chain<typeof obj>; // "a" | "a.b" | "a.b.c"
React Usage
Utility types for React import from ts-uni/react
import { ReactEventHandler } from "ts-uni/react";
const handleSomething: ReactEventHandler<"button", "onClick"> = (event) => {
console.log("clicked", event);
};
Contributing
If you have any useful types, please submit a pull request to the src/
folder.
We will review and merge it as soon as possible.