This PR improves traceability between string resource and type definition file.
For now, you can figure out which key exists in string resource but can't discover a relation between key and value.
It means you may have to move around resource json file and view every time you want to use new string resource..to solve the problem this PR changes return type to string literal, now you can leverage IDE power!
Generated file would be like below.
declare module "react-native-i18n" {
var fallbacks: boolean;
var translations: {
[keys: string]: any;
};
- function t(key: "title"): string;
+ function t(key: "title"): 'Example';
}
Overview
This PR improves traceability between string resource and type definition file.
For now, you can figure out which key exists in string resource but can't discover a relation between key and value.
It means you may have to move around resource json file and view every time you want to use new string resource..to solve the problem this PR changes return type to string literal, now you can leverage IDE power!
Generated file would be like below.