Skip to content

Commit

Permalink
Update tsconfig and make nav interfaces exposable for consumption (#1223
Browse files Browse the repository at this point in the history
)

**Related Ticket:** #1186
**Related PR:** developmentseed/next-veda-ui#10

**Note**
To expose interfaces from veda-ui - they should be defined in `.ts`
files vs `.d.ts` files. This is because parcel isn't building the
typescript definition files into `lib/index.d.ts` but does so when the
file is `.ts`.

**When building the library with `.d.ts` extension - there are NO type
hints from NextInstance side**
<img width="1086" alt="Screenshot 2024-11-04 at 9 23 19 AM"
src="https://github.com/user-attachments/assets/75d746c3-018e-44a8-8ee3-4f37e336c363">

**When building the library with `.ts` extension - there are type hints
form NextInstance side**
<img width="1124" alt="Screenshot 2024-11-04 at 9 20 02 AM"
src="https://github.com/user-attachments/assets/26ec377d-feb1-48ca-a18b-e54835de91ff">


### Description of Changes
* Update typescript definition file of nav types to typescript file
* Add declaration true to tsconfig

### Notes & Questions About Changes
Found this thread about typescript definition files and parcel build
here parcel-bundler/parcel#1240

### Validation / Testing
_{Update with info on what can be manually validated in the Deploy
Preview link for example "Validate style updates to selection modal do
NOT affect cards"}_
  • Loading branch information
sandrahoang686 authored Nov 7, 2024
2 parents d2bc0e5 + 0438c6b commit adb8741
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getString, getNavItemsFromVedaConfig } from 'veda';
import { InternalNavLink, ExternalNavLink, ModalNavLink, DropdownNavLink, NavItemType } from '$components/common/page-header/types.d';
import { InternalNavLink, ExternalNavLink, ModalNavLink, DropdownNavLink, NavItemType } from '$components/common/page-header/types';

import {
STORIES_PATH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { DropMenu, DropMenuItem } from '@devseed-ui/dropdown';
import DropdownScrollable from '../dropdown-scrollable';
import GoogleForm from '../google-form';
import { LinkProperties } from '../card';
import { AlignmentEnum, InternalNavLink, ExternalNavLink, NavLinkItem, DropdownNavLink, ModalNavLink, NavItem, NavItemType } from './types.d';
import { AlignmentEnum, InternalNavLink, ExternalNavLink, NavLinkItem, DropdownNavLink, ModalNavLink, NavItem, NavItemType } from './types';
import GlobalMenuLinkCSS from '$styles/menu-link';
import { useMediaQuery } from '$utils/use-media-query';

Expand Down
9 changes: 8 additions & 1 deletion app/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import StoriesHubContent from '$components/stories/hub/hub-content';
import { useFiltersWithQS } from '$components/common/catalog/controls/hooks/use-filters-with-query';
import PageHeader from '$components/common/page-header';
import LogoContainer from '$components/common/page-header/logo-container';
import type { NavItem, InternalNavLink, NavItemType } from '$components/common/page-header/types';


export {
Expand All @@ -42,6 +43,12 @@ export {
ReactQueryProvider,
StoriesHubContent,
LogoContainer,

// HOOKS and utility functions
useFiltersWithQS
useFiltersWithQS,

// TYPES
NavItem,
NavItemType,
InternalNavLink
};
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"moduleResolution": "node",
"esModuleInterop": true,
"strictNullChecks": true,
"declaration": true,
"baseUrl": "./",
"jsx": "react",
"paths": {
Expand Down

0 comments on commit adb8741

Please sign in to comment.