mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

How to access `Unit.isValidAlpha`?

Open xxczaki opened this issue 4 years ago • 2 comments

Using TypeScript:

import math from 'mathjs';`

// @ts-expect-error
math.Unit.isValidAlpha = () => {
	return true;
};

Throws Cannot read property \'Unit\' of undefined.

xxczaki avatar Feb 15 '21 15:02 xxczaki

Thanks for reporting Antoni.

It may be that this is simply an other example of the TypeScript definitions not being up to date, see also #1539, #2076.

Help getting the TypeScript definitions up to date would be very welcome!

josdejong avatar Feb 15 '21 18:02 josdejong

@josdejong Thanks for a quick reply! The TypeScript definition is outdated, although I forgot to mention that this error occurs after adding the @ts-expect-error or @ts-ignore declaration (edited the issue description for clarity). So I think something is wrong with the export...

xxczaki avatar Feb 16 '21 08:02 xxczaki