Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix TS errors for some component library files #10275

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const ContractBoxBase = ({
<View testID={CONTRACT_BOX_NO_PET_NAME_TEST_ID}>
<Button
variant={ButtonVariants.Link}
textVariant={TextVariant.HeadingMD}
label={formattedAddress}
onPress={onContractPress}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ const CustomSpendCap = ({
<Button
variant={ButtonVariants.Link}
onPress={handlePress}
textVariant={TextVariant.BodyMD}
label={
isEditDisabled
? strings('contract_allowance.custom_spend_cap.edit')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ exports[`CustomSpendCap should match snapshot 1`] = `
}
}
suppressHighlighting={true}
textVariant="sBodyMD"
>
<Text
accessibilityRole="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { TouchableOpacityProps } from 'react-native';

// External dependencies.
import { ListItemProps } from '../ListItem/ListItem.types';
import { IconName } from '../../Icons/Icon';
import { ListItemProps } from '../../../component-library/components/List/ListItem/ListItem.types';
import { IconName } from '../../../component-library/components/Icons/Icon';
import { GestureResponderEvent } from 'react-native-modal';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Provider } from 'react-redux';
import AggregatedPercentage from './AggregatedPercentage';
import { createStore } from 'redux';
import initialBackgroundState from '../../../../util/test/initial-background-state.json';
import { ComponentStory, Meta } from '@storybook/react-native';

const mockInitialState = {
wizard: {
Expand All @@ -16,7 +17,7 @@ const mockInitialState = {
const rootReducer = (state = mockInitialState) => state;
const store = createStore(rootReducer);

export default {
const AggregatedPercentageStory: Meta<typeof AggregatedPercentage> = {
title: 'Component Library / AggregatedPercentage',
component: AggregatedPercentage,
decorators: [
Expand All @@ -26,9 +27,26 @@ export default {
</Provider>
),
],
args: {
ethFiat: 1000,
tokenFiat: 500,
tokenFiat1dAgo: 950,
ethFiat1dAgo: 450,
},
};

const Template = (args) => <AggregatedPercentage {...args} />;
export default AggregatedPercentageStory;

interface AggregatedPercentageArgs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible for you to add a .types file to the AggregatedPercentage folder with this interface so that it's reusable for the main component as well?

ethFiat: number;
tokenFiat: number;
tokenFiat1dAgo: number;
ethFiat1dAgo: number;
}

const Template: ComponentStory<typeof AggregatedPercentage> = (
args: AggregatedPercentageArgs,
) => <AggregatedPercentage {...args} />;

export const Default = Template.bind({});
Default.args = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Provider } from 'react-redux';
import PercentageChange from './PercentageChange';
import { createStore } from 'redux';
import initialBackgroundState from '../../../../util/test/initial-background-state.json';
import { ComponentStory, Meta } from '@storybook/react-native';

const mockInitialState = {
wizard: {
Expand All @@ -16,7 +17,7 @@ const mockInitialState = {
const rootReducer = (state = mockInitialState) => state;
const store = createStore(rootReducer);

export default {
const PercentageChangeStory: Meta<typeof PercentageChange> = {
title: 'Component Library / PercentageChange',
component: PercentageChange,
decorators: [
Expand All @@ -26,9 +27,20 @@ export default {
</Provider>
),
],
args: {
value: 0,
},
};

const Template = (args) => <PercentageChange {...args} />;
export default PercentageChangeStory;

interface PercentageChangeArgs {
value: number | null | undefined;
}

const Template: ComponentStory<typeof PercentageChange> = (
args: PercentageChangeArgs,
) => <PercentageChange {...args} />;

export const Default = Template.bind({});
Default.args = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const BadgeBadgeNotificationsMeta = {
argTypes: {
name: {
control: { type: 'text' },
defaultValue: SAMPLE_BADGENOTIFICATIONS_PROPS.name,
defaultValue: SAMPLE_BADGENOTIFICATIONS_PROPS.iconName,
},
},
};
Expand Down
1 change: 0 additions & 1 deletion app/component-library/components/RadioButton/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { TouchableOpacityProps } from 'react-native';
/**
* SelectButtonBase component props.
*/
// @ts-expect-error ts(2320) 'hitSlop' mismatch within libraries'
export interface SelectButtonBaseProps
extends Omit<SelectValueProps, 'style'>,
TouchableOpacityProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SelectValueProps } from '../SelectValue/SelectValue.types';
/**
* SelectOption component props.
*/
// @ts-expect-error ts(2320) 'hitSlop' mismatch within libraries'
export interface SelectOptionProps
extends ListItemSelectProps,
Omit<SelectValueProps, 'style'> {}
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions app/components/UI/CollectibleDetectionModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { strings } from '../../../../locales/i18n';
import Banner from '../../../component-library/components/Banners/Banner/Banner';
import { BannerVariant } from '../../../component-library/components/Banners/Banner';
import { ButtonVariants } from '../../../component-library/components/Buttons/Button';
import { TextVariant } from '../../../component-library/components/Texts/Text';
import {
ToastContext,
ToastVariants,
Expand Down Expand Up @@ -64,7 +63,6 @@ const CollectibleDetectionModal = () => {
variant: ButtonVariants.Link,
label: strings('wallet.nfts_autodetect_cta'),
onPress: showToastAndEnableNFtDetection,
textVariant: TextVariant.BodyMD,
}}
/>
</View>
Expand Down
1 change: 0 additions & 1 deletion app/components/Views/AddAsset/AddAsset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ const AddAsset = () => {
? {
variant: ButtonVariants.Link,
onPress: goToSecuritySettings,
textVariant: TextVariant.BodyMD,
label: strings('wallet.display_nft_media_cta'),
}
: undefined
Expand Down
1 change: 0 additions & 1 deletion app/components/Views/BrowserTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,6 @@ export const BrowserTab = (props) => {
setIpfsBannerVisible: () => setIpfsBannerVisible(false),
},
}),
textVariant: TextVariant.BodyMD,
label: 'Turn on IPFS gateway',
}}
variant={BannerVariant.Alert}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
"react-native-quick-base64": "^2.0.8",
"react-native-quick-crypto": "^0.6.1",
"react-native-randombytes": "^3.5.3",
"react-native-reanimated": "3.1.0",
"react-native-reanimated": "3.14.0",
"react-native-redash": "16.2.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "3.19.0",
Expand Down Expand Up @@ -571,4 +571,4 @@
}
},
"packageManager": "[email protected]"
}
}
2 changes: 1 addition & 1 deletion tsconfig.lint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// "app/**/*",
"app/__mocks__/**/*",
"app/actions/**/*",
// "app/component-library/**/*",
"app/component-library/**/*",
"app/component-library/constants/**/*",
"app/component-library/hooks/**/*",
// "app/components/**/*",
Expand Down
Loading
Loading