mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Enable TypeScript strict mode
This commit is contained in:
12 files changed
+229
-13
No files matched your search
@@ -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" />
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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 ?? [];
|
||||
|
||||
|
||||
@@ -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 instanceof Error && error.name === 'AbortError')) {
|
||||
return; // User cancelled
|
||||
}
|
||||
|
||||
|
||||
@@ -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}`;
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user