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

[wallet][MS-336] Custom wallet for coins/nft #604

Merged
merged 31 commits into from
Aug 9, 2024
Merged

Conversation

ltminhthu
Copy link
Contributor

No description provided.

Copy link

@ltminhthu ltminhthu self-assigned this Jul 30, 2024
@ltminhthu ltminhthu requested a review from halv1s July 30, 2024 04:19
@tanlethanh
Copy link
Member

typescript "strictNullCheck"

type GenericWidget = {
   type: "SAMO_WIDGET" | "CUSTOM_A"
} & SamoWidget & UnknownWidget;

type SamoWidget = {
   type: "SAMO_WIDGET"
   abc: string
}

function renderWidget(widget: GenericWidget){
   if (widget.type === "SAMO_WIDGET") {
      // widget will be automatically casted to SamoWidget
      console.log(widget.abc) // no type error
   }
}

Copy link
Member

Choose a reason for hiding this comment

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

you should move it to components/

apps/wallet/src/utils/widget.ts Outdated Show resolved Hide resolved
@tanlethanh tanlethanh merged commit 27e0cca into dev Aug 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants