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 thePlugin
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.