Skip to content

Conversation

toofishes
Copy link

Overview

#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

wxt-dev#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.
Copy link

netlify bot commented Sep 24, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit f44bdb8
🔍 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.

@RayGuo-ergou
Copy link
Contributor

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

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