Skip to content

Commit

Permalink
Merge pull request #7 from reslear/feat/types
Browse files Browse the repository at this point in the history
feat!: types
  • Loading branch information
niklasfjeldberg authored Jan 15, 2024
2 parents 8014c61 + 5d109f8 commit 72fea6e
Show file tree
Hide file tree
Showing 8 changed files with 453 additions and 24 deletions.
3 changes: 3 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ export type {
ModifiersComponents,
BlocksContent,
} from './types';

// fix export types for vite-plugin-dts
import './types';
6 changes: 5 additions & 1 deletion lib/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const Text = ({ componentsContext, text, ...modifiers }: TextType) => {

// Loop on each active modifier to wrap the text in its component
return modifierNames.reduce(
// @ts-ignore
(children: string, modifierName: Modifier) => {
// Don't wrap the text if the modifier is disabled
if (!modifiers[modifierName]) return children;
Expand All @@ -38,7 +39,10 @@ export const Text = ({ componentsContext, text, ...modifiers }: TextType) => {
return children;
}

return ModifierComponent({ children });
return ModifierComponent({
// @ts-ignore
children,
});
},
// By default, return the text without any wrapper to avoid useless nesting
text,
Expand Down
Loading

0 comments on commit 72fea6e

Please sign in to comment.