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

View File

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

View File

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

View File

@@ -139,7 +139,9 @@
"./src/userContext.test.ts", "./src/userContext.test.ts",
"src/Common/EntityValue.tsx", "src/Common/EntityValue.tsx",
"./src/Platform/Hosted/Components/SwitchAccount.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": [ "include": [
"src/CellOutputViewer/transforms/**/*", "src/CellOutputViewer/transforms/**/*",