gui strict null fixes p23232323

This commit is contained in:
Dallin Romney 2024-11-26 14:59:30 -08:00
parent 820320cf60
commit 1bfc0a47e9
5 changed files with 9 additions and 8 deletions

View file

@ -13,9 +13,7 @@ interface OllamaStatusProps {
isOllamaConnected: boolean;
}
const {
ollama: { downloadUrl },
} = providers;
const downloadUrl = providers.ollama!.downloadUrl!;
export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) {
const ideMessenger = useContext(IdeMessengerContext);

View file

@ -211,10 +211,12 @@ function findLastIndex<T>(
return -1; // if no element satisfies the predicate
}
function resolveParagraph(p: JSONContent): [string, MentionAttrs[], string] {
function resolveParagraph(
p: JSONContent,
): [string, MentionAttrs[], string | undefined] {
let text = "";
const contextItems = [];
let slashCommand = undefined;
let slashCommand: string | undefined = undefined;
for (const child of p.content || []) {
if (child.type === "text") {
text += text === "" ? child.text.trimStart() : child.text;

View file

@ -239,7 +239,7 @@ function useSubmenuContextProviders() {
{
title: description.title,
},
)
);
if (result.status === "error") {
console.error(

View file

@ -56,7 +56,7 @@ const hljsToTextMate: Record<string, string[]> = {
function constructTheme(
tmTheme: typeof window.fullColorTheme,
): Record<string, string> {
const rules = tmTheme["rules"] || [];
const rules = tmTheme?.["rules"] || [];
const tokenToForeground = {};
rules.forEach(({ token, foreground }) => {

View file

@ -26,5 +26,6 @@ export const selectContextProviderDescriptions = createSelector(
export const selectUseActiveFile = createSelector(
[(store: RootState) => store.state.config.experimental?.defaultContext],
(defaultContext) => defaultContext?.includes("activeFile" as any),
(defaultContext) =>
defaultContext?.find((provider) => provider.name === "activeFile") ?? false,
);