Skip to content

Commit

Permalink
Merge pull request #974 from microsoft/benibenj/modest-dragonfly
Browse files Browse the repository at this point in the history
Validate NLS strings
  • Loading branch information
benibenj authored May 3, 2024
2 parents 093d33f + d3cc84c commit 9316842
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/nls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ function createPatcher(translations: ITranslations): <T>(value: T) => T {
return value;
}

return ((translations[match[1]] as unknown) ?? value) as T;
const translation = translations[match[1]] as unknown;
if (translation === undefined) {
throw new Error(`No translation found for ${value}`);
}

return translation as T;
};
}

Expand Down

0 comments on commit 9316842

Please sign in to comment.