Fix typescript strict issues for NotebookTerminalComponent and other files

This commit is contained in:
vaidankarswapnil
2021-08-26 13:50:41 +05:30
parent 8eeda41021
commit 85aa028cb4
4 changed files with 18 additions and 13 deletions

View File

@@ -15,10 +15,13 @@ export interface NotebookTerminalComponentProps {
} }
export class NotebookTerminalComponent extends React.Component<NotebookTerminalComponentProps> { export class NotebookTerminalComponent extends React.Component<NotebookTerminalComponentProps> {
private terminalWindow: Window; // Need to declare as Window | null as contentWindow is typeof Window | null.
// Only Window type declaration throws compilation typeScript error in compile strict mode
private terminalWindow: Window | null;
constructor(props: NotebookTerminalComponentProps) { constructor(props: NotebookTerminalComponentProps) {
super(props); super(props);
this.terminalWindow = window;
} }
componentDidMount(): void { componentDidMount(): void {

View File

@@ -25,12 +25,12 @@ const notebookRecord = makeNotebookRecord({
"0": makeMarkdownCell({ "0": makeMarkdownCell({
cell_type: "markdown", cell_type: "markdown",
source: "abc", source: "abc",
metadata: undefined, metadata: Map(),
} as MarkdownCellParams), } as MarkdownCellParams),
"1": makeCodeCell({ "1": makeCodeCell({
cell_type: "code", cell_type: "code",
execution_count: undefined, execution_count: 0,
metadata: undefined, metadata: Map(),
source: "print(5)", source: "print(5)",
outputs: List.of({ outputs: List.of({
name: "stdout", name: "stdout",
@@ -40,8 +40,8 @@ const notebookRecord = makeNotebookRecord({
} as CodeCellParams), } as CodeCellParams),
"2": makeCodeCell({ "2": makeCodeCell({
cell_type: "code", cell_type: "code",
execution_count: undefined, execution_count: 0,
metadata: undefined, metadata: Map(),
source: 'display(HTML("<h1>Sample html</h1>"))', source: 'display(HTML("<h1>Sample html</h1>"))',
outputs: List.of({ outputs: List.of({
data: Object.freeze({ data: Object.freeze({
@@ -54,8 +54,8 @@ const notebookRecord = makeNotebookRecord({
} as CodeCellParams), } as CodeCellParams),
"3": makeCodeCell({ "3": makeCodeCell({
cell_type: "code", cell_type: "code",
execution_count: undefined, execution_count: 0,
metadata: undefined, metadata: Map(),
source: 'print("hello world")', source: 'print("hello world")',
outputs: List.of({ outputs: List.of({
name: "stdout", name: "stdout",

View File

@@ -5,9 +5,9 @@ import { ApiType } from "../UserContext";
export interface TerminalProps { export interface TerminalProps {
authToken: string; authToken: string;
notebookServerEndpoint: string; notebookServerEndpoint: string;
terminalEndpoint: string; terminalEndpoint: string | undefined;
databaseAccount: DataModels.DatabaseAccount; databaseAccount: DataModels.DatabaseAccount | undefined;
authType: AuthType; authType: AuthType | undefined;
apiType: ApiType; apiType: ApiType;
subscriptionId: string; subscriptionId: string | undefined;
} }

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/Controls/Notebook/NotebookTerminalComponent.tsx",
"./src/Explorer/Notebook/NotebookUtil.test.ts"
], ],
"include": [ "include": [
"src/CellOutputViewer/transforms/**/*", "src/CellOutputViewer/transforms/**/*",