Skip to content

Commit

Permalink
fix(types): typing issues on DTS generation
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjavi committed Sep 27, 2023
1 parent 4b90203 commit f3865c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
],
// 'scope-empty': [2, 'never'],
'scope-enum': [
2,
1,
'always',
[
'general',
Expand Down
6 changes: 3 additions & 3 deletions packages/storylite/src/services/renderer/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ const defaultDecorator: SLDecorator<any> = (Story, context) => {
}

function applyDecorators(
StoryComponent: React.FC,
StoryComponent: SLFunctionComponent,
decorators: SLDecorator[],
context: SLDecoratorContext,
) {
): SLFunctionComponent {
return decorators.reduce(
(DecoratedStory, decorator) =>
function DecoratedWithDecorator() {
return decorator(DecoratedStory as SLFunctionComponent, context)
},
StoryComponent,
)
) as SLFunctionComponent
}

export function renderStory(storyComponent: SLFunctionComponent, story: StoryWithId) {
Expand Down
14 changes: 3 additions & 11 deletions packages/storylite/src/types/components.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ComponentProps } from 'react'
import type { ComponentProps, ReactNode } from 'react'

import type { SLObject } from './core'

Expand All @@ -10,17 +10,9 @@ export type SLElement<P extends SLObject = {}> = {
key: string | number | null
}

export type SLNode =
| null
| undefined
| string
| number
| boolean
| SLElement<any>
| Iterable<SLNode>
// | SLFunctionComponent<any>
export type SLNode = ReactNode

export type SLFunctionComponent<P extends SLObject = {}> = React.FC<P>
export type SLFunctionComponent<P = {}> = React.FC<P>

export type SLComponentProps<T> = T extends
| React.ComponentType<infer P extends SLObject>
Expand Down

0 comments on commit f3865c9

Please sign in to comment.