thepassle / app-tools

128 stars 8 forks source link

Update types.ts #30

Open davie-robertson opened 3 months ago

davie-robertson commented 3 months ago

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.