fix: 🐛 default $json type to any

This commit is contained in:
Christian Kaisermann 2021-02-10 21:22:48 -03:00
parent 0dec146add
commit 41d8e4d28b
2 changed files with 1 additions and 11 deletions

View File

@ -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:

View File

@ -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;
};