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

update ts; remove suppressImplicitAnyIndexErrors #68

Merged
merged 4 commits into from
Feb 16, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Set up NodeJS
uses: actions/setup-node@v2-beta
with:
node-version: 15.3.0
node-version: 20.11.1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The updated linting packages were throwing errors with old node version; Node 15 is long unsupported, anyway.


- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
"@types/ramda": "^0.27.27",
"@types/react": "^16.9.49",
"@types/react-dom": "^16.9.8",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.37.0",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"babel-eslint": "10.x",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.4",
"eslint": "^7.32.0",
"eslint": "^8.56.0",
"eslint-config-google": "0.x",
"eslint-config-mitodl": "^1.0.0",
"eslint-plugin-babel": "5.x",
Expand All @@ -71,7 +71,7 @@
"react": "^16.13.1",
"react-dom": "^16.13.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.3"
"typescript": "^5.3.3"
},
"peerDependencies": {
"@types/history": "^4.9",
Expand Down
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const useFacetOptions = (
): ((group: string) => Aggregation | null) => {
return useCallback(
(group: string) => {
const emptyActiveFacets = (activeFacets[group] || []).map(
const emptyActiveFacets = (activeFacets[group as keyof Facets] || []).map(
(facet: string) => ({
key: facet,
doc_count: 0
Expand Down Expand Up @@ -197,11 +197,12 @@ export const useSearchInputs = (history: HHistory): UseSearchInputsResult => {
setSearchParams(current => {
const { activeFacets, sort, ui } = current
const newFacets = clone(activeFacets)
const facetName = name as keyof Facets

if (isEnabled) {
newFacets[name] = _.union(newFacets[name] || [], [value])
newFacets[facetName] = _.union(newFacets[facetName] || [], [value])
} else {
newFacets[name] = _.without(newFacets[name] || [], value)
newFacets[facetName] = _.without(newFacets[facetName] || [], value)
}
return {
...current,
Expand All @@ -222,10 +223,11 @@ export const useSearchInputs = (history: HHistory): UseSearchInputsResult => {
const newFacets = clone(activeFacets)

facets.forEach(([name, value, isEnabled]) => {
const facetName = name as keyof Facets
if (isEnabled) {
newFacets[name] = _.union(newFacets[name] || [], [value])
newFacets[facetName] = _.union(newFacets[facetName] || [], [value])
} else {
newFacets[name] = _.without(newFacets[name] || [], value)
newFacets[facetName] = _.without(newFacets[facetName] || [], value)
}
})
return {
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"outDir": "./dist/",
"tsBuildInfoFile": ".tsbuildinfo",
"strict": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
Expand Down
Loading
Loading