Skip to content

Commit bd94824

Browse files
authored
Merge pull request #7922 from nextcloud-libraries/chore/ts
refactor: fix Typescript issues in build files
2 parents 1cad6e8 + 66c2531 commit bd94824

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

build/l10n-plugin.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ export default (dir: string) => {
4646
this.info('[l10n] Building translation chunks for components')
4747
// This will split translations in a map like "using file(s)" => {locale, translations}
4848
for (const locale in allTranslations) {
49-
const currentTranslations = allTranslations[locale]
49+
const currentTranslations = allTranslations[locale]!
5050
for (const [usage, msgIds] of Object.entries(context)) {
5151
if (!(usage in translations)) {
5252
translations[usage] = []
5353
}
5454
// split the translations by usage in components
55-
translations[usage].push({
55+
translations[usage]!.push({
5656
l: locale,
5757
// We simply filter those translations whos msg IDs are used by current context
5858
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -93,7 +93,7 @@ export default (dir: string) => {
9393
const match = id.match(/\0l10nwrapper\?source=(.+)/)
9494
if (match) {
9595
// In case this is the wrapper module we provide a module that imports only the required translations and exports t and n functions
96-
const source = decodeURIComponent(match[1])
96+
const source = decodeURIComponent(match[1]!)
9797
// filter function to check the paths (files that use this translation) includes the current source
9898
const filterByPath = (paths: string) => paths.split(':').some((path) => source.endsWith(path))
9999
// All translations that need to be imported for the current source

build/translations.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function parseFile(fileName: string) {
4545
const po = await readFile(fileName)
4646

4747
// compress translations
48-
const json = Object.fromEntries(Object.entries(poParser.parse(po).translations[''])
48+
const json = Object.fromEntries(Object.entries(poParser.parse(po).translations['']!)
4949
// Remove the meta data entry
5050
.filter(([key]) => key !== '')
5151
// Remove not translated string to save space

0 commit comments

Comments
 (0)