Composer apply generate duplicated code

When implementing internationalization, we need to design different language codes.

i18n.ts

export const dict = {
  UserCount: {
    cn: '使用人数',
    en: 'User Count'
  },
}

Generated code

export const dict = {
  // ... (existing translations)

  PhoneNumber: {
    cn: '手机号码',
    en: 'Phone Number'
  },

  // ... (other existing translations)
}

Merged code

export const dict = {
+    PhoneNumber: {
+        cn: '手机号码',
+        en: 'Phone Number'
+    },
    UserCount: {
        cn: '使用人数',
        en: 'User Count'
    },
}

export const dict = {
    PhoneNumber: {
        cn: '手机号码',
        en: 'Phone Number'
    },
}

The dict variable is declared twice, and I omitted other keys for privacy reasons.

1 Like