Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 app/hooks/use-params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ type AllParams = Readonly<Params<string>>
export const requireParams =
<K extends string = never>(...requiredKeys: K[]) =>
(params: AllParams) => {
const requiredParams: { [k in K]?: string } = {}
const requiredParams: Partial<Record<K, string>> = {}
for (const k of requiredKeys) {
const value = params[k]
if (process.env.NODE_ENV !== 'production') {
invariant(k in params && value, err(k))
}
requiredParams[k] = value
}
return requiredParams as { readonly [k in K]: string }
return requiredParams as Readonly<Record<K, string>>

@david-crespo david-crespo Jan 28, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is an updated lint rule, consistent-indexed-object-style. I think they're right, this is a very tiny bit better.

typescript-eslint/typescript-eslint#10160

}

export const getProjectSelector = requireParams('project')
Expand Down
Loading