Last active
November 12, 2025 04:21
-
-
Save lisonge/f7221a04ce533260fd5480e4b7e5fb3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const createInheritedComposable = <F extends (...args: any[]) => any>(fn: F): F => { | |
| const key = Symbol('inherited-composable-' + Date.now()) | |
| return ((...args: any[]) => { | |
| let r: any = inject(key, key) | |
| if (r === key) { | |
| r = fn(...args) | |
| provide(key, r) | |
| } | |
| return r | |
| }) as F | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment