给出:
const I18 = { EN: { M1: { A: 'Hi' } } };
(page: Keys, label:string ) => () => string | string
用法
const current = 'EN';
const T = (param1, param2) => I18[current][param1][param2];
console.log( T('M1','A') ) // return 'hi';
如何为此编写def类型?我尝试过:
type Opts = keyof typeof I18;
type Keys = keyof typeof I18.EN;
因此,我可以轻松键入param1和当前变量;但是如何提供对param2的检查?