Skip to content

Commit 4b21e82

Browse files
Merge #1444
1444: Update typescript to 4.9.5 (ts) r=bidoubiwa a=bidoubiwa The library was not compatible with environments using typescript `v4.9.5` causing typing errors. Co-authored-by: Charlotte Vermandel <[email protected]>
2 parents 8a3f422 + 7250937 commit 4b21e82

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ dist
33
examples
44
scripts
55
tests/env
6+
coverage

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@ module.exports = {
5353
},
5454
],
5555
'comma-dangle': 'off',
56+
'@typescript-eslint/ban-ts-ignore': 'off',
5657
},
5758
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,6 @@
109109
"rollup-plugin-typescript2": "^0.34.1",
110110
"shx": "^0.3.2",
111111
"ts-jest": "^26.5.6",
112-
"typescript": "4.6.4"
112+
"typescript": "^4.9.5"
113113
}
114114
}

src/clients/client.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ class Client {
5959
* @param indexUid - The index UID
6060
* @returns Instance of Index
6161
*/
62-
index<T = any>(indexUid: string): Index<T> {
62+
index<T extends Record<string, any> = Record<string, any>>(
63+
indexUid: string
64+
): Index<T> {
6365
return new Index<T>(this.config, indexUid)
6466
}
6567

@@ -70,7 +72,9 @@ class Client {
7072
* @param indexUid - The index UID
7173
* @returns Promise returning Index instance
7274
*/
73-
async getIndex<T = any>(indexUid: string): Promise<Index<T>> {
75+
async getIndex<T extends Record<string, any> = Record<string, any>>(
76+
indexUid: string
77+
): Promise<Index<T>> {
7478
return new Index<T>(this.config, indexUid).fetchInfo()
7579
}
7680

tests/search.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@ describe.each([
802802
'unreachable',
803803
{},
804804
{
805+
// @ts-ignore qwe
805806
signal: controller.signal,
806807
}
807808
)
@@ -824,6 +825,7 @@ describe.each([
824825
searchQuery,
825826
{},
826827
{
828+
// @ts-ignore
827829
signal: controllerA.signal,
828830
}
829831
)
@@ -832,6 +834,7 @@ describe.each([
832834
searchQuery,
833835
{},
834836
{
837+
// @ts-ignore
835838
signal: controllerB.signal,
836839
}
837840
)
@@ -840,6 +843,7 @@ describe.each([
840843
searchQuery,
841844
{},
842845
{
846+
// @ts-ignore
843847
signal: controllerC.signal,
844848
}
845849
)

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
"lib": ["ES2019", "ESNext", "dom"],
1212
"moduleResolution": "node",
1313
"noImplicitAny": true,
14+
"strict": true,
15+
"alwaysStrict": true,
1416
"strictNullChecks": true,
1517
"strictFunctionTypes": true,
1618
"strictPropertyInitialization": true,
1719
"strictBindCallApply": true,
1820
"noImplicitThis": true,
1921
"noImplicitReturns": true,
20-
"alwaysStrict": true,
2122
"esModuleInterop": true,
2223
"experimentalDecorators": true,
2324
"emitDecoratorMetadata": true,

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6736,10 +6736,10 @@ typedarray-to-buffer@^3.1.5:
67366736
dependencies:
67376737
is-typedarray "^1.0.0"
67386738

6739-
typescript@4.6.4:
6740-
version "4.6.4"
6741-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9"
6742-
integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==
6739+
typescript@^4.9.5:
6740+
version "4.9.5"
6741+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
6742+
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
67436743

67446744
undefsafe@^2.0.5:
67456745
version "2.0.5"

0 commit comments

Comments
 (0)