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

refactor: remove useless spread #3600

Merged
merged 5 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ClientRequestImpl {
let methodUpperCase = this.method.toUpperCase()

const headerValues: Record<string, string> = {
...(args?.header ?? {}),
...args?.header,
Copy link
Contributor Author

@exoego exoego Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note) spread fallback is redundant

const a = undefined
console.log({ ...a, b: 1 })

// { b: 1}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put out a PR related to this.

exoego#5

...(typeof opt?.headers === 'function'
? await opt.headers()
: opt?.headers
Expand Down Expand Up @@ -201,7 +201,7 @@ export const hc = <T extends Hono<any, any, any>>(
const req = new ClientRequestImpl(url, method)
if (method) {
options ??= {}
const args = deepMerge<ClientRequestOptions>(options, { ...(opts.args[1] ?? {}) })
const args = deepMerge<ClientRequestOptions>(options, { ...opts.args[1] })
return req.fetch(opts.args[0], args)
}
return req
Expand Down
3 changes: 2 additions & 1 deletion src/middleware/jsx-renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const createRenderer =
? jsx(
(props: any) => component(props, c),
{
...{ Layout, ...(props as any) },
Layout,
...(props as any),
},
children as any
)
Expand Down
Loading