chore: remove Types suffixes from client/src/redux/prop-types.ts (#44010)

* chore: remove Type suffixes from client/src/redux/prop-types.ts.

* chore: add  PropType suffixes to PropTypes in client/src/redux/prop-types.ts.
This commit is contained in:
Vishwasa Navada K
2021-11-09 19:51:46 +05:30
committed by GitHub
parent 4c88fcdc69
commit 5ffd65e4e7
17 changed files with 113 additions and 229 deletions

View File

@ -25,7 +25,7 @@ import {
userByNameSelector,
fetchProfileForUser
} from '../redux';
import { UserType } from '../redux/prop-types';
import { User } from '../redux/prop-types';
import { certMap } from '../resources/cert-and-project-map';
import certificateMissingMessage from '../utils/certificate-missing-message';
import reallyWeirdErrorMessage from '../utils/really-weird-error-message';
@ -69,7 +69,7 @@ interface IShowCertificationProps {
certSlug: string;
}) => void;
signedInUserName: string;
user: UserType;
user: User;
userFetchState: {
complete: boolean;
};
@ -78,7 +78,7 @@ interface IShowCertificationProps {
}
const requestedUserSelector = (state: unknown, { username = '' }) =>
userByNameSelector(username.toLowerCase())(state) as UserType;
userByNameSelector(username.toLowerCase())(state) as User;
const validCertSlugs = certMap.map(cert => cert.certSlug);

View File

@ -12,7 +12,7 @@ import {
fetchProfileForUser,
usernameSelector
} from '../redux';
import { UserType } from '../redux/prop-types';
import { User } from '../redux/prop-types';
interface IShowProfileOrFourOhFourProps {
fetchProfileForUser: (username: string) => void;
@ -23,14 +23,14 @@ interface IShowProfileOrFourOhFourProps {
};
isSessionUser: boolean;
maybeUser: string;
requestedUser: UserType;
requestedUser: User;
showLoading: boolean;
}
const createRequestedUserSelector =
() =>
(state: unknown, { maybeUser = '' }) =>
userByNameSelector(maybeUser.toLowerCase())(state) as UserType;
userByNameSelector(maybeUser.toLowerCase())(state) as User;
const createIsSessionUserSelector =
() =>
(state: unknown, { maybeUser = '' }) =>

View File

@ -4,11 +4,7 @@ import '../components/layouts/project-links.css';
import { Trans, useTranslation } from 'react-i18next';
import ProjectModal from '../components/SolutionViewer/ProjectModal';
import { Spacer, Link } from '../components/helpers';
import {
ChallengeFiles,
CompletedChallenge,
UserType
} from '../redux/prop-types';
import { ChallengeFiles, CompletedChallenge, User } from '../redux/prop-types';
import {
projectMap,
legacyProjectMap
@ -19,7 +15,7 @@ import { maybeUrlRE } from '../utils';
interface IShowProjectLinksProps {
certName: string;
name: string;
user: UserType;
user: User;
}
type SolutionStateType = {

View File

@ -22,7 +22,7 @@ import {
isSignedInSelector,
hardGoTo as navigate
} from '../redux';
import { UserType } from '../redux/prop-types';
import { User } from '../redux/prop-types';
import { submitNewAbout, updateUserFlag, verifyCert } from '../redux/settings';
const { apiLocation } = envData;
@ -40,7 +40,7 @@ interface IShowSettingsProps {
updateIsHonest: () => void;
updatePortfolio: () => void;
updateQuincyEmail: (isSendQuincyEmail: boolean) => void;
user: UserType;
user: User;
verifyCert: () => void;
path?: string;
}
@ -49,7 +49,7 @@ const mapStateToProps = createSelector(
signInLoadingSelector,
userSelector,
isSignedInSelector,
(showLoading: boolean, user: UserType, isSignedIn) => ({
(showLoading: boolean, user: User, isSignedIn) => ({
showLoading,
user,
isSignedIn

View File

@ -6,7 +6,7 @@ import envData from '../../../../config/env.json';
import { isAuditedCert } from '../../../../utils/is-audited';
import { generateIconComponent, SuperBlock } from '../../assets/icons';
import LinkButton from '../../assets/icons/link-button';
import { ChallengeNodeType } from '../../redux/prop-types';
import { ChallengeNode } from '../../redux/prop-types';
import { Link, Spacer } from '../helpers';
import './map.css';
@ -20,7 +20,7 @@ interface MapProps {
interface MapData {
allChallengeNode: {
nodes: ChallengeNodeType[];
nodes: ChallengeNode[];
};
}
@ -39,7 +39,7 @@ const linkSpacingStyle = {
alignItems: 'center'
};
function renderLandingMap(nodes: ChallengeNodeType[]) {
function renderLandingMap(nodes: ChallengeNode[]) {
nodes = nodes.filter(node => node.superBlock !== 'coding-interview-prep');
return (
<ul data-test-label='certifications'>
@ -61,7 +61,7 @@ function renderLandingMap(nodes: ChallengeNodeType[]) {
);
}
function renderLearnMap(nodes: ChallengeNodeType[], currentSuperBlock = '') {
function renderLearnMap(nodes: ChallengeNode[], currentSuperBlock = '') {
nodes = nodes.filter(node => node.superBlock !== currentSuperBlock);
return curriculumLocale === 'english' ? (
<ul data-test-label='learn-curriculum-map'>

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { HandlerProps } from 'react-reflex';
export const FileType = PropTypes.shape({
export const FilePropType = PropTypes.shape({
key: PropTypes.string,
ext: PropTypes.string,
name: PropTypes.string,
@ -10,7 +10,7 @@ export const FileType = PropTypes.shape({
tail: PropTypes.string
});
export const MarkdownRemark = PropTypes.shape({
export const MarkdownRemarkPropType = PropTypes.shape({
html: PropTypes.string,
frontmatter: PropTypes.shape({
title: PropTypes.string,
@ -19,60 +19,15 @@ export const MarkdownRemark = PropTypes.shape({
})
});
export const ChallengeNode = PropTypes.shape({
block: PropTypes.string,
challengeOrder: PropTypes.number,
challengeType: PropTypes.number,
dashedName: PropTypes.string,
description: PropTypes.string,
challengeFiles: PropTypes.array,
fields: PropTypes.shape({
slug: PropTypes.string,
blockName: PropTypes.string
}),
forumTopicId: PropTypes.number,
guideUrl: PropTypes.string,
head: PropTypes.arrayOf(PropTypes.string),
helpCategory: PropTypes.string,
instructions: PropTypes.string,
isComingSoon: PropTypes.bool,
removeComments: PropTypes.bool,
isLocked: PropTypes.bool,
isPrivate: PropTypes.bool,
order: PropTypes.number,
required: PropTypes.arrayOf(
PropTypes.shape({
link: PropTypes.string,
raw: PropTypes.string,
src: PropTypes.string
})
),
superOrder: PropTypes.number,
superBlock: PropTypes.string,
tail: PropTypes.arrayOf(PropTypes.string),
time: PropTypes.string,
title: PropTypes.string,
translationPending: PropTypes.bool,
videoUrl: PropTypes.string
});
export const AllChallengeNode = PropTypes.shape({
export const AllMarkdownRemarkPropType = PropTypes.shape({
edges: PropTypes.arrayOf(
PropTypes.shape({
node: ChallengeNode
node: MarkdownRemarkPropType
})
)
});
export const AllMarkdownRemark = PropTypes.shape({
edges: PropTypes.arrayOf(
PropTypes.shape({
node: MarkdownRemark
})
)
});
export const User = PropTypes.shape({
export const UserPropType = PropTypes.shape({
about: PropTypes.string,
completedChallenges: PropTypes.arrayOf(
PropTypes.shape({
@ -125,7 +80,7 @@ export const User = PropTypes.shape({
website: PropTypes.string
});
export const CurrentCertsType = PropTypes.arrayOf(
export const CurrentCertsPropType = PropTypes.arrayOf(
PropTypes.shape({
show: PropTypes.bool,
title: PropTypes.string,
@ -133,8 +88,8 @@ export const CurrentCertsType = PropTypes.arrayOf(
})
);
export const StepsType = PropTypes.shape({
currentCerts: CurrentCertsType,
export const StepsPropType = PropTypes.shape({
currentCerts: CurrentCertsPropType,
isShowCerts: PropTypes.bool,
isShowName: PropTypes.bool,
isShowProfile: PropTypes.bool
@ -142,13 +97,13 @@ export const StepsType = PropTypes.shape({
// TYPESCRIPT TYPES
export type CurrentCertType = {
export type CurrentCert = {
show: boolean;
title: string;
certSlug: string;
};
export type MarkdownRemarkType = {
export type MarkdownRemark = {
fields: [{ component: string; nodeIdentity: string; slug: string }];
fileAbsolutePath: string;
frontmatter: {
@ -196,7 +151,7 @@ export interface VideoLocaleIds {
portuguese?: string;
}
export type ChallengeNodeType = {
export type ChallengeNode = {
block: string;
challengeOrder: number;
challengeType: number;
@ -211,15 +166,31 @@ export type ChallengeNodeType = {
id: string;
instructions: string;
isComingSoon: boolean;
internal?: {
content: string;
contentDigest: string;
description: string;
fieldOwners: string[];
ignoreType: boolean | null;
mediaType: string;
owner: string;
type: string;
};
removeComments: boolean;
isLocked: boolean;
isPrivate: boolean;
order: number;
question: Question;
required: Required[];
solutions: {
[T in FileKey]: FileKeyChallenge;
};
sourceInstanceName: string;
superOrder: number;
superBlock: string;
tail: string[];
template: string;
tests: Test[];
time: string;
title: string;
translationPending: boolean;
@ -231,28 +202,28 @@ export type ChallengeNodeType = {
videoUrl: string;
};
export type AllChallengeNodeType = {
export type AllChallengeNode = {
edges: [
{
node: ChallengeNodeType;
node: ChallengeNode;
}
];
};
export type AllMarkdownRemarkType = {
export type AllMarkdownRemark = {
edges: [
{
node: MarkdownRemarkType;
node: MarkdownRemark;
}
];
};
export type ResizePropsType = {
export type ResizeProps = {
onStopResize: (arg0: HandlerProps) => void;
onResize: () => void;
};
export type DimensionsType = {
export type Dimensions = {
height: number;
width: number;
};
@ -272,7 +243,7 @@ export type CertTest = {
title: string;
};
export type UserType = {
export type User = {
about: string;
acceptedPrivacyTerms: boolean;
completedChallenges: CompletedChallenge[];
@ -288,7 +259,7 @@ export type UserType = {
name: string;
picture: string;
points: number;
portfolio: PortfolioType[];
portfolio: Portfolio[];
profileUI: {
isLocked: boolean;
showCerts: boolean;
@ -301,9 +272,9 @@ export type UserType = {
twitter: string;
username: string;
website: string;
} & isCertifiedTypes;
} & isCertified;
export type isCertifiedTypes = {
export type isCertified = {
is2018DataVisCert: boolean;
isApisMicroservicesCert: boolean;
isBackEndCert: boolean;
@ -331,10 +302,10 @@ export type CompletedChallenge = {
challengeFiles: ChallengeFiles;
};
export type ExtTypes = 'js' | 'html' | 'css' | 'jsx';
export type FileKeyTypes = 'indexjs' | 'indexhtml' | 'indexcss';
export type Ext = 'js' | 'html' | 'css' | 'jsx';
export type FileKey = 'indexjs' | 'indexhtml' | 'indexcss';
export type ChallengeMetaType = {
export type ChallengeMeta = {
block: string;
id: string;
introPath: string;
@ -347,7 +318,7 @@ export type ChallengeMetaType = {
helpCategory: string;
};
export type PortfolioType = {
export type Portfolio = {
id: string;
title?: string;
url?: string;
@ -355,88 +326,21 @@ export type PortfolioType = {
description?: string;
};
export type FileKeyChallengeType = {
export type FileKeyChallenge = {
contents: string;
ext: ExtTypes;
ext: Ext;
head: string;
id: string;
key: FileKeyTypes;
key: FileKey;
name: string;
tail: string;
};
// This looks redundant - same as ChallengeNodeType above?
// TODO: @moT01 Yes, it is an almost duplicate because @ojeytonwilliams
// does not allow us to add 'Type' at the end...
// The below is more accurate, because it was built based on graphql's
// interpretation of what we have. The props commented out are what we
// think are on the node, but actually do not exist.
export type ChallengeNode = {
block: string;
challengeFiles: ChallengeFiles;
challengeOrder: number;
challengeType: number;
dashedName: string;
description: string;
fields: {
slug: string;
blockName: string;
tests: Test[];
};
forumTopicId: number;
// guideUrl: string;
// head: string[];
helpCategory: string;
id: string;
instructions: string;
internal?: {
content: string;
contentDigest: string;
description: string;
fieldOwners: string[];
ignoreType: boolean | null;
mediaType: string;
owner: string;
type: string;
};
order: number;
question: {
answers: string[];
solution: number;
text: string;
} | null;
removeComments: boolean;
required: [
{
link: string;
raw: string;
src: string;
}
];
solutions: {
[T in FileKeyTypes]: FileKeyChallengeType;
};
sourceInstanceName: string;
superBlock: string;
superOrder: number;
template: string;
tests: Test[];
time: string;
title: string;
translationPending: boolean;
videoId?: string;
videoUrl?: string;
// isComingSoon: boolean;
// isLocked: boolean;
// isPrivate: boolean;
// tail: string[];
};
// Extra types built from challengeSchema
export type ChallengeFile = {
fileKey: string;
ext: ExtTypes;
ext: Ext;
name: string;
editableRegionBoundaries: number[];
usesMultifileEditor: boolean;

View File

@ -6,7 +6,7 @@ import { sortChallengeFiles } from '../../../../../utils/sort-challengefiles';
import {
ChallengeFile,
ChallengeFiles,
ResizePropsType
ResizeProps
} from '../../../redux/prop-types';
import EditorTabs from './EditorTabs';
import ActionRow from './action-row';
@ -30,7 +30,7 @@ interface DesktopLayoutProps {
testsPane: Pane;
};
preview: ReactElement;
resizeProps: ResizePropsType;
resizeProps: ResizeProps;
superBlock: string;
testOutput: ReactElement;
}

View File

@ -22,10 +22,10 @@ import { Loader } from '../../../components/helpers';
import { userSelector, isDonationModalOpenSelector } from '../../../redux';
import {
ChallengeFiles,
DimensionsType,
ExtTypes,
FileKeyTypes,
ResizePropsType,
Dimensions,
Ext,
FileKey,
ResizeProps,
Test
} from '../../../redux/prop-types';
import { editorToneOptions } from '../../../utils/tone/editor-config';
@ -55,11 +55,11 @@ interface EditorProps {
containerRef: RefObject<HTMLElement>;
contents: string;
description: string;
dimensions: DimensionsType;
dimensions: Dimensions;
editorRef: MutableRefObject<editor.IStandaloneCodeEditor>;
executeChallenge: (options?: { showCompletionModal: boolean }) => void;
ext: ExtTypes;
fileKey: FileKeyTypes;
ext: Ext;
fileKey: FileKey;
canFocusOnMountRef: MutableRefObject<boolean>;
initialEditorContent: string;
initialExt: string;
@ -67,7 +67,7 @@ interface EditorProps {
initialTests: Test[];
isResetting: boolean;
output: string[];
resizeProps: ResizePropsType;
resizeProps: ResizeProps;
saveEditorContent: () => void;
setEditorFocusability: (isFocusable: boolean) => void;
submitChallenge: () => void;
@ -76,7 +76,7 @@ interface EditorProps {
theme: string;
title: string;
updateFile: (object: {
fileKey: FileKeyTypes;
fileKey: FileKey;
editorValue: string;
editableRegionBoundaries: number[] | null;
}) => void;

View File

@ -14,9 +14,9 @@ import LearnLayout from '../../../components/layouts/learn';
import {
ChallengeFile,
ChallengeFiles,
ChallengeMetaType,
ChallengeNodeType,
ResizePropsType,
ChallengeMeta,
ChallengeNode,
ResizeProps,
Test
} from '../../../redux/prop-types';
import { isContained } from '../../../utils/is-contained';
@ -78,7 +78,7 @@ interface ShowClassicProps {
cancelTests: () => void;
challengeMounted: (arg0: string) => void;
createFiles: (arg0: ChallengeFile[]) => void;
data: { challengeNode: ChallengeNodeType };
data: { challengeNode: ChallengeNode };
executeChallenge: (options?: { showCompletionModal: boolean }) => void;
challengeFiles: ChallengeFiles;
initConsole: (arg0: string) => void;
@ -86,11 +86,11 @@ interface ShowClassicProps {
isChallengeCompleted: boolean;
output: string[];
pageContext: {
challengeMeta: ChallengeMetaType;
challengeMeta: ChallengeMeta;
};
t: TFunction;
tests: Test[];
updateChallengeMeta: (arg0: ChallengeMetaType) => void;
updateChallengeMeta: (arg0: ChallengeMeta) => void;
}
interface ShowClassicState {
@ -122,7 +122,7 @@ class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
containerRef: React.RefObject<unknown>;
editorRef: React.RefObject<unknown>;
instructionsPanelRef: React.RefObject<HTMLDivElement>;
resizeProps: ResizePropsType;
resizeProps: ResizeProps;
constructor(props: ShowClassicProps) {
super(props);

View File

@ -10,10 +10,7 @@ import type { Dispatch } from 'redux';
// Local Utilities
import LearnLayout from '../../../components/layouts/learn';
import {
ChallengeNodeType,
ChallengeMetaType
} from '../../../redux/prop-types';
import { ChallengeNode, ChallengeMeta } from '../../../redux/prop-types';
import { updateChallengeMeta, challengeMounted } from '../redux';
// Redux
const mapStateToProps = () => ({});
@ -28,11 +25,11 @@ const mapDispatchToProps = (dispatch: Dispatch) =>
// Types
interface ShowCodeAllyProps {
data: { challengeNode: ChallengeNodeType };
data: { challengeNode: ChallengeNode };
pageContext: {
challengeMeta: ChallengeMetaType;
challengeMeta: ChallengeMeta;
};
updateChallengeMeta: (arg0: ChallengeMetaType) => void;
updateChallengeMeta: (arg0: ChallengeMeta) => void;
}
// Component

View File

@ -16,10 +16,7 @@ import {
executeGA,
allowBlockDonationRequests
} from '../../../redux';
import {
AllChallengeNodeType,
ChallengeFiles
} from '../../../redux/prop-types';
import { AllChallengeNode, ChallengeFiles } from '../../../redux/prop-types';
import {
closeModal,
@ -281,7 +278,7 @@ export class CompletionModalInner extends Component<
const useCurrentBlockIds = (blockName: string) => {
const {
allChallengeNode: { edges }
}: { allChallengeNode: AllChallengeNodeType } = useStaticQuery(graphql`
}: { allChallengeNode: AllChallengeNode } = useStaticQuery(graphql`
query getCurrentBlockNodes {
allChallengeNode(sort: { fields: [superOrder, order, challengeOrder] }) {
edges {

View File

@ -14,8 +14,8 @@ import Spacer from '../../../../components/helpers/spacer';
import LearnLayout from '../../../../components/layouts/learn';
import { isSignedInSelector } from '../../../../redux';
import {
ChallengeMetaType,
ChallengeNodeType,
ChallengeMeta,
ChallengeNode,
Test
} from '../../../../redux/prop-types';
import ChallengeDescription from '../../components/Challenge-Description';
@ -73,7 +73,7 @@ const mapDispatchToActions = {
// Types
interface BackEndProps {
challengeMounted: (arg0: string) => void;
data: { challengeNode: ChallengeNodeType };
data: { challengeNode: ChallengeNode };
description: string;
executeChallenge: (options: { showCompletionModal: boolean }) => void;
forumTopicId: number;
@ -84,12 +84,12 @@ interface BackEndProps {
isSignedIn: boolean;
output: string[];
pageContext: {
challengeMeta: ChallengeMetaType;
challengeMeta: ChallengeMeta;
};
t: TFunction;
tests: Test[];
title: string;
updateChallengeMeta: (arg0: ChallengeMetaType) => void;
updateChallengeMeta: (arg0: ChallengeMeta) => void;
updateSolutionFormValues: () => void;
}

View File

@ -12,10 +12,7 @@ import { createSelector } from 'reselect';
import Spacer from '../../../../components/helpers/spacer';
import LearnLayout from '../../../../components/layouts/learn';
import {
ChallengeNodeType,
ChallengeMetaType
} from '../../../../redux/prop-types';
import { ChallengeNode, ChallengeMeta } from '../../../../redux/prop-types';
import ChallengeDescription from '../../components/Challenge-Description';
import Hotkeys from '../../components/Hotkeys';
import ChallengeTitle from '../../components/challenge-title';
@ -54,14 +51,14 @@ const mapDispatchToProps = (dispatch: Dispatch) =>
// Types
interface ProjectProps {
challengeMounted: (arg0: string) => void;
data: { challengeNode: ChallengeNodeType };
data: { challengeNode: ChallengeNode };
isChallengeCompleted: boolean;
openCompletionModal: () => void;
pageContext: {
challengeMeta: ChallengeMetaType;
challengeMeta: ChallengeMeta;
};
t: TFunction;
updateChallengeMeta: (arg0: ChallengeMetaType) => void;
updateChallengeMeta: (arg0: ChallengeMeta) => void;
updateSolutionFormValues: () => void;
}

View File

@ -14,10 +14,7 @@ import { createSelector } from 'reselect';
import Loader from '../../../components/helpers/loader';
import Spacer from '../../../components/helpers/spacer';
import LearnLayout from '../../../components/layouts/learn';
import {
ChallengeNodeType,
ChallengeMetaType
} from '../../../redux/prop-types';
import { ChallengeNode, ChallengeMeta } from '../../../redux/prop-types';
import ChallengeDescription from '../components/Challenge-Description';
import Hotkeys from '../components/Hotkeys';
import VideoPlayer from '../components/VideoPlayer';
@ -56,15 +53,15 @@ const mapDispatchToProps = (dispatch: Dispatch) =>
// Types
interface ShowVideoProps {
challengeMounted: (arg0: string) => void;
data: { challengeNode: ChallengeNodeType };
data: { challengeNode: ChallengeNode };
description: string;
isChallengeCompleted: boolean;
openCompletionModal: () => void;
pageContext: {
challengeMeta: ChallengeMetaType;
challengeMeta: ChallengeMeta;
};
t: TFunction;
updateChallengeMeta: (arg0: ChallengeMetaType) => void;
updateChallengeMeta: (arg0: ChallengeMeta) => void;
updateSolutionFormValues: () => void;
}

View File

@ -8,9 +8,9 @@ import ButtonSpacer from '../../components/helpers/button-spacer';
import FullWidthRow from '../../components/helpers/full-width-row';
import LearnLayout from '../../components/layouts/learn';
import {
MarkdownRemarkType,
AllChallengeNodeType,
ChallengeNodeType
MarkdownRemark,
AllChallengeNode,
ChallengeNode
} from '../../redux/prop-types';
import './intro.css';
@ -18,7 +18,7 @@ import './intro.css';
function renderMenuItems({
edges = []
}: {
edges?: Array<{ node: ChallengeNodeType }>;
edges?: Array<{ node: ChallengeNode }>;
}) {
return edges
.map(({ node }) => node)
@ -33,8 +33,8 @@ function IntroductionPage({
data: { markdownRemark, allChallengeNode }
}: {
data: {
markdownRemark: MarkdownRemarkType;
allChallengeNode: AllChallengeNodeType;
markdownRemark: MarkdownRemark;
allChallengeNode: AllChallengeNode;
};
}): React.FunctionComponentElement<typeof LearnLayout> {
const { t } = useTranslation();

View File

@ -22,11 +22,7 @@ import {
tryToShowDonationModal,
userSelector
} from '../../redux';
import {
MarkdownRemarkType,
AllChallengeNodeType,
UserType
} from '../../redux/prop-types';
import { MarkdownRemark, AllChallengeNode, User } from '../../redux/prop-types';
import Block from './components/Block';
import CertChallenge from './components/CertChallenge';
import SuperBlockIntro from './components/SuperBlockIntro';
@ -43,8 +39,8 @@ type FetchState = {
type SuperBlockProp = {
currentChallengeId: string;
data: {
markdownRemark: MarkdownRemarkType;
allChallengeNode: AllChallengeNodeType;
markdownRemark: MarkdownRemark;
allChallengeNode: AllChallengeNode;
};
expandedState: {
[key: string]: boolean;
@ -57,7 +53,7 @@ type SuperBlockProp = {
t: TFunction;
toggleBlock: (arg0: string) => void;
tryToShowDonationModal: () => void;
user: UserType;
user: User;
};
configureAnchors({ offset: -40, scrollDuration: 0 });
@ -74,7 +70,7 @@ const mapStateToProps = (state: unknown) => {
isSignedIn,
signInLoading: boolean,
fetchState: FetchState,
user: UserType
user: User
) => ({
currentChallengeId,
isSignedIn,

View File

@ -4,7 +4,7 @@ import envData from '../../../config/env.json';
import type {
ChallengeFile,
CompletedChallenge,
UserType
User
} from '../redux/prop-types';
const { apiLocation } = envData;
@ -55,7 +55,7 @@ async function request<T>(
/** GET **/
interface SessionUser {
user?: { [username: string]: UserType };
user?: { [username: string]: User };
sessionMeta: { activeDonations: number };
}
@ -71,12 +71,12 @@ type ApiUser = {
result?: string;
};
type ApiUserType = Omit<UserType, 'completedChallenges'> & {
type ApiUserType = Omit<User, 'completedChallenges'> & {
completedChallenges?: challengeFilesForFiles[];
};
type UserResponseType = {
user: { [username: string]: UserType } | Record<string, never>;
user: { [username: string]: User } | Record<string, never>;
result: string | undefined;
};
@ -226,7 +226,7 @@ export function putUpdateMyUsername(username: string): Promise<void> {
}
export function putUpdateMyProfileUI(
profileUI: UserType['profileUI']
profileUI: User['profileUI']
): Promise<void> {
return put('/update-my-profileui', { profileUI });
}