-
Notifications
You must be signed in to change notification settings - Fork 167
fix: build permit even maxTokenAmount is set to 0 #1605
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🌿 Documentation Preview
|
@@ -408,7 +408,7 @@ const generateSignedPermit = async < | |||
|
|||
let maxAmountToken = maxUint256; | |||
|
|||
if (policyToken.maxTokenAmount) { | |||
if (policyToken.maxTokenAmount !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ What about the case that maxTokenAmount == null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new bee to TS: this is typed as 'undefined | bigInt', is that possible to assign 'null' to it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think best practice is to check for policyToken.maxTokenAmount != null
, which checks for null
or undefined
.
i believe the main reason to make the change here is to defend against someone possibly making a change later where it's nullable and doesn't notice that you are strictly checking for undefined
here.
Pull Request Checklist
yarn test
)site
folder, and guidelines for updating/adding docs can be found in the contribution guide)feat!: breaking change
)yarn lint:check
) and fix any issues? (yarn lint:write
)PR-Codex overview
This PR focuses on refining the condition that checks if
maxTokenAmount
is defined for apolicyToken
. The change enhances code clarity by explicitly checking forundefined
rather than relying on a truthy check.Detailed summary
if (policyToken.maxTokenAmount)
toif (policyToken.maxTokenAmount !== undefined)
ingasManager.ts
.