Skip to content

Commit cbd2e2d

Browse files
committed
syntax quirks in code prettifier
1 parent 1c62bc3 commit cbd2e2d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

blog/2022/how-to-subscribe-to-svelte-store-sub-property-changes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tags:
99

1010
Svelte stores are great. You can easily subscribe to them to be notified when a value changes, and react accordingly.
1111

12-
```js
12+
```ts
1313
//store.ts
1414
import { writable } from 'svelte/store';
1515
import type { Filter } from './ListFilterTypes';
@@ -24,7 +24,7 @@ export const emptyFilter: Filter = {
2424
max: ''
2525
};
2626

27-
export const filter = writable < Filter > Object.assign({}, emptyFilter);
27+
export const filter = writable<Filter>(Object.assign({}, emptyFilter));
2828
```
2929

3030
```js
@@ -46,10 +46,10 @@ Derived stores allow you to create a new store that is based on the value of an
4646

4747
So we can easily add a derived store to our `store.ts` file:
4848

49-
```js/0,4
49+
```ts/0,4
5050
import { writable, derived } from 'svelte/store';
5151
52-
export const filter = writable < Filter > Object.assign({}, emptyFilter);
52+
export const filter = writable<Filter>(Object.assign({}, emptyFilter));
5353
5454
export const filterValue = derived(filter, ($filter) => $filter.value);
5555
```

0 commit comments

Comments
 (0)