josdejong/mathjs
Property 'Unit' does not exist on type 'MathJsStatic'. Did you mean 'unit'? error in Typescript
Aberta
#2.286 aberto em 14 de jul. de 2021
help wantedtypescript
Métricas do repositório
- Stars
- (15.065 estrelas)
- Métricas de merge de PR
- (Métricas PR pendentes)
Description
When creating the following code in Typescript
import { MathJsStatic, create, all, MathType } from 'mathjs';
const math: MathJsStatic = create(all, {}) as MathJsStatic;
math.createUnit('cells'); // works perfectly
math.Unit; // results in: Property 'Unit' does not exist on type 'MathJsStatic'. Did you mean 'unit'?
It looks like Unit isn't properly part of the new MathJS typescript definitions or it's not linking correctly.
if I replace the line above with window['testing'] = math then the Unit is in fact present.

Edit: I am running mathjs 9.4.4 without @types/mathjs (relying on the built-in type definitions)