Skip to content

Commit

Permalink
Merge pull request #21 from zolplay-cn/cali
Browse files Browse the repository at this point in the history
feat: add LayoutProps and LayoutComponent types
  • Loading branch information
CaliCastle committed Oct 26, 2022
2 parents 57ee935 + 479115b commit 04bc88a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @zolplay/react

## 0.5.0

### Minor Changes

- Add LayoutProps and LayoutComponent types

## 0.4.1

### Patch Changes
Expand Down
10 changes: 5 additions & 5 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zolplay/react",
"version": "0.4.1",
"version": "0.5.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.mjs",
Expand All @@ -23,8 +23,8 @@
"@zolplay/config": "workspace:*",
"@zolplay/utils": "workspace:*",
"nanoid": "^3.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"string-hash": "^1.1.3",
"tinycolor2": "^1.4.2"
},
Expand All @@ -41,7 +41,7 @@
"vite": "^3.1.8"
},
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
17 changes: 9 additions & 8 deletions packages/react/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-types */
import type { FC, PropsWithChildren } from 'react'

// CSS custom variables
Expand All @@ -7,16 +8,16 @@ declare module 'react' {
}
}

// eslint-disable-next-line @typescript-eslint/ban-types
export type Component<P = {}> = FC<
PropsWithChildren<
{
className?: string
} & P
>
export type ComponentProps<P = {}> = PropsWithChildren<
{
className?: string
} & P
>
export type Component<P = {}> = FC<ComponentProps<P>>

// eslint-disable-next-line @typescript-eslint/ban-types
export type PrimitiveComponent<P = {}> = Component<
P & { as?: keyof JSX.IntrinsicElements }
>

export type LayoutProps<P = {}> = PropsWithChildren<P>
export type LayoutComponent<P = {}> = FC<LayoutProps<P>>
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 04bc88a

Please sign in to comment.