wxt icon indicating copy to clipboard operation
wxt copied to clipboard

fix: Add another `defineItem` signature when `init` function is passed

Open toofishes opened this issue 2 months ago • 4 comments

Overview

https://github.com/wxt-dev/wxt/pull/1601 adjusted the typing of defineItem to examine whether defaultValue or fallback were passed, and only then, remove the null from the possible returned value. However, it did not accommodate the case where an init function is passed to prevent a null return, which was previously allowed.

Add a new type signature for this case, and add some tests for type expectations to catch the issue.

Manual Testing

Added type tests that fail before this change, and succeed after.

Related Issue

  • #1601

toofishes avatar Sep 24 '25 13:09 toofishes

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
Latest commit f44bdb8caa5a2e7785989377ec61d0a68de2696d
Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/68d3f850ba020800081e4cb4
Deploy Preview https://deploy-preview-1909--creative-fairy-df92c4.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Sep 24 '25 13:09 netlify[bot]

just about to create a PR for this :) haha thank you!

RayGuo-ergou avatar Sep 29 '25 02:09 RayGuo-ergou

LOL I didn't see this, I created a similar one

aiktb avatar Oct 03 '25 14:10 aiktb

@aklinker1 Is there anything I can do to help get this reviewed and merged?

toofishes avatar Oct 16 '25 13:10 toofishes