feat(assets): add TypeScript type declarations for Hugo @params module

Add proper type definitions for Hugo's `@params` virtual module, configure
tsconfig paths/typeRoots for resolution, and remove the @ts-expect-error
suppress in color-scheme.ts. Also fix nil input handling in camel-case-keys.
This commit is contained in:
Cell
2026-07-16 15:51:25 +08:00
parent 3242dbf2fb
commit 54fb90388f
5 changed files with 16 additions and 3 deletions
-1
View File
@@ -1,4 +1,3 @@
// @ts-expect-error — Hugo js.Build virtual module
import params from '@params'
/**
+8
View File
@@ -0,0 +1,8 @@
/**
* Hugo `@params` type declarations
* This file provides TypeScript type definitions for Hugo's `@params` module
*/
declare module '@params' {
export const defaultTheme: string
}
+6
View File
@@ -4,6 +4,12 @@
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"module": "ESNext",
"moduleResolution": "bundler",
"paths": {
"@params": ["./js/types/params"]
},
"typeRoots": [
"./js/types"
],
"strict": true,
"noUnusedLocals": true,
"allowSyntheticDefaultImports": true,
@@ -26,7 +26,7 @@
// Practical usage in templates
{{- $siteParams := partial "function/camel-case-keys.html" .Site.Params }}
*/ -}}
{{- $input := . -}}
{{- $input := . | default dict -}}
{{- $output := dict -}}
{{- if reflect.IsMap $input -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- hugo.Store.Set "version" "v1.0.0-mrn0yyrp" -}}
{{- hugo.Store.Set "version" "v1.0.0-mrn7n5sf" -}}
{{- .Store.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}