From 90f4480679bbfcb6ce2e39830e77a061c363813d Mon Sep 17 00:00:00 2001 From: "F. Levi" <55688616+flevi29@users.noreply.github.com> Date: Fri, 7 Feb 2025 19:53:04 +0200 Subject: [PATCH 1/3] autocomplete and local-react to typescript --- package.json | 2 +- packages/autocomplete-client/package.json | 3 +- packages/instant-meilisearch/package.json | 3 +- playgrounds/autocomplete/index.html | 15 +- playgrounds/autocomplete/main.js | 8 -- playgrounds/autocomplete/package.json | 6 +- .../autocomplete/{setup.mjs => setup.js} | 0 playgrounds/autocomplete/src/app.js | 92 ------------ playgrounds/autocomplete/src/app.ts | 94 +++++++++++++ playgrounds/autocomplete/src/main.ts | 10 ++ playgrounds/autocomplete/{ => src}/style.css | 0 playgrounds/autocomplete/src/vite-env.d.ts | 1 + playgrounds/autocomplete/tsconfig.json | 24 ++++ playgrounds/local-react/package.json | 14 +- .../local-react/src/{App.jsx => App.tsx} | 0 .../{MultiIndex.jsx => MultiIndex.tsx} | 7 +- .../{SingleIndex.jsx => SingleIndex.tsx} | 8 +- ...gleMovieIndex.jsx => SingleMovieIndex.tsx} | 5 +- .../local-react/src/{index.jsx => index.tsx} | 2 +- playgrounds/local-react/src/vite-env.d.ts | 1 + playgrounds/local-react/tsconfig.app.json | 26 ++++ playgrounds/local-react/tsconfig.json | 7 + playgrounds/local-react/tsconfig.node.json | 24 ++++ playgrounds/local-react/vite.config.ts | 7 +- turbo.json | 3 + yarn.lock | 132 +++++++++++++++--- 26 files changed, 345 insertions(+), 149 deletions(-) delete mode 100644 playgrounds/autocomplete/main.js rename playgrounds/autocomplete/{setup.mjs => setup.js} (100%) delete mode 100644 playgrounds/autocomplete/src/app.js create mode 100644 playgrounds/autocomplete/src/app.ts create mode 100644 playgrounds/autocomplete/src/main.ts rename playgrounds/autocomplete/{ => src}/style.css (100%) create mode 100644 playgrounds/autocomplete/src/vite-env.d.ts create mode 100644 playgrounds/autocomplete/tsconfig.json rename playgrounds/local-react/src/{App.jsx => App.tsx} (100%) rename playgrounds/local-react/src/components/{MultiIndex.jsx => MultiIndex.tsx} (91%) rename playgrounds/local-react/src/components/{SingleIndex.jsx => SingleIndex.tsx} (86%) rename playgrounds/local-react/src/components/{SingleMovieIndex.jsx => SingleMovieIndex.tsx} (90%) rename playgrounds/local-react/src/{index.jsx => index.tsx} (83%) create mode 100644 playgrounds/local-react/src/vite-env.d.ts create mode 100644 playgrounds/local-react/tsconfig.app.json create mode 100644 playgrounds/local-react/tsconfig.json create mode 100644 playgrounds/local-react/tsconfig.node.json diff --git a/package.json b/package.json index 21d77055..dfc30b7d 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "test:watch": "yarn build && vitest", "instant-meilisearch:test:watch": "vitest --project \"@meilisearch/instant-meilisearch\"", "autocomplete:test:watch": "vitest --project \"@meilisearch/autocomplete-client\"", - "test:types": "yarn build && tsc --noEmit", + "test:types": "turbo test:types", "version-packages": "changeset version && turbo version", "release": "yarn build && changeset publish" }, diff --git a/packages/autocomplete-client/package.json b/packages/autocomplete-client/package.json index af0586c0..cb1a0317 100644 --- a/packages/autocomplete-client/package.json +++ b/packages/autocomplete-client/package.json @@ -8,7 +8,8 @@ }, "scripts": { "build": "vite build && tsc -p tsconfig.json", - "version": "node scripts/update_version.cjs" + "version": "node scripts/update_version.cjs", + "test:types": "tsc --noEmit" }, "type": "module", "types": "./dist/types/index.d.ts", diff --git a/packages/instant-meilisearch/package.json b/packages/instant-meilisearch/package.json index 96ddf612..8d7d5455 100644 --- a/packages/instant-meilisearch/package.json +++ b/packages/instant-meilisearch/package.json @@ -25,7 +25,8 @@ ], "scripts": { "build": "vite build && tsc -p tsconfig.json", - "version": "node scripts/update_version.cjs" + "version": "node scripts/update_version.cjs", + "test:types": "tsc --noEmit" }, "type": "module", "types": "./dist/types/index.d.ts", diff --git a/playgrounds/autocomplete/index.html b/playgrounds/autocomplete/index.html index 7e86c793..f6690b1e 100644 --- a/playgrounds/autocomplete/index.html +++ b/playgrounds/autocomplete/index.html @@ -1,16 +1,13 @@ - - + + - - - + + + Demo of Meilisearch + autocomplete.js -
-
- - + diff --git a/playgrounds/autocomplete/main.js b/playgrounds/autocomplete/main.js deleted file mode 100644 index ba14b87b..00000000 --- a/playgrounds/autocomplete/main.js +++ /dev/null @@ -1,8 +0,0 @@ -import './style.css' - -// eslint-disable-next-line no-undef -document.querySelector('#app').innerHTML = ` -
-
-
-` diff --git a/playgrounds/autocomplete/package.json b/playgrounds/autocomplete/package.json index 9c857aae..1b5a401b 100644 --- a/playgrounds/autocomplete/package.json +++ b/playgrounds/autocomplete/package.json @@ -3,12 +3,14 @@ "version": "0.0.0", "private": true, "description": "Javascript playground for autocomplete", + "type": "module", "scripts": { - "predev": "node setup.mjs", + "predev": "node setup.js", "dev": "vite", "setup": "node setup.mjs", "test:e2e": "concurrently --kill-others -s first \"yarn dev\" \"cypress run --env playground=local\"", - "test:e2e:watch": "concurrently --kill-others -s first \"yarn dev\" \"cypress open --env playground=local\"" + "test:e2e:watch": "concurrently --kill-others -s first \"yarn dev\" \"cypress open --env playground=local\"", + "test:types": "tsc" }, "keywords": [ "autocomplete" diff --git a/playgrounds/autocomplete/setup.mjs b/playgrounds/autocomplete/setup.js similarity index 100% rename from playgrounds/autocomplete/setup.mjs rename to playgrounds/autocomplete/setup.js diff --git a/playgrounds/autocomplete/src/app.js b/playgrounds/autocomplete/src/app.js deleted file mode 100644 index 24fb2b7b..00000000 --- a/playgrounds/autocomplete/src/app.js +++ /dev/null @@ -1,92 +0,0 @@ -import { autocomplete } from '@algolia/autocomplete-js' -import { - meilisearchAutocompleteClient, - getMeilisearchResults, -} from '@meilisearch/autocomplete-client' -import '@algolia/autocomplete-theme-classic' - -const client = meilisearchAutocompleteClient({ - url: 'http://localhost:7700', - apiKey: 'masterKey', -}) - -autocomplete({ - container: '#autocomplete', - placeholder: 'Search for games', - openOnFocus: true, - debug: true, - getSources({ query }) { - return [ - { - sourceId: 'steam-video-games', - getItems() { - const description = getMeilisearchResults({ - searchClient: client, - queries: [ - { - indexName: 'steam-video-games', - query, - params: { - hitsPerPage: 10, - attributesToSnippet: ['name:10', 'description:5'], - snippetEllipsisText: '..', - }, - }, - ], - }) - - return description - }, - templates: { - item({ item, components, html }) { - return html`
-
-
- ${item.name} -
-
-
- ${components.Highlight({ - hit: item, - attribute: 'name', - tagName: 'test', - })} -
-
- ${components.Snippet({ - hit: item, - attribute: 'description', - })} -
-
-
- -
-
-
` - }, - }, - }, - ] - }, -}) diff --git a/playgrounds/autocomplete/src/app.ts b/playgrounds/autocomplete/src/app.ts new file mode 100644 index 00000000..5a814379 --- /dev/null +++ b/playgrounds/autocomplete/src/app.ts @@ -0,0 +1,94 @@ +import { autocomplete } from '@algolia/autocomplete-js' +import { + meilisearchAutocompleteClient, + getMeilisearchResults, +} from '@meilisearch/autocomplete-client' +import '@algolia/autocomplete-theme-classic' + +const client = meilisearchAutocompleteClient({ + url: 'http://localhost:7700', + apiKey: 'masterKey', +}) + +export function setupAutocomplete(element: HTMLElement): void { + autocomplete({ + container: element, + placeholder: 'Search for games', + openOnFocus: true, + debug: true, + getSources({ query }) { + return [ + { + sourceId: 'steam-video-games', + getItems() { + const description = getMeilisearchResults({ + searchClient: client, + queries: [ + { + indexName: 'steam-video-games', + query, + params: { + hitsPerPage: 10, + attributesToSnippet: ['name:10', 'description:5'], + snippetEllipsisText: '..', + }, + }, + ], + }) + + return description + }, + templates: { + item({ item, components, html }) { + return html`
+
+
+ ${item.name} +
+
+
+ ${components.Highlight({ + hit: item, + attribute: 'name', + tagName: 'test', + })} +
+
+ ${components.Snippet({ + hit: item, + attribute: 'description', + })} +
+
+
+ +
+
+
` + }, + }, + }, + ] + }, + }) +} diff --git a/playgrounds/autocomplete/src/main.ts b/playgrounds/autocomplete/src/main.ts new file mode 100644 index 00000000..e9ea22ae --- /dev/null +++ b/playgrounds/autocomplete/src/main.ts @@ -0,0 +1,10 @@ +import './style.css' +import { setupAutocomplete } from './app.js' + +document.querySelector('#app')!.innerHTML = ` +
+
+
+` + +setupAutocomplete(document.querySelector('#autocomplete')!) diff --git a/playgrounds/autocomplete/style.css b/playgrounds/autocomplete/src/style.css similarity index 100% rename from playgrounds/autocomplete/style.css rename to playgrounds/autocomplete/src/style.css diff --git a/playgrounds/autocomplete/src/vite-env.d.ts b/playgrounds/autocomplete/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/playgrounds/autocomplete/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/playgrounds/autocomplete/tsconfig.json b/playgrounds/autocomplete/tsconfig.json new file mode 100644 index 00000000..92f8583f --- /dev/null +++ b/playgrounds/autocomplete/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/playgrounds/local-react/package.json b/playgrounds/local-react/package.json index f5b685c7..1593ea9a 100644 --- a/playgrounds/local-react/package.json +++ b/playgrounds/local-react/package.json @@ -3,12 +3,14 @@ "version": "0.0.0", "private": true, "description": "React playground for instant-meilisearch", + "type": "module", "scripts": { "predev": "node setup.mjs", "dev": "vite", "setup": "node setup.mjs", "test:e2e": "concurrently --kill-others -s first \"yarn dev\" \"cypress run --env playground=local\"", - "test:e2e:watch": "concurrently --kill-others -s first \"yarn dev\" \"cypress open --env playground=local\"" + "test:e2e:watch": "concurrently --kill-others -s first \"yarn dev\" \"cypress open --env playground=local\"", + "test:types": "tsc -b" }, "keywords": [ "react", @@ -21,11 +23,13 @@ "license": "ISC", "devDependencies": { "@meilisearch/instant-meilisearch": "*", + "@types/react": "^19.0.8", + "@types/react-dom": "^19.0.3", "instantsearch.css": "^8.5.1", - "react": "^18.3.1", - "react-dom": "^18.3.1", + "react": "^19.0.0", + "react-dom": "^19.0.0", "@vitejs/plugin-react": "^4.3.4", - "react-instantsearch": "^7.15.0", - "react-router-dom": "^6.28.2" + "react-instantsearch": "^7.15.3", + "react-router-dom": "^7.1.5" } } diff --git a/playgrounds/local-react/src/App.jsx b/playgrounds/local-react/src/App.tsx similarity index 100% rename from playgrounds/local-react/src/App.jsx rename to playgrounds/local-react/src/App.tsx diff --git a/playgrounds/local-react/src/components/MultiIndex.jsx b/playgrounds/local-react/src/components/MultiIndex.tsx similarity index 91% rename from playgrounds/local-react/src/components/MultiIndex.jsx rename to playgrounds/local-react/src/components/MultiIndex.tsx index 19239d50..25c14f7e 100644 --- a/playgrounds/local-react/src/components/MultiIndex.jsx +++ b/playgrounds/local-react/src/components/MultiIndex.tsx @@ -10,6 +10,7 @@ import { Hits, } from 'react-instantsearch' import { instantMeiliSearch } from '@meilisearch/instant-meilisearch' +import type { Hit } from 'algoliasearch' const { searchClient } = instantMeiliSearch( 'http://localhost:7700', @@ -21,7 +22,7 @@ const { searchClient } = instantMeiliSearch( } ) -const Hit = ({ hit }) => { +const HitComponent = ({ hit }: { hit: Hit }) => { return (
@@ -50,7 +51,7 @@ const MultiIndex = () => (
- +
@@ -67,7 +68,7 @@ const MultiIndex = () => (
- +
diff --git a/playgrounds/local-react/src/components/SingleIndex.jsx b/playgrounds/local-react/src/components/SingleIndex.tsx similarity index 86% rename from playgrounds/local-react/src/components/SingleIndex.jsx rename to playgrounds/local-react/src/components/SingleIndex.tsx index 20509fda..639ade01 100644 --- a/playgrounds/local-react/src/components/SingleIndex.jsx +++ b/playgrounds/local-react/src/components/SingleIndex.tsx @@ -12,6 +12,7 @@ import { Snippet, } from 'react-instantsearch' import { instantMeiliSearch } from '@meilisearch/instant-meilisearch' +import type { Hit } from 'algoliasearch' const { searchClient } = instantMeiliSearch( 'http://localhost:7700', @@ -36,6 +37,7 @@ const SingleIndex = () => (
+ {/* TODO: https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/react/#replace-defaultrefinement-with-initialuistate-on-instantsearch */} (
- +
) -const Hit = ({ hit }) => { +const HitComponent = ({ hit }: { hit: Hit }) => { return (
@@ -81,7 +83,7 @@ const Hit = ({ hit }) => {
- {hit.name} + {hit.name}
diff --git a/playgrounds/local-react/src/components/SingleMovieIndex.jsx b/playgrounds/local-react/src/components/SingleMovieIndex.tsx similarity index 90% rename from playgrounds/local-react/src/components/SingleMovieIndex.jsx rename to playgrounds/local-react/src/components/SingleMovieIndex.tsx index 653464b2..145104c8 100644 --- a/playgrounds/local-react/src/components/SingleMovieIndex.jsx +++ b/playgrounds/local-react/src/components/SingleMovieIndex.tsx @@ -9,6 +9,7 @@ import { RefinementList, } from 'react-instantsearch' import { instantMeiliSearch } from '@meilisearch/instant-meilisearch' +import type { Hit } from 'algoliasearch' const { searchClient } = instantMeiliSearch( 'http://localhost:7700', @@ -34,13 +35,13 @@ const SingleIndex = () => (
- +
) -const Hit = ({ hit }) => { +const HitComponent = ({ hit }: { hit: Hit }) => { return (
diff --git a/playgrounds/local-react/src/index.jsx b/playgrounds/local-react/src/index.tsx similarity index 83% rename from playgrounds/local-react/src/index.jsx rename to playgrounds/local-react/src/index.tsx index 1b16ac74..631172f6 100644 --- a/playgrounds/local-react/src/index.jsx +++ b/playgrounds/local-react/src/index.tsx @@ -4,7 +4,7 @@ import { BrowserRouter } from 'react-router-dom' import './index.css' import App from './App' -createRoot(document.getElementById('app')).render( +createRoot(document.getElementById('app')!).render( diff --git a/playgrounds/local-react/src/vite-env.d.ts b/playgrounds/local-react/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/playgrounds/local-react/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/playgrounds/local-react/tsconfig.app.json b/playgrounds/local-react/tsconfig.app.json new file mode 100644 index 00000000..dfc691d4 --- /dev/null +++ b/playgrounds/local-react/tsconfig.app.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/playgrounds/local-react/tsconfig.json b/playgrounds/local-react/tsconfig.json new file mode 100644 index 00000000..1ffef600 --- /dev/null +++ b/playgrounds/local-react/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/playgrounds/local-react/tsconfig.node.json b/playgrounds/local-react/tsconfig.node.json new file mode 100644 index 00000000..ff0dc7df --- /dev/null +++ b/playgrounds/local-react/tsconfig.node.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/playgrounds/local-react/vite.config.ts b/playgrounds/local-react/vite.config.ts index 4d622e8c..8e054e3a 100644 --- a/playgrounds/local-react/vite.config.ts +++ b/playgrounds/local-react/vite.config.ts @@ -1,9 +1,8 @@ -/* eslint-disable @typescript-eslint/no-require-imports */ -const { defineConfig } = require('vite') -const react = require('@vitejs/plugin-react') +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' // https://vite.dev/config/ -module.exports = defineConfig({ +export default defineConfig({ server: { port: 5174, strictPort: true }, plugins: [react()], }) diff --git a/turbo.json b/turbo.json index 9cbd8959..4a753520 100644 --- a/turbo.json +++ b/turbo.json @@ -13,6 +13,9 @@ "test": { "dependsOn": ["build"] }, + "test:types": { + "dependsOn": ["build"] + }, "test:watch": { "persistent": true, "cache": false, diff --git a/yarn.lock b/yarn.lock index dd1c94de..bcacc851 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1032,11 +1032,6 @@ "@nodelib/fs.scandir" "2.1.4" fastq "^1.6.0" -"@remix-run/router@1.21.1": - version "1.21.1" - resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.21.1.tgz#bf15274d3856c395402719fa6b1dc8cc5245aaf7" - integrity sha512-KeBYSwohb8g4/wCcnksvKTYlg69O62sQeLynn2YE+5z7JWEj95if27kclW9QqbrlsQ2DINI8fjbV3zyuKfwjKg== - "@rollup/rollup-android-arm-eabi@4.31.0": version "4.31.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.31.0.tgz#d4dd60da0075a6ce9a6c76d71b8204f3e1822285" @@ -1165,6 +1160,11 @@ dependencies: "@babel/types" "^7.20.7" +"@types/cookie@^0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.6.0.tgz#eac397f28bf1d6ae0ae081363eca2f425bedf0d5" + integrity sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA== + "@types/debug@^4.0.0": version "4.1.12" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" @@ -1271,6 +1271,18 @@ resolved "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz" integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw== +"@types/react-dom@^19.0.3": + version "19.0.3" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-19.0.3.tgz#0804dfd279a165d5a0ad8b53a5b9e65f338050a4" + integrity sha512-0Knk+HJiMP/qOZgMyNFamlIjw9OFCsyC2ZbigmEEyXXixgre6IQpm/4V+r3qH4GC1JPvRJKInw+on2rV6YZLeA== + +"@types/react@^19.0.8": + version "19.0.8" + resolved "https://registry.yarnpkg.com/@types/react/-/react-19.0.8.tgz#7098e6159f2a61e4f4cef2c1223c044a9bec590e" + integrity sha512-9P/o1IGdfmQxrujGbIMDyYaaCykhLKc0NGCtYcECNUr9UAaDe4gwvV9bR6tvd5Br1SG0j+PBpbKr2UYY8CwqSw== + dependencies: + csstype "^3.0.2" + "@types/semver@^6.0.0": version "6.2.3" resolved "https://registry.npmjs.org/@types/semver/-/semver-6.2.3.tgz" @@ -1596,6 +1608,13 @@ algoliasearch-helper@3.23.0, algoliasearch-helper@^3.23.0: dependencies: "@algolia/events" "^4.0.1" +algoliasearch-helper@3.24.1: + version "3.24.1" + resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.24.1.tgz#763115d81fc56518bff36b7c707967f70d8fdf45" + integrity sha512-knYRACqLH9UpeR+WRUrBzBFR2ulGuOjI2b525k4PNeqZxeFMHJE7YcL7s6Jh12Qza0rtHqZdgHMfeuaaAkf4wA== + dependencies: + "@algolia/events" "^4.0.1" + algoliasearch@^5.19.0: version "5.19.0" resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-5.19.0.tgz#2a1490bb46a937515797fac30b2d1503fb028536" @@ -2271,6 +2290,11 @@ convert-source-map@^2.0.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== +cookie@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-1.0.2.tgz#27360701532116bd3f1f9416929d176afe1e4610" + integrity sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA== + core-util-is@1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" @@ -2442,7 +2466,7 @@ csso@^4.0.2: dependencies: css-tree "^1.1.2" -csstype@^3.1.3: +csstype@^3.0.2, csstype@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== @@ -3884,6 +3908,13 @@ instantsearch-ui-components@0.11.0: dependencies: "@babel/runtime" "^7.1.2" +instantsearch-ui-components@0.11.1: + version "0.11.1" + resolved "https://registry.yarnpkg.com/instantsearch-ui-components/-/instantsearch-ui-components-0.11.1.tgz#664ca03f657079946e459af72fa8d2674799c466" + integrity sha512-ZqUbJYYgObQ47J08ftXV1KNC1vdEoiD4/49qrkCdW46kRzLxLgYXJGuEuk48DQwK4aBtIoccgTyfbMGfcqNjxg== + dependencies: + "@babel/runtime" "^7.1.2" + instantsearch.css@^8.5.1: version "8.5.1" resolved "https://registry.yarnpkg.com/instantsearch.css/-/instantsearch.css-8.5.1.tgz#ece29d17048c282dda95b5eb35400041c519f97d" @@ -3907,6 +3938,24 @@ instantsearch.js@4.77.0: qs "^6.5.1 < 6.10" search-insights "^2.17.2" +instantsearch.js@4.77.3: + version "4.77.3" + resolved "https://registry.yarnpkg.com/instantsearch.js/-/instantsearch.js-4.77.3.tgz#17f607d0cc9ae950a99b88ea61353e89d8699634" + integrity sha512-nlNDHpRa15lXw6HEzCyEtickhRZOzmWXiLuhlfRazC/LjqbmmfE2ZMfGUp8YMeLIrP9i4HuK02/+esd2MsnrKA== + dependencies: + "@algolia/events" "^4.0.1" + "@types/dom-speech-recognition" "^0.0.1" + "@types/google.maps" "^3.55.12" + "@types/hogan.js" "^3.0.0" + "@types/qs" "^6.5.3" + algoliasearch-helper "3.24.1" + hogan.js "^3.0.2" + htm "^3.0.0" + instantsearch-ui-components "0.11.1" + preact "^10.10.0" + qs "^6.5.1 < 6.10" + search-insights "^2.17.2" + instantsearch.js@^4.56.2: version "4.56.8" resolved "https://registry.npmjs.org/instantsearch.js/-/instantsearch.js-4.56.8.tgz" @@ -5826,6 +5875,13 @@ react-dom@^18.3.1: loose-envify "^1.1.0" scheduler "^0.23.2" +react-dom@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-19.0.0.tgz#43446f1f01c65a4cd7f7588083e686a6726cfb57" + integrity sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ== + dependencies: + scheduler "^0.25.0" + react-instantsearch-core@7.15.0: version "7.15.0" resolved "https://registry.yarnpkg.com/react-instantsearch-core/-/react-instantsearch-core-7.15.0.tgz#521509c579152ba38273837a47af114ceb7af217" @@ -5836,6 +5892,16 @@ react-instantsearch-core@7.15.0: instantsearch.js "4.77.0" use-sync-external-store "^1.0.0" +react-instantsearch-core@7.15.3: + version "7.15.3" + resolved "https://registry.yarnpkg.com/react-instantsearch-core/-/react-instantsearch-core-7.15.3.tgz#a05e17146ce4819c5819d55317981d4067cb81b4" + integrity sha512-pr8Ro40KOb6aJHUePL0RLVICWYQLXvKL5OoFlS2Dgpske5swRyz/M1vhtUk+MtCPYEuxVDcFeQWwTX3tS2CQcw== + dependencies: + "@babel/runtime" "^7.1.2" + algoliasearch-helper "3.24.1" + instantsearch.js "4.77.3" + use-sync-external-store "^1.0.0" + react-instantsearch@^7.15.0: version "7.15.0" resolved "https://registry.yarnpkg.com/react-instantsearch/-/react-instantsearch-7.15.0.tgz#617ad01753673018f5df8bf27b2f91ed086087e8" @@ -5846,6 +5912,16 @@ react-instantsearch@^7.15.0: instantsearch.js "4.77.0" react-instantsearch-core "7.15.0" +react-instantsearch@^7.15.3: + version "7.15.3" + resolved "https://registry.yarnpkg.com/react-instantsearch/-/react-instantsearch-7.15.3.tgz#6c1cff8528f6f2a56535c4e36169169d4434508e" + integrity sha512-KDKvLgizxGRrHIy2RfFYvgw/VmyYHXLNk0TJkRpyoUClUhn1zoXwESFjSLz1n4AY/utkZkuhpfmJo9S7NfEqoQ== + dependencies: + "@babel/runtime" "^7.1.2" + instantsearch-ui-components "0.11.1" + instantsearch.js "4.77.3" + react-instantsearch-core "7.15.3" + react-is@^16.13.1: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" @@ -5856,20 +5932,22 @@ react-refresh@^0.14.2: resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.2.tgz#3833da01ce32da470f1f936b9d477da5c7028bf9" integrity sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA== -react-router-dom@^6.28.2: - version "6.28.2" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.28.2.tgz#9bc4f58b0cfe91d39d1a6be4beb0ef051ca9b06e" - integrity sha512-O81EWqNJWqvlN/a7eTudAdQm0TbI7hw+WIi7OwwMcTn5JMyZ0ibTFNGz+t+Lju0df4LcqowCegcrK22lB1q9Kw== +react-router-dom@^7.1.5: + version "7.1.5" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-7.1.5.tgz#6b706a5503c01d99c1af69336a7de2e21cadd339" + integrity sha512-/4f9+up0Qv92D3bB8iN5P1s3oHAepSGa9h5k6tpTFlixTTskJZwKGhJ6vRJ277tLD1zuaZTt95hyGWV1Z37csQ== dependencies: - "@remix-run/router" "1.21.1" - react-router "6.28.2" + react-router "7.1.5" -react-router@6.28.2: - version "6.28.2" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.28.2.tgz#1ddea57c2de0d99e12d00af14d1499703f1378a9" - integrity sha512-BgFY7+wEGVjHCiqaj2XiUBQ1kkzfg6UoKYwEe0wv+FF+HNPCxtS/MVPvLAPH++EsuCMReZl9RYVGqcHLk5ms3A== +react-router@7.1.5: + version "7.1.5" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-7.1.5.tgz#c9e19d329d9ce2215fdae844ab6b023b911094db" + integrity sha512-8BUF+hZEU4/z/JD201yK6S+UYhsf58bzYIDq2NS1iGpwxSXDu7F+DeGSkIXMFBuHZB21FSiCzEcUb18cQNdRkA== dependencies: - "@remix-run/router" "1.21.1" + "@types/cookie" "^0.6.0" + cookie "^1.0.1" + set-cookie-parser "^2.6.0" + turbo-stream "2.4.0" react@^18.3.1: version "18.3.1" @@ -5878,6 +5956,11 @@ react@^18.3.1: dependencies: loose-envify "^1.1.0" +react@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/react/-/react-19.0.0.tgz#6e1969251b9f108870aa4bff37a0ce9ddfaaabdd" + integrity sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ== + read-pkg-up@^7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz" @@ -6162,6 +6245,11 @@ scheduler@^0.23.2: dependencies: loose-envify "^1.1.0" +scheduler@^0.25.0: + version "0.25.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.25.0.tgz#336cd9768e8cceebf52d3c80e3dcf5de23e7e015" + integrity sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA== + scriptjs@^2.5.9: version "2.5.9" resolved "https://registry.npmjs.org/scriptjs/-/scriptjs-2.5.9.tgz" @@ -6197,6 +6285,11 @@ set-blocking@^2.0.0: resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== +set-cookie-parser@^2.6.0: + version "2.7.1" + resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz#3016f150072202dfbe90fadee053573cc89d2943" + integrity sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ== + set-function-length@^1.2.1, set-function-length@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz" @@ -6769,6 +6862,11 @@ turbo-linux-arm64@2.3.3: resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-2.3.3.tgz#284e26825f5d692bffb5b126a9aeccaae6a4533b" integrity sha512-NmDE/NjZoDj1UWBhMtOPmqFLEBKhzGS61KObfrDEbXvU3lekwHeoPvAMfcovzswzch+kN2DrtbNIlz+/rp8OCg== +turbo-stream@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/turbo-stream/-/turbo-stream-2.4.0.tgz#1e4fca6725e90fa14ac4adb782f2d3759a5695f0" + integrity sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g== + turbo-windows-64@2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-2.3.3.tgz#2900ac2c00d9609bc480d90564a98ca1cc7f4b17" From 6f98286e6d1fea8f9314aedb3ce9697bcee17d65 Mon Sep 17 00:00:00 2001 From: "F. Levi" <55688616+flevi29@users.noreply.github.com> Date: Sat, 8 Feb 2025 14:54:50 +0200 Subject: [PATCH 2/3] convert most playgrounds to TypeScript --- packages/autocomplete-client/package.json | 5 +- packages/instant-meilisearch/package.json | 3 +- playgrounds/autocomplete/package.json | 8 +- playgrounds/autocomplete/src/app.ts | 1 + playgrounds/javascript/index.html | 5 +- playgrounds/javascript/package.json | 6 +- playgrounds/javascript/src/{app.js => app.ts} | 31 +- playgrounds/javascript/src/vite-env.d.ts | 1 + playgrounds/javascript/tsconfig.json | 24 + playgrounds/local-react/index.html | 2 +- playgrounds/react/index.html | 2 +- playgrounds/react/package.json | 14 +- playgrounds/react/src/{App.jsx => App.tsx} | 6 +- .../react/src/{index.jsx => index.tsx} | 2 +- playgrounds/react/src/vite-env.d.ts | 1 + playgrounds/react/tsconfig.app.json | 26 + playgrounds/react/tsconfig.json | 7 + playgrounds/react/tsconfig.node.json | 24 + playgrounds/vue3/index.html | 3 +- playgrounds/vue3/package.json | 9 +- playgrounds/vue3/src/App.vue | 27 +- playgrounds/vue3/src/{main.js => main.ts} | 3 +- playgrounds/vue3/src/vite-env.d.ts | 1 + playgrounds/vue3/tsconfig.app.json | 15 + playgrounds/vue3/tsconfig.json | 7 + playgrounds/vue3/tsconfig.node.json | 25 + yarn.lock | 1292 +++-------------- 27 files changed, 402 insertions(+), 1148 deletions(-) rename playgrounds/javascript/src/{app.js => app.ts} (81%) create mode 100644 playgrounds/javascript/src/vite-env.d.ts create mode 100644 playgrounds/javascript/tsconfig.json rename playgrounds/react/src/{App.jsx => App.tsx} (89%) rename playgrounds/react/src/{index.jsx => index.tsx} (76%) create mode 100644 playgrounds/react/src/vite-env.d.ts create mode 100644 playgrounds/react/tsconfig.app.json create mode 100644 playgrounds/react/tsconfig.json create mode 100644 playgrounds/react/tsconfig.node.json rename playgrounds/vue3/src/{main.js => main.ts} (58%) create mode 100644 playgrounds/vue3/src/vite-env.d.ts create mode 100644 playgrounds/vue3/tsconfig.app.json create mode 100644 playgrounds/vue3/tsconfig.json create mode 100644 playgrounds/vue3/tsconfig.node.json diff --git a/packages/autocomplete-client/package.json b/packages/autocomplete-client/package.json index cb1a0317..54b793a5 100644 --- a/packages/autocomplete-client/package.json +++ b/packages/autocomplete-client/package.json @@ -45,8 +45,7 @@ "@meilisearch/instant-meilisearch": "*" }, "devDependencies": { - "@algolia/autocomplete-js": "^1.7.4", - "cssnano": "^4.1.10", - "instantsearch.js": "^4.56.2" + "@algolia/autocomplete-js": "^1.18.0", + "instantsearch.js": "^4.77.3" } } diff --git a/packages/instant-meilisearch/package.json b/packages/instant-meilisearch/package.json index 8d7d5455..cf3c7c4c 100644 --- a/packages/instant-meilisearch/package.json +++ b/packages/instant-meilisearch/package.json @@ -48,7 +48,6 @@ "meilisearch": "^0.48.2" }, "devDependencies": { - "cssnano": "^4.1.10", - "instantsearch.js": "^4.56.2" + "instantsearch.js": "^4.77.3" } } diff --git a/playgrounds/autocomplete/package.json b/playgrounds/autocomplete/package.json index 1b5a401b..6fd8d2b6 100644 --- a/playgrounds/autocomplete/package.json +++ b/playgrounds/autocomplete/package.json @@ -21,10 +21,10 @@ "author": "", "license": "ISC", "dependencies": { - "@algolia/autocomplete-core": "1.17.9", - "@algolia/autocomplete-plugin-query-suggestions": "^1.17.9", - "@algolia/autocomplete-plugin-tags": "^1.17.9", - "@algolia/autocomplete-theme-classic": "^1.17.9", + "@algolia/autocomplete-core": "^1.18.0", + "@algolia/autocomplete-plugin-query-suggestions": "^1.18.0", + "@algolia/autocomplete-plugin-tags": "^1.18.0", + "@algolia/autocomplete-theme-classic": "^1.18.0", "@meilisearch/autocomplete-client": "*" } } diff --git a/playgrounds/autocomplete/src/app.ts b/playgrounds/autocomplete/src/app.ts index 5a814379..17724340 100644 --- a/playgrounds/autocomplete/src/app.ts +++ b/playgrounds/autocomplete/src/app.ts @@ -3,6 +3,7 @@ import { meilisearchAutocompleteClient, getMeilisearchResults, } from '@meilisearch/autocomplete-client' +// @ts-expect-error it doesn't have type declarations... import '@algolia/autocomplete-theme-classic' const client = meilisearchAutocompleteClient({ diff --git a/playgrounds/javascript/index.html b/playgrounds/javascript/index.html index 0f327219..771abcb7 100644 --- a/playgrounds/javascript/index.html +++ b/playgrounds/javascript/index.html @@ -1,4 +1,4 @@ - + @@ -47,7 +47,6 @@

Misc

- - + diff --git a/playgrounds/javascript/package.json b/playgrounds/javascript/package.json index 66d05f8d..7aea5cb8 100644 --- a/playgrounds/javascript/package.json +++ b/playgrounds/javascript/package.json @@ -5,13 +5,15 @@ "description": "Instant-meilisearch playground written with vanilla javascript", "type": "module", "scripts": { - "dev": "vite" + "dev": "vite", + "test:types": "tsc" }, "browserslist": [ "defaults" ], "license": "MIT", "dependencies": { - "@meilisearch/instant-meilisearch": "0.24.0" + "@meilisearch/instant-meilisearch": "0.24.0", + "instantsearch.js": "^4.77.3" } } diff --git a/playgrounds/javascript/src/app.js b/playgrounds/javascript/src/app.ts similarity index 81% rename from playgrounds/javascript/src/app.js rename to playgrounds/javascript/src/app.ts index 6634ca4d..d77cf40d 100644 --- a/playgrounds/javascript/src/app.js +++ b/playgrounds/javascript/src/app.ts @@ -1,5 +1,14 @@ -/* eslint-disable no-undef */ import { instantMeiliSearch } from '@meilisearch/instant-meilisearch' +import { default as instantsearch } from 'instantsearch.js' +import { + clearRefinements, + configure, + hits, + pagination, + refinementList, + searchBox, + sortBy, +} from 'instantsearch.js/es/widgets' const search = instantsearch({ indexName: 'steam-video-games', @@ -13,7 +22,7 @@ const search = instantsearch({ }) search.addWidgets([ - instantsearch.widgets.sortBy({ + sortBy({ container: '#sort-by', items: [ { value: 'steam-video-games', label: 'Relevant' }, @@ -27,33 +36,33 @@ search.addWidgets([ }, ], }), - instantsearch.widgets.searchBox({ + searchBox({ container: '#searchbox', }), - instantsearch.widgets.clearRefinements({ + clearRefinements({ container: '#clear-refinements', }), - instantsearch.widgets.refinementList({ + refinementList({ container: '#genres-list', attribute: 'genres', }), - instantsearch.widgets.refinementList({ + refinementList({ container: '#players-list', attribute: 'players', }), - instantsearch.widgets.refinementList({ + refinementList({ container: '#platforms-list', attribute: 'platforms', }), - instantsearch.widgets.configure({ + configure({ hitsPerPage: 6, attributesToSnippet: ['description:150'], }), - instantsearch.widgets.refinementList({ + refinementList({ container: '#misc-list', attribute: 'misc', }), - instantsearch.widgets.hits({ + hits({ container: '#hits', templates: { item: ` @@ -72,7 +81,7 @@ search.addWidgets([ `, }, }), - instantsearch.widgets.pagination({ + pagination({ container: '#pagination', }), ]) diff --git a/playgrounds/javascript/src/vite-env.d.ts b/playgrounds/javascript/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/playgrounds/javascript/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/playgrounds/javascript/tsconfig.json b/playgrounds/javascript/tsconfig.json new file mode 100644 index 00000000..92f8583f --- /dev/null +++ b/playgrounds/javascript/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/playgrounds/local-react/index.html b/playgrounds/local-react/index.html index 3251ccf8..3bce1cbb 100644 --- a/playgrounds/local-react/index.html +++ b/playgrounds/local-react/index.html @@ -9,6 +9,6 @@
- + diff --git a/playgrounds/react/index.html b/playgrounds/react/index.html index 3251ccf8..3bce1cbb 100644 --- a/playgrounds/react/index.html +++ b/playgrounds/react/index.html @@ -9,6 +9,6 @@
- + diff --git a/playgrounds/react/package.json b/playgrounds/react/package.json index b4878bad..42569168 100644 --- a/playgrounds/react/package.json +++ b/playgrounds/react/package.json @@ -5,7 +5,8 @@ "description": "React playground for instant-meilisearch", "type": "module", "scripts": { - "dev": "vite" + "dev": "vite", + "test:types": "tsc -b" }, "keywords": [ "react", @@ -17,9 +18,12 @@ "author": "", "license": "ISC", "devDependencies": { - "react": "^18.3.1", - "react-dom": "^18.3.1", - "react-instantsearch": "^7.15.0", + "@types/react": "^19.0.8", + "@types/react-dom": "^19.0.3", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "@vitejs/plugin-react": "^4.3.4", + "react-instantsearch": "^7.15.3", "@meilisearch/instant-meilisearch": "*" } -} \ No newline at end of file +} diff --git a/playgrounds/react/src/App.jsx b/playgrounds/react/src/App.tsx similarity index 89% rename from playgrounds/react/src/App.jsx rename to playgrounds/react/src/App.tsx index e7244c69..629b48ef 100644 --- a/playgrounds/react/src/App.jsx +++ b/playgrounds/react/src/App.tsx @@ -11,6 +11,7 @@ import { SortBy, Snippet, } from 'react-instantsearch' +import type { Hit } from 'algoliasearch' import './App.css' import { instantMeiliSearch } from '@meilisearch/instant-meilisearch' @@ -40,6 +41,7 @@ const App = () => (
+ {/* TODO: https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/react/#replace-defaultrefinement-with-initialuistate-on-instantsearch */} (
) -const Hit = ({ hit }) => { +const Hit = ({ hit }: { hit: Hit }) => { return (
@@ -85,7 +87,7 @@ const Hit = ({ hit }) => {
- {hit.name} + {hit.name}
diff --git a/playgrounds/react/src/index.jsx b/playgrounds/react/src/index.tsx similarity index 76% rename from playgrounds/react/src/index.jsx rename to playgrounds/react/src/index.tsx index b0eac1a3..5a38342b 100644 --- a/playgrounds/react/src/index.jsx +++ b/playgrounds/react/src/index.tsx @@ -3,7 +3,7 @@ import { createRoot } from 'react-dom/client' import './index.css' import App from './App' -createRoot(document.getElementById('app')).render( +createRoot(document.getElementById('app')!).render( diff --git a/playgrounds/react/src/vite-env.d.ts b/playgrounds/react/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/playgrounds/react/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/playgrounds/react/tsconfig.app.json b/playgrounds/react/tsconfig.app.json new file mode 100644 index 00000000..dfc691d4 --- /dev/null +++ b/playgrounds/react/tsconfig.app.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/playgrounds/react/tsconfig.json b/playgrounds/react/tsconfig.json new file mode 100644 index 00000000..1ffef600 --- /dev/null +++ b/playgrounds/react/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/playgrounds/react/tsconfig.node.json b/playgrounds/react/tsconfig.node.json new file mode 100644 index 00000000..ff0dc7df --- /dev/null +++ b/playgrounds/react/tsconfig.node.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/playgrounds/vue3/index.html b/playgrounds/vue3/index.html index 8388c4bb..5bbf410e 100644 --- a/playgrounds/vue3/index.html +++ b/playgrounds/vue3/index.html @@ -2,12 +2,11 @@ - Vite + Vue
- + diff --git a/playgrounds/vue3/package.json b/playgrounds/vue3/package.json index 93b2ba3c..082f689a 100644 --- a/playgrounds/vue3/package.json +++ b/playgrounds/vue3/package.json @@ -5,13 +5,16 @@ "type": "module", "scripts": { "dev": "vite", - "preview": "vite preview" + "preview": "vite preview", + "test:types": "vue-tsc -b" }, "devDependencies": { - "vue-instantsearch": "^4.10.8", + "vue-instantsearch": "^4.20.4", "@meilisearch/instant-meilisearch": "*", "vue": "^3.5.13", + "@vue/tsconfig": "^0.7.0", "instantsearch.css": "^8.5.1", - "@vitejs/plugin-vue": "^5.2.1" + "@vitejs/plugin-vue": "^5.2.1", + "vue-tsc": "^2.2.0" } } diff --git a/playgrounds/vue3/src/App.vue b/playgrounds/vue3/src/App.vue index 00e87ed2..232a33f3 100644 --- a/playgrounds/vue3/src/App.vue +++ b/playgrounds/vue3/src/App.vue @@ -1,3 +1,13 @@ + + -