handsontable / handsontable/hyperformula
Add support for inferring return types of a custom function
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 171
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
Description
As described in #875 by MartinDawson:
Consider any formula that you do not know the exact return type of or the return type is too large and can change based on parameters :
=GET_FINANCIALS("AMZN", "revenue"), this would return a currency value.
=GET_FINANCIALS("AMZN", "operatingMargin"), this would return a percentage value.
=GET_FINANCIALS("AMZN", "balanceSheet"), this would return an object of currencies & percentages.Hyperformula currently has this for custom plugins:
returnNumberType. This isn't sufficient for functions who's return types can change dynamically.The percentages should be automatically formatted as percentages. The currencies as currencies.
Currently this is not possible in HF and this causes bugs where other formulas don't work if you put the above as parameters because the cell types are wrong.
However we should not apply it to all functions automatically because some functions such as
=TEXT()want to format stuff as strings specifically.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the prior discussion in #875 and the custom-plugin returnNumberType behavior described here. Define what dynamic return-type inference and automatic currency or percentage formatting should do, while preserving functions such as TEXT() that explicitly return strings; completion should cover the parameter-dependent examples and prevent incorrect downstream formula types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100