@types delcarations

When i add some @types/i18next.d.ts type declarations to my client-side it works fine when running locally but when trying to build the from the build folder it does not get anything referenced in the custom typedefinition file. VSC also shows this as valid inside the source files. But once in the build output directory, it does not seem to get the declarations anymore. Eventho VSC is able to list the file when cmd+clicking on the module name inside the build error, it is marked red. does anybody have a clue why this might be the case? Also moving around the typedefinition file inside the build folder manually or adding path/typeRoot to the tsconfig inside the build folder does not have any impact :S This is my declaration file:
import { TranslationsT } from '../translations/resources/de'
import { ParseKeys } from 'i18next'

declare module 'i18next' {
export type DefaultNS = 'translation'
export type Keys = ParseKeys<DefaultNS>
interface CustomTypeOptions {
defaultNS: DefaultNS
resources: {
translation: TranslationsT
}
}
}
import { TranslationsT } from '../translations/resources/de'
import { ParseKeys } from 'i18next'

declare module 'i18next' {
export type DefaultNS = 'translation'
export type Keys = ParseKeys<DefaultNS>
interface CustomTypeOptions {
defaultNS: DefaultNS
resources: {
translation: TranslationsT
}
}
}
2 Replies
miho
miho14mo ago
Could you share your folder structure, where did you put the type declarations? Are you editing the tsconfig.json in the client folder?
Gwaggli
GwaggliOP14mo ago
I put the type declarations inside the client folder under /src/client/@types/i18next.d.ts At first i did not edit the tsconfig.json file and later tried to adjust it but it didnt help as well. But made sense, as it is not copied over to the build folder, right?
Want results from more Discord servers?
Add your server