From f2767935e96922a10d1cd60e8763453186947104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Wed, 1 Nov 2023 11:25:52 +0100 Subject: [PATCH] Trick TS instead of exporting object in a default export --- packages/dnb-eufemia/src/components/flex/Flex.tsx | 4 +++- packages/dnb-eufemia/src/components/grid/Grid.ts | 7 +++---- packages/dnb-eufemia/src/components/grid/index.ts | 10 ++-------- .../src/components/grid/stories/Grid.stories.tsx | 4 +--- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/packages/dnb-eufemia/src/components/flex/Flex.tsx b/packages/dnb-eufemia/src/components/flex/Flex.tsx index ab5ad516f09..68aecf3d66f 100644 --- a/packages/dnb-eufemia/src/components/flex/Flex.tsx +++ b/packages/dnb-eufemia/src/components/flex/Flex.tsx @@ -1 +1,3 @@ -export * as default from './' +// For TypeScript compatibility we import and export it this way +import * as _default from './' +export { _default as default } diff --git a/packages/dnb-eufemia/src/components/grid/Grid.ts b/packages/dnb-eufemia/src/components/grid/Grid.ts index 8ac61be7fcf..68aecf3d66f 100644 --- a/packages/dnb-eufemia/src/components/grid/Grid.ts +++ b/packages/dnb-eufemia/src/components/grid/Grid.ts @@ -1,4 +1,3 @@ -import Container from './Container' -import Item from './Item' - -export default { Container, Item } +// For TypeScript compatibility we import and export it this way +import * as _default from './' +export { _default as default } diff --git a/packages/dnb-eufemia/src/components/grid/index.ts b/packages/dnb-eufemia/src/components/grid/index.ts index f27be86a54e..810d55f7468 100644 --- a/packages/dnb-eufemia/src/components/grid/index.ts +++ b/packages/dnb-eufemia/src/components/grid/index.ts @@ -1,8 +1,2 @@ -/** - * Component Entry - * - */ - -import Grid from './Grid' -export default Grid -export * from './Grid' +export { default as Container } from './Container' +export { default as Item } from './Item' diff --git a/packages/dnb-eufemia/src/components/grid/stories/Grid.stories.tsx b/packages/dnb-eufemia/src/components/grid/stories/Grid.stories.tsx index 90c52bd589f..2f89f2ed140 100644 --- a/packages/dnb-eufemia/src/components/grid/stories/Grid.stories.tsx +++ b/packages/dnb-eufemia/src/components/grid/stories/Grid.stories.tsx @@ -4,15 +4,13 @@ */ import React from 'react' - import { Grid } from '../..' -import '../style' export default { title: 'Eufemia/Components/Layout', } -export const colors = [ +const colors = [ { background: '#babeee' } as React.CSSProperties, { background: '#dfe0ee' } as React.CSSProperties, { background: '#90d2c3' } as React.CSSProperties,