Skip to content

Commit

Permalink
Merge pull request #5219 from Agoric/ta/lint-ts-ignore
Browse files Browse the repository at this point in the history
replace ts-ignore with ts-expect-error
  • Loading branch information
mergify[bot] authored Apr 25, 2022
2 parents 1712f42 + b5af947 commit b124fbc
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions packages/ui-components/src/display/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ export const stringifyValue = (
placesToShow = 2,
) => {
if (assetKind === AssetKind.NAT) {
// @ts-ignore AmountValue is a Nat
// @ts-expect-error AmountValue is a Nat
return stringifyNat(value, decimalPlaces, placesToShow);
}
if (assetKind === AssetKind.SET) {
// @ts-ignore AmountValue is a SetValue
return stringifySet(value);
}
assert.fail(details`AssetKind ${assetKind} must be NAT or SET`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ export const stringifyRatioAsFraction = (
`decimalPlaces for denominator ${ratio.denominator} must be provided`,
);
const numeratorString = stringifyNat(
// @ts-ignore value is BigInt
ratio.numerator.value,
numDecimalPlaces,
numPlacesToShow,
);
const denominatorString = stringifyNat(
// @ts-ignore value is BigInt
ratio.denominator.value,
denomDecimalPlaces,
denomPlacesToShow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ export const stringifyRatioAsPercent = (
);
const denomPower = 10n ** BigInt(denomDecimalPlaces);
const numPower = 10n ** BigInt(numDecimalPlaces);
// @ts-ignore value is BigInt
const numerator = ratio.numerator.value * denomPower * PERCENT_BASE;
// @ts-ignore value is BigInt
const denominator = ratio.denominator.value * numPower;
const str = `${Number(numerator) / Number(denominator)}`;
const capturedNum = captureNum(str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { TextField } from '@material-ui/core';
import test from 'ava';
import enzyme from 'enzyme';

// @ts-ignore path is correct for compiled output
// @ts-expect-error path is correct for compiled output
import { makeNatAmountInput } from '../../../dist/index.js'; // eslint-disable-line import/no-unresolved

const { shallow, render } = enzyme; // CJS so no named imports
Expand Down Expand Up @@ -118,6 +118,7 @@ test('error=true', t => {
});

test('can simulate input - just calls onChange', t => {
/** @type {bigint | undefined} */
let receivedValue;
const onChange = newValue => {
receivedValue = newValue;
Expand Down Expand Up @@ -188,6 +189,7 @@ test('displays 3 eth correctly', t => {
});

test('discards negative values', t => {
/** @type {bigint | undefined} */
let receivedValue;
const onChange = newValue => {
receivedValue = newValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ test('roundToDecimalPlaces', t => {
});

test('roundToDecimalPlaces non-string throws', t => {
// @ts-ignore deliberate error for testing
// @ts-expect-error deliberate error for testing
t.throws(() => round({}, 0), {
message: /.* must be a string/,
});
});

test('roundToDecimalPlaces non-num decimalPlaces throws', t => {
// @ts-ignore deliberate error for testing
// @ts-expect-error deliberate error for testing
t.throws(() => round('020', '0'), {
message: /.* must be a number/,
});
Expand Down

0 comments on commit b124fbc

Please sign in to comment.