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> {
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) {
super(props);
this.terminalWindow = window;
}
componentDidMount(): void {

View File

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

View File

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

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