Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bunch of TS errors at compilation time #2091

Closed
dilame opened this issue Dec 18, 2023 · 1 comment
Closed

A bunch of TS errors at compilation time #2091

dilame opened this issue Dec 18, 2023 · 1 comment

Comments

@dilame
Copy link

dilame commented Dec 18, 2023

I am trying to setup i18next with TypeScript, but get a bunch of errors, here it is:

node_modules/i18next/typescript/t.d.ts:71:46 - error TS2589: Type instantiation is excessively deep and possibly infinite.

71   [Ns in FlatNamespace]: WithOrWithoutPlural<KeysBuilder<Resources[Ns], false>>;
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/i18next/typescript/t.d.ts:121:30 - error TS2536: Type '$FirstNamespace<ActualNS>' cannot be used to index type 'Keys'.

121       | ParseKeysByKeyPrefix<Keys[$FirstNamespace<ActualNS>], KPrefix>
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/i18next/typescript/t.d.ts:217:58 - error TS2322: Type '$FirstNamespace<Ns>' is not assignable to type 'string | number | bigint | boolean | null | undefined'.
  Type 'Ns | Ns[0]' is not assignable to type 'string | number | bigint | boolean | null | undefined'.
    Type 'Ns' is not assignable to type 'string | number | bigint | boolean | null | undefined'.
      Type 'Namespace' is not assignable to type 'string | number | bigint | boolean | null | undefined'.
        Type 'symbol' is not assignable to type 'string | number | bigint | boolean | null | undefined'.
          Type 'string | number | symbol' is not assignable to type 'string | number | bigint | boolean | null | undefined'.
            Type 'symbol' is not assignable to type 'string | number | bigint | boolean | null | undefined'.

217   $TFunctionBrand: $IsResourcesDefined extends true ? `${$FirstNamespace<Ns>}` : never;
                                                             ~~~~~~~~~~~~~~~~~~~

node_modules/i18next/index.d.ts:279:22 - error TS2589: Type instantiation is excessively deep and possibly infinite.

279     TKPrefix extends KeyPrefix<ActualNs> = undefined,
                         ~~~~~~~~~~~~~~~~~~~

My TypeScript version is 5.1.3.
I have a complex tsconfig.*.json structure, but here is the most important one – tsconfig.checks.json:

{
  "compilerOptions": {
    // Strict Checks
    "alwaysStrict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "useUnknownInCatchVariables": true,
    "strictPropertyInitialization": true,
    "strictFunctionTypes": true,
    "noImplicitThis": true,
    "strictBindCallApply": true,
    "noPropertyAccessFromIndexSignature": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    // Linter Checks
    "noImplicitReturns": true,
    "noImplicitOverride": true,
    "forceConsistentCasingInFileNames": true,
    // https://eslint.org/docs/rules/consistent-return ?
    "noFallthroughCasesInSwitch": true,
    // https://eslint.org/docs/rules/no-fallthrough
    "noUnusedLocals": true,
    // https://eslint.org/docs/rules/no-unused-vars
    "noUnusedParameters": true,
    // https://eslint.org/docs/rules/no-unused-vars#args
    "allowUnreachableCode": false,
    // https://eslint.org/docs/rules/no-unreachable ?
    "allowUnusedLabels": false,
    // https://eslint.org/docs/rules/no-unused-labels
    // Base Strict Checks
    "noImplicitUseStrict": false,
    "suppressExcessPropertyErrors": false,
    "suppressImplicitAnyIndexErrors": false,
    "noStrictGenericChecks": false
  }
}
@adrai
Copy link
Member

adrai commented Dec 18, 2023

please provide a minimal reproducible example repository...

maybe related:
#1921
#1972

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants