josdejong/mathjs

Improve type definitions for 'mathjs/number'

Open

#2,284 建立於 2021年7月13日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)JavaScript (1,298 fork)batch import
bughelp wantedtypescript

倉庫指標

Star
 (13,832 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Hi,

I tried following the directions of the webpage regarding custom bundling ( https://mathjs.org/docs/custom_bundling.html ), but it seems like there is an issue with using the sub-modules when in a TypeScript project.

The error I get when trying to import mathjs/number as described in the article is as follows: import { create, all } from "mathjs/number"; Cannot find module 'mathjs/number' or its corresponding type declarations.

In my package.json, I have version 9.4.3 of mathjs, and 9.4.2 of @types/mathjs. I checked the installed mathjs in my node_modules, and its package.json does indeed export './number', so I'm confused as to why it's not being picked up. Could it be that type definitions are not being imported along with it, therefore throwing an error?

Maybe adding something like "mathjs/number": ["./index.d.ts"] to paths of mathjs's package.json could help? (It doesn't, but maybe something similar does)

貢獻者指南