Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add usePropsWithContext hook for hook based components #1234

Merged
merged 1 commit into from
Jan 31, 2022

Conversation

tujoworker
Copy link
Member

@tujoworker tujoworker commented Jan 28, 2022

This PR is all about better TS support.

The new hook usePropsWithContext replaces extendPropsWithContext and returns the type given as the first property. This ensures the new object returned functions with the wanted type.

As an example, the Tag.tsx did use a not typed variant of unstyled – it was valid because we got back any.

EDIT: This PR relies on PR #1235

@tujoworker tujoworker force-pushed the chore/extend-typings branch from 1a477f8 to ef77ece Compare January 28, 2022 20:09
@tujoworker tujoworker marked this pull request as draft January 28, 2022 20:15
@tujoworker tujoworker force-pushed the chore/extend-typings branch from ef77ece to 379b907 Compare January 28, 2022 20:19
@tujoworker tujoworker requested a review from dinarosv January 28, 2022 20:21
@tujoworker tujoworker marked this pull request as ready for review January 28, 2022 20:21
@gatsby-cloud
Copy link

gatsby-cloud bot commented Jan 28, 2022

Gatsby Cloud Build Report

DNB Eufemia Portal

🎉 Your build was successful! See the Deploy preview here.

Build Details

View the build logs here.

🕐 Build time: 9m

Performance

Lighthouse report

Metric Score
Performance 🔶 66
Accessibility 💚 100
Best Practices 💚 100
SEO 💚 92

🔗 View full report

@tujoworker tujoworker force-pushed the chore/extend-typings branch from 54e9d8a to 42c057f Compare January 30, 2022 09:55
@tujoworker tujoworker marked this pull request as draft January 30, 2022 10:02
@tujoworker tujoworker force-pushed the chore/extend-typings branch from 42c057f to 562bc8e Compare January 30, 2022 10:29
@tujoworker tujoworker force-pushed the chore/extend-typings branch from 6e1180a to 3a99ba6 Compare January 31, 2022 10:13
@tujoworker tujoworker marked this pull request as ready for review January 31, 2022 10:13
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3a99ba6:

Sandbox Source
eufemia-starter Configuration

Copy link
Contributor

@dinarosv dinarosv left a comment

Choose a reason for hiding this comment

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

Good work 👏 😄

@tujoworker tujoworker merged commit d60feeb into main Jan 31, 2022
@tujoworker tujoworker deleted the chore/extend-typings branch January 31, 2022 12:21
tujoworker pushed a commit that referenced this pull request Feb 2, 2022
# [9.20.0](v9.19.0...v9.20.0) (2022-02-02)

### Bug Fixes

* add stylis plugin TS Type definitions ([4c8210c](4c8210c))
* **AvatarGroup:** remove left border from first avatar ([#1254](#1254)) ([bc1a870](bc1a870))
* **Breadcrumb:** fix React Node usage in aria-label ([1c921fa](1c921fa))
* **BreadCrumb:** make isCollapsed prop typing strict to only use boolean ([392e6eb](392e6eb))
* **CodeHighlighting:** ensure a scrollbar is shown when not enough space is available (pre tag) ([#1230](#1230)) ([4bd2930](4bd2930))
* **InfoCard:** change text props to React.ReactNode ([#1253](#1253)) ([79c37af](79c37af))
* label of avatar group to be react node ([#1244](#1244)) ([04df401](04df401))
* label of tag group to be react node ([#1245](#1245)) ([4949d85](4949d85))
* make Eufemia "warn" log better recognizable ([#1231](#1231)) ([c917b94](c917b94))
* **StepIndicator:** fix height animation issue when CSS is loaded too slow ([#1221](#1221)) ([8dfdd7e](8dfdd7e))
* **TagGroup:** make TagGroup component inline, so it can be used in body text / paragraphs ([#1229](#1229)) ([b64f5d3](b64f5d3))
* **TimeLine:** display skeleton when items is passed as children ([#1255](#1255)) ([4eaea6b](4eaea6b))
* **Timeline:** fix TypeScript issue when using children ([0a9571c](0a9571c))
* **Types:** correct usage of icon types inside Button and BreadcrumbItem ([85dee9c](85dee9c))
* **Types:** correct usage of title and size attributes along side with some other colliding props ([540998a](540998a))
* **Types:** fix SkeletonShow type usage ([03c8525](03c8525))

### Features

* add usePropsWithContext hook for hook based components ([#1234](#1234)) ([d60feeb](d60feeb))
* remove type="module" in order omit the "fullySpecified" spec ([bc3f12a](bc3f12a))
* **TypeScript:** enhance overall typing and add verify check ([608bede](608bede))
@tujoworker
Copy link
Member Author

🎉 This PR is included in version 9.20.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants