Closed mquandalle closed 4 months ago
Unfortunately I don't think it's possible to access the AvailableLanguageTag
type from inside the Adapter package.
You can manually type it in src/app.d.ts
:
import type { AvailableLanguageTag } from "$lib/paraglide/runtime.js"
declare global {
namespace App {
interface Locals {
paraglide: {
lang: AvailableLanguageTag
textDirection: "rtl" | "ltr"
}
}
}
}
I suppose this file could be generated in the outdir
? Sveltekit itself generate some typing files at dev/build type to type load
function arguments.
(obviously using a relative import ./runtime.js
instead of an import path that depends on the app config)
That could work, I'd have to prototype it
Problem
The
locals.paraglide.lang
should be typed with string literals corresponding to the supported languages instead of the genericstring
type, likecreateI18n
keys for example.Expected behavior
No response
Reproduction
Other information
No response