Skip to content

Commit

Permalink
chore: update typescript version to v~5.4.5 (#10866)
Browse files Browse the repository at this point in the history
## **Description**

With this PR we are bumping typescript version on mobile.

With this, we can remove some of @ts-expect-error that we have, and
match extension version.

We although create a warning when running eslint (yarn lint)

```
WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <5.2.0

YOUR TYPESCRIPT VERSION: 5.4.5
```

Since typescript seems to be working fine we can go with this PR to
review but also means that we also need to update eslint, that is
happening on this
[PR](#10865), and since
have more changes will be open for discussion.

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
tommasini authored Aug 29, 2024
1 parent 0809367 commit ce6310d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
2 changes: 0 additions & 2 deletions app/components/UI/CollectibleMedia/CollectibleMedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ const CollectibleMedia: React.FC<CollectibleMediaProps> = ({
big && styles.bigImage,
cover && styles.cover,
]}
//@ts-expect-error - fixed on typescript v5
testID="fallback-nft-ipfs"
/>
<View style={styles.imageFallBackTextContainer}>
Expand Down Expand Up @@ -186,7 +185,6 @@ const CollectibleMedia: React.FC<CollectibleMediaProps> = ({
return (
<RemoteImage
fadeIn
//@ts-expect-error - fixed on typescript v5
resizeMode={'contain'}
source={{ uri: sourceUri }}
style={[
Expand Down
7 changes: 0 additions & 7 deletions app/components/UI/Ramp/Views/Quotes/Quotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,9 @@ function Quotes() {

const [filteredQuotes, highlightedQuotes] = useMemo(() => {
if (quotes) {
//@ts-expect-error - fixed on typescript v5
const allQuotes = quotes.filter(
//@ts-expect-error - fixed on typescript v5
(quote): quote is QuoteResponse | SellQuoteResponse => !quote.error,
);
//@ts-expect-error - fixed on typescript v5
const highlightedPreviouslyUsed = allQuotes.findIndex(({ provider }) =>
ordersProviders.includes(provider.id),
);
Expand Down Expand Up @@ -246,9 +243,7 @@ function Quotes() {
refresh_count: appConfig.POLLING_CYCLES - pollingCyclesLeft,
results_count: filteredQuotes.length,
provider_onramp_first: filteredQuotes[0]?.provider?.name,
//@ts-expect-error - fixed on typescript v5
provider_onramp_list: filteredQuotes.map(({ provider }) => provider.name),
//@ts-expect-error - fixed on typescript v5
previously_used_count: filteredQuotes.filter(({ provider }) =>
ordersProviders.includes(provider.id),
).length,
Expand Down Expand Up @@ -772,7 +767,6 @@ function Quotes() {
{isFetchingQuotes && isInPolling ? (
<LoadingQuotes count={2} />
) : (
//@ts-expect-error - fixed on typescript v5
highlightedQuotes.map((quote, index) => (
<Row key={quote.provider.id}>
<Quote
Expand Down Expand Up @@ -898,7 +892,6 @@ function Quotes() {
{isFetchingQuotes && isInPolling ? (
<LoadingQuotes />
) : (
//@ts-expect-error - fixed on typescript v5
filteredQuotes.map((quote, index) => (
<Fragment key={quote.provider.id}>
{index === HIGHLIGHTED_QUOTES_COUNT &&
Expand Down
4 changes: 4 additions & 0 deletions app/util/conversion/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ describe('conversion utils', () => {
conversionUtil('1', {
fromNumericBase: 'dec',
toNumericBase: 'dec',
//@ts-expect-error - conversion.js file needs conversion to ts file
toCurrency: 'usd',
conversionRate: 468.58,
numberOfDecimals: 2,
Expand All @@ -196,6 +197,7 @@ describe('conversion utils', () => {
conversionUtil('1.5', {
fromNumericBase: 'dec',
toNumericBase: 'dec',
//@ts-expect-error - conversion.js file needs conversion to ts file
toCurrency: 'usd',
conversionRate: 468.58,
numberOfDecimals: 2,
Expand All @@ -210,6 +212,7 @@ describe('conversion utils', () => {
conversionUtil('468.58', {
fromNumericBase: 'dec',
toNumericBase: 'dec',
//@ts-expect-error - conversion.js file needs conversion to ts file
toCurrency: 'usd',
conversionRate: 468.58,
numberOfDecimals: 2,
Expand All @@ -222,6 +225,7 @@ describe('conversion utils', () => {
conversionUtil('702.87', {
fromNumericBase: 'dec',
toNumericBase: 'dec',
//@ts-expect-error - conversion.js file needs conversion to ts file
toCurrency: 'usd',
conversionRate: 468.58,
numberOfDecimals: 2,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
"serve-handler": "^6.1.5",
"simple-git": "^3.22.0",
"ts-node": "^10.5.0",
"typescript": "~4.8.4",
"typescript": "~5.4.5",
"wdio-cucumberjs-json-reporter": "^4.4.3",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28929,10 +28929,10 @@ typescript-tuple@^2.2.1:
dependencies:
typescript-compare "^0.0.2"

typescript@~4.8.4:
version "4.8.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6"
integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==
typescript@~5.4.5:
version "5.4.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==

u2f-api@0.2.7:
version "0.2.7"
Expand Down

0 comments on commit ce6310d

Please sign in to comment.