chore(docs): turn on strictNullChecks (#36180)

strictNullChecks was off for docs, which lets errors slip through and
leads to incorrect required/optional typing on Zod-inferred types. This
PR enables strictNullChecks and fixes all the existing violations.
This commit is contained in:
Charis
2025-06-04 17:05:37 -04:00
committed by GitHub
parent 5862505164
commit cf3ecc93eb
70 changed files with 487 additions and 531 deletions

View File

@@ -1,7 +1,7 @@
'use client'
import { useEffect, useState } from 'react'
import { usePathname } from 'next/navigation'
import { useEffect, useState } from 'react'
import { MenuId } from '~/components/Navigation/NavigationMenu/NavigationMenu'
import type { ICommonItem } from '~/components/reference/Reference.types'
import type { Json } from '~/features/helpers.types'
@@ -52,7 +52,10 @@ export function deepFilterSections<T extends ICommonItem>(
*
* See https://webpack.js.org/api/module-methods/#dynamic-expressions-in-import
*/
export function useCommonSections(commonSectionsFile: string) {
export function useCommonSections(
commonSectionsFile: string,
{ enabled = true }: { enabled: boolean }
) {
const [commonSections, setCommonSections] = useState<ICommonItem[]>()
useEffect(() => {
@@ -67,6 +70,10 @@ export function useCommonSections(commonSectionsFile: string) {
fetchCommonSections()
}, [commonSectionsFile])
if (!enabled) {
return null
}
return commonSections
}