You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to enable noUncheckedIndexedAccess in my own TypeScript project's tsconfig, however the @algolia/client-search package throws an error when this config is enabled.
To isolate the issue, I created a fresh project (npm init, npx tsc --init, etc), and imported the @algolia/client-search package. When noUncheckedIndexedAccess is disabled, TypeScript compiles fine. However when enabled, there are errors emitting from the @algolia/client-common package because it does not comply with this stricter TS configuration.
One option would be for Algolia to also use this configuration, which may solve this specific case.
Granted, it feels strange that my own TypeScript config is limited by dependencies, however after reading this thread, and some of the comments and linked issues, it may be the case that Algolia is publishing its modules in a way that depends on ts files (not just d.ts declarations)?
Anyway, this is currently blocking me from enabling the config I want in my own TS projects, and could be a larger issue.
Language
JavaScript
Client
All
Steps to reproduce
create a new nodejs/TypeScript project
add @algolia/client-search as a dependency and import it in one of your modules
enable noUncheckedIndexedAccess in tsconfig
attempt to compile with tsc
Relevant log output
node_modules/@algolia/client-common/src/transporter/helpers.ts:11:5 - error TS2322: Type 'TData | undefined' is not assignable to type'TData'.
'TData' could be instantiated with an arbitrary type which could be unrelated to 'TData | undefined'.
11 shuffledArray[c] = array[b];~~~~~~~~~~~~~~~~
node_modules/@algolia/client-common/src/transporter/helpers.ts:12:5 - error TS2322: Type 'TData | undefined' is not assignable to type'TData'.
'TData' could be instantiated with an arbitrary type which could be unrelated to 'TData | undefined'.
12 shuffledArray[b] = a;~~~~~~~~~~~~~~~~
node_modules/@algolia/client-common/src/transporter/helpers.ts:71:5 - error TS2322: Type 'string | undefined' is not assignable to type'string'.
Type 'undefined' is not assignable to type'string'.
71 serializedHeaders[header.toLowerCase()] = value;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 3 errors in the same file, starting at: node_modules/@algolia/client-common/src/transporter/helpers.ts:11
Self-service
I'd be willing to fix this bug myself.
The text was updated successfully, but these errors were encountered:
Description
I'm trying to enable
noUncheckedIndexedAccess
in my own TypeScript project's tsconfig, however the@algolia/client-search
package throws an error when this config is enabled.To isolate the issue, I created a fresh project (
npm init
,npx tsc --init
, etc), and imported the@algolia/client-search
package. WhennoUncheckedIndexedAccess
is disabled, TypeScript compiles fine. However when enabled, there are errors emitting from the@algolia/client-common
package because it does not comply with this stricter TS configuration.One option would be for Algolia to also use this configuration, which may solve this specific case.
Granted, it feels strange that my own TypeScript config is limited by dependencies, however after reading this thread, and some of the comments and linked issues, it may be the case that Algolia is publishing its modules in a way that depends on ts files (not just d.ts declarations)?
Anyway, this is currently blocking me from enabling the config I want in my own TS projects, and could be a larger issue.
Language
JavaScript
Client
All
Steps to reproduce
@algolia/client-search
as a dependency and import it in one of your modulesnoUncheckedIndexedAccess
in tsconfigtsc
Relevant log output
Self-service
The text was updated successfully, but these errors were encountered: