Document 'declare' keyword outside of libdef files
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
The `declare` keyword is currently documented as part of the [Creating Library Definitions](https://flow.org/en/docs/libdefs/creation/#declaring-a-global-function-) docs.
It can, however, be used outside of libdef files which does not appear to be documented anywhere. Is the behavior well defined for this case?
Using `declare` in source code can be useful for handling function overrides where you need an uninitialized variable declared separate from the implementation. An example is provided [here](https://flow.org/try/#0C4TwDgpgBA8gbhATgGwPYEMAmFMDECuAdgMbACWqhUAvFAN4BQUUAPDAHwAUTzUokALigBnYIjKEA5jwCUQupzDpE6ALZCYc+qnzAwujQF9DAbh482AGigAVAKLIIqrj2b8IQ0eKmXXfFYTCAGaoiOpQnAB00UoqqsJCAIKIKiAs9o7OMjTssLLyUTHKaglQyanpDk7sWnQ6egawxmbMFjDWAAouvHzgHiJiEpK+PWLogSFhQorF8UId2dS5MPn0M3GlC-L1+sBGpgyGDAzYxMjK0HDKUKgIKBjYeIQad2hYOAQk5JRmQUSkFCotyQb0euEInHcnkGPn842CoVU2UYzEQEGA+EQVEKkViJUWuRRUAAkGiMVjtLpdkJ3KggnCJoiaNRaAByP5fQGsqAAfgZCLC63xUCEePiAG0AAwAXVMrWYByOPQYxEooig6G2VMaXiGhhoN1eDw+hBYuth5skXFZ7lZMk4rIAFhBkGg7SZlarAsAoAAjLUNPZQQj4VS+pD62jA+7vJ4sENhpDWS3W23WIXhS0EqAAVig9qdLrdMjMXvVxAD1IG3kkkcNIONcctyZhVodaYi0Vxs2E2bFwkiACtUBJONkC87XahWdZWQB3ULITDuno9IA) which is cleaner than the alternative of coercing an `any` back to `OverloadedFunction`.
Contributor guide
Assessment
This issue has not been assessed yet.