Skip to content

Commit 6f98286

Browse files
committed
convert most playgrounds to TypeScript
1 parent 90f4480 commit 6f98286

File tree

27 files changed

+402
-1148
lines changed

27 files changed

+402
-1148
lines changed

packages/autocomplete-client/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
4545
"@meilisearch/instant-meilisearch": "*"
4646
},
4747
"devDependencies": {
48-
"@algolia/autocomplete-js": "^1.7.4",
49-
"cssnano": "^4.1.10",
50-
"instantsearch.js": "^4.56.2"
48+
"@algolia/autocomplete-js": "^1.18.0",
49+
"instantsearch.js": "^4.77.3"
5150
}
5251
}

packages/instant-meilisearch/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"meilisearch": "^0.48.2"
4949
},
5050
"devDependencies": {
51-
"cssnano": "^4.1.10",
52-
"instantsearch.js": "^4.56.2"
51+
"instantsearch.js": "^4.77.3"
5352
}
5453
}

playgrounds/autocomplete/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"author": "",
2222
"license": "ISC",
2323
"dependencies": {
24-
"@algolia/autocomplete-core": "1.17.9",
25-
"@algolia/autocomplete-plugin-query-suggestions": "^1.17.9",
26-
"@algolia/autocomplete-plugin-tags": "^1.17.9",
27-
"@algolia/autocomplete-theme-classic": "^1.17.9",
24+
"@algolia/autocomplete-core": "^1.18.0",
25+
"@algolia/autocomplete-plugin-query-suggestions": "^1.18.0",
26+
"@algolia/autocomplete-plugin-tags": "^1.18.0",
27+
"@algolia/autocomplete-theme-classic": "^1.18.0",
2828
"@meilisearch/autocomplete-client": "*"
2929
}
3030
}

playgrounds/autocomplete/src/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
meilisearchAutocompleteClient,
44
getMeilisearchResults,
55
} from '@meilisearch/autocomplete-client'
6+
// @ts-expect-error it doesn't have type declarations...
67
import '@algolia/autocomplete-theme-classic'
78

89
const client = meilisearchAutocompleteClient({

playgrounds/javascript/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
@@ -47,7 +47,6 @@ <h2>Misc</h2>
4747
</div>
4848
</div>
4949

50-
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
51-
<script type="module" src="./src/app.js"></script>
50+
<script type="module" src="./src/app.ts"></script>
5251
</body>
5352
</html>

playgrounds/javascript/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
"description": "Instant-meilisearch playground written with vanilla javascript",
66
"type": "module",
77
"scripts": {
8-
"dev": "vite"
8+
"dev": "vite",
9+
"test:types": "tsc"
910
},
1011
"browserslist": [
1112
"defaults"
1213
],
1314
"license": "MIT",
1415
"dependencies": {
15-
"@meilisearch/instant-meilisearch": "0.24.0"
16+
"@meilisearch/instant-meilisearch": "0.24.0",
17+
"instantsearch.js": "^4.77.3"
1618
}
1719
}

playgrounds/javascript/src/app.js renamed to playgrounds/javascript/src/app.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
/* eslint-disable no-undef */
21
import { instantMeiliSearch } from '@meilisearch/instant-meilisearch'
2+
import { default as instantsearch } from 'instantsearch.js'
3+
import {
4+
clearRefinements,
5+
configure,
6+
hits,
7+
pagination,
8+
refinementList,
9+
searchBox,
10+
sortBy,
11+
} from 'instantsearch.js/es/widgets'
312

413
const search = instantsearch({
514
indexName: 'steam-video-games',
@@ -13,7 +22,7 @@ const search = instantsearch({
1322
})
1423

1524
search.addWidgets([
16-
instantsearch.widgets.sortBy({
25+
sortBy({
1726
container: '#sort-by',
1827
items: [
1928
{ value: 'steam-video-games', label: 'Relevant' },
@@ -27,33 +36,33 @@ search.addWidgets([
2736
},
2837
],
2938
}),
30-
instantsearch.widgets.searchBox({
39+
searchBox({
3140
container: '#searchbox',
3241
}),
33-
instantsearch.widgets.clearRefinements({
42+
clearRefinements({
3443
container: '#clear-refinements',
3544
}),
36-
instantsearch.widgets.refinementList({
45+
refinementList({
3746
container: '#genres-list',
3847
attribute: 'genres',
3948
}),
40-
instantsearch.widgets.refinementList({
49+
refinementList({
4150
container: '#players-list',
4251
attribute: 'players',
4352
}),
44-
instantsearch.widgets.refinementList({
53+
refinementList({
4554
container: '#platforms-list',
4655
attribute: 'platforms',
4756
}),
48-
instantsearch.widgets.configure({
57+
configure({
4958
hitsPerPage: 6,
5059
attributesToSnippet: ['description:150'],
5160
}),
52-
instantsearch.widgets.refinementList({
61+
refinementList({
5362
container: '#misc-list',
5463
attribute: 'misc',
5564
}),
56-
instantsearch.widgets.hits({
65+
hits({
5766
container: '#hits',
5867
templates: {
5968
item: `
@@ -72,7 +81,7 @@ search.addWidgets([
7281
`,
7382
},
7483
}),
75-
instantsearch.widgets.pagination({
84+
pagination({
7685
container: '#pagination',
7786
}),
7887
])
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"isolatedModules": true,
13+
"moduleDetection": "force",
14+
"noEmit": true,
15+
16+
/* Linting */
17+
"strict": true,
18+
"noUnusedLocals": true,
19+
"noUnusedParameters": true,
20+
"noFallthroughCasesInSwitch": true,
21+
"noUncheckedSideEffectImports": true
22+
},
23+
"include": ["src"]
24+
}

playgrounds/local-react/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
<body>
1111
<div id="app"></div>
12-
<script type="module" src="src/index.jsx"></script>
12+
<script type="module" src="src/index.tsx"></script>
1313
</body>
1414
</html>

0 commit comments

Comments
 (0)