Fix typescript strict issues for Toolbar and VirtualCommandBarComponent

This commit is contained in:
vaidankarswapnil
2021-09-01 15:11:03 +05:30
parent 39dd293fc1
commit e44d6ab186
4 changed files with 13 additions and 11 deletions

View File

@@ -5,9 +5,9 @@ import { NotebookUtil } from "../NotebookUtil";
import * as NteractUtil from "../NTeractUtil";
interface VirtualCommandBarComponentProps {
kernelSpecName: string;
kernelStatus: string;
currentCellType: string;
kernelSpecName: string | undefined;
kernelStatus: string | undefined;
currentCellType: string | undefined;
isNotebookUntrusted: boolean;
onRender: () => void;
}
@@ -40,7 +40,7 @@ interface InitialProps {
// Redux
const makeMapStateToProps = (
initialState: AppState,
_: AppState,
initialProps: InitialProps
): ((state: AppState) => VirtualCommandBarComponentProps) => {
const { contentRef } = initialProps;
@@ -70,8 +70,8 @@ const makeMapStateToProps = (
currentCellType = NteractUtil.getCurrentCellType(content);
return {
kernelStatus,
kernelSpecName,
kernelStatus: kernelStatus ? kernelStatus : "",
kernelSpecName: kernelSpecName ? kernelSpecName : "",
currentCellType,
isNotebookUntrusted: NotebookUtil.isNotebookUntrusted(state, contentRef),
onRender: initialProps.onRender,

View File

@@ -12,7 +12,7 @@ export interface SnapshotFragment {
export type SnapshotRequest = NotebookSnapshotRequest | CellSnapshotRequest;
interface NotebookSnapshotRequestBase {
requestId: string;
aspectRatio: number;
aspectRatio: number | undefined;
notebookContentRef: string; // notebook redux contentRef
downloadFilename?: string; // Optional: will download as a file
}

View File

@@ -213,7 +213,7 @@ const mapDispatchToProps = (
takeNotebookSnapshot: (request: SnapshotRequest) => dispatch(cdbActions.takeNotebookSnapshot(request)),
});
const makeMapStateToProps = (state: AppState, ownProps: ComponentProps): ((state: AppState) => StateProps) => {
const makeMapStateToProps = (_: AppState, ownProps: ComponentProps): ((state: AppState) => StateProps) => {
const mapStateToProps = (state: AppState) => {
const cell = selectors.cell.cellFromState(state, { id: ownProps.id, contentRef: ownProps.contentRef });
const cellType = cell.cell_type;
@@ -225,8 +225,8 @@ const makeMapStateToProps = (state: AppState, ownProps: ComponentProps): ((state
return {
cellType,
cellIdAbove,
cellIdBelow,
cellIdAbove: cellIdAbove ? cellIdAbove : "",
cellIdBelow: cellIdBelow ? cellIdBelow : "",
hasCodeOutput: cellType === "code" && NotebookUtil.hasCodeCellOutput(cell as ImmutableCodeCell),
isNotebookUntrusted: NotebookUtil.isNotebookUntrusted(state, ownProps.contentRef),
};

View File

@@ -139,7 +139,9 @@
"./src/userContext.test.ts",
"src/Common/EntityValue.tsx",
"./src/Platform/Hosted/Components/SwitchAccount.tsx",
"./src/Platform/Hosted/Components/SwitchSubscription.tsx"
"./src/Platform/Hosted/Components/SwitchSubscription.tsx",
"./src/Explorer/Notebook/NotebookComponent/VirtualCommandBarComponent.tsx",
"./src/Explorer/Notebook/NotebookRenderer/Toolbar.tsx"
],
"include": [
"src/CellOutputViewer/transforms/**/*",