Files
shakespeare/tanceof OpenAI.APIUserAbortError || error?.name === 'AbortError') {
T

9.6 KiB

diff --git a/package-lock.json b/package-lock.json
index cee59369..035fc334 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -106,6 +106,7 @@
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
+ "@types/jsdom": "^27.0.0",
"@types/jszip": "^3.4.0",
"@types/node": "^22.5.5",
"@types/nunjucks": "^3.2.6",
@@ -5796,6 +5797,18 @@
"@types/unist": "*"
}
},
+ "node_modules/@types/jsdom": {
+ "version": "27.0.0",
+ "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-27.0.0.tgz",
+ "integrity": "sha512-NZyFl/PViwKzdEkQg96gtnB8wm+1ljhdDay9ahn4hgb+SfVtPCbm3TlmDUFXTA+MGN3CijicnMhG18SI5H3rFw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*",
+ "@types/tough-cookie": "*",
+ "parse5": "^7.0.0"
+ }
+ },
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@@ -5908,6 +5921,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/tough-cookie": {
+ "version": "4.0.5",
+ "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz",
+ "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/trusted-types": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
diff --git a/package.json b/package.json
index 7dc81e30..b7742d3a 100644
--- a/package.json
+++ b/package.json
@@ -117,6 +117,7 @@
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
+ "@types/jsdom": "^27.0.0",
"@types/jszip": "^3.4.0",
"@types/node": "^22.5.5",
"@types/nunjucks": "^3.2.6",
diff --git a/src/components/AIProviderConfigDialog.tsx b/src/components/AIProviderConfigDialog.tsx
index e38a614a..94a11e9c 100644
--- a/src/components/AIProviderConfigDialog.tsx
+++ b/src/components/AIProviderConfigDialog.tsx
@@ -1173,7 +1173,7 @@ export function AIProviderConfigDialog({
 
<div className="space-y-3">
<Label className="text-sm font-medium">{t('paymentMethod')}</Label>
- <Tabs value={paymentMethod} onValueChange={(value: 'stripe' | 'lightning') => setPaymentMethod(value)} className="w-full">
+ <Tabs value={paymentMethod} onValueChange={(value) => setPaymentMethod(value as 'stripe' | 'lightning')} className="w-full">
<TabsList className="grid w-full grid-cols-2">
<TabsTrigger value="stripe" className="flex items-center gap-2">
<CreditCard className="h-4 w-4" />
diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx
index 4d390a4d..f44501f5 100644
--- a/src/components/ErrorBoundary.tsx
+++ b/src/components/ErrorBoundary.tsx
@@ -9,7 +9,7 @@ import { getSentryInstance } from '@/lib/sentry';
interface ErrorBoundaryProps {
children: ReactNode;
fallback?: ReactNode | ((props: FallbackProps) => ReactNode);
- onError?: (error: Error, info: { componentStack: string | null }) => void;
+ onError?: (error: Error, info: { componentStack?: string | null }) => void;
/** Whether to report errors to Sentry (default: true) */
reportToSentry?: boolean;
}
@@ -91,7 +91,7 @@ export function ErrorBoundary({
onError,
reportToSentry = true,
}: ErrorBoundaryProps) {
- const handleError = (error: Error, info: { componentStack: string | null }) => {
+ const handleError = (error: Error, info: { componentStack?: string | null }) => {
// Log error details for debugging
console.error('ErrorBoundary caught an error:', error, info);
 
diff --git a/src/hooks/useNostrPublish.ts b/src/hooks/useNostrPublish.ts
index b9a3bc25..5d790626 100644
--- a/src/hooks/useNostrPublish.ts
+++ b/src/hooks/useNostrPublish.ts
@@ -5,12 +5,14 @@ import { useCurrentUser } from "./useCurrentUser";
 
import type { NostrEvent } from "@nostrify/nostrify";
 
-export function useNostrPublish(): UseMutationResult<NostrEvent> {
+type NostrEventInput = Pick<NostrEvent, 'kind' | 'content'> & Partial<Pick<NostrEvent, 'tags' | 'created_at'>>;
+
+export function useNostrPublish(): UseMutationResult<NostrEvent, Error, NostrEventInput> {
const { nostr } = useNostr();
const { user } = useCurrentUser();
 
return useMutation({
- mutationFn: async (t: Omit<NostrEvent, 'id' | 'pubkey' | 'sig'>) => {
+ mutationFn: async (t: NostrEventInput) => {
if (user) {
const tags = t.tags ?? [];
 
diff --git a/src/lib/SessionManager.ts b/src/lib/SessionManager.ts
index a6ebaceb..b812fb0b 100644
--- a/src/lib/SessionManager.ts
+++ b/src/lib/SessionManager.ts
@@ -661,7 +661,7 @@ export class SessionManager {
console.error('AI generation error:', error);
 
// Handle user cancellation
- if (error instanceof OpenAI.APIUserAbortError || error?.name === 'AbortError') {
+ if (error instanceof OpenAI.APIUserAbortError || (error && typeof error === 'object' && 'name' in error && error.name === 'AbortError')) {
return; // User cancelled
}
 
diff --git a/src/lib/build/esmPlugin.ts b/src/lib/build/esmPlugin.ts
index 02602cd4..3853fbc9 100644
--- a/src/lib/build/esmPlugin.ts
+++ b/src/lib/build/esmPlugin.ts
@@ -158,7 +158,7 @@ export function esmPlugin(options: EsmPluginOptions): Plugin {
let current: string | undefined = base;
while (current && current.length) {
// Remove the last package from the path (handling scoped packages like @scope/name)
- const next = current.replace(/\/node_modules\/(@[^/]+\/)?[^/]+$/, "");
+ const next: string = current.replace(/\/node_modules\/(@[^/]+\/)?[^/]+$/, "");
if (next === current) break;
current = next;
const candidate = `${current}/node_modules/${name}`;
diff --git a/src/lib/build/index.test.ts b/src/lib/build/index.test.ts
index 134f7d5f..e494d1c2 100644
--- a/src/lib/build/index.test.ts
+++ b/src/lib/build/index.test.ts
@@ -130,7 +130,7 @@ describe('buildProject', () => {
});
 
vi.mocked(mockFS.readdir)
- .mockImplementation(async (path: string, _options?: { withFileTypes: true }) => {
+ .mockImplementation(async (path: string, _options?: { withFileTypes?: boolean }) => {
if (path === '/test/project/public') {
return [
{ name: 'favicon.ico', isDirectory: () => false, isFile: () => true },
diff --git a/src/lib/commands/mkdir.ts b/src/lib/commands/mkdir.ts
index 82ddd883..13807265 100644
--- a/src/lib/commands/mkdir.ts
+++ b/src/lib/commands/mkdir.ts
@@ -80,7 +80,7 @@ export class MkdirCommand implements ShellCommand {
// Create the directory
await this.fs.mkdir(absolutePath);
} else {
- return createErrorResult(`${this.name}: ${dirPath}: ${error.message}`);
+ return createErrorResult(`${this.name}: ${dirPath}: ${error instanceof Error ? error.message : String(error)}`);
}
}
}
diff --git a/src/lib/commands/touch.ts b/src/lib/commands/touch.ts
index bce66f25..bb0b8a9b 100644
--- a/src/lib/commands/touch.ts
+++ b/src/lib/commands/touch.ts
@@ -73,7 +73,7 @@ export class TouchCommand implements ShellCommand {
await this.fs.writeFile(absolutePath, '', 'utf8');
} else {
// Other error (permission, etc.)
- return createErrorResult(`${this.name}: ${filePath}: ${error.message}`);
+ return createErrorResult(`${this.name}: ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
}
}
 
diff --git a/tsconfig.json b/tsconfig.json
index 56af9ad1..58190179 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -15,11 +15,9 @@
"jsx": "react-jsx",
 
/* Linting */
- "strict": false,
- "strictNullChecks": true,
+ "strict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
- "noImplicitAny": false,
"noFallthroughCasesInSwitch": false,
 
"baseUrl": ".",