mirror of
https://github.com/cupcakearmy/svelte-i18n.git
synced 2024-11-16 09:59:58 +01:00
fix: 🐛 default $json type to any
This commit is contained in:
parent
0dec146add
commit
41d8e4d28b
@ -142,16 +142,6 @@ Returns the raw JSON value of the specified `messageId` for the current locale.
|
||||
</ul>
|
||||
```
|
||||
|
||||
If you're using TypeScript, you can define the returned type as well:
|
||||
|
||||
```html
|
||||
<ul>
|
||||
{#each $json<Item[]>('list.items') as item}
|
||||
<li>{item.name}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
```
|
||||
|
||||
### Formats
|
||||
|
||||
`svelte-i18n` comes with a default set of `number`, `time` and `date` formats:
|
||||
|
@ -82,7 +82,7 @@ const formatNumber: NumberFormatter = (n, options) => {
|
||||
return getNumberFormatter(options).format(n);
|
||||
};
|
||||
|
||||
const getJSON: JSONGetter = <T>(id: string, locale = getCurrentLocale()) => {
|
||||
const getJSON: JSONGetter = <T = any>(id: string, locale = getCurrentLocale()) => {
|
||||
return lookup(id, locale) as T;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user