Fixed typescript strict issue of Statusbar, hostedUtils, StringUtils etc (#785)
This commit is contained in:
parent
0bbf9de963
commit
397231dca2
|
@ -79,7 +79,7 @@ interface InitialProps {
|
||||||
contentRef: ContentRef;
|
contentRef: ContentRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
const makeMapStateToProps = (initialState: AppState, initialProps: InitialProps): ((state: AppState) => Props) => {
|
const makeMapStateToProps = (_initialState: AppState, initialProps: InitialProps): ((state: AppState) => Props) => {
|
||||||
const { contentRef } = initialProps;
|
const { contentRef } = initialProps;
|
||||||
|
|
||||||
const mapStateToProps = (state: AppState) => {
|
const mapStateToProps = (state: AppState) => {
|
||||||
|
|
|
@ -40,7 +40,7 @@ export function getDatabaseAccountKindFromExperience(apiExperience: typeof userC
|
||||||
return AccountKind.GlobalDocumentDB;
|
return AccountKind.GlobalDocumentDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function extractMasterKeyfromConnectionString(connectionString: string): string {
|
export function extractMasterKeyfromConnectionString(connectionString: string): string | undefined {
|
||||||
// Only Gremlin uses the actual master key for connection to cosmos
|
// Only Gremlin uses the actual master key for connection to cosmos
|
||||||
const matchedParts = connectionString.match("AccountKey=(.*);ApiKind=Gremlin;$");
|
const matchedParts = connectionString.match("AccountKey=(.*);ApiKind=Gremlin;$");
|
||||||
return (matchedParts && matchedParts.length > 1 && matchedParts[1]) || undefined;
|
return (matchedParts && matchedParts.length > 1 && matchedParts[1]) || undefined;
|
||||||
|
|
|
@ -35,7 +35,7 @@ describe("Default Experience Utility", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getApiKindFromDefaultExperience()", () => {
|
describe("getApiKindFromDefaultExperience()", () => {
|
||||||
function runScenario(defaultExperience: typeof userContext.apiType, expectedApiKind: number): void {
|
function runScenario(defaultExperience: typeof userContext.apiType | null, expectedApiKind: number): void {
|
||||||
const resolvedApiKind = DefaultExperienceUtility.getApiKindFromDefaultExperience(defaultExperience);
|
const resolvedApiKind = DefaultExperienceUtility.getApiKindFromDefaultExperience(defaultExperience);
|
||||||
expect(resolvedApiKind).toEqual(expectedApiKind);
|
expect(resolvedApiKind).toEqual(expectedApiKind);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,27 +3,27 @@ import * as StringUtils from "./StringUtils";
|
||||||
describe("StringUtils", () => {
|
describe("StringUtils", () => {
|
||||||
describe("stripSpacesFromString()", () => {
|
describe("stripSpacesFromString()", () => {
|
||||||
it("should strip all spaces from input string", () => {
|
it("should strip all spaces from input string", () => {
|
||||||
const transformedString: string = StringUtils.stripSpacesFromString("a b c");
|
const transformedString: string | undefined = StringUtils.stripSpacesFromString("a b c");
|
||||||
expect(transformedString).toBe("abc");
|
expect(transformedString).toBe("abc");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return original string if input string has no spaces", () => {
|
it("should return original string if input string has no spaces", () => {
|
||||||
const transformedString: string = StringUtils.stripSpacesFromString("abc");
|
const transformedString: string | undefined = StringUtils.stripSpacesFromString("abc");
|
||||||
expect(transformedString).toBe("abc");
|
expect(transformedString).toBe("abc");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return undefined if input is undefined", () => {
|
it("should return undefined if input is undefined", () => {
|
||||||
const transformedString: string = StringUtils.stripSpacesFromString(undefined);
|
const transformedString: string | undefined = StringUtils.stripSpacesFromString(undefined);
|
||||||
expect(transformedString).toBeUndefined();
|
expect(transformedString).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return undefined if input is undefiend", () => {
|
it("should return undefined if input is undefiend", () => {
|
||||||
const transformedString: string = StringUtils.stripSpacesFromString(undefined);
|
const transformedString: string | undefined = StringUtils.stripSpacesFromString(undefined);
|
||||||
expect(transformedString).toBe(undefined);
|
expect(transformedString).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return empty string if input is an empty string", () => {
|
it("should return empty string if input is an empty string", () => {
|
||||||
const transformedString: string = StringUtils.stripSpacesFromString("");
|
const transformedString: string | undefined = StringUtils.stripSpacesFromString("");
|
||||||
expect(transformedString).toBe("");
|
expect(transformedString).toBe("");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export function stripSpacesFromString(inputString: string): string {
|
export function stripSpacesFromString(inputString?: string): string | undefined {
|
||||||
if (inputString === undefined || typeof inputString !== "string") {
|
if (inputString === undefined || typeof inputString !== "string") {
|
||||||
return inputString;
|
return inputString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import create, { UseStore } from "zustand";
|
import create, { UseStore } from "zustand";
|
||||||
|
|
||||||
export interface NotebookSnapshotHooks {
|
export interface NotebookSnapshotHooks {
|
||||||
snapshot: string;
|
snapshot?: string;
|
||||||
error: string;
|
error?: string;
|
||||||
setSnapshot: (imageSrc: string) => void;
|
setSnapshot: (imageSrc: string) => void;
|
||||||
setError: (error: string) => void;
|
setError: (error: string) => void;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ export async function fetchAccessData(portalToken: string): Promise<AccessInputM
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useTokenMetadata(token: string): AccessInputMetadata {
|
export function useTokenMetadata(token: string): AccessInputMetadata | undefined {
|
||||||
const [state, setState] = useState<AccessInputMetadata>();
|
const [state, setState] = useState<AccessInputMetadata | undefined>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (token) {
|
if (token) {
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/AzureTheme.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/AzureTheme.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/Prompt.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/Prompt.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/PromptContent.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/PromptContent.tsx",
|
||||||
|
"./src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookUtil.ts",
|
"./src/Explorer/Notebook/NotebookUtil.ts",
|
||||||
|
@ -88,6 +89,8 @@
|
||||||
"./src/Platform/Hosted/Components/MeControl.test.tsx",
|
"./src/Platform/Hosted/Components/MeControl.test.tsx",
|
||||||
"./src/Platform/Hosted/Components/MeControl.tsx",
|
"./src/Platform/Hosted/Components/MeControl.tsx",
|
||||||
"./src/Platform/Hosted/Components/SignInButton.tsx",
|
"./src/Platform/Hosted/Components/SignInButton.tsx",
|
||||||
|
"./src/Platform/Hosted/HostedUtils.test.ts",
|
||||||
|
"./src/Platform/Hosted/HostedUtils.ts",
|
||||||
"./src/Platform/Hosted/extractFeatures.test.ts",
|
"./src/Platform/Hosted/extractFeatures.test.ts",
|
||||||
"./src/Platform/Hosted/extractFeatures.ts",
|
"./src/Platform/Hosted/extractFeatures.ts",
|
||||||
"./src/ReactDevTools.ts",
|
"./src/ReactDevTools.ts",
|
||||||
|
@ -119,6 +122,7 @@
|
||||||
"./src/Utils/MessageValidation.ts",
|
"./src/Utils/MessageValidation.ts",
|
||||||
"./src/Utils/NotificationConsoleUtils.ts",
|
"./src/Utils/NotificationConsoleUtils.ts",
|
||||||
"./src/Utils/PricingUtils.ts",
|
"./src/Utils/PricingUtils.ts",
|
||||||
|
"./src/Utils/StringUtils.test.ts",
|
||||||
"./src/Utils/StringUtils.ts",
|
"./src/Utils/StringUtils.ts",
|
||||||
"./src/Utils/StyleUtils.ts",
|
"./src/Utils/StyleUtils.ts",
|
||||||
"./src/Utils/WindowUtils.test.ts",
|
"./src/Utils/WindowUtils.test.ts",
|
||||||
|
@ -127,6 +131,8 @@
|
||||||
"./src/hooks/useDirectories.tsx",
|
"./src/hooks/useDirectories.tsx",
|
||||||
"./src/hooks/useFullScreenURLs.tsx",
|
"./src/hooks/useFullScreenURLs.tsx",
|
||||||
"./src/hooks/useGraphPhoto.tsx",
|
"./src/hooks/useGraphPhoto.tsx",
|
||||||
|
"./src/hooks/useNotebookSnapshotStore.ts",
|
||||||
|
"./src/hooks/usePortalAccessToken.tsx",
|
||||||
"./src/hooks/useNotificationConsole.ts",
|
"./src/hooks/useNotificationConsole.ts",
|
||||||
"./src/hooks/useObservable.ts",
|
"./src/hooks/useObservable.ts",
|
||||||
"./src/hooks/useSidePanel.ts",
|
"./src/hooks/useSidePanel.ts",
|
||||||
|
|
Loading…
Reference in New Issue