Skip to content

Commit d9305fe

Browse files
committed
fix(chokidar): prevent structured clone of non-serializable values in dynamic dictionary content
1 parent 2a04da0 commit d9305fe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/@intlayer/chokidar/src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,17 @@ export const writeDynamicDictionary = async (
9595
let localedDictionariesPathsRecord: LocalizedDictionaryResult = {};
9696

9797
for await (const locale of locales) {
98+
const content = dictionaryEntry.dictionary.content;
99+
100+
// Prevent structured clone of Symbols or other non-serializable values
101+
const jsonContent = JSON.stringify(content);
102+
98103
const localizedDictionary = {
99104
...dictionaryEntry.dictionary,
100105
locale,
101-
// @ts-expect-error - Fix Type instantiation is excessively deep and possibly infinite
102106
content: getLocalisedContent(
103-
dictionaryEntry.dictionary.content as any,
107+
// Prevent structured clone of Symbols
108+
jsonContent,
104109
locale,
105110
{
106111
dictionaryKey: key,

0 commit comments

Comments
 (0)