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
@@ -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