Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSG] FileSystemModule's writeFile data must not have ArrayBuffer? #2031

Closed
yusukebe opened this issue Jan 19, 2024 · 3 comments
Closed

[SSG] FileSystemModule's writeFile data must not have ArrayBuffer? #2031

yusukebe opened this issue Jan 19, 2024 · 3 comments
Labels

Comments

@yusukebe
Copy link
Member

yusukebe commented Jan 19, 2024

What version of Hono are you using?

Latest: https://github.com/honojs/hono/tree/24723ffb91e34ce42e1b9d01f818e636f6a2fb65

What runtime/platform is your app running on?

any

What steps can reproduce the bug?

import fs from 'node:fs/promises'
import { Hono } from '../../src'
import { toSSG } from '../../src/helper/ssg'

const app = new Hono()

toSSG(app, fs)

What is the expected behavior?

There is no type error.

What do you see instead?

A type error.

Screenshot 2024-01-19 at 18 58 12

Additional information

If we just want to be compatible with Node.js fs, we can remove the ArrayBuffer.

diff --git a/src/helper/ssg/index.ts b/src/helper/ssg/index.ts
index 3834b6e..ef078f7 100644
--- a/src/helper/ssg/index.ts
+++ b/src/helper/ssg/index.ts
@@ -13,7 +13,7 @@ import { joinPaths, dirname } from './utils'
  * The API might be changed.
  */
 export interface FileSystemModule {
-  writeFile(path: string, data: string | ArrayBuffer | Uint8Array): Promise<void>
+  writeFile(path: string, data: string | Uint8Array): Promise<void>
   mkdir(path: string, options: { recursive: boolean }): Promise<void | string>
 }
@yusukebe
Copy link
Member Author

@watany-dev

Could you take a look?

@watany-dev
Copy link
Contributor

@yusukebe

I certainly don't need it. Fixed.

@yusukebe
Copy link
Member Author

Thanks. Fixed by #2032

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants