Skip to content

Update types.ts#30

Open
davie-robertson wants to merge 1 commit into
thepassle:masterfrom
davie-robertson:patch-3
Open

Update types.ts#30
davie-robertson wants to merge 1 commit into
thepassle:masterfrom
davie-robertson:patch-3

Conversation

@davie-robertson
Copy link
Copy Markdown

The current type definition for the shouldNavigate method in the Plugin interface is causing type errors with certain valid implementations. The issue is that the current definition doesn't correctly account for directly returned Promises in the condition function. By simplifying the type to () => boolean | Promise<boolean>, we allow for both synchronous and asynchronous condition functions without needing a nested function structure.

This change will resolve type errors while maintaining compatibility with existing implementations and allowing for more flexible usage patterns.

The current type definition for the `shouldNavigate` method in the `Plugin` interface is causing type errors with certain valid implementations. The issue is that the current definition doesn't correctly account for directly returned Promises in the condition function. By simplifying the type to `() => boolean | Promise<boolean>`, we allow for both synchronous and asynchronous condition functions without needing a nested function structure. This change will resolve type errors while maintaining compatibility with existing implementations and allowing for more flexible usage patterns. Old pattern remains for backwards compatibility.
@davie-robertson davie-robertson mentioned this pull request May 25, 2025
@thepassle
Copy link
Copy Markdown
Owner

Sorry, I had missed this PR, would you be willing to fix the conflicts? Then we can get this merged :)

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