Skip to content

Conversation

@chrispader
Copy link
Contributor

@chrispader chrispader commented Nov 11, 2025

This PR simply wraps the type for wrapped callbacks ({ f: T }) in an explicit type, that improves TypeScript errors shown to the user, when a callback prop is not wrapped in callback(...)

The typescript will therefore change slightly, allowing for a better developer experience:

Example: A onMeasurement callback prop on TtiMeasurementView

Before

Type '(measurement: TtiMeasurementValue) => void' is not assignable to type '{ f: (measurement: TtiMeasurementValue) => void; }'.ts(2322)

After

Type '(measurement: TtiMeasurementValue) => void' is not assignable to type 'NitroViewWrappedCallback<(measurement: TtiMeasurementValue) => void>'.ts(2322)

As seen above, the developer will now see an explicit NitroViewWrappedCallback type, which the they can look up for further necessary steps.

@vercel
Copy link

vercel bot commented Nov 11, 2025

@chrispader is attempting to deploy a commit to the Margelo Team on Vercel.

A member of the Team first needs to authorize it.

@chrispader chrispader changed the title feat: Add explicit type for Nitro view wrapped callbacks for better TypeScript errors feat: Add explicit type for better TypeScript errors on wrapped callbacks in Nitro Views Nov 11, 2025
@chrispader chrispader changed the title feat: Add explicit type for better TypeScript errors on wrapped callbacks in Nitro Views feat: Add explicit type for better TypeScript errors on wrapped callbacks on Nitro views Nov 11, 2025
@mrousavy mrousavy merged commit bc51dfd into mrousavy:main Nov 20, 2025
4 of 5 checks 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