josdejong/typed-function

Add return-type annotations?

Open

#124 aberto em 7 de mar. de 2022

Ver no GitHub
 (9 comments) (0 reactions) (0 assignees)JavaScript (22 forks)github user discovery
enhancementhelp wanted

Métricas do repositório

Stars
 (78 stars)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

There are two circumstances so far in which the utility of typed-function knowing the return type of (each signature of) a typed-function has come up: (1) supporting useful type inference in automatically-generated TypeScript declarations for typed-functions, see #123, and (2) determining what sort of an entity a sub-expression in math js will be, so as to know what simplifications are valid to apply to that subexpression. (Right now, mathjs just applies the same configurable list of possible simplifications at all levels of an expression, but that could be refined to allow changing the order of numbers being multiplied but leave the order of matrix multiplications alone, if mathjs could tell which parts of an expression evaluated to numbers or to matrices.)

Given these two indications of its value, it's worth considering whether to add return-type annotations to typed-function.

Guia do colaborador