refactor: clean up ref types (#45070)
The react-hotkeys innerRef type is incorrect (it accepts both callback and object refs), but the lib is unmaintained at this point.
This commit is contained in:
committed by
GitHub
parent
22acd4894d
commit
44e2bce920
@ -135,8 +135,8 @@ const BASE_LAYOUT = {
|
|||||||
// Component
|
// Component
|
||||||
class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
||||||
static displayName: string;
|
static displayName: string;
|
||||||
containerRef: React.RefObject<unknown>;
|
containerRef: React.RefObject<HTMLElement>;
|
||||||
editorRef: React.RefObject<unknown>;
|
editorRef: React.RefObject<HTMLElement>;
|
||||||
instructionsPanelRef: React.RefObject<HTMLDivElement>;
|
instructionsPanelRef: React.RefObject<HTMLDivElement>;
|
||||||
resizeProps: ResizeProps;
|
resizeProps: ResizeProps;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
||||||
import { navigate } from 'gatsby';
|
import { navigate } from 'gatsby';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { HotKeys, GlobalHotKeys } from 'react-hotkeys';
|
import { HotKeys, GlobalHotKeys } from 'react-hotkeys';
|
||||||
@ -42,11 +40,10 @@ interface HotkeysProps {
|
|||||||
canFocusEditor: boolean;
|
canFocusEditor: boolean;
|
||||||
challengeFiles: ChallengeFiles;
|
challengeFiles: ChallengeFiles;
|
||||||
children: React.ReactElement;
|
children: React.ReactElement;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
editorRef?: React.RefObject<HTMLElement>;
|
||||||
editorRef?: React.Ref<HTMLElement> | any;
|
|
||||||
executeChallenge?: (options?: { showCompletionModal: boolean }) => void;
|
executeChallenge?: (options?: { showCompletionModal: boolean }) => void;
|
||||||
submitChallenge: () => void;
|
submitChallenge: () => void;
|
||||||
innerRef: React.Ref<HTMLElement> | unknown;
|
innerRef: React.Ref<HTMLElement>;
|
||||||
instructionsPanelRef?: React.RefObject<HTMLElement>;
|
instructionsPanelRef?: React.RefObject<HTMLElement>;
|
||||||
nextChallengePath: string;
|
nextChallengePath: string;
|
||||||
prevChallengePath: string;
|
prevChallengePath: string;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
||||||
import { Grid, Col, Row } from '@freecodecamp/react-bootstrap';
|
import { Grid, Col, Row } from '@freecodecamp/react-bootstrap';
|
||||||
import { graphql } from 'gatsby';
|
import { graphql } from 'gatsby';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
@ -65,8 +63,7 @@ interface ProjectProps {
|
|||||||
// Component
|
// Component
|
||||||
class Project extends Component<ProjectProps> {
|
class Project extends Component<ProjectProps> {
|
||||||
static displayName: string;
|
static displayName: string;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
private _container: HTMLElement | null = null;
|
||||||
private _container: any;
|
|
||||||
|
|
||||||
constructor(props: ProjectProps) {
|
constructor(props: ProjectProps) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -90,7 +87,7 @@ class Project extends Component<ProjectProps> {
|
|||||||
helpCategory
|
helpCategory
|
||||||
});
|
});
|
||||||
challengeMounted(challengeMeta.id);
|
challengeMounted(challengeMeta.id);
|
||||||
this._container.focus();
|
this._container?.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps: ProjectProps): void {
|
componentDidUpdate(prevProps: ProjectProps): void {
|
||||||
|
Reference in New Issue
Block a user