Skip to content

Commit

Permalink
chore: move exported types from package entry point into a separate f…
Browse files Browse the repository at this point in the history
…ile (#2323)
  • Loading branch information
emmenko authored Aug 2, 2021
1 parent a04f5d0 commit a0e1cd7
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 43 deletions.
11 changes: 11 additions & 0 deletions .changeset/plenty-zoos-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@commercetools-frontend/actions-global': patch
'@commercetools-frontend/application-shell-connectors': patch
'@commercetools-frontend/browser-history': patch
'@commercetools-frontend/i18n': patch
'@commercetools-frontend/react-notifications': patch
---

Move exported types into a separate file, to avoid having type imports/exports in the package entry point.

> This change is only useful in development in the merchant-center-application-kit repository.
3 changes: 3 additions & 0 deletions packages/actions-global/src/export-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { DispatchActionError } from './actions/handle-action-error';

export type TDispatchActionError = DispatchActionError;
8 changes: 2 additions & 6 deletions packages/actions-global/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import type { DispatchActionError } from './actions/handle-action-error';

export type TDispatchActionError = DispatchActionError;

export { default as version } from './version';
export * from './actions';
export * from './hooks';
export * from './types';

export { default as version } from './version';
export * from './export-types';
18 changes: 18 additions & 0 deletions packages/application-shell-connectors/src/export-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type {
TProviderProps as ProviderProps,
TApplicationContext as ApplicationContext,
TNormalizedMenuVisibilities as NormalizedMenuVisibilities,
TNormalizedPermissions as NormalizedPermissions,
TNormalizedActionRights as NormalizedActionRights,
TNormalizedDataFences as NormalizedDataFences,
} from './components/application-context';

export type TProviderProps<AdditionalEnvironmentProperties extends {}> =
ProviderProps<AdditionalEnvironmentProperties>;
export type TApplicationContext<AdditionalEnvironmentProperties extends {}> =
ApplicationContext<AdditionalEnvironmentProperties>;

export type TNormalizedMenuVisibilities = NormalizedMenuVisibilities;
export type TNormalizedPermissions = NormalizedPermissions;
export type TNormalizedActionRights = NormalizedActionRights;
export type TNormalizedDataFences = NormalizedDataFences;
22 changes: 2 additions & 20 deletions packages/application-shell-connectors/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
import type {
TProviderProps as ProviderProps,
TApplicationContext as ApplicationContext,
TNormalizedMenuVisibilities as NormalizedMenuVisibilities,
TNormalizedPermissions as NormalizedPermissions,
TNormalizedActionRights as NormalizedActionRights,
TNormalizedDataFences as NormalizedDataFences,
} from './components/application-context';

export type TProviderProps<AdditionalEnvironmentProperties extends {}> =
ProviderProps<AdditionalEnvironmentProperties>;
export type TApplicationContext<AdditionalEnvironmentProperties extends {}> =
ApplicationContext<AdditionalEnvironmentProperties>;

export type TNormalizedMenuVisibilities = NormalizedMenuVisibilities;
export type TNormalizedPermissions = NormalizedPermissions;
export type TNormalizedActionRights = NormalizedActionRights;
export type TNormalizedDataFences = NormalizedDataFences;
export { default as version } from './version';
export * from './export-types';

export {
Context,
Expand All @@ -34,5 +18,3 @@ export {
ProjectExtensionProviderForImageRegex,
withProjectExtensionImageRegex,
} from './components/project-extension-image-regex';

export { default as version } from './version';
2 changes: 1 addition & 1 deletion packages/application-shell/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as version } from './version';
export { default as ApplicationShell } from './components/application-shell';
export { default as ApplicationShellProvider } from './components/application-shell-provider';
export { default as createApolloClient } from './configure-apollo';
Expand All @@ -14,7 +15,6 @@ export { GtmContext } from './components/gtm-booter';
export { default as GtmUserLogoutTracker } from './components/gtm-user-logout-tracker';
export { default as SetupFlopFlipProvider } from './components/setup-flop-flip-provider';
export { default as ConfigureIntlProvider } from './components/configure-intl-provider';
export { default as version } from './version';
export {
useMcQuery,
useMcLazyQuery,
Expand Down
4 changes: 4 additions & 0 deletions packages/browser-history/src/export-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { EnhancedLocation } from 'history-query-enhancer';

// Convenience types
export type TEnhancedLocation<Q extends {}> = EnhancedLocation<Q>;
7 changes: 1 addition & 6 deletions packages/browser-history/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
// eslint-disable-next-line import/named
import type { EnhancedLocation } from 'history-query-enhancer';

export { default as version } from './version';
export * from './export-types';

export { default, createEnhancedHistory } from './enhanced-history';

// Convenience types
export type TEnhancedLocation<Q extends {}> = EnhancedLocation<Q>;
3 changes: 3 additions & 0 deletions packages/i18n/src/export-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { Props } from './async-locale-data/async-locale-data';

export type TAsyncLocaleDataProps = Props;
5 changes: 1 addition & 4 deletions packages/i18n/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import type { Props } from './async-locale-data/async-locale-data';

export type TAsyncLocaleDataProps = Props;

export { default as version } from './version';
export * from './export-types';

export {
AsyncLocaleData,
Expand Down
3 changes: 2 additions & 1 deletion packages/notifications/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { default as version } from './version';
export * from './types';

export { default as middleware } from './middleware';
export { default as reducer } from './reducer';
export { addNotification, removeNotification } from './action-creators';
export { ADD_NOTIFICATION, REMOVE_NOTIFICATION } from './action-types';
export * from './types';
1 change: 1 addition & 0 deletions packages/permissions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { default as version } from './version';

export { default as RestrictedByPermissions } from './components/restricted-by-permissions';
export { default as branchOnPermissions } from './components/branch-on-permissions';
export {
Expand Down
4 changes: 4 additions & 0 deletions packages/react-notifications/src/export-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { TProps as MapNotificationToComponentProps } from './components/map-notification-to-component';

// Re-export type for convenience
export type TMapNotificationToComponentProps = MapNotificationToComponentProps;
7 changes: 2 additions & 5 deletions packages/react-notifications/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import type { TProps as MapNotificationToComponentProps } from './components/map-notification-to-component';

// Re-export type for convenience
export type TMapNotificationToComponentProps = MapNotificationToComponentProps;

export { default as version } from './version';
export * from './export-types';

export { default as NotificationProviderForCustomComponent } from './components/map-notification-to-component';
export { default as Notification } from './components/notification';
export {
Expand Down

1 comment on commit a0e1cd7

@vercel
Copy link

@vercel vercel bot commented on a0e1cd7 Aug 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.