✨ ts-uni.dev ✨
Universal TypeScript Utilities
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.
ts-uni
package to help you to work with typescript type easier.
# npm
npm install ts-uni
# yarn
yarn add ts-uni
# pnpm
pnpm install ts-uni
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"
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);
};
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.