chore: use Object.create for better semantics
This commit is contained in:
parent
ec5f9f78d3
commit
38624a8661
|
@ -136,11 +136,17 @@ export function $t(key: string, variables?: Record<string, any>): string {
|
|||
// description: $t("clientTheme.description")
|
||||
// }
|
||||
// and any future accesses of the description prop will result in an up to date translation
|
||||
return {
|
||||
__proto__: String.prototype,
|
||||
valueOf: getter,
|
||||
toString: getter
|
||||
} as unknown as string;
|
||||
const descriptor = {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: getter
|
||||
};
|
||||
|
||||
return Object.create(String.prototype, {
|
||||
toString: descriptor,
|
||||
valueOf: descriptor
|
||||
});
|
||||
}
|
||||
|
||||
interface TranslateProps {
|
||||
|
|
Loading…
Reference in a new issue