diff --git a/README.md b/README.md index 5b3e9db..613f246 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ # @oshx/type-helper +[![Node.js Package](https://github.com/oshx/type-helper/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/oshx/type-helper/actions/workflows/npm-publish.yml) + This package includes the practical type helper for TypeScript users. ## Installation @@ -26,8 +28,8 @@ type ObjectKey type ObjectValue // explicit constant object values -interface PropsWithClassName - // extendable interface with optional property 'className' +type PropsWithClassName + // extendable interface-like-type with optional property 'className' type AnyFunction // simply declared any function diff --git a/types.d.ts b/index.d.ts similarity index 91% rename from types.d.ts rename to index.d.ts index 745af29..5160bfc 100644 --- a/types.d.ts +++ b/index.d.ts @@ -23,19 +23,19 @@ declare type ObjectKey = keyof T */ declare type ObjectValue = T[ObjectKey] -/** The extendable interface for CSS-in-JS users. +/** The extendable interface-like-type for CSS-in-JS users. * * @example * interface ReactComponentProps extends PropsWithChildren, PropsWithClassName { * ... * } */ -declare interface PropsWithClassName< +declare type PropsWithClassName< T extends object = object, ClassNameType = string | undefined -> extends T { +> = { className: ClassNameType -} +} & T /** The simple `Any function` declaration. * diff --git a/package.json b/package.json index 9ff9338..952e6cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oshx/type-helper", - "version": "1.0.3", + "version": "1.0.4", "description": "Types help TypeScript types.", "repository": { "type": "git", @@ -13,12 +13,12 @@ "exports": { ".": { "types": { - "default": "./types.d.ts" + "default": "./index.d.ts" } } }, - "typeRoots": "./types.d.ts", - "types": "./types.d.ts", + "typeRoots": "./index.d.ts", + "types": "./index.d.ts", "author": { "name": "오승환", "email": "oshxios@gmail.com", diff --git a/tsconfig.json b/tsconfig.json index ba79914..7d52658 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,6 @@ "rootDir": "./", "moduleResolution": "node", "baseUrl": "./", - "paths": {}, "allowJs": true, "checkJs": true, "declaration": true,