josdejong/mathjs

Easier types when working with "create"

オープン

#2,322 opened on 2021/09/21

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (1,314 件のフォーク)batch import
bughelp wantedtypescript

Repository metrics

Stars
 (15,065 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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.

コントリビューターガイド