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")
|
// description: $t("clientTheme.description")
|
||||||
// }
|
// }
|
||||||
// and any future accesses of the description prop will result in an up to date translation
|
// and any future accesses of the description prop will result in an up to date translation
|
||||||
return {
|
const descriptor = {
|
||||||
__proto__: String.prototype,
|
configurable: true,
|
||||||
valueOf: getter,
|
enumerable: false,
|
||||||
toString: getter
|
writable: false,
|
||||||
} as unknown as string;
|
value: getter
|
||||||
|
};
|
||||||
|
|
||||||
|
return Object.create(String.prototype, {
|
||||||
|
toString: descriptor,
|
||||||
|
valueOf: descriptor
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TranslateProps {
|
interface TranslateProps {
|
||||||
|
|
Loading…
Reference in a new issue