josdejong/mathjs

Easier types when working with "create"

Open

#2,322 创建于 2021年9月21日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)JavaScript (1,298 fork)batch import
bughelp wantedtypescript

仓库指标

Star
 (13,832 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

I followed the custom bundling docs and created my own instance of math.js, like this:

const math = create({ addDependencies, bignumberDependencies, divideDependencies, meanDependencies }, config);
const mbn = this.math.bignumber!;

What I don't like is that I have to use the ! non-null assertion operator, even if it is clear that the bignumber property should be non-null (as per the bignumberDependencies object passed to create).

I further had to disable the @typescript-eslint/no-non-null-assertion ESLint rule, because the lint task was failing.

My feature request: let the compiler know that the objects returned by create are non-null, based on the inputs provided.

贡献者指南